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

adoptions due to commissioning

using fbHourAxis as engine
pumping state
defining park positions and homing
messing with true declination
reacting to halt command
parent 46c334d0
......@@ -56,7 +56,7 @@ VAR
Rightascension_current: LREAL;
(* Hour Angle part *)
fbHourAxisTrack : FB_ModuloAxis;
fbHourAxis : FB_Axis;
fbHourAxisJog : FB_AxisJog;
Hourangle_absolute,
Hourangle_real,
......@@ -127,7 +127,8 @@ see https://gitlab.aip.de/bmk10k/telescope_firmware/snippets/5
east: BOOL;
//(boolean, TRUE: Swap telescope TO observe western hemisphere. Set TO FALSE once there. IF already there, set TO FALSE immediately.FALSE: no effect)
west: BOOL;
// internal command: telescope is moved to pumping position
pumping: BOOL;
// offset TO current tracking point on axis tau, degrees, double
tauoffset: LREAL;
// offset TO current tracking point on axis dec, degrees, double
......@@ -177,7 +178,6 @@ VAR_OUTPUT
tracktime: LREAL;
// True: telescope is calibrated
homed: BOOL;
testing: BOOL := TRUE;
END_VAR
VAR CONSTANT
(* Potsdam:
......@@ -192,17 +192,12 @@ VAR CONSTANT
// telescope site height above sea level: source Wikipedia Cerro Armazones Observatory
height: LREAL := 2810.0;
siderial_velocity: LREAL := 360.0 / 86164.099;
// TODO: change to final value
position_velocity: LREAL := 1.0;
// TODO: change to final value
declination_park: LREAL := 0.0;
// TODO: change to final value
hourangle_park: LREAL := 318.466;
declination_park: LREAL := 294.0;
hourangle_park: LREAL := 359.5;
// TODO: change to final value
declination_home: LREAL := -65.0;
// TODO: change to final value
hourangle_home: LREAL := 355.0;
declination_home: LREAL := 270.0;
hourangle_home: LREAL := 270.0;
lag_error : LREAL := 0.5;
position_error : LREAL := 10.0/3600.0;
......@@ -215,10 +210,6 @@ IF fbTime.bValid THEN
jd := DateTime2JD(fbTime.systemTime);
END_IF
lst := CT2LST(longitude, jd);
IF testing THEN
ra := lst*15.0;
de := latitude;
END_IF
// set reset state either by hardware (key pressed) or by software (set by e.g. tcs)
reset := softreset OR GVL_Telescope.Key2;
IF softreset THEN
......@@ -251,15 +242,17 @@ west_of_pier := (hourangle_absolute > 270.0);
east_of_pier := NOT west_of_pier;
IF west_of_pier THEN
Declination_real := 180.0 - Declination_absolute; // OK
hourangle_real := hourangle_absolute; // OK
ELSE // west_of_pier
IF Declination_absolute>180.0 THEN
Declination_real := Declination_absolute - 360.0;
ELSE
Declination_real := Declination_absolute;
END_IF
END_IF
IF Declination_absolute > 270.0 THEN
hourangle_real := hourangle_absolute - 180.0;
ELSE
hourangle_real := hourangle_absolute; // OK
END_IF
rightascension_current := MODABS(lst*15.0 - hourangle_real, 360.0);
......@@ -268,17 +261,7 @@ hadec2altaz( ha := hourangle_real,
lat := latitude,
alt => altitude,
az => azimut);
(*
eq2hor( ra := ra,
Dec := de,
JD := jd,
LAT := latitude,
LON := longitude,
ALTITUDE := height,
alt => altitude_calc, //worng
az => azimut_calc, //wrong
ha => Hourangle_calc); //wrong
*)
eq2hor2(alpha := ra,
delta := de,
lon := longitude,
......@@ -384,6 +367,8 @@ ELSIF east THEN
TCS_command := E_TCSCommand.east;
ELSIF west THEN
TCS_command := E_TCSCommand.west;
ELSIF pumping THEN
TCS_command := E_TCSCommand.pumping;
ELSIF stop THEN
TCS_command := E_TCSCommand.stop;
ELSE
......@@ -399,8 +384,8 @@ IF telescope_mode = E_TelescopeMode.automatic THEN
IF TCS_command = E_TCSCommand.gohome THEN // goto home position
track := FALSE;
goto := FALSE;
Declination_set := declination_park;
Hourangle_set := hourangle_park;
Declination_set := declination_home;
Hourangle_set := hourangle_home;
Hourangle_velocity := position_velocity;
Declination_velocity := position_velocity;
END_IF
......@@ -415,6 +400,7 @@ IF telescope_mode = E_TelescopeMode.automatic THEN
END_IF
IF TCS_command = E_TCSCommand.track THEN // move telescope to last ra/de and start tracking.
goto := FALSE;
(*
IF ABS(Declination_current - de) > position_error THEN
Declination_velocity := position_velocity;
Declination_set := de;
......@@ -428,13 +414,22 @@ IF telescope_mode = E_TelescopeMode.automatic THEN
Hourangle_velocity := siderial_velocity;
Hourangle_set := 270.0;
END_IF
*)
Declination_velocity := 0.0;
Hourangle_velocity := siderial_velocity;
Hourangle_set := SEL(west_of_pier, 360.0, 270.0);
END_IF
IF TCS_command = E_TCSCommand.goto THEN // move telescope to tau/de and stop there. Set track to false, if true. False: no effect.
track := FALSE;
// TODO: check altitude
Declination_set := de;
IF tau >= 0.0 AND tau < 360.0 THEN
IF de >= -90 AND de <= 90 THEN
Declination_set := SEL(west_of_pier, 180 - de, 360 + de);
END_IF
IF tau >= 180.0 AND tau < 360.0 THEN
Hourangle_set := tau;
ELSIF tau >= 0.0 AND tau <180 THEN
//TODO
goto := FALSE;
ELSIF ra >= 0.0 AND ra < 360.0 THEN
Hourangle_set := Hourangle_calc;
END_IF
......@@ -449,25 +444,45 @@ IF telescope_mode = E_TelescopeMode.automatic THEN
// Setting allowed only if telescope is not moving.
IF TCS_command = E_TCSCommand.east THEN
IF west_of_pier THEN
east := FALSE;
// move telescope to west of pier
Declination_velocity := position_velocity;
Hourangle_velocity := position_velocity;
Declination_set := 270;
Hourangle_set := 180.0;
ELSE
east := FALSE;
END_IF
END_IF
// Setting allowed only if telescope is not moving.
IF TCS_command = E_TCSCommand.west THEN
IF east_of_pier THEN
west := FALSE;
// move telescope to east of pier
Declination_velocity := position_velocity;
Hourangle_velocity := position_velocity;
Declination_set := 270;
Hourangle_set := 360.0;
ELSE
west := FALSE;
END_IF
END_IF
// internal command, might not be issued by the TCS
IF TCS_command = E_TCSCommand.pumping THEN
Declination_velocity := position_velocity;
Hourangle_velocity := position_velocity;
Declination_set := 211.0;
Hourangle_set := 360.0;
END_IF
fbDeclinationAxis(bPowerEnable := power,
bEnable_Positive := TRUE, //declination_real <= F_DeclinationLimit(latitude, west_of_pier, TRUE),
bEnable_Negative := TRUE, //declination_real >= F_DeclinationLimit(latitude, west_of_pier, FALSE),
bReset := reset,
bMoveAbsExec := gohome OR park OR goto, // TODO gohome or park or goto
bMoveAbsExec := gohome OR park OR goto OR east OR west OR pumping, // TODO gohome or park or goto
fMoveAbsPos := Declination_set,
fMoveAbsVelo := Declination_velocity,
bStop := stop,
bStop := Declination_lagerror,
bHalt := stop,
bMoveAbsDone => DeclinationDone,
bMoveAbsBusy => DeclinationBusy,
bMoveAbsErr => DeclinationError,
......@@ -477,15 +492,16 @@ IF telescope_mode = E_TelescopeMode.automatic THEN
fActPos => Declination_current,
stAxis := GVL_Telescope.DecAxisRef);
// TODO: enable_positive and negative
fbHourAxisTrack(bPowerEnable := power,
fbHourAxis(bPowerEnable := power,
bReset := reset,
bMoveModExec := gohome OR park OR track OR goto,
fMoveModPos := Hourangle_set,
fMoveModVelo := Hourangle_velocity,
bStop := stop,
bMoveModDone => HourangleDone,
bMoveModBusy => HourangleBusy,
bMoveModErr => HourangleError,
bMoveAbsExec := gohome OR park OR track OR goto OR east OR west OR pumping,
fMoveAbsPos := Hourangle_set,
fMoveAbsVelo := Hourangle_velocity,
bStop := Hourangle_lagerror,
bHalt := stop,
bMoveAbsDone => HourangleDone,
bMoveAbsBusy => HourangleBusy,
bMoveAbsErr => HourangleError,
bAxError => HourangleAxisError,
nAxErrId => HourangleErrorID,
fActVelo => ,
......@@ -503,6 +519,7 @@ IF telescope_mode = E_TelescopeMode.automatic THEN
racurrent := rightascension_current;
azcurrent := azimut;
altcurrent := altitude;
slewtime := MAX(ABS(Hourangle_current-Hourangle_set)/position_velocity, ABS(Declination_current-Declination_set)/position_velocity);
homed := GVL_Telescope.DecAxisRef.Status.Homed AND GVL_Telescope.HourAxisRef.Status.Homed;
IF gohome AND ready THEN
gohome := FALSE;
......@@ -611,10 +628,6 @@ GVL_MainControl.ControlLamp := DeclinationError OR HourangleError OR
<LineId Id="60" Count="0" />
<LineId Id="354" Count="0" />
<LineId Id="65" Count="0" />
<LineId Id="642" Count="0" />
<LineId Id="2005" Count="0" />
<LineId Id="2007" Count="0" />
<LineId Id="2006" Count="0" />
<LineId Id="628" Count="1" />
<LineId Id="643" Count="0" />
<LineId Id="646" Count="0" />
......@@ -639,21 +652,18 @@ GVL_MainControl.ControlLamp := DeclinationError OR HourangleError OR
<LineId Id="1576" Count="1" />
<LineId Id="2012" Count="0" />
<LineId Id="1579" Count="0" />
<LineId Id="1585" Count="0" />
<LineId Id="1581" Count="1" />
<LineId Id="2017" Count="0" />
<LineId Id="2014" Count="0" />
<LineId Id="2016" Count="0" />
<LineId Id="2015" Count="0" />
<LineId Id="2013" Count="0" />
<LineId Id="1583" Count="0" />
<LineId Id="1580" Count="0" />
<LineId Id="2226" Count="1" />
<LineId Id="2229" Count="1" />
<LineId Id="2228" 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" />
<LineId Id="1283" Count="7" />
<LineId Id="1794" Count="0" />
<LineId Id="1282" Count="0" />
<LineId Id="1795" Count="3" />
......@@ -704,7 +714,9 @@ GVL_MainControl.ControlLamp := DeclinationError OR HourangleError OR
<LineId Id="1513" Count="0" />
<LineId Id="1526" Count="0" />
<LineId Id="1547" Count="1" />
<LineId Id="1520" Count="5" />
<LineId Id="1520" Count="3" />
<LineId Id="2867" Count="1" />
<LineId Id="1524" Count="1" />
<LineId Id="1511" Count="0" />
<LineId Id="1519" Count="0" />
<LineId Id="1509" Count="0" />
......@@ -727,17 +739,22 @@ GVL_MainControl.ControlLamp := DeclinationError OR HourangleError OR
<LineId Id="549" Count="0" />
<LineId Id="552" Count="0" />
<LineId Id="556" Count="0" />
<LineId Id="2231" Count="0" />
<LineId Id="553" Count="0" />
<LineId Id="1532" Count="0" />
<LineId Id="1536" Count="8" />
<LineId Id="1546" Count="0" />
<LineId Id="1545" Count="0" />
<LineId Id="2232" Count="0" />
<LineId Id="2235" Count="0" />
<LineId Id="2233" Count="1" />
<LineId Id="554" Count="0" />
<LineId Id="557" Count="0" />
<LineId Id="560" Count="0" />
<LineId Id="558" Count="0" />
<LineId Id="748" Count="0" />
<LineId Id="2660" Count="2" />
<LineId Id="1296" Count="1" />
<LineId Id="2663" Count="2" />
<LineId Id="1299" Count="1" />
<LineId Id="1298" Count="0" />
<LineId Id="750" Count="0" />
......@@ -750,22 +767,35 @@ GVL_MainControl.ControlLamp := DeclinationError OR HourangleError OR
<LineId Id="591" Count="0" />
<LineId Id="578" Count="0" />
<LineId Id="581" Count="1" />
<LineId Id="584" Count="0" />
<LineId Id="2656" Count="1" />
<LineId Id="2236" Count="1" />
<LineId Id="2652" Count="2" />
<LineId Id="583" Count="0" />
<LineId Id="579" Count="0" />
<LineId Id="593" Count="0" />
<LineId Id="585" Count="2" />
<LineId Id="2658" Count="1" />
<LineId Id="2238" Count="1" />
<LineId Id="589" Count="0" />
<LineId Id="2655" Count="0" />
<LineId Id="588" Count="0" />
<LineId Id="580" Count="0" />
<LineId Id="2882" Count="0" />
<LineId Id="2871" Count="0" />
<LineId Id="2874" Count="3" />
<LineId Id="2881" Count="0" />
<LineId Id="2870" Count="0" />
<LineId Id="653" Count="3" />
<LineId Id="658" Count="1" />
<LineId Id="662" Count="1" />
<LineId Id="662" Count="0" />
<LineId Id="2445" Count="0" />
<LineId Id="663" Count="0" />
<LineId Id="667" Count="2" />
<LineId Id="673" Count="3" />
<LineId Id="664" Count="0" />
<LineId Id="752" Count="0" />
<LineId Id="568" Count="4" />
<LineId Id="2446" Count="0" />
<LineId Id="703" Count="0" />
<LineId Id="721" Count="1" />
<LineId Id="724" Count="0" />
......@@ -781,6 +811,7 @@ GVL_MainControl.ControlLamp := DeclinationError OR HourangleError OR
<LineId Id="713" Count="0" />
<LineId Id="712" Count="0" />
<LineId Id="714" Count="1" />
<LineId Id="2666" Count="0" />
<LineId Id="1276" Count="0" />
<LineId Id="716" Count="0" />
<LineId Id="754" Count="4" />
......
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