Refine PLC algorithm documentation for lighting control and EtherCAT integration

- Updated the output structure for `struct_room_outs` to focus solely on light states, removing unnecessary status feedback fields.
- Simplified the control logic for lights 1 to 6, aligning with the new design approach for Option C.
- Added detailed instructions for declaring `EtherCAT_RelayFeedback` and `EtherCAT_Outputs` in the Global Variable List, enhancing clarity for integration with the EL2809 module.

This update improves the documentation's accuracy and usability for developers working on the home automation system.
This commit is contained in:
2026-02-08 00:47:57 +02:00
parent 63b343f139
commit 6ef31cd12a
14 changed files with 873 additions and 80 deletions

View File

@@ -0,0 +1,27 @@
(*
GVL: GVL_IO
Option C relay feedback only. EL2809 DO: map channels directly in the device tree
to NVL_Out (e.g. NVL_Out.l_masterBedroom.l_1..l_6, ...) and boiler relay.
Initialize EtherCAT_RelayFeedback to zero at startup (or use default init).
*)
VAR_GLOBAL
// ---------- Option C: relay feedback (copy of output for next cycle) ----------
EtherCAT_RelayFeedback: STRUCT
masterBedroom: struct_room_outs;
masterBathroom: struct_room_outs;
bedroom_1: struct_room_outs;
bedroom_2: struct_room_outs;
bathroom: struct_room_outs;
guest_wc: struct_room_outs;
kitchen: struct_room_outs;
pantry: struct_room_outs;
livingRoom: struct_room_outs;
diningRoom: struct_room_outs;
entrance: struct_room_outs;
hallway: struct_room_outs;
veranda: struct_room_outs;
front: struct_room_outs;
back: struct_room_outs;
side: struct_room_outs;
END_STRUCT;
END_VAR

View File

@@ -0,0 +1,48 @@
(*
GVL: NVL stubs (or replace by CODESYS Network Variable lists NVL_In / NVL_Out).
In the real project, bind these to your UDP/network variable sender/receiver.
DI_Emergency_Stop: link to physical input or leave FALSE.
*)
VAR_GLOBAL
NVL_In: STRUCT
masterBedroom: struct_room_cmds;
masterBathroom: struct_room_cmds;
bedroom_1: struct_room_cmds;
bedroom_2: struct_room_cmds;
bathroom: struct_room_cmds;
guestWc: struct_room_cmds;
kitchen: struct_room_cmds;
pantry: struct_room_cmds;
livingRoom: struct_room_cmds;
dinningRoom: struct_room_cmds;
entrance: struct_room_cmds;
hallway: struct_room_cmds;
outVeranda: struct_room_cmds;
outFront: struct_room_cmds;
outBack: struct_room_cmds;
outSide: struct_room_cmds;
boiler: struct_boiler_cmd;
END_STRUCT;
NVL_Out: STRUCT
l_masterBedroom: struct_room_outs;
l_masterBathroom: struct_room_outs;
l_bedroom_1: struct_room_outs;
l_bedroom_2: struct_room_outs;
l_bathroom: struct_room_outs;
l_guestWc: struct_room_outs;
l_kitchen: struct_room_outs;
l_pantry: struct_room_outs;
l_livingRoom: struct_room_outs;
l_dinningRoom: struct_room_outs;
l_entrance: struct_room_outs;
l_hallway: struct_room_outs;
l_outVeranda: struct_room_outs;
l_outFront: struct_room_outs;
l_outBack: struct_room_outs;
l_outSide: struct_room_outs;
boiler_status: struct_boiler_status;
END_STRUCT;
DI_Emergency_Stop: BOOL := FALSE;
END_VAR