Commit c42f8b60 authored by Jörg Weingrill's avatar Jörg Weingrill
Browse files

introduction of absolute encoder values with conversion to real values; added README (TODOs)

parent 868278ba
......@@ -126,6 +126,9 @@
<Compile Include="POUs\F_Decoder.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\F_HourangleLimit.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\F_Y.TcPOU">
<SubType>Code</SubType>
</Compile>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.12">
<POU Name="F_HourangleLimit" Id="{554b9597-c408-4ecf-87ac-bb54cc0c61e6}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION F_HourangleLimit : LREAL
VAR_INPUT
// limits for west of pier if true otherwise east of pier
west: BOOL;
// positive is true for the positive (upper) limit, false for the ngeative (lower) limit
positive: BOOL := TRUE;
END_VAR
VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF west THEN
IF positive THEN
F_HourangleLimit := 360.0;
ELSE
F_HourangleLimit := 270.0;
END_IF
ELSE // east
IF positive THEN
F_HourangleLimit := 270.0;
ELSE
F_HourangleLimit := 180.0;
END_IF
END_IF]]></ST>
</Implementation>
<LineIds Name="F_HourangleLimit">
<LineId Id="7" Count="0" />
<LineId Id="13" Count="0" />
<LineId Id="17" Count="0" />
<LineId Id="15" Count="0" />
<LineId Id="18" Count="0" />
<LineId Id="16" Count="0" />
<LineId Id="19" Count="5" />
<LineId Id="14" Count="0" />
</LineIds>
</POU>
</TcPlcObject>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.17">
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.12">
<POU Name="MAIN" Id="{f2c30934-2a66-4ca1-b954-b6a792cbb96d}" SpecialFunc="None">
<Declaration><![CDATA[PROGRAM MAIN
VAR
......
......@@ -19,9 +19,11 @@ VAR
altitude_calc, azimut_calc: LREAL;
(* Declination section *)
fbDeclinationAxis : FB_Axis;
fbDeclinationAxisJog : FB_AxisJog;
fbDeclinationAxis: FB_Axis;
fbDeclinationAxisJog: FB_AxisJog;
// absolute encoder value of the declination axis
Declination_absolute,
// encoder value of the declination axis derived from absolute encoder in [-90 ... 0 ... +90]
Declination_real,
// encoder value from the motor
Declination_current,
......@@ -42,8 +44,6 @@ VAR
DeclinationCalibrated: BOOL;
// true if axis is moving
DeclinationBusy: BOOL;
//DeclinationActive: BOOL;
// True if calibration has been aborted
DeclinationAborted: BOOL;
// true if general error in the axis control occured
......@@ -58,6 +58,7 @@ VAR
(* Hour Angle part *)
fbHourAxisTrack : FB_ModuloAxis;
fbHourAxisJog : FB_AxisJog;
Hourangle_absolute,
Hourangle_real,
Hourangle_current,
Hourangle_calc,
......@@ -238,20 +239,19 @@ ELSE
END_IF
//F_Y(GVL_Telescope.declination_encoder, 98887, 229833, 90, -90);
//FIXME shouldn't that be also dependent on hour angle?!
// Declination +90° ... 98887
west_of_pier := GVL_Telescope.declination_encoder<98887 OR GVL_Telescope.declination_encoder > 229833;
Declination_absolute := F_AbsoluteDecoder(GVL_Telescope.declination_encoder, 45.41473388671875, 262144);
hourangle_absolute := F_AbsoluteDecoder(GVL_Telescope.hourangle_encoder, 95.12787, 262144);
// GVL_Telescope.declination_encoder<98887 OR GVL_Telescope.declination_encoder > 229833; --> west of pier
west_of_pier := (hourangle_absolute > 270.0);
east_of_pier := NOT west_of_pier;
IF east_of_pier THEN
declination_real := 180.0 - F_Decoder(GVL_Telescope.declination_encoder, 45.41473388671875, 262144);
IF declination_real > 180.0 THEN
declination_real := declination_real - 360.0;
END_IF
IF Declination_absolute > 90.0 THEN
Declination_real := 180.0 - Declination_absolute;
hourangle_real := hourangle_absolute;
ELSE
declination_real := F_Decoder(GVL_Telescope.declination_encoder, 45.41473388671875, 262144);
Declination_real := Declination_absolute;
hourangle_real := hourangle_absolute - 180.0;
END_IF
//FIXME above declination 90 the hourangle has to be reduced by 12!
hourangle_real := F_AbsoluteDecoder(GVL_Telescope.hourangle_encoder, 95.12787, 262144);
rightascension_current := MODABS(lst*15.0 - hourangle_real, 360.0);
hadec2altaz( ha := hourangle_real,
......@@ -290,13 +290,13 @@ END_IF
*)
// old nc scaling 0.302675079777926
// new feed constant = old feed constant * calibration factor 0.305559987589397406645987351813
Declination_lag := declination_current - declination_real;
Hourangle_lag := hourangle_real - hourangle_current;
Declination_lag := declination_current - declination_absolute;
Hourangle_lag := hourangle_current - hourangle_absolute;
Declination_lagerror := ABS(Declination_lag) > lag_error;
Hourangle_lagerror := ABS(Hourangle_lag) > lag_error;
AxDecMcHome(Execute := HomeTrigger.Q,
Position := declination_real,
Position := declination_absolute,
HomingMode := MC_Direct,
Done => DeclinationCalibrated,
Busy => DeclinationBusy,
......@@ -306,7 +306,7 @@ AxDecMcHome(Execute := HomeTrigger.Q,
Axis := GVL_Telescope.DecAxisRef);
AxHourMcHome(Execute := HomeTrigger.Q,
Position := hourangle_real,
Position := hourangle_absolute,
HomingMode := MC_Direct,
Done => HourangleCalibrated,
Busy => HourangleBusy,
......@@ -336,8 +336,8 @@ IF telescope_mode = E_TelescopeMode.manual THEN
fbHourAxisJog(
bPowerEnable := GVL_Telescope.Option1,
bEnable_Positive := hourangle_real>= 270.0,
bEnable_Negative := hourangle_real<= 360.0,
bEnable_Positive := hourangle_real >= F_HourangleLimit(west_of_pier, TRUE),
bEnable_Negative := hourangle_real <= F_HourangleLimit(west_of_pier, FALSE),
fPowerOverride := 100,
bReset := GVL_Telescope.Key2,
bForward := GVL_Telescope.hour_plus,
......@@ -456,7 +456,7 @@ IF telescope_mode = E_TelescopeMode.automatic THEN
fActVelo =>,
fActPos => Declination_current,
stAxis := GVL_Telescope.DecAxisRef);
// TODO: enable_positive and negative
fbHourAxisTrack(bPowerEnable := power,
bReset := reset,
bMoveModExec := gohome OR park OR track OR goto,
......@@ -479,7 +479,7 @@ IF telescope_mode = E_TelescopeMode.automatic THEN
stopped := GVL_Telescope.DecAxisRef.Status.NotMoving AND GVL_Telescope.HourAxisRef.Status.NotMoving;
decurrent := Declination_current;
taucurrent := Hourangle_current;
// racurrent = lst - hourangle_real;
// Calculation of ra: racurrent = lst[deg] - hourangle_real;
racurrent := rightascension_current;
azcurrent := azimut;
altcurrent := altitude;
......@@ -511,76 +511,76 @@ DeclinationCalEvent( Trigger := poweron_delay.Q AND DeclinationCalibrated,
OffLevel := ADSLOG_MSGTYPE_WARN);
HourangleCalEvent( Trigger := poweron_delay.Q AND HourangleCalibrated,
Level := ADSLOG_MSGTYPE_HINT,
FormatString := 'Hourangle Axis %s',
OnMessage := 'calibrated',
OffMessage := 'uncalibrated',
OffLevel := ADSLOG_MSGTYPE_WARN);
Level := ADSLOG_MSGTYPE_HINT,
FormatString := 'Hourangle Axis %s',
OnMessage := 'calibrated',
OffMessage := 'uncalibrated',
OffLevel := ADSLOG_MSGTYPE_WARN);
CalibrationEvent( Trigger := HomeTrigger.Q,
Level := ADSLOG_MSGTYPE_HINT,
OnMessage := 'Calibrating telescope axis');
DeclinationErrorEvent( Trigger := DeclinationError,
Level := ADSLOG_MSGTYPE_ERROR,
FormatString := 'Declination %s',
OnMessage := 'Error',
OffMessage := 'Error cleared',
OffLevel := ADSLOG_MSGTYPE_HINT);
Level := ADSLOG_MSGTYPE_ERROR,
FormatString := 'Declination %s',
OnMessage := 'Error',
OffMessage := 'Error cleared',
OffLevel := ADSLOG_MSGTYPE_HINT);
DeclinationAxisEvent( Trigger := DeclinationAxisError,
Level := ADSLOG_MSGTYPE_ERROR,
FormatString := 'Declination Axis %s',
OnMessage := 'Error',
OffMessage := 'Error cleared',
OffLevel := ADSLOG_MSGTYPE_HINT);
HourangleErrorEvent( Trigger := HourangleError,
Level := ADSLOG_MSGTYPE_ERROR,
FormatString := 'Hourangle %s',
OnMessage := 'Error',
OffMessage := 'Error cleared',
OffLevel := ADSLOG_MSGTYPE_HINT);
HourangleAxisEvent( Trigger := HourangleAxisError,
Level := ADSLOG_MSGTYPE_ERROR,
FormatString := 'Declination Axis %s',
FormatString := 'Hourangle Axis %s',
OnMessage := 'Error',
OffMessage := 'Error cleared',
OffLevel := ADSLOG_MSGTYPE_HINT);
HourangleErrorEvent( Trigger := HourangleError,
Level := ADSLOG_MSGTYPE_ERROR,
FormatString := 'Hourangle %s',
OnMessage := 'Error',
OffMessage := 'Error cleared',
OffLevel := ADSLOG_MSGTYPE_HINT);
HourangleAxisEvent( Trigger := HourangleAxisError,
Level := ADSLOG_MSGTYPE_ERROR,
FormatString := 'Hourangle Axis %s',
OnMessage := 'Error',
OffMessage := 'Error cleared',
OffLevel := ADSLOG_MSGTYPE_HINT);
TCSgohomeEvent( Trigger := gohome,
Level := ADSLOG_MSGTYPE_HINT,
FormatString := 'GOHOME %s',
OnMessage := 'commencing',
OffMEssage := 'completed');
Level := ADSLOG_MSGTYPE_HINT,
FormatString := 'GOHOME %s',
OnMessage := 'commencing',
OffMEssage := 'completed');
TCSparkEvent( Trigger := park,
Level := ADSLOG_MSGTYPE_HINT,
FormatString := 'PARK %s',
OnMessage := 'commencing',
OffMEssage := 'completed');
Level := ADSLOG_MSGTYPE_HINT,
FormatString := 'PARK %s',
OnMessage := 'commencing',
OffMEssage := 'completed');
TCSgotoEvent( Trigger := goto,
Level := ADSLOG_MSGTYPE_HINT,
FormatString := 'GOTO %s',
OnMessage := 'commencing',
OffMEssage := 'completed');
Level := ADSLOG_MSGTYPE_HINT,
FormatString := 'GOTO %s',
OnMessage := 'commencing',
OffMEssage := 'completed');
TCStrackEvent( Trigger := track,
Level := ADSLOG_MSGTYPE_HINT,
FormatString := 'TRACK %s',
OnMessage := 'commencing',
OffMEssage := 'completed');
Level := ADSLOG_MSGTYPE_HINT,
FormatString := 'TRACK %s',
OnMessage := 'commencing',
OffMEssage := 'completed');
TCSstopEvent( Trigger := stop,
Level := ADSLOG_MSGTYPE_WARN,
FormatString := 'STOP %s',
OnMessage := 'commencing',
OffMEssage := 'completed',
OffLevel := ADSLOG_MSGTYPE_HINT);
Level := ADSLOG_MSGTYPE_WARN,
FormatString := 'STOP %s',
OnMessage := 'commencing',
OffMEssage := 'completed',
OffLevel := ADSLOG_MSGTYPE_HINT);
TCSstopEvent( Trigger := stop,
Level := ADSLOG_MSGTYPE_WARN,
FormatString := 'STOP %s',
OnMessage := 'commencing',
OffMEssage := 'completed',
OffLevel := ADSLOG_MSGTYPE_HINT);
Level := ADSLOG_MSGTYPE_WARN,
FormatString := 'STOP %s',
OnMessage := 'commencing',
OffMEssage := 'completed',
OffLevel := ADSLOG_MSGTYPE_HINT);
AltitudeEvent( Trigger := altitude_calc<0.0,
Level := ADSLOG_MSGTYPE_WARN,
FormatString := '%s',
OnMessage := 'Target below horizon',
OffMEssage := '');
Level := ADSLOG_MSGTYPE_WARN,
FormatString := '%s',
OnMessage := 'Target below horizon',
OffMEssage := '');
GVL_MainControl.ControlLamp := DeclinationError OR HourangleError OR
Declination_lagerror OR Hourangle_lagerror OR
DeclinationAxisError OR HourangleAxisError;]]></ST>
......@@ -609,16 +609,18 @@ GVL_MainControl.ControlLamp := DeclinationError OR HourangleError OR
<LineId Id="637" Count="0" />
<LineId Id="66" Count="0" />
<LineId Id="322" Count="0" />
<LineId Id="1277" Count="1" />
<LineId Id="344" Count="0" />
<LineId Id="341" Count="0" />
<LineId Id="345" Count="0" />
<LineId Id="67" Count="0" />
<LineId Id="359" Count="2" />
<LineId Id="348" Count="1" />
<LineId Id="346" Count="1" />
<LineId Id="68" Count="1" />
<LineId Id="278" Count="0" />
<LineId Id="1278" Count="0" />
<LineId Id="1571" Count="0" />
<LineId Id="68" Count="0" />
<LineId Id="1578" Count="0" />
<LineId Id="1576" Count="1" />
<LineId Id="1575" Count="0" />
<LineId Id="1579" Count="0" />
<LineId Id="1585" Count="0" />
<LineId Id="1581" Count="2" />
<LineId Id="1580" Count="0" />
<LineId Id="1587" Count="0" />
<LineId Id="1586" Count="0" />
<LineId Id="70" Count="4" />
<LineId Id="1281" Count="0" />
<LineId Id="75" Count="0" />
......
# TODO on site:
1. setup IP address for Beckhoff CX-22743D (master)
2. setup IP address for Beckhoff CX-3AEAC6 (dome)
3. set NTP time server on master Beckhoff
4. set ADS route between Beckhoff master and dome
5. check rotation direction and limit switches
6. check if hardware limit switches are set.
7. dome automization
* verify goto-and-track
* verify lst (local siderial time)
* implement east and west TCS commands
* verify communication with TCS
# Links
* [TCS interface](https://gitlab.aip.de/bmk10k/telescope_firmware/snippets/5)
* [Beckhoff source](https://gitlab.aip.de/bmk10k/telescope_firmware/)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment