Sample scripts VBS

Description
VBS scripts for closing equipments

<hello, I am close to finish my evaluation of SGP, this is the latest items I have to solve and after a order. The software I use today, autorise the “Running mode full auto”, after the complete images process, I have to finalise the closing of all equipments mode VBS scripts . I haved look on the web to find scripts command use by the user of SGP, nothing find. So I com to you for help. I attach the vbs script I use, some one hoe can look and corect for SGP (The scripts are documented on the fonction they have to execute). Many thans for helping me, if that job as to be pay, tell me, no problmes if its raisonable. Philippe>
Link to Logs

<// End of automatic observation session
// Observatoire de Philippe Rees

// delays in ms
// *_close => disconnection in SGP
// *_off => disconnection of switch in SGP

// -----------------------------------------------------------------------------
// VARIABLES
// – switch
sw_port_scope=6
sw_port_cam=7
sw_port_atik=5
sw_port_foc=8
sw_port_usb=3
sw_port_rof=2

// – scope
// parking position (alt/az degrees)
scope_park_alt=2
scope_park_az=268
// margin on ha et en az (minimum 1 degré)
scope_park_threshold=2
// number of attempts for parking to do
scope_park_try=2
// waiting time for parking (ms)
scope_delay_park=30000
// waiting time after disconnecting the scope (ms)
scope_delay_close=10000
// waiting time after scope power cut (ms)
scope_delay_off=5000

// – camera1
// temperature to reach (degrés celcius)
cam1_temp=10
// minimum temperature to consider the camera sufficiently cooled
cam1_temp_mini=5
// time intervals between each temperature test (ms)
cam1_delay_check=30000
// maximum time to reach the requested temperature (ms)
cam1_delay_total=600000
// waiting time after disconnecting the camera (ms)
cam1_delay_close=5000
// additional waiting delay if safety temperature not reached (ms, voir cam1_temp_mini)
cam1_delay_erreurtemp=300000
// waiting time after the camera has been cut off (ms)
cam1_delay_off=2000

// – camera 2
// cam2_delay_close=5000
// cam2_delay_off=2000

// – observatoire
// waiting time between each power outage on the switch (other elements of the observatory, en ms)
sw_delay_off=2000

// roff : waiting time for roof closure (ms)
rof_delay_close=30000

// -----------------------------------------------------------------------------
// CORE : SCOPE
core_scope:
print “# TELESCOPE #”
scope_is_parked=0

// -------------
my_test=1
parking_test:
print "# SCOPE : “check parking position”
// check parking position
Get_telescope_position ra dec alt az ahor
alt=alt180/PI
az=az
180/PI
print " Position (alt/az): " alt “/” az

// checks if correct parking position (and margin of error)
if alt>(scope_park_alt+scope_park_threshold) then
print " ERREUR : bad parking position, alt = " alt " (" scope_park_alt “)”
goto parking_ko:
endif
if alt<(scope_park_alt-scope_park_threshold) then
print " ERREUR : bad parking position, alt = " alt " (" scope_park_alt “)”
goto parking_ko:
endif

if az>(scope_park_az+scope_park_threshold) then
print " ERREUR : bad parking position, az = " az " (" scope_park_az “)”
goto parking_ko:
endif
if az<(scope_park_az-scope_park_threshold) then
print " ERREUR : bad parking position, az = " az " (" scope_park_az “)”
goto parking_ko:
endif

// -------------
// final parking status display and decision making
parking_ok:
print " Correct parking position"
scope_is_parked=1
goto parking_end:

parking_ko:
print " Incorrect parking position"
if (my_test<=scope_park_try) then
// tenter un reparking
Print " Parking scope, position " scope_park_alt " " scope_park_az “, tentative n°” my_test
alt=scope_park_altPI/180
az=scope_park_az
PI/180
Print " Parking scope, alt/az " alt “/” az
// make sure it is not parked (ascom)
Unpark_telescope
Delay 3000
Waitforenddelay
// sideral tracking (pour ascom)
// Return_telescope_to_sidereal
// Delay 2000
// Waitforenddelay

// now park
Print " Parking…"
// Park_telescope my_ha my_dec
Park_telescope_ElvAz az alt
// wait for the scope
Delay scope_delay_park
Waitforenddelay
// retested parking position
my_test=my_test+1
goto parking_test:
else
Print " Parking FAILURE, Bypass Roof Closure"
endif

// ne bypass pas extinction scope
goto parking_end:

// -------------
// extinction
parking_end:
print “# SCOPE : observatory stop”
close_telescope_devices
delay scope_delay_close
waitforenddelay

print “# SCOPE : extinction”
setswitch sw_port_scope 0
delay scope_delay_off
waitforenddelay
print " Telescope off"

// -----------------------------------------------------------------------------
// CORE : CAMERAS
print “”
print “# CAMERAS #”

// -------------
// CHECK TEMP
print “# CAM 1 : temperature check”

// init var
temp=-275
waittime=0

// TODO => TEMP DE +5 deg

// - boucle while
while_camera_temp:
getccdtemperature 1 temp

if temp<cam1_temp then
print " Bad temperature : " temp " (" cam1_temp “)”
delay cam1_delay_check
waitforenddelay
waittime=waittime+cam1_delay_check
if waittime>cam1_delay_total then
goto while_camera_temp_end:
else
goto while_camera_temp:
endif
endif

// - boucle while : fin
while_camera_temp_end:

// last temperature check for display
getccdtemperature 1 temp

// if bad temperature then add a safety delay before switching off
if temp<cam1_temp then
print " ERREUR : heating temperature not reached"
if temp<cam1_temp_mini then
print " camera temperature below safety temperature"
cam1_delay_close=cam1_delay_close+cam1_delay_erreurtemp
else
print " safety temperature reached"
endif
else
print " correct camera temperature !"
goto camera_temp_end:
endif

camera_temp_end:

// -----------------------------------------------------------------------------
// stop/turn off cameras

// ---------- CAMERA1
print “# CAM 1 : Stoped”
close_ccd_camera_ex 1
delay cam1_delay_close
waitforenddelay

// ---------- CAMERA2 (this guide camera is managed by PHD2, the question is can SGP turn it off?)
//print “# CAM 2 : arrêt”
//close_ccd_camera_ex 2
//delay cam2_delay_close
//waitforenddelay

// DELAY IF BAD TEMPERATURE

print “# CAMERAS : extinction”
setswitch sw_port_cam 0
delay cam2_delay_off
waitforenddelay

// -----------------------------------------------------------------------------
// extinction des autres éléments
print “”
print “# FINAL EXTINCTIONS #”

print “# ALLSKY : extinction”
setswitch sw_port_atik 0
delay sw_delay_off
waitforenddelay

print “# FOCUSER : extinction”
setswitch sw_port_foc 0
delay sw_delay_off
waitforenddelay

print “# USB HUB : extinction”
setswitch sw_port_usb 0
delay sw_delay_off
waitforenddelay

// -----------------------------------------------------------------------------
// roof closure
print “”
print “# CLOSING OF THE GARDEN SHED #”

// CANCEL CLOSURE IF NO PARKING
if scope_is_parked=0 then
Print " The telescope is not parked, cancellation of the roof closure"
else
Print " The telescope is parked, the roof is closed"
setswitch sw_port_rof 1
delay rof_delay_close
waitforenddelay
endif

// -----------------------------------------------------------------------------
// END
print “”
print “# END OF SCRIPT #”
EXIT

Useful Info

OS: < win V10>
Ver: <4.1.0.827>