Industrielle styresystemer - Wiki
To set up CDPStudio as an MQTT Broker, the MQTTBroker module must be added to the program.
Then, after opening the module and navigating to the table editor, the "ListenAddress" and "ListenPort" properties must be set. The IP should be set to the IPv4 address of the Ethernet Adapter that is used to connect to the PLC, while the port should be set to 1884. The IPv4 address can be found by opening the windows command window and typing the command "ipconfig".
Here, the IPv4 address is 158.37.139.100 which is what will be used.
Now the MQTTBroker setup is finished.
To publish and subscribe, we also need a client. The MQTTClient module must be added to the program. Then, in the table editor, the properties "BrokerHost" and "BrokerPort" must be set to the MQTTBroker's properties.
To add a publisher or subscriber, the modules "PublishTopic<datatype>" and "SubscriberTopic<datatype>" must be added to the MQTTClient. These modules are only found when the MQTTClient is selected, and can be found under the submenus "PublishTopic" and "SubscribeTopic":
After adding either, the topic must be set.
Topic | Datatype | Typical Values | Publisher | Description |
---|---|---|---|---|
/status | bool | 1 | PLC | Should be published at the start of every update so CDP can detect loss of connection. Value should always be 1. |
Topic | Datatype | Typical Values | Publisher | Description |
---|---|---|---|---|
/settings/system/flowtime | float | 600-1320 | CDPStudio | How long the keep the system in flow state in hours. |
/settings/system/ebbtime | float | 60-240 | CDPStudio | How long the keep the system in ebb state inhours. |
/settings/system/flowtime | float | 600-1320 | CDPStudio | How long the keep the system in flow state in hours. |
/settings/system/ebbtime | float | 60-240 | CDPStudio | How long the keep the system in ebb state inhours. |
/settings/ebbflow/auto | bool | 1 or 0 | CDPStudio | Whether ebb and flow is controlled automatically (1) or manually (0) |
/settings/ph/target | float | 5.8-6.0 | CDPStudio | Target PH value |
/settings/ph/max | float | 6.0-6.2 | CDPStudio | Maximum allowed PH value before system regulates |
/settings/ph/min | float | 5.6-5.8 | CDPStudio | Minimum allowed PH value before system regulates |
/settings/ph/auto | bool | 0 or 1 | CDPStudio | Whether PH is controlled automatically (1) or manually (0) |
/settings/ec/target | float | 11-12 | CDPStudio | Target EC value |
/settings/ec/max | float | 12-12.5 | CDPStudio | Maximum allowed EC value before system regulates |
/settings/ec/min | float | 11.5-12 | CDPStudio | Minimum allowed EC value before system regulates |
/settings/ec/auto | bool | 0 or 1 | CDPStudio | Whether EC is controlled automatically (1) or manually (0) |
/settings/air/temp/target | float | 20.5-21.5 | CDPStudio | Target air temperature |
/settings/air/temp/max | float | 21.5-22 | CDPStudio | Maximum allowed air temperature system regulates |
/settings/air/temp/min | float | 20-20.5 | CDPStudio | Minimum allowed air temperature before system regulates |
/settings/air/temp/auto | bool | 0 or 1 | CDPStudio | Whether air temperature is controlled automatically (1) or manually (0) |
/settings/air/humidity/target | float | 65-75 | CDPStudio | Target humidity% |
/settings/air/humidity/max | float | 75-80 | CDPStudio | Maximum allowed humidity% before system regulates |
/settings/air/humidity/min | float | 60-65 | CDPStudio | Minimum allowed humidity% before system regulates |
/settings/air/humidity/auto | bool | 0 or 1 | CDPStudio | Whether EC is controlled automatically (1) or manually (0) |
/settings/air/co2/target | float | 1000-2000 | CDPStudio | Target CO2 ppm |
/settings/air/co2/max | float | 2500-3000 | CDPStudio | Maximum allowed CO2 ppm before system regulates |
/settings/air/co2/min | float | 500-1000 | CDPStudio | Minimum allowed CO2 ppm before system regulates |
/settings/air/co2/auto | bool | 0-1 | CDPStudio | Whether air co2 ppm is controlled automatically (1) or manually (0) |
/settings/light/light1/timeon | string | 960-1320 | CDPStudio | How long to keep light 1 on. Convert to time in CODESYS with STRING_TO_TIME() |
/settings/light/light1/timeoff | string | 120-480 | CDPStudio | How long to keep light 1 off. Convert to time in CODESYS with STRING_TO_TIME() |
/settings/light/light1/timeon | string | 960-1320 | CDPStudio | How long to keep light 2 on. Convert to time in CODESYS with STRING_TO_TIME() |
/settings/light/light1/timeoff | string | 120-480 | CDPStudio | How long to keep light 2 off. Convert to time in CODESYS with STRING_TO_TIME() |
/settings/light/auto | bool | 0 or 1 | CDPStudio | Whether lights are controlled automatically (1) or manually (0) |
/settings/valve/exercise/state | bool | 0 or 1 | CDPStudio | Whether valves should be exercised to avoid debris buildup and relubricate (1) or not (0) |
/settings/valve/exercise/time | float | 0 or 1 | CDPStudio | Time interval of how often to exercise the valves given in hours |
Topic | Datatype | Typical Range | Publisher | Description |
---|---|---|---|---|
/override/valve/tank1/ebb | int | 0, 1, 2 | CDPStudio | Overrides the tank 1 drain/ebb valve. 0 = Off, 1 = On, 2 = Auto. |
/override/valve/tank1/flow | int | 0, 1, 2 | CDPStudio | Overrides the tank 1 fill/flow valve. 0 = Off, 1 = On, 2 = Auto. |
/override/valve/tank2/ebb | int | 0, 1, 2 | CDPStudio | Overrides the tank 2 drain/ebb valve. 0 = Off, 1 = On, 2 = Auto. |
/override/valve/tank2/flow | int | 0, 1, 2 | CDPStudio | Overrides the tank 1 fill/flow valve. 0 = Off, 1 = On, 2 = Auto. |
/override/valve/threeway | int | 0, 1, 2 | CDPStudio | Overrides the three-way valve. 0 = Off, 1 = On, 2 = Auto. |
/override/light1 | int | 0, 1, 2 | CDPStudio | Overrides the light 1. 0 = Off, 1 = On, 2 = Auto. |
/override/light1 | int | 0, 1, 2 | CDPStudio | Overrides the light 2. 0 = Off, 1 = On, 2 = Auto. |
/override/tank1/startebb | bool | 0, 1 | CDPStudio | Sends a pulse to initiate the ebb process for tank 1 |
/override/tank1/startflow | bool | 0, 1 | CDPStudio | Sends a pulse to initiate the flow process for tank 1 |
/override/tank2/startebb | bool | 0, 1 | CDPStudio | Sends a pulse to initiate the ebb process for tank 2 |
/override/tank2/startflow | bool | 0, 1 | CDPStudio | Sends a pulse to initiate the flow process for tank 2 |
/override/startprocess | bool | 0, 1 | CDPStudio | Sets the process state. Should not be a pulse. |
/override/pump | int | 0, 1, 2 | CDPStudio | Overrides the pump. 0 = Off, 1 = On, 2 = Auto. |
Topic | Datatype | Typical Range | Publisher | Description |
---|---|---|---|---|
/sensor/water/ec | float | 0-30 | PLC | Water EC measurement. |
/sensor/water/ph | float | 5-7 | PLC | Water PH measurement. |
/sensor/water/temp | float | 10-40 | PLC | Water temperature measurement. |
/sensor/air/temp | float | ? | PLC | Air temperature measurement. |
/sensor/air/humidity | float | ? | PLC | Air humidity measurement. |
/sensor/air/co2 | float | ? | PLC | Air CO2 measurement. |
Topic | Datatype | Typical Range | Publisher | Description |
---|---|---|---|---|
'/state/valve/tank1/ebb' | bool | 0, 1, 2 | PLC | Tank 1 drain/ebb valve state. 0 = auto, 1 = off, 2 = on |
'/state/valve/tank2/ebb' | bool | 0, 1, 2 | PLC | Tank2 drain/ebb valve state. 0 = auto, 1 = off, 2 = on |
'/state/valve/tank1/flow' | bool | 0, 1, 2 | PLC | Tank1 fill/flow valve state. 0 = auto, 1 = off, 2 = on |
'/state/valve/tank2/flow' | bool | 0, 1, 2 | PLC | Tank2 fill/flow valve state. 0 = auto, 1 = off, 2 = on |
'/state/valve/threeway' | bool | 0, 1, 2 | PLC | Three-way valve state. 0 = auto, 1 = to reservoir (stirring), 2 = to tank1/2 |
'/state/pump' | bool | 0, 1, 2 | PLC | Pump state. 0 = auto, 1 = off, 2 = on |
Topic | Datatype | Typical Range | Publisher | Description |
---|---|---|---|---|
/system/light1/state | bool | 0, 1 | PLC | Light state, 0 = off, 1 = on. |
/system/light2/state | bool | 0, 1 | PLC | Light state. 0 = off, 1 = on |
/system/light1/timeRemaining | float | 0-24 | PLC | Time until light 1 toggles on or off, given in hours. |
/system/light2/timeRemaining | float | 0-24 | PLC | Time until light 2 toggles on or off, given in hours. |
/system/tank1/state | bool | 0, 1 | PLC | Tank 1 current state. 0 = ebb, 1 = flow |
/system/tank2/state | bool | 0, 1 | PLC | Tank 2 current state. 0 = ebb, 1 = flow |
/system/tank1/timeRemaining | float | 0-24 | PLC | Time remaining of tank 1 state. Given in hours. |
/system/tank2/timeRemaining | float | 0-24 | PLC | Time remaining of tank 2 state. Given in hours. |