PLC application sources (NVL, rooms, boiler), HA/Node-RED integration guide, and NVL patch utilities. Co-authored-by: Cursor <cursoragent@cursor.com>
34 lines
1.2 KiB
Smalltalk
34 lines
1.2 KiB
Smalltalk
(* === DECLARATION === *)
|
|
(* Water heater — fb_boiler; coil mapped to NVL_Sender.boiler_status.relay_output (%QX5.4). *)
|
|
PROGRAM Boiler_PRG
|
|
VAR
|
|
heater : fb_boiler;
|
|
max_on_minutes : INT;
|
|
max_on_time : TIME;
|
|
END_VAR
|
|
|
|
(* === IMPLEMENTATION === *)
|
|
max_on_minutes := NVL_Receiver.boiler_cmd.max_on_time_minutes;
|
|
IF max_on_minutes <= 0 THEN
|
|
max_on_minutes := 480;
|
|
END_IF;
|
|
max_on_time := T#1M * max_on_minutes;
|
|
|
|
heater(
|
|
ha_on := NVL_Receiver.boiler_cmd.ha_on,
|
|
ha_off := NVL_Receiver.boiler_cmd.ha_off,
|
|
schedule_on := NVL_Receiver.boiler_cmd.schedule_on,
|
|
schedule_off := NVL_Receiver.boiler_cmd.schedule_off,
|
|
emergency_stop := NVL_Receiver.boiler_cmd.emergency_stop,
|
|
max_on_time := max_on_time
|
|
);
|
|
|
|
NVL_Sender.boiler_status.state := heater.state;
|
|
NVL_Sender.boiler_status.relay_output := heater.relay_control;
|
|
NVL_Sender.boiler_status.on_time_minutes := DINT_TO_INT(heater.on_time_seconds / 60);
|
|
NVL_Sender.boiler_status.remaining_minutes := DINT_TO_INT(heater.remaining_seconds / 60);
|
|
NVL_Sender.boiler_status.emergency_active := heater.emergency_active;
|
|
NVL_Sender.boiler_status.time_limit_reached := heater.time_limit_reached;
|
|
NVL_Sender.boiler_status.error_state := heater.error_state;
|
|
NVL_Sender.boiler_status.error_code := heater.error_code;
|