system_integration:hub4_grid_parallel_external_control_loop
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
system_integration:hub4_grid_parallel_external_control_loop [2016-02-03 21:40] – [3.3 Using the MK2 directly instead of CCGX] mvader | system_integration:hub4_grid_parallel_external_control_loop [2019-01-22 10:16] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 5: | Line 5: | ||
Note that it is also possible to run a Victron grid parallel storage system without designing and implementing your own control loop, logic or measurements. See the [[system_integration: | Note that it is also possible to run a Victron grid parallel storage system without designing and implementing your own control loop, logic or measurements. See the [[system_integration: | ||
- | For firmware version requirements, | + | Note that though this page mentions Hub-4, which is deprecated, it also applies to ESS. |
- | + | ||
- | Three/ | + | |
===== 1. Overview of Hub-4 operating modes ===== | ===== 1. Overview of Hub-4 operating modes ===== | ||
==== 1.1 Mode 1 - Standard ==== | ==== 1.1 Mode 1 - Standard ==== | ||
- | Standard \\ The system runs automatically, | + | The system runs automatically, |
- | + | ||
- | Necessary Victron equipment: | + | |
- | - Multi or Quattro inverter/ | + | |
- | - Color Control GX | + | |
- | - AC sensor used for control loop | + | |
- | + | ||
- | For details refer to the [[system_integration: | + | |
==== 1.2 Mode 2 - Advanced ==== | ==== 1.2 Mode 2 - Advanced ==== | ||
- | Same as standard operating mode, but more flexibility is given to implement | + | Same as standard operating mode, but customer adds custom control doing time shifting, load management or other energy management optimization algorithms. |
- | + | ||
- | Necessary Victron equipment: | + | |
- | - Same as mode 1, Standard. | + | |
- | + | ||
- | Available | + | |
* Grid power setpoint | * Grid power setpoint | ||
* Maximum charge percentage | * Maximum charge percentage | ||
* Maximum discharge percentage | * Maximum discharge percentage | ||
+ | |||
+ | There are two ways access those control points: | ||
+ | - Send commands to the CCGX via ModbusTCP, from an external control module, a PLC for example. | ||
+ | - Run self-implemented scripts on the CCGX, same functionality, | ||
+ | |||
+ | For more information, | ||
+ | |||
==== 1.3 Mode 3 - Custom ==== | ==== 1.3 Mode 3 - Custom ==== | ||
Customer self implements their control loop and grid measurements, | Customer self implements their control loop and grid measurements, | ||
Line 46: | Line 39: | ||
* Disable charge flag | * Disable charge flag | ||
* Disable feedback flag | * Disable feedback flag | ||
+ | |||
+ | For more information, | ||
+ | |||
===== 2. Details of operating mode 2 - Advanced ===== | ===== 2. Details of operating mode 2 - Advanced ===== | ||
- | ==== 2.1 Operation | + | ==== 2.1 Available control points |
- | | + | |
- | * D-Bus: com.victronenergy.hub4 / | + | === a) Grid power setpoint |
- | | + | * Positive: take power from grid. |
- | * Maximum | + | * Negative: |
- | * 0%: disable charging. This setting may be used for time shifting. For example by disabling charging the battery when feeding back to the grid is profitable, and leaving battery capacity for later. | + | * Default: 0W. |
- | * 100%: no charge power not limited by CCGX (max charge current on multi still applies). | + | |
- | * >0% and <100%: The maximum allowed AC-In power is\\ '' | + | === b) Max charge current (fractional) - Modbus-TCP register 2701 === |
- | | + | Reduces the charge |
- | * Modbus: Register 2701, unit ID 0 | + | |
- | * Maximum discharge percentage. Can be used to enabled | + | |
- | * D-Bus: com.victronenergy.hub4 / | + | * 100%: unlimited charging. Battery, VEConfigure settings, and BMS permitting. |
- | * Modbus: Register 2702, unit ID 0 | + | * >0% and <100%: The maximum allowed AC-In power is\\ '' |
+ | |||
+ | === c) Enable discharge - Modbus-TCP register 2702 === | ||
+ | Though presented as a percentage, it is really a on/off mechanism. Setting the percentage below 50% will disable discharge. And setting it equal to or above 50% will enable discharge. | ||
+ | |||
+ | See the Modbus-TCP excel sheet for scaling and datatypes, available [[https:// | ||
+ | |||
+ | ==== 2.2 Accessing the control points ==== | ||
+ | |||
+ | === A) Via ModbusTCP === | ||
+ | See above mentioned register numbers. Use ModbusTCP unitid 100. | ||
+ | |||
+ | === B) Via MQTT === | ||
+ | Recently we have added MQTT to the protocols on the CCGX. For more information, | ||
+ | |||
+ | === C) Running your own scriptson the CCGX === | ||
+ | Start reading [[open_source: | ||
+ | |||
+ | The Hub-4 related | ||
+ | * com.victronenergy.hub4 /AcPowerSetpoint | ||
+ | * com.victronenergy.hub4 / | ||
+ | * com.victronenergy.hub4 / | ||
+ | |||
+ | ==== 2.3 Background ==== | ||
+ | In standard mode the Hub-4 control system tries to keep the power flowing through the grid meter at 0 Watt (so no power is taken in from the grid, nor is any power fed back to the grid). Mode 2 means you set the target for the grid power. Setting the target to 100 Watt means that the system tries to take 100 Watt from the grid. The power will be used to feed the loads or charge the battery. | ||
+ | |||
+ | In addition you can also control battery charge and discharge. This allows you to control when the battery is charged and discharged. | ||
+ | |||
+ | ==== 2.4 Notes ==== | ||
- | ==== 2.1 Notes ==== | ||
* The above settings are intended for power management, and will be overridden by battery safety mechanisms. For example: if the multi is in sustain mode - because the battery is almost empty - it will start charging the battery, event if the grid power setpoint is negative or the maximum charge percentage is set to zero. | * The above settings are intended for power management, and will be overridden by battery safety mechanisms. For example: if the multi is in sustain mode - because the battery is almost empty - it will start charging the battery, event if the grid power setpoint is negative or the maximum charge percentage is set to zero. | ||
* Sustain will always remain in operation. Disabling charge will not disable sustain. Note that this was added to the Hub-4 Assistant released in january 2016 (version 154). | * Sustain will always remain in operation. Disabling charge will not disable sustain. Note that this was added to the Hub-4 Assistant released in january 2016 (version 154). | ||
Line 71: | Line 94: | ||
===== 3. Details of operating mode 3 - Custom ===== | ===== 3. Details of operating mode 3 - Custom ===== | ||
==== 3.1 Operation ==== | ==== 3.1 Operation ==== | ||
+ | |||
+ | Mode 3 means you take direct control of the Multi itself by setting the power it should take/feed back on its AC input. It allows for easy control of the power flowing to the battery. The power flowing to the batter (or more precise: to DC system attached to the Multi) is equal to the AC-In power minus the AC-Out power. In mode 3 you have to create your own control loop, and update set setpoint frequently. | ||
+ | |||
* When the grid is available, the Multi will be connected to the grid. You can control its operation with the Power setpoint. When positive, energy will flow to the grid. When negative, energy will be taken from the grid. Some examples: | * When the grid is available, the Multi will be connected to the grid. You can control its operation with the Power setpoint. When positive, energy will flow to the grid. When negative, energy will be taken from the grid. Some examples: | ||
- | * When set to +400W, it will feed 400W back through its input. This energy will be taken from the battery. If there is also a 200W AC load connected to AC output the total energy taken from the batteryt | + | * When set to +400W, it will feed 400W back through its input. This energy will be taken from the battery. If there is also a 200W AC load connected to AC output the total energy taken from the battery |
* When set to -400W, it will take 400W from the AC input. When the load on the output is lower than 400W, it will charge the battery with the difference. When the load on the AC output is higher, it will discharge the battery with the difference. So with a negative setpoint charge/ | * When set to -400W, it will take 400W from the AC input. When the load on the output is lower than 400W, it will charge the battery with the difference. When the load on the AC output is higher, it will discharge the battery with the difference. So with a negative setpoint charge/ | ||
* **Important note**: When using the CCGX to communicate with the HUB-4 assistant (see further on) you should bear in mind that the CCGX inverts the setpoint. So positive becomes negative and vice versa. | * **Important note**: When using the CCGX to communicate with the HUB-4 assistant (see further on) you should bear in mind that the CCGX inverts the setpoint. So positive becomes negative and vice versa. | ||
Line 90: | Line 116: | ||
* Note that the mechanism is slow, which to our opinion is not perfect, but also no problem. | * Note that the mechanism is slow, which to our opinion is not perfect, but also no problem. | ||
* The ' | * The ' | ||
- | * If your system contains a Hub-4 compatible AC-Sensor which is set up as grid meter, the CCGX will automatically enter mode 1 and start updating the AC power setpoint continuously. | + | * If your system contains a Hub-4 compatible AC-Sensor which is set up as grid meter, the CCGX will automatically enter mode 1 and start updating the AC power setpoint continuously. |
==== 3.3 Using the MK2 directly instead of CCGX ==== | ==== 3.3 Using the MK2 directly instead of CCGX ==== | ||
Line 100: | Line 126: | ||
And now, after all the warnings, the information: | And now, after all the warnings, the information: | ||
- | Use RAMID 128 and higher. | + | Use RAM ID 128 and higher. |
- | The assistant RAM will be filled from ID 128 with ‘assistant RAM records’. | + | The assistant RAM will be filled from ID 128 with ‘assistant RAM records’. Each record starts with a word that contains the AssistantID and the size of the record, and then a number of AssistantRAM words. |
- | + | ^ RAM ID ^ contents | |
- | Assistant | + | | 128 | ID_Size (1st Assistant) | |
+ | | 129 | 1st AssistantRAM0 | ||
+ | | 130 | 1st AssistantRAM1 | ||
+ | | ... | ... | | ||
+ | | RAMn | 1st AssistantRAMn | ||
+ | | RAMn+1 | ||
+ | | RAMn+2 | 2nd AssistantRAM0 | ||
+ | | RAMn+3 | ||
+ | | etcetera || | ||
The ID_Size word contains 0xZZZY, where: | The ID_Size word contains 0xZZZY, where: | ||
* ZZZ = the Assistant ID. This is where you can recognize the function of the assistant (HUB4 ID = 3) | * ZZZ = the Assistant ID. This is where you can recognize the function of the assistant (HUB4 ID = 3) | ||
- | * Y = the number of ramIDs that will follow. | + | * Y = the number of ramIDs that will follow |
+ | |||
+ | So you have to scan the Assistant RAM records by looking at each ID_size record. | ||
- | So you have to scan the assistant RAM records, search | + | Search |
- | (Bit0 of RAM1 contains the flag ' | + | * bit0 of AssistantRAM1 |
+ | * bit1 of AssistantRAM1 | ||
Above information is an addendum to the ' | Above information is an addendum to the ' | ||
+ | |||
+ | **EXAMPLE: | ||
+ | |||
+ | **Reading the ID_Size:** | ||
+ | |||
+ | -> 0x05, 0xFF, 0x57, 0x30, 0x80, 0x00*, 0xF5\\ | ||
+ | (Length, 0xFF, ‘W’, 0x30, Lo(ID), Hi(ID), Checksum) | ||
+ | |||
+ | Response: | ||
+ | <- 0x07, 0xFF, 0x57, 0x85, 0x32, 0x00, 0x52, 0x5A, 0x40\\ | ||
+ | (Length, 0xFF, ‘W’, 0x85, Lo(ValueA), Hi(ValueA), Lo(ValueB)*, | ||
+ | |||
+ | ValueA is the contents of RAMID 128. In this example it is 0x0032 which indicates HUB4 with 2 extra RAMIDs. | ||
+ | |||
+ | //*) Please note that you will get an extra ValueB. This is a feature of newer Multi firmware versions. Because the IDs range from 0..255 the Hi(ID) field would always be 0. | ||
+ | Newer Multi firmwares allow you to specify a second ID in this field. So in this case ValueB is the value of RAMID 0 because the 0x00 is interpreted as the second ID. | ||
+ | RAMID 0 corresponds with UMains (This can be found in paragraph 7.3.11 of the ' | ||
+ | NOTE: You will always get a ValueB in the response. You can make handy use of this by reading an extra RAMID or you can ignore it if you don’t need it. | ||
+ | // | ||
+ | |||
+ | **Writing the set point with +200 Watt: | ||
+ | We should write RAM ID 129 to +200.\\ | ||
+ | Writing requires 2 frames, one frame specifying the ID to write and one frame specifying the data to write. | ||
+ | |||
+ | -> 0x05, 0xFF, 0x57, 0x32, 0x81, 0x00, 0xF2\\ | ||
+ | (0x32=Command Write RAMID, 81 00 = 129, Note that 2nd byte will always be 0 in this command) | ||
+ | |||
+ | -> 0x05, 0xFF, 0x57, 0x34, 0xC8, 0x00, 0xA9\\ | ||
+ | (0x34=Command Write Data, C8 00 = 200)\\ | ||
+ | //Note: If a negative set point is needed you should specify this as the 2’s complement value so for example -200W must be specified as 0xFF38 | ||
+ | -> 0x05, 0xFF, 0x57, 0x34, 0x38, 0xFF, 0x3A// | ||
+ | |||
+ | Response:\\ | ||
+ | <- 0x05, 0xFF, 0x57, 0x87, 0x00, 0x00, 0x1E | ||
+ | Write OK (87 means successful. Just ignore the rest of the frame (00,00 in this case)) | ||
+ | |||
+ | Please refer to the ' | ||
+ | |||
+ | |||
===== 4. Combining Hub-4 with Lithium batteries ===== | ===== 4. Combining Hub-4 with Lithium batteries ===== | ||
* Victron Lithium batteries with a VE.Bus BMS: select this in the Hub4 assistant and all will be done automatically. | * Victron Lithium batteries with a VE.Bus BMS: select this in the Hub4 assistant and all will be done automatically. | ||
Line 121: | Line 197: | ||
* As an alternative to running the control loop externally, using ModbusTCP, it is also possible to run code on the CCGX itself and update the AcPowerSetpoint via D-Bus. We have one customer that is running a MQTT client on the CCGX, written in Python, that gets the control-loop output as updates from a MQTT broker. And the Python script sends them to the Multi, using D-Bus service com.victronenergy.vebus.ttyO1, | * As an alternative to running the control loop externally, using ModbusTCP, it is also possible to run code on the CCGX itself and update the AcPowerSetpoint via D-Bus. We have one customer that is running a MQTT client on the CCGX, written in Python, that gets the control-loop output as updates from a MQTT broker. And the Python script sends them to the Multi, using D-Bus service com.victronenergy.vebus.ttyO1, | ||
| | ||
+ | |||
===== DISQUS ===== | ===== DISQUS ===== | ||
~~DISQUS~~ | ~~DISQUS~~ | ||
+ |
system_integration/hub4_grid_parallel_external_control_loop.1454532017.txt.gz · Last modified: 2016-02-03 21:40 by mvader