- Reorganized project: codesys/, docs/codesys|redesign|integration|reference/, scripts/ - CODESYS project and exports in codesys/ - Documentation index in docs/README.md - Redesign and light naming configuration - Water boiler control and safety design Co-authored-by: Cursor <cursoragent@cursor.com>
190 lines
5.9 KiB
Markdown
190 lines
5.9 KiB
Markdown
# CODESYS Project Analysis
|
|
|
|
## Overview
|
|
|
|
This document contains information extracted from the CODESYS project export file (`Home_Automation.export`).
|
|
|
|
## Device Information
|
|
|
|
- **Device Name**: `codesys-home`
|
|
- **CODESYS Version**: 4.15.0.0
|
|
- **Platform**: CODESYS Control for Raspberry Pi MC SL
|
|
- **SDK Version**: 3.5.21.0
|
|
- **Order Number**: 2302000009
|
|
|
|
## Hardware Configuration
|
|
|
|
### EtherCAT Network
|
|
|
|
- **EtherCAT Master**: Version 4.9.0.0
|
|
- **EtherCAT Task**: `EtherCAT_Task`
|
|
|
|
### EtherCAT Devices
|
|
|
|
1. **EK1100** - EtherCAT Coupler (2A E-Bus)
|
|
- Vendor: Beckhoff Automation GmbH & Co. KG
|
|
- Order Number: EK1100
|
|
- Function: EtherCAT coupler connecting to E-Bus modules
|
|
|
|
2. **EL1809** - 16Ch. Digital Input 24V, 3ms
|
|
- Vendor: Beckhoff Automation GmbH & Co. KG
|
|
- Order Number: EL1809
|
|
- Function: 16-channel digital input module
|
|
- Channels: 16 digital inputs (Channels 1-16)
|
|
|
|
3. **Output Module** (Likely EL2004 or similar)
|
|
- 16 output channels configured
|
|
- Channel addresses: 16#1A00 through 16#1A0F (Channels 1-16)
|
|
|
|
## Network Variables
|
|
|
|
CODESYS communicates with Node-RED using UDP-based network variables.
|
|
|
|
### Variables Sent to Node-RED (NVL_Sender)
|
|
|
|
**List Identifier**: 1
|
|
**Protocol**: UDP
|
|
**Task**: EtherCAT_Task
|
|
**Transmission**: Cyclic
|
|
**Interval**: T#50ms
|
|
**Minimum Gap**: T#20ms
|
|
|
|
**Structure**: `struct_lights` containing light states for each room:
|
|
|
|
| Variable Name | Type | Description |
|
|
|--------------|------|-------------|
|
|
| `l_masterBedroom` | struct_lights | Master bedroom lights |
|
|
| `l_masterBathroom` | struct_lights | Master bathroom lights |
|
|
| `l_bedroom_1` | struct_lights | Bedroom 1 lights |
|
|
| `l_bedroom_2` | struct_lights | Bedroom 2 lights |
|
|
| `l_bathroom` | struct_lights | Bathroom lights |
|
|
| `l_hallway` | struct_lights | Hallway lights |
|
|
| `l_pantry` | struct_lights | Pantry lights |
|
|
| `l_kitchen` | struct_lights | Kitchen lights |
|
|
| `l_livingRoom` | struct_lights | Living room lights |
|
|
| `l_dinningRoom` | struct_lights | Dining room lights |
|
|
| `l_entrance` | struct_lights | Entrance lights |
|
|
| `l_guestWc` | struct_lights | Guest WC lights |
|
|
| `l_outVeranda` | struct_lights | Outdoor veranda lights |
|
|
| `l_outFront` | struct_lights | Outdoor front lights |
|
|
| `l_outSide` | struct_lights | Outdoor side lights |
|
|
| `l_outBack` | struct_lights | Outdoor back lights |
|
|
|
|
### Variables Received from Node-RED (NVL_Receiver)
|
|
|
|
**List Identifier**: 3
|
|
**Protocol**: UDP
|
|
**Task**: EtherCAT_Task
|
|
**Transmission**: Cyclic
|
|
**Interval**: T#50ms
|
|
**Minimum Gap**: T#20ms
|
|
**Import File**: `C:\Users\NearchosParaskeva\OneDrive - individual\Codesys_Home_Automation\NVL_Receiver.gvl`
|
|
|
|
**Structure**: `struct_switches` containing switch states for each room:
|
|
|
|
| Variable Name | Type | Description |
|
|
|--------------|------|-------------|
|
|
| `masterBedroom` | struct_switches | Master bedroom switches |
|
|
| `masterBathroom` | struct_switches | Master bathroom switches |
|
|
| `bedroom_1` | struct_switches | Bedroom 1 switches |
|
|
| `bedroom_2` | struct_switches | Bedroom 2 switches |
|
|
| `bathroom` | struct_switches | Bathroom switches |
|
|
| `hallway` | struct_switches | Hallway switches |
|
|
| `pantry` | struct_switches | Pantry switches |
|
|
| `kitchen` | struct_switches | Kitchen switches |
|
|
| `livingRoom` | struct_switches | Living room switches |
|
|
| `dinningRoom` | struct_switches | Dining room switches |
|
|
| `entrance` | struct_switches | Entrance switches |
|
|
| `guestWc` | struct_switches | Guest WC switches |
|
|
| `outVeranda` | struct_switches | Outdoor veranda switches |
|
|
| `outFront` | struct_switches | Outdoor front switches |
|
|
| `outSide` | struct_switches | Outdoor side switches |
|
|
| `outBack` | struct_switches | Outdoor back switches |
|
|
|
|
## Program Structure
|
|
|
|
### Main Program (PLC_PRG)
|
|
|
|
- **Type**: Program
|
|
- **Language**: Structured Text (ST)
|
|
- **Function Blocks Used**: `fb_switch`
|
|
- **Instances**:
|
|
- `masterBedroom: fb_switch`
|
|
|
|
### Function Blocks
|
|
|
|
- **fb_toogleButton**: Toggle button function block
|
|
- **fb_switch**: Switch control function block
|
|
|
|
### Variables Used in Logic
|
|
|
|
From the program code, the following variables are referenced:
|
|
- `lights.l_1`, `lights.l_2`, `lights.l_3`, `lights.l_4`, `lights.l_5`, `lights.l_6`
|
|
- `switches.sw_1`, `switches.sw_2`, `switches.sw_3`, `switches.sw_4`, `switches.sw_5`, `switches.sw_6`
|
|
- `switches.all_off`
|
|
- `switches.all_on`
|
|
|
|
## Room Configuration
|
|
|
|
The system controls lighting for 15 rooms/areas:
|
|
|
|
1. Master Bedroom
|
|
2. Master Bathroom
|
|
3. Bedroom 1
|
|
4. Bedroom 2
|
|
5. Bathroom
|
|
6. Hallway
|
|
7. Pantry
|
|
8. Kitchen
|
|
9. Living Room
|
|
10. Dining Room
|
|
11. Entrance
|
|
12. Guest WC
|
|
13. Outdoor Veranda
|
|
14. Outdoor Front
|
|
15. Outdoor Side
|
|
16. Outdoor Back
|
|
|
|
## I/O Mapping
|
|
|
|
### Inputs (EL1809)
|
|
- 16 digital input channels
|
|
- Likely used for local switch inputs or status feedback
|
|
|
|
### Outputs (16 channels, likely EL2004)
|
|
- 16 digital output channels (16#1A00 - 16#1A0F)
|
|
- Used to control relay outputs for lighting
|
|
|
|
**Note**: The exact mapping between relay outputs and rooms needs to be determined from the program logic or wiring documentation.
|
|
|
|
## Libraries Used
|
|
|
|
- **IoStandard** (System)
|
|
- **SM3_Basic** (3S - Smart Software Solutions GmbH)
|
|
- **SM3_CNC** (3S - Smart Software Solutions GmbH)
|
|
- **3SLicense** (CODESYS)
|
|
- **SM3_CamBuilder** (CODESYS)
|
|
- **SM3_Robotics** (CODESYS)
|
|
- **SM3_Robotics_Visu** (CODESYS)
|
|
- **SM3_Transformation** (CODESYS)
|
|
- **Standard** (System)
|
|
- **CmpLog** (System)
|
|
|
|
## Task Configuration
|
|
|
|
- **EtherCAT Task**: Used for EtherCAT communication and network variable updates
|
|
- **Update Rate**: 50ms (cyclic transmission)
|
|
|
|
## Notes
|
|
|
|
- The project uses structured data types (`struct_lights`, `struct_switches`) for organizing room data
|
|
- Network variables are packed and transmitted via UDP
|
|
- The system appears to support both indoor and outdoor lighting control
|
|
- Water boiler control mentioned in documentation was not found in the export - may be in a separate module or not yet implemented
|
|
|
|
---
|
|
|
|
**Analysis Date**: January 27, 2026
|
|
**Source File**: `Home_Automation.export`
|
|
**Export Format**: CODESYS XML
|