From 10769caaab5a46e0efe05a730ee9ab426ff34cb6 Mon Sep 17 00:00:00 2001 From: Snorre Selmer Date: Wed, 10 Nov 2021 17:29:01 +0100 Subject: [PATCH 1/5] Reworked heating-cooling --- heating_cooling.ic10 | 53 +++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/heating_cooling.ic10 b/heating_cooling.ic10 index d6b8787..409a310 100644 --- a/heating_cooling.ic10 +++ b/heating_cooling.ic10 @@ -1,6 +1,11 @@ alias gas_sensor d0 -alias thermostat d1 # Logic Switch, Dial variant (Max=30) -alias temp_variance d2 # Logic Memory, must be more than 0 (2 is a good value) +# d1= Logic Switch, Dial variant (Max=30) +alias thermostat d1 +# d2 = Logic Memory, must be more than 0 +alias temp_variance d2 +# d3 = Console, LED Display variant, optional +alias temp_disp d3 + alias curr_temp r0 alias target_temp r1 alias variance r2 @@ -9,10 +14,10 @@ alias max_temp r4 alias cooling_active r5 alias heating_active r6 -define wall_heaters 24258244 # Wall Heaters -define wall_coolers -739292323 # Wall Coolers (Gas) -define liquid_wall_coolers -1369060582 # Wall Coolers (Liquid) -define temp_convert 273 +define wall_heaters 24258244 +define wall_coolers -739292323 +define liquid_wall_coolers -1369060582 +define temp_convert 273.15 start: yield @@ -30,47 +35,49 @@ l target_temp thermostat Setting l curr_temp gas_sensor Temperature sub curr_temp curr_temp temp_convert +# update display +brdns temp_disp 2 +jal display + # compare current temp to max/min temp and # initiate cooling or heating if needed bgt curr_temp max_temp cooling blt curr_temp min_temp heating -# Go to start again j start -cooling: -yield -# read ambient temp from sensor and convert to C -l curr_temp gas_sensor Temperature -sub curr_temp curr_temp temp_convert +display: +s temp_disp Setting curr_temp +j ra + +cooling: # test if coolers need to be on or not sgt cooling_active curr_temp target_temp +# update display +brdns temp_disp 2 +jal display + # send state to coolers sb wall_coolers On cooling_active sb liquid_wall_coolers On cooling_active -# if curr_temp is higher than target, keep cooling -bgt curr_temp target_temp cooling +bgtz cooling_active cooling -# ...if not, go to start again j start heating: -yield -# read ambient temp from sensor and convert to C -l curr_temp gas_sensor Temperature -sub curr_temp curr_temp temp_convert - # test if heaters need to be on or not slt heating_active curr_temp target_temp +# update display +brdns temp_disp 2 +jal display + # send state to heaters sb wall_heaters On heating_active -# if curr_temp is lower than target, keep heating -blt curr_temp target_temp heating +bgtz heating_active heating -# ...if not, go to start again j start \ No newline at end of file From 96db3f1ea0c6f6fdbd54ed9c32e723fdf930a48d Mon Sep 17 00:00:00 2001 From: Snorre Selmer Date: Wed, 10 Nov 2021 18:15:31 +0100 Subject: [PATCH 2/5] Forgot to add updates to heating and cooling loops --- heating_cooling.ic10 | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/heating_cooling.ic10 b/heating_cooling.ic10 index 409a310..e21bf5d 100644 --- a/heating_cooling.ic10 +++ b/heating_cooling.ic10 @@ -31,9 +31,7 @@ add max_temp max_temp variance # initiate target temperature l target_temp thermostat Setting -# read ambient temp from sensor and convert to C -l curr_temp gas_sensor Temperature -sub curr_temp curr_temp temp_convert +jal temp_read # update display brdns temp_disp 2 @@ -44,14 +42,26 @@ jal display bgt curr_temp max_temp cooling blt curr_temp min_temp heating +sb wall_coolers On cooling_active +sb liquid_wall_coolers On cooling_active +sb wall_heaters On heating_active + j start +temp_read: +l curr_temp gas_sensor Temperature +sub curr_temp curr_temp temp_convert + +j ra + display: s temp_disp Setting curr_temp j ra cooling: +jal temp_read + # test if coolers need to be on or not sgt cooling_active curr_temp target_temp @@ -68,6 +78,8 @@ bgtz cooling_active cooling j start heating: +jal temp_read + # test if heaters need to be on or not slt heating_active curr_temp target_temp From 563c57aa1e614016cb66ebd404719e03b7130c2c Mon Sep 17 00:00:00 2001 From: Snorre Selmer Date: Wed, 10 Nov 2021 18:48:52 +0100 Subject: [PATCH 3/5] Explicitly initiating heating/cooling variables --- heating_cooling.ic10 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/heating_cooling.ic10 b/heating_cooling.ic10 index e21bf5d..c67cb62 100644 --- a/heating_cooling.ic10 +++ b/heating_cooling.ic10 @@ -19,6 +19,9 @@ define wall_coolers -739292323 define liquid_wall_coolers -1369060582 define temp_convert 273.15 +move cooling_active 0 +move heating_active 0 + start: yield # establish min- and max-temps to registry From 2ff9c7a70d2159c4caf63d4e29556027c526b008 Mon Sep 17 00:00:00 2001 From: Snorre Selmer Date: Wed, 10 Nov 2021 18:52:25 +0100 Subject: [PATCH 4/5] ...and let's not forget to yield... --- heating_cooling.ic10 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/heating_cooling.ic10 b/heating_cooling.ic10 index c67cb62..b9ee6f5 100644 --- a/heating_cooling.ic10 +++ b/heating_cooling.ic10 @@ -63,6 +63,7 @@ s temp_disp Setting curr_temp j ra cooling: +yield jal temp_read # test if coolers need to be on or not @@ -81,6 +82,7 @@ bgtz cooling_active cooling j start heating: +yield jal temp_read # test if heaters need to be on or not From 367714cb4f5bacee85da88bb7d00fef4da654356 Mon Sep 17 00:00:00 2001 From: Snorre Selmer Date: Mon, 15 Nov 2021 14:32:10 +0100 Subject: [PATCH 5/5] Updated constants to upper-case --- automated_canister_filling.ic10 | 8 ++++---- cooling_tower_drain.ic10 | 4 ++-- filtration.ic10 | 8 ++++---- gas_mixer.ic10 | 10 +++++----- heating_cooling.ic10 | 30 ++++++++++++------------------ 5 files changed, 27 insertions(+), 33 deletions(-) diff --git a/automated_canister_filling.ic10 b/automated_canister_filling.ic10 index ad13356..690713b 100644 --- a/automated_canister_filling.ic10 +++ b/automated_canister_filling.ic10 @@ -16,8 +16,8 @@ alias gas_to_move r3 alias fill_pressure r4 alias pump_active r5 -define canister 42280099 -define smart_canister -668314371 +define CANISTER 42280099 +define SMART_CANISTER -668314371 start: yield @@ -26,8 +26,8 @@ ls canister_present canister_storage 0 Occupied # identify canister ls canister_hash canister_storage 0 OccupantHash # set safe fill-pressure -beq canister_hash canister regular -beq canister_hash smart_canister smart +beq canister_hash CANISTER regular +beq canister_hash SMART_CANISTER smart regular: move fill_pressure 8000000 # regular can safe max diff --git a/cooling_tower_drain.ic10 b/cooling_tower_drain.ic10 index dcbf496..e8f8ea6 100644 --- a/cooling_tower_drain.ic10 +++ b/cooling_tower_drain.ic10 @@ -11,7 +11,7 @@ alias temp_go r2 alias press_go r3 alias pump_go r4 -define temp_thresh 313 # 39.85C +define TEMP_THRESH 313 # 39.85C # Sets volume pump max capacity l pipe_press pump Maximum @@ -23,7 +23,7 @@ yield l pipe_temp sensor Temperature l pipe_press sensor Pressure # Checks if temp is below threshold -slt temp_go pipe_temp temp_thresh +slt temp_go pipe_temp TEMP_THRESH sgtz press_go pipe_press # If cooling-tower has pressure, and temp is safe.. and pump_go temp_go press_go diff --git a/filtration.ic10 b/filtration.ic10 index b22d324..08dc838 100644 --- a/filtration.ic10 +++ b/filtration.ic10 @@ -23,8 +23,8 @@ alias press_run r6 alias filter_run r7 alias purge_run r8 -define max_press 58000 # 58MPa -define max_temp 313 # 40C +define MAX_PRESS 58000 # 58MPa +define MAX_TEMP 313 # 40C l filter1 purge_pump Maximum # borrow filter1 s purge_pump Setting filter1 # set max throughput @@ -55,8 +55,8 @@ j filter # then start filtering filter: l mud_temp mud_sensor Temperature # get input temp l tank_press tank Pressure # get output pressure -slt temp_run mud_temp max_temp # is temp safe -slt press_run tank_press max_press # is press safe +slt temp_run mud_temp MAX_TEMP # is temp safe +slt press_run tank_press MAX_PRESS # is press safe and filter_run temp_run press_run # temp and press? s filter_unit On filter_run # run filter j start # loop diff --git a/gas_mixer.ic10 b/gas_mixer.ic10 index fdce57c..e0c33df 100644 --- a/gas_mixer.ic10 +++ b/gas_mixer.ic10 @@ -20,9 +20,9 @@ alias mixer_run r6 alias purge_activate r7 # Stops mixing if either input-gas is below 500kPa -define press_in_min 500 +define PRESS_IN_MIN 500 # Stops mixing if output-tank is "full" -define press_out_max 58000 +define PRESS_OUT_MAX 58000 # Sets purge pump to max output l tank_a_press pump Maximum @@ -41,9 +41,9 @@ l tank_b_press tank_b Pressure l tank_out_press tank_out Pressure # Checks if pressures are within tolerances -sgt tank_a_ok tank_a_press press_in_min -sgt tank_b_ok tank_b_press press_in_min -slt tank_out_ok tank_out_press press_out_max +sgt tank_a_ok tank_a_press PRESS_IN_MIN +sgt tank_b_ok tank_b_press PRESS_IN_MIN +slt tank_out_ok tank_out_press PRESS_OUT_MAX and mixer_run tank_a_ok tank_b_ok and mixer_run tank_out_ok mixer_run diff --git a/heating_cooling.ic10 b/heating_cooling.ic10 index b9ee6f5..1709d47 100644 --- a/heating_cooling.ic10 +++ b/heating_cooling.ic10 @@ -14,10 +14,10 @@ alias max_temp r4 alias cooling_active r5 alias heating_active r6 -define wall_heaters 24258244 -define wall_coolers -739292323 -define liquid_wall_coolers -1369060582 -define temp_convert 273.15 +define WALL_HEATERS 24258244 +define WALL_COOLERS -739292323 +define LIQUID_WALL_COOLERS -1369060582 +define TEMP_CONVERT 273.15 move cooling_active 0 move heating_active 0 @@ -31,9 +31,9 @@ sub min_temp min_temp variance l max_temp thermostat Setting add max_temp max_temp variance -# initiate target temperature l target_temp thermostat Setting +# get current temperature jal temp_read # update display @@ -45,21 +45,19 @@ jal display bgt curr_temp max_temp cooling blt curr_temp min_temp heating -sb wall_coolers On cooling_active -sb liquid_wall_coolers On cooling_active -sb wall_heaters On heating_active +sb WALL_COOLERS On cooling_active +sb LIQUID_WALL_COOLERS On cooling_active +sb WALL_HEATERS On heating_active j start temp_read: l curr_temp gas_sensor Temperature -sub curr_temp curr_temp temp_convert - +sub curr_temp curr_temp TEMP_CONVERT j ra display: s temp_disp Setting curr_temp - j ra cooling: @@ -69,16 +67,14 @@ jal temp_read # test if coolers need to be on or not sgt cooling_active curr_temp target_temp -# update display brdns temp_disp 2 jal display # send state to coolers -sb wall_coolers On cooling_active -sb liquid_wall_coolers On cooling_active +sb WALL_COOLERS On cooling_active +sb LIQUID_WALL_COOLERS On cooling_active bgtz cooling_active cooling - j start heating: @@ -88,13 +84,11 @@ jal temp_read # test if heaters need to be on or not slt heating_active curr_temp target_temp -# update display brdns temp_disp 2 jal display # send state to heaters -sb wall_heaters On heating_active +sb WALL_HEATERS On heating_active bgtz heating_active heating - j start \ No newline at end of file