Browse Source

deving

master
Bennet krebs 2 months ago
parent
commit
71f0204f93
  1. 10
      code/cast_control.py
  2. 12
      code/check_for_cast_safety.py

10
code/cast_control.py

@ -80,12 +80,9 @@ class CastControl:
def cast_routine(self, start_parameters: dict): # main routine for one complete cast cycle
"""PUT IN WAVECHECKER HERE"""
#Check for wave good conditions
wave_check = CastSafety()
wave_conditions_safe, new_top_deploy, new_bottom_deploy = wave_check.check_wave_conditions()
print(wave_conditions_safe)
print(new_top_deploy)
print(new_bottom_deploy)
if wave_conditions_safe:
print("wave conditions good. Cast is a-go.")
top_line_deploy = new_top_deploy
@ -93,8 +90,6 @@ class CastControl:
else:
print("wave conditions bad. aborting cast!")
return False
"""PUT IN WAVECHECKER HERE"""
# get start parameter
#top_line_deploy = start_parameters['top_line_deploy']
@ -122,7 +117,6 @@ class CastControl:
winch.open_winch_connection()
winch_ready = winch.is_winch_ready()
self.countdown_to_next_movement(upcast_start_time)
while datetime.datetime.now() < upcast_start_time: # wait for correct time for upcast
time.sleep(1)
@ -179,7 +173,7 @@ class CastControl:
while datetime.datetime.now() < next_movement_time - datetime.timedelta(seconds=5):
time.sleep(1)
time_left = int((next_movement_time - datetime.datetime.now()).total_seconds())
if time_left % 2 == 0:
if time_left % 10 == 0:
print("Waiting until "+str(next_movement_time)+" for next movement -> "+str(time_left)+"s...", end="\r")
print("Waiting until " + str(next_movement_time) + " for next movement -> " + str(time_left) + "s...", end='')
print(" Wait time complete.")

12
code/check_for_cast_safety.py

@ -71,9 +71,12 @@ class CastSafety:
self.wave_conditions_safe = False
if top_line_deploy >= bottom_line_deploy:
self.wave_conditions_safe = False
print("waterlevel:"+str(self.check_results["waterlevel"]))
print("bottom_line_deploy:"+str(bottom_line_deploy))
print("new_top:"+str(top_line_deploy))
if self.check_results["wave_trough"]*2 >= self.check_parameters["max_permitted_waveheight"]:
self.wave_conditions_safe = False
print("Measured Waterlevel above SBE19: "+str(self.check_results["waterlevel"]))
print("Bottom line deploy target: "+str(bottom_line_deploy))
print("Top line deploy target: "+str(top_line_deploy))
print("Wave conditions are safe: "+str(self.wave_conditions_safe))
return top_line_deploy, bottom_line_deploy
@ -90,8 +93,5 @@ class CastSafety:
if __name__ == "__main__":
wave_check=CastSafety()
wave_conditions_safe, new_top_deploy, new_bottom_deploy = wave_check.check_wave_conditions()
print(wave_conditions_safe)
print(new_top_deploy)
print(new_bottom_deploy)

Loading…
Cancel
Save