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

Multiple improvements and bugfixes

Stop condition in AxisJog, EQ2HOR2 function block added, ConvertEnvironment calculates Wind max and average, wind control for dome deactivated, declinationslimit improved, LREAL_TO_FMTESTR added, Thermocontrol,: added coldhead info for html,
parent 9922939d
WSB azcam
LAPTOP-O4DSP8K9 AIP2
11616 6140
637015608563047748 637020886902494410
...@@ -1487,8 +1487,8 @@ External Setpoint Generation: ...@@ -1487,8 +1487,8 @@ External Setpoint Generation:
<Name>HourAxis</Name> <Name>HourAxis</Name>
<AxisPara> <AxisPara>
<General UnitName="°"/> <General UnitName="°"/>
<Dynamic AccelerationMaximum="160" DecelerationMaximum="160" Acceleration="9" Deceleration="9" Jerk="7.36538"/> <Dynamic AccelerationMaximum="160" DecelerationMaximum="160" Acceleration="10" Deceleration="10" Jerk="7.36538"/>
<Velo RefSearch="0.261880121330377" RefSync="0.261880121330377" SlowManual="1.30940060665188" FastManual="7.8564036399113" Fast="26.1880121330377" Maximum="26.188"/> <Velo RefSearch="1" RefSync="1" SlowManual="1" FastManual="3" Fast="26.1880121330377" Maximum="10"/>
<OtherSettings AllowMotionCmdToSlave="true" PulseDistancePos="1" PulseDistanceNeg="1"/> <OtherSettings AllowMotionCmdToSlave="true" PulseDistancePos="1" PulseDistanceNeg="1"/>
</AxisPara> </AxisPara>
<Encoder Name="Enc" EncType="8"> <Encoder Name="Enc" EncType="8">
...@@ -1686,9 +1686,9 @@ External Setpoint Generation: ...@@ -1686,9 +1686,9 @@ External Setpoint Generation:
<Axis Id="2" CreateSymbols="true" AxisType="1"> <Axis Id="2" CreateSymbols="true" AxisType="1">
<Name>DeclinationAxis</Name> <Name>DeclinationAxis</Name>
<AxisPara> <AxisPara>
<General UnitName="°"/> <General UnitName="°" UnitFlags="#x00000004"/>
<Dynamic AccelerationMaximum="160" DecelerationMaximum="160" Acceleration="10" Deceleration="10" Jerk="5"/> <Dynamic AccelerationMaximum="160" DecelerationMaximum="160" Acceleration="10" Deceleration="10" Jerk="5"/>
<Velo RefSearch="5" RefSync="5" SlowManual="1" FastManual="10" Fast="261.575656435389" Maximum="20"/> <Velo RefSearch="1" RefSync="1" SlowManual="1" FastManual="3" Fast="261.575656435389" Maximum="10"/>
<OtherSettings AllowMotionCmdToSlave="true" PulseDistancePos="1" PulseDistanceNeg="1"/> <OtherSettings AllowMotionCmdToSlave="true" PulseDistancePos="1" PulseDistanceNeg="1"/>
</AxisPara> </AxisPara>
<Encoder Name="Enc" EncType="8"> <Encoder Name="Enc" EncType="8">
...@@ -1888,7 +1888,7 @@ External Setpoint Generation: ...@@ -1888,7 +1888,7 @@ External Setpoint Generation:
<Axis Id="3" CreateSymbols="true" AxisType="2"> <Axis Id="3" CreateSymbols="true" AxisType="2">
<Name>DomeAzimuth</Name> <Name>DomeAzimuth</Name>
<AxisPara> <AxisPara>
<General UnitName="°"/> <General UnitName="°" UnitFlags="#x00000004"/>
<Velo SlowManual="50" FastManual="100" Fast="100" Maximum="100"/> <Velo SlowManual="50" FastManual="100" Fast="100" Maximum="100"/>
<PositionAreaControl Range="2"/> <PositionAreaControl Range="2"/>
<TargetPosControl Range="1"/> <TargetPosControl Range="1"/>
...@@ -1896,7 +1896,7 @@ External Setpoint Generation: ...@@ -1896,7 +1896,7 @@ External Setpoint Generation:
<Discrete BreakDistancePos="1" BreakDistanceNeg="1" BreakDelayPos="0.5" BreakDelayNeg="0.5"/> <Discrete BreakDistancePos="1" BreakDistanceNeg="1" BreakDelayPos="0.5" BreakDelayNeg="0.5"/>
</AxisPara> </AxisPara>
<Encoder Name="Enc" EncType="4"> <Encoder Name="Enc" EncType="4">
<EncPara ScaleFactorNumerator="0.02767314622" MaxCount="#x0000ffff"> <EncPara ScaleFactorNumerator="360" ScaleFactorDenominator="13050" ToleranceWndModuloStart="0.5" MaxCount="#x0000ffff">
<Inc RefMode="2" RefSoftSyncMask="#x0000ffff"/> <Inc RefMode="2" RefSoftSyncMask="#x0000ffff"/>
</EncPara> </EncPara>
<Vars VarGrpType="1"> <Vars VarGrpType="1">
...@@ -2096,6 +2096,11 @@ Drive Status 4 (manually linked): ...@@ -2096,6 +2096,11 @@ Drive Status 4 (manually linked):
<Comment><![CDATA[ manual operation]]></Comment> <Comment><![CDATA[ manual operation]]></Comment>
<Type>BOOL</Type> <Type>BOOL</Type>
</Var> </Var>
<Var>
<Name>GVL_Environment.rawWindSpeed1</Name>
<Comment><![CDATA[ Weather Station 1]]></Comment>
<Type>INT</Type>
</Var>
<Var> <Var>
<Name>GVL_Dome.DomeAxisRef.NcToPlc</Name> <Name>GVL_Dome.DomeAxisRef.NcToPlc</Name>
<Type GUID="{6A65C767-34E5-42BF-AD87-E1A503EAC7BE}" Namespace="MC">NCTOPLC_AXIS_REF</Type> <Type GUID="{6A65C767-34E5-42BF-AD87-E1A503EAC7BE}" Namespace="MC">NCTOPLC_AXIS_REF</Type>
...@@ -2139,11 +2144,6 @@ External Setpoint Generation: ...@@ -2139,11 +2144,6 @@ External Setpoint Generation:
]]></Comment> ]]></Comment>
</SubVar> </SubVar>
</Var> </Var>
<Var>
<Name>GVL_Environment.rawWindSpeed1</Name>
<Comment><![CDATA[ Weather Station 1]]></Comment>
<Type>INT</Type>
</Var>
<Var> <Var>
<Name>GVL_Environment.rawWindDirection1</Name> <Name>GVL_Environment.rawWindDirection1</Name>
<Type>INT</Type> <Type>INT</Type>
...@@ -2255,9 +2255,9 @@ External Setpoint Generation: ...@@ -2255,9 +2255,9 @@ External Setpoint Generation:
<Type>UINT</Type> <Type>UINT</Type>
</Var> </Var>
<Var> <Var>
<Name>GVL_ThermoControl.Temperature_raw1</Name> <Name>GVL_Telescope.hourangle_encoder</Name>
<Comment><![CDATA[ Coldhead]]></Comment> <Comment><![CDATA[ Baumer Encoder external reference]]></Comment>
<Type>INT</Type> <Type>UDINT</Type>
</Var> </Var>
<Var> <Var>
<Name>GVL_Telescope.HourAxisRef.NcToPlc</Name> <Name>GVL_Telescope.HourAxisRef.NcToPlc</Name>
...@@ -2346,14 +2346,14 @@ External Setpoint Generation: ...@@ -2346,14 +2346,14 @@ External Setpoint Generation:
</SubVar> </SubVar>
</Var> </Var>
<Var> <Var>
<Name>GVL_Telescope.hourangle_encoder</Name> <Name>GVL_Telescope.declination_encoder</Name>
<Comment><![CDATA[ Baumer Encoder external reference]]></Comment> <Comment><![CDATA[ Baumer Encoder external reference]]></Comment>
<Type>UDINT</Type> <Type>UDINT</Type>
</Var> </Var>
<Var> <Var>
<Name>GVL_Telescope.declination_encoder</Name> <Name>GVL_ThermoControl.Temperature_raw1</Name>
<Comment><![CDATA[ Baumer Encoder external reference]]></Comment> <Comment><![CDATA[ Coldhead]]></Comment>
<Type>UDINT</Type> <Type>INT</Type>
</Var> </Var>
<Var> <Var>
<Name>GVL_ThermoControl.Temperature_raw2</Name> <Name>GVL_ThermoControl.Temperature_raw2</Name>
...@@ -2597,7 +2597,6 @@ External Setpoint Generation: ...@@ -2597,7 +2597,6 @@ External Setpoint Generation:
<DcMode>53796e6368726f6e00000000000000004672656552756e2f534d2d53796e6368726f6e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</DcMode> <DcMode>53796e6368726f6e00000000000000004672656552756e2f534d2d53796e6368726f6e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</DcMode>
<DcMode>4443000000000000000000000000000044432d53796e6368726f6e000000000000000000000000000000000000000000000000000000000000000000000020030100000000000000000000000000000000000000000000000000000000000000</DcMode> <DcMode>4443000000000000000000000000000044432d53796e6368726f6e000000000000000000000000000000000000000000000000000000000000000000000020030100000000000000000000000000000000000000000000000000000000000000</DcMode>
<DcMode>4443494e00000000000000000000000044432d53796e6368726f6e2028696e7075742062617365642900000000000000000000000000000000000000000020030100000000000000000001000000000000000000000000000000000000000000</DcMode> <DcMode>4443494e00000000000000000000000044432d53796e6368726f6e2028696e7075742062617365642900000000000000000000000000000000000000000020030100000000000000000001000000000000000000000000000000000000000000</DcMode>
<MBoxUserCmdData>02000300090000000e0000000300000000000000000000000000000000000000200080010100000001456e61626c65204320726573657400</MBoxUserCmdData>
<MBoxUserCmdData>0200030009000000130000000300000000000000000000000000000000000000200080020100000001456e61626c652065787465726e20726573657400</MBoxUserCmdData> <MBoxUserCmdData>0200030009000000130000000300000000000000000000000000000000000000200080020100000001456e61626c652065787465726e20726573657400</MBoxUserCmdData>
<Pdo Name="ENC Inputs" Index="#x1a00" Flags="#x0010"> <Pdo Name="ENC Inputs" Index="#x1a00" Flags="#x0010">
<ExcludePdo>#x1a01</ExcludePdo> <ExcludePdo>#x1a01</ExcludePdo>
...@@ -6657,6 +6656,7 @@ Bit1: Value bigger/equal Limit2]]></Comment> ...@@ -6657,6 +6656,7 @@ Bit1: Value bigger/equal Limit2]]></Comment>
<MBoxUserCmdData>020005001800000011000000000000000000000000000000000000000000000003400282000000000c000c0001000000f401e803bc02000056656c6f63697479206f6273657276657200</MBoxUserCmdData> <MBoxUserCmdData>020005001800000011000000000000000000000000000000000000000000000003400282000000000c000c0001000000f401e803bc02000056656c6f63697479206f6273657276657200</MBoxUserCmdData>
<MBoxUserCmdData>020005000a0000001700000000000000000000000000000000000000000000000340d6800000000003004443204c696e6b20636f6e6e656374696f6e206d6f646500</MBoxUserCmdData> <MBoxUserCmdData>020005000a0000001700000000000000000000000000000000000000000000000340d6800000000003004443204c696e6b20636f6e6e656374696f6e206d6f646500</MBoxUserCmdData>
<MBoxUserCmdData>020005000a00000014000000000000000000000000000000000000000000000003402f81000000001c00446973706c61792076616c7565206c696e65203200</MBoxUserCmdData> <MBoxUserCmdData>020005000a00000014000000000000000000000000000000000000000000000003402f81000000001c00446973706c61792076616c7565206c696e65203200</MBoxUserCmdData>
<MBoxUserCmdData>020005000a0000001b000000000000000000000000000000000000000000000003405e810000000000004572726f72207265616374696f6e20636f6e74726f6c20776f726400</MBoxUserCmdData>
<Pdo Name="AT" Index="#x0010" Flags="#x0001" SyncMan="3"> <Pdo Name="AT" Index="#x0010" Flags="#x0001" SyncMan="3">
<Entry Name="Drive status word" Index="#x0087" Flags="#x00000800"> <Entry Name="Drive status word" Index="#x0087" Flags="#x00000800">
<Type>UINT</Type> <Type>UINT</Type>
......
...@@ -87,6 +87,9 @@ ...@@ -87,6 +87,9 @@
<Compile Include="POUs\FunctionBlocks\FB_EQ2HOR.TcPOU"> <Compile Include="POUs\FunctionBlocks\FB_EQ2HOR.TcPOU">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="POUs\FunctionBlocks\FB_EQ2HOR2.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\FunctionBlocks\FB_EventLog.TcPOU"> <Compile Include="POUs\FunctionBlocks\FB_EventLog.TcPOU">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
...@@ -138,6 +141,9 @@ ...@@ -138,6 +141,9 @@
<Compile Include="POUs\F_YREAL.TcPOU"> <Compile Include="POUs\F_YREAL.TcPOU">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="POUs\LREAL_TO_FMTESTR.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\MAIN.TcPOU"> <Compile Include="POUs\MAIN.TcPOU">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
......
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?> <?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.4024.0">
<GVL Name="GVL_Dome" Id="{8410bcc3-97cb-4334-927b-71c02664ab1a}"> <GVL Name="GVL_Dome" Id="{8410bcc3-97cb-4334-927b-71c02664ab1a}">
<Declaration><![CDATA[{attribute 'qualified_only'} <Declaration><![CDATA[{attribute 'qualified_only'}
VAR_GLOBAL VAR_GLOBAL
......
...@@ -28,16 +28,19 @@ VAR ...@@ -28,16 +28,19 @@ VAR
WindEvent, WindEvent,
HumidityEvent, HumidityEvent,
PrecepationEvent: FB_Eventlog; PrecepationEvent: FB_Eventlog;
WindAverage,
PrecepationAverage: FB_TimeAverage;
avg_wind, max_wind: REAL;
END_VAR END_VAR
]]></Declaration> ]]></Declaration>
<Implementation> <Implementation>
<ST><![CDATA[(* convert raw Sensor values to real values *) <ST><![CDATA[(* convert raw Sensor values to real values *)
WindSpeed1 := F_YREAL(GVL_Environment.rawWindSpeed1, 0, 32767, 0.0, 60.0); // m/s WindSpeed1 := F_YREAL(GVL_Environment.rawWindSpeed1, 0, 32767, 0.0, 60.0); // m/s
WindDirection1 := F_YREAL(GVL_Environment.rawWindDirection1, 0, 32767, 0.0, 360.0); // ° WindDirection1 := F_YREAL(GVL_Environment.rawWindDirection1, 0, 32767, 0.0, 360.0); // °
Temperature1 := F_YREAL(GVL_Environment.rawTemperature1, 0, 32767, -40.0, 60.0); // °C Temperature1 := F_YREAL(GVL_Environment.rawTemperature1, 0, 32767, -40.0, 60.0); // °C -40...80?
Humidity1 := F_YREAL(GVL_Environment.rawHumidity1, 0, 32767, 0.0, 100.0); // % Humidity1 := F_YREAL(GVL_Environment.rawHumidity1, 0, 32767, 0.0, 100.0); // %
Pressure1 := F_YREAL(GVL_Environment.rawPressure1, 0, 32767, 800.0, 1060.0); // mBar Pressure1 := F_YREAL(GVL_Environment.rawPressure1, 0, 32767, 300.0, 800.0); // mBar 300...1100? 800..1060?
Brightness1 := F_YREAL(GVL_Environment.rawBrightness1, 0, 32767, 1.0, 120000.0); // Lux Brightness1 := F_YREAL(GVL_Environment.rawBrightness1, 0, 32767, 1.0, 150000.0); // Lux
LightDirection1 := F_YREAL(GVL_Environment.rawLightDirection1, 0, 32767, 0.0, 360.0); // ° LightDirection1 := F_YREAL(GVL_Environment.rawLightDirection1, 0, 32767, 0.0, 360.0); // °
Precipation1 := F_YREAL(GVL_Environment.rawPrecipation1, 0, 32767, 0.001, 100.0); // mm/h Precipation1 := F_YREAL(GVL_Environment.rawPrecipation1, 0, 32767, 0.001, 100.0); // mm/h
...@@ -46,7 +49,7 @@ WindDirection2 := F_YREAL(GVL_Environment.rawWindDirection2, 0, 32767, 0.0, 3 ...@@ -46,7 +49,7 @@ WindDirection2 := F_YREAL(GVL_Environment.rawWindDirection2, 0, 32767, 0.0, 3
Temperature2 := F_YREAL(GVL_Environment.rawTemperature2, 0, 32767, -40.0, 60.0); // °C Temperature2 := F_YREAL(GVL_Environment.rawTemperature2, 0, 32767, -40.0, 60.0); // °C
Humidity2 := F_YREAL(GVL_Environment.rawHumidity2, 0, 32767, 0.0, 100.0); // % Humidity2 := F_YREAL(GVL_Environment.rawHumidity2, 0, 32767, 0.0, 100.0); // %
Pressure2 := F_YREAL(GVL_Environment.rawPressure2, 0, 32767, 800.0, 1060.0); // mBar Pressure2 := F_YREAL(GVL_Environment.rawPressure2, 0, 32767, 800.0, 1060.0); // mBar
Brightness2 := F_YREAL(GVL_Environment.rawBrightness2, 0, 32767, 1.0, 120000.0); // Lux Brightness2 := F_YREAL(GVL_Environment.rawBrightness2, 0, 32767, 1.0, 150000.0); // Lux
LightDirection2 := F_YREAL(GVL_Environment.rawLightDirection2, 0, 32767, 0.0, 360.0); // ° LightDirection2 := F_YREAL(GVL_Environment.rawLightDirection2, 0, 32767, 0.0, 360.0); // °
Precipation2 := F_YREAL(GVL_Environment.rawPrecipation2, 0, 32767, 0.001, 100.0); // mm/h Precipation2 := F_YREAL(GVL_Environment.rawPrecipation2, 0, 32767, 0.001, 100.0); // mm/h
...@@ -62,7 +65,9 @@ END_IF ...@@ -62,7 +65,9 @@ END_IF
TemperatureDome := F_YREAL(GVL_Environment.rawTemperatureDome, 0, 32767, -30.0, 70.0); // °C TemperatureDome := F_YREAL(GVL_Environment.rawTemperatureDome, 0, 32767, -30.0, 70.0); // °C
HumidityDome := F_YREAL(GVL_Environment.rawHumidityDome, 0, 32767, 0.0, 100.0); // % HumidityDome := F_YREAL(GVL_Environment.rawHumidityDome, 0, 32767, 0.0, 100.0); // %
WindEvent( Trigger := MAX(WindSpeed1, WindSpeed2) > 10.0, WindAverage(IN := WindSpeed, PT := T#5M, AVG => avg_wind, MAXAVG => max_wind);
PrecepationAverage(IN := MAX(Precipation1, Precipation2), PT := T#2M);
WindEvent( Trigger := avg_wind > 10.0,
Level := ADSLOG_MSGTYPE_WARN, Level := ADSLOG_MSGTYPE_WARN,
FormatString := 'Wind Speed: %s', FormatString := 'Wind Speed: %s',
OnMessage := LREAL_TO_STRING(MAX(WindSpeed1, WindSpeed2)), OnMessage := LREAL_TO_STRING(MAX(WindSpeed1, WindSpeed2)),
...@@ -76,7 +81,7 @@ HumidityEvent( Trigger := MAX(Humidity1, Humidity2) > 80.0, ...@@ -76,7 +81,7 @@ HumidityEvent( Trigger := MAX(Humidity1, Humidity2) > 80.0,
OffMessage := 'OK', OffMessage := 'OK',
OffLevel := ADSLOG_MSGTYPE_HINT); OffLevel := ADSLOG_MSGTYPE_HINT);
PrecepationEvent( Trigger := MAX(Precipation1, Precipation2) > 0.3, PrecepationEvent( Trigger := PrecepationAverage.AVG > 0.3,
Level := ADSLOG_MSGTYPE_WARN, Level := ADSLOG_MSGTYPE_WARN,
FormatString := 'Precepation: %s', FormatString := 'Precepation: %s',
OnMessage := LREAL_TO_STRING( MAX(Precipation1, Precipation2)), OnMessage := LREAL_TO_STRING( MAX(Precipation1, Precipation2)),
...@@ -104,6 +109,7 @@ PrecepationEvent( Trigger := MAX(Precipation1, Precipation2) > 0.3, ...@@ -104,6 +109,7 @@ PrecepationEvent( Trigger := MAX(Precipation1, Precipation2) > 0.3,
<LineId Id="194" Count="0" /> <LineId Id="194" Count="0" />
<LineId Id="68" Count="0" /> <LineId Id="68" Count="0" />
<LineId Id="71" Count="1" /> <LineId Id="71" Count="1" />
<LineId Id="230" Count="1" />
<LineId Id="143" Count="20" /> <LineId Id="143" Count="20" />
<LineId Id="2" Count="0" /> <LineId Id="2" Count="0" />
</LineIds> </LineIds>
......
...@@ -15,6 +15,7 @@ VAR ...@@ -15,6 +15,7 @@ VAR
ReadCycle: BOOL; ReadCycle: BOOL;
Azimuth_set, Azimuth_set,
Azimuth_current: LREAL; Azimuth_current: LREAL;
move_azimuth, stop_azimuth: BOOL;
END_VAR END_VAR
]]></Declaration> ]]></Declaration>
<Implementation> <Implementation>
...@@ -26,18 +27,19 @@ IF DomeState.0 THEN ...@@ -26,18 +27,19 @@ IF DomeState.0 THEN
GVL_Dome.FlapOpened := DomeState.3; GVL_Dome.FlapOpened := DomeState.3;
GVL_Dome.FlapClosed := DomeState.4; GVL_Dome.FlapClosed := DomeState.4;
END_IF END_IF
(*
IF ABS(ConvertEnvironment.WindDirection - Azimuth_current) > 150.0 THEN IF ABS(ConvertEnvironment.WindDirection - Azimuth_current) > 150.0 THEN
Azimuth_set := ConvertEnvironment.WindDirection; Azimuth_set := ConvertEnvironment.WindDirection;
END_IF END_IF
*)
DomeAxis(bPowerEnable := TRUE, DomeAxis(bPowerEnable := TRUE,
bEnable_Positive := TRUE, bEnable_Positive := Azimuth_current < 360.0,
bEnable_Negative := TRUE, bEnable_Negative := Azimuth_current >= 0.0,
bMoveAbsExec := FALSE, //ConvertEnvironment.WindSpeed > 15.0, bMoveAbsExec := ABS(Azimuth_set - Azimuth_current) > 1.0, //ConvertEnvironment.WindSpeed > 15.0,
fMoveAbsPos := Azimuth_set, fMoveAbsPos := Azimuth_set,
fMoveAbsVelo := 3.0, fMoveAbsVelo := 3.0,
bStop := ConvertEnvironment.WindSpeed < 10.0, bStop := stop_azimuth,
fActPos => Azimuth_current, fActPos => Azimuth_current,
stAxis := GVL_Dome.DomeAxisRef); stAxis := GVL_Dome.DomeAxisRef);
...@@ -109,6 +111,7 @@ DomeLog(Trigger := bError, ...@@ -109,6 +111,7 @@ DomeLog(Trigger := bError,
<LineId Id="310" Count="0" /> <LineId Id="310" Count="0" />
<LineId Id="312" Count="1" /> <LineId Id="312" Count="1" />
<LineId Id="289" Count="0" /> <LineId Id="289" Count="0" />
<LineId Id="365" Count="0" />
<LineId Id="291" Count="3" /> <LineId Id="291" Count="3" />
<LineId Id="296" Count="2" /> <LineId Id="296" Count="2" />
<LineId Id="307" Count="0" /> <LineId Id="307" Count="0" />
......
<?xml version="1.0" encoding="utf-8"?> <?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.4024.0">
<POU Name="F_DeclinationLimit" Id="{63bf7f2c-aa22-4403-8fe6-705497e9da03}" SpecialFunc="None"> <POU Name="F_DeclinationLimit" Id="{63bf7f2c-aa22-4403-8fe6-705497e9da03}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION F_DeclinationLimit : LREAL <Declaration><![CDATA[FUNCTION F_DeclinationLimit : LREAL
VAR_INPUT VAR_INPUT
// observers latitude in degrees from -90.0 ... +90.0 // observers latitude in degrees from -90.0 ... +90.0
latitude: LREAL; latitude: LREAL;
west_of_pier: BOOL;
// positive is true for the positive (upper) limit, false for the ngeative (lower) limit // positive is true for the positive (upper) limit, false for the ngeative (lower) limit
positive: BOOL := TRUE; positive: BOOL := TRUE;
END_VAR END_VAR
...@@ -13,17 +14,17 @@ END_VAR ...@@ -13,17 +14,17 @@ END_VAR
]]></Declaration> ]]></Declaration>
<Implementation> <Implementation>
<ST><![CDATA[(* returns the limits for the declination *) <ST><![CDATA[(* returns the limits for the declination *)
IF latitude >= 0.0 THEN IF west_of_pier THEN
IF positive THEN IF positive THEN
F_DeclinationLimit := 90.0; F_DeclinationLimit := 270.0 - latitude;
ELSE ELSE
F_DeclinationLimit := -90.0 + latitude; F_DeclinationLimit := 90.0 - latitude;
END_IF END_IF
ELSE // negative latitude ELSE // east_of_pier
IF positive THEN IF positive THEN
F_DeclinationLimit := 90.0 - latitude; F_DeclinationLimit := 90.0 + latitude;
ELSE ELSE
F_DeclinationLimit := -90.0; F_DeclinationLimit := 270.0 + latitude;
END_IF END_IF
END_IF END_IF
]]></ST> ]]></ST>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.12"> <TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.0">
<POU Name="FB_AxisJog" Id="{fb989a3e-caa4-4410-9164-68fdd76c828e}" SpecialFunc="None"> <POU Name="FB_AxisJog" Id="{fb989a3e-caa4-4410-9164-68fdd76c828e}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_AxisJog <Declaration><![CDATA[FUNCTION_BLOCK FB_AxisJog
VAR_INPUT VAR_INPUT
...@@ -9,7 +9,7 @@ VAR_INPUT ...@@ -9,7 +9,7 @@ VAR_INPUT
bEnable_Negative: BOOL := TRUE; bEnable_Negative: BOOL := TRUE;
fPowerOverride: LREAL := 100; fPowerOverride: LREAL := 100;
bReset: BOOL; bReset: BOOL;
bStop: BOOL := FALSE;
bForward: BOOL; bForward: BOOL;
bBackward: BOOL; bBackward: BOOL;
END_VAR END_VAR
...@@ -44,7 +44,6 @@ VAR ...@@ -44,7 +44,6 @@ VAR
// StartTrig: R_TRIG; // StartTrig: R_TRIG;
nstate: INT; nstate: INT;
nLaststate: INT; nLaststate: INT;
bStop: BOOL := FALSE;
END_VAR END_VAR
VAR_IN_OUT VAR_IN_OUT
...@@ -87,11 +86,11 @@ fbMCReset( ...@@ -87,11 +86,11 @@ fbMCReset(
AxMcJog( AxMcJog(
JogForward := bForward, JogForward := bForward,
JogBackwards := bBackward, JogBackwards := bBackward,
Mode := MC_JOGMODE_STANDARD_SLOW, Mode := MC_JOGMODE_STANDARD_FAST,
Position := fActPos, Position := fActPos,
Velocity := fActVelo, Velocity := fActVelo,
Acceleration := 0, Acceleration := 5,
Deceleration := 0, Deceleration := 100,
Jerk := 0, Jerk := 0,
Done => AxMcJogOut.Done, Done => AxMcJogOut.Done,
Busy => AxMcJogOut.Busy, Busy => AxMcJogOut.Busy,
......
<?xml version="1.0" encoding="utf-8"?> <?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.4024.0">
<POU Name="FB_EQ2HOR" Id="{2aaa455b-6325-4dbe-b61c-a8cfdf369fe1}" SpecialFunc="None"> <POU Name="FB_EQ2HOR" Id="{2aaa455b-6325-4dbe-b61c-a8cfdf369fe1}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_EQ2HOR <Declaration><![CDATA[FUNCTION_BLOCK FB_EQ2HOR
VAR_INPUT VAR_INPUT
...@@ -106,7 +106,7 @@ Calculate LOCAL MEAN SIDEREAL TIME *) ...@@ -106,7 +106,7 @@ Calculate LOCAL MEAN SIDEREAL TIME *)
lmst := ct2lst(lon, jd); // get LST (in hours) - note:this is independent of time zone since giving jd lmst := ct2lst(lon, jd); // get LST (in hours) - note:this is independent of time zone since giving jd
lmst := lmst*h2d ; //convert LMST to degrees (btw, this is the RA of the zenith) lmst := lmst*h2d ; //convert LMST to degrees (btw, this is the RA of the zenith)
// calculate local APPARENT sidereal time // calculate local APPARENT sidereal time
last := lmst + d_psi *COS(eps)/3600.0 ; //add correction in degrees last := lmst + d_psi *COS(eps*d2r)/3600.0 ; //add correction in degrees
(****************************************************************************** (******************************************************************************
Find hour angle (in DEGREES) *) Find hour angle (in DEGREES) *)
......
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.0">
<POU Name="FB_EQ2HOR2" Id="{7b34f02a-1435-4300-8153-5c49f62d1b5b}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_EQ2HOR2
VAR_INPUT
// right ascension in degrees
alpha: LREAL;
// declination in degrees
delta: LREAL;
// longitude in degrees
lon: LREAL;
// latitude in degrees
lat: LREAL;
// Julian Days
JD: LREAL;
END_VAR
VAR_OUTPUT
// altitude in degrees
alt: LREAL;
// azimuth in degrees
az: LREAL;
// hour angle in degreesss
ha: LREAL;
END_VAR
VAR
lst: LREAL;
sinalt, sinaz, cosaz, az2: LREAL;
END_VAR
VAR CONSTANT
d2r: LREAL := PI/180.0;
r2d: LREAL := 180.0/PI;
h2r: LREAL := PI/12.0;
h2d: LREAL := 15.0;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[lst := ct2lst(lon, jd);
ha := MODABS(lst*15.0 - alpha, 360.0);
sinalt := (SIN(delta*d2r)*SIN(lat*d2r)) + (COS(delta*d2r)*COS(lat*d2r)*COS(ha*d2r));
alt := ASIN(sinalt) * r2d;
sinaz := -SIN(ha*d2r)*COS(delta*d2r)/COS(alt*d2r);
az := ASIN(sinaz) * r2d;
cosaz := (SIN(delta*d2r) - SIN(lat*d2r)*sinalt)/(COS(lat*d2r)*COS(alt*d2r));
az2 := ACOS(cosaz) * r2d;]]></ST>
</Implementation>
<LineIds Name="FB_EQ2HOR2">
<LineId Id="9" Count="0" />
<LineId Id="16" Count="0" />
<LineId Id="18" Count="0" />
<LineId Id="26" Count="1" />
<LineId Id="24" Count="0" />
<LineId Id="28" Count="0" />
<LineId Id="23" Count="0" />
<LineId Id="50" 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.4024.0">
<POU Name="LREAL_TO_FMTESTR" Id="{87e8e94a-e4ab-4792-8032-2087ad1cc7b1}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION LREAL_TO_FMTESTR : STRING
VAR_INPUT
in : LREAL; // 1.19412572985311e-6
iPrecision : INT := 2;
bRound : BOOL := TRUE;
END_VAR
VAR
lstring: STRING;
ppos: INT;
epos: INT;
mantisse: LREAL;
exponent: STRING;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[lstring := LREAL_TO_STRING(in);
ppos := FIND(lstring, '.');
epos := FIND(lstring, 'e');
IF epos = 0 OR ppos = 0 THEN
LREAL_TO_FMTESTR := LREAL_TO_FMTSTR(in, iPrecision, bRound);
RETURN;
END_IF
mantisse := STRING_TO_LREAL(LEFT(lstring, epos-1)); // 1.19412572985311
exponent := RIGHT(lstring, LEN(lstring)-epos+1); // e-6
LREAL_TO_FMTESTR := CONCAT(LREAL_TO_FMTSTR(mantisse,iPrecision, bRound), exponent);]]></ST>
</Implementation>
<LineIds Name="LREAL_TO_FMTESTR">
<LineId Id="7" Count="0" />
<LineId Id="22" Count="0" />
<LineId Id="14" Count="0" />
<LineId Id="18" Count="1" />
<LineId Id="21" Count="0" />
<LineId Id="20" Count="0" />
<LineId Id="26" Count="0" />
<LineId Id="28" Count="0" />
<LineId Id="13" Count="0" />
</LineIds>
</POU>
</TcPlcObject>
\ No newline at end of file
...@@ -58,7 +58,7 @@ DomeLightEvent( Trigger := GVL_MainControl.LightDome, ...@@ -58,7 +58,7 @@ DomeLightEvent( Trigger := GVL_MainControl.LightDome,
<LineId Id="24" Count="2" /> <LineId Id="24" Count="2" />
<LineId Id="5" Count="0" /> <LineId Id="5" Count="0" />
<LineId Id="39" Count="0" /> <LineId Id="39" Count="0" />
<LineId Id="61" Count="0" /> <LineId Id="76" Count="0" />
<LineId Id="41" Count="3" /> <LineId Id="41" Count="3" />
<LineId Id="40" Count="0" /> <LineId Id="40" Count="0" />
<LineId Id="50" Count="0" /> <LineId Id="50" Count="0" />
......
...@@ -16,17 +16,17 @@ VAR ...@@ -16,17 +16,17 @@ VAR
// local siderial time calculated from Julian date // local siderial time calculated from Julian date
lst, lst,
// values calulated when ra and dec are set by TCS