Hello,
I would like to control a "Battery ESS (Generic)" component using Modbus communications over Ethernet from a computer external to the HIL. An example model is already provided (Generic microgrid with multiprotocol gateway) but in this case the CAN protocol is used instead of Modbus.
Using this example as an initial base, I have modified the "Battery ESS (Generic) UI" component that handles CAN communications, deleting all CAN-related configuration and blocks, and adding a Modbus Device for which I create a config in the model initialization file. I intend to keep the same input and output variables that the CAN interface used, keeping the same variable tipes, which are all "uint" as far as I can see.
When I try to validate the model, a number of errors arise related to the "Battery ESS (Generic)" component. Some of those are:
Error occurred in handler 'pre_compile' of component Battery ESS (Generic).Battery DC Link SP1.dynamiccs
→ General error
→ ERROR in 'pre_compile' handler registered on component 'dynamiccs': can't multiply sequence by non-int of type 'float'
Error occurred in handler 'pre_compile' of component Battery ESS (Generic).battery_converter_control.Voltage Droop control1.LPF_V
→ General error
→ ERROR in 'pre_compile' handler registered on component 'LPF_V': can't multiply sequence by non-int of type 'float'
Error occurred in handler 'pre_compile' of component Battery ESS (Generic).battery_converter_control.Frequency Droop control1.LPF_P
→ General error
→ ERROR in 'pre_compile' handler registered on component 'LPF_P': can't multiply sequence by non-int of type 'float'
I guess that I am doing something wrong and that the Battery ESS (Generic) component is receiving some float variables, which shouldn't be floats.
Any guidance on how to resolve this issue or any model example where this component is linked with a Modbus interface would be greatly appreciated.
Best regards,
Edit: After further testing, I realized that the baseline CAN interface uses 8 bits for the uint registers, and I can't find a way to use 8-bit registers in Modbus in the Modbus Device documentation. Could the errors be related to this?
Edit-v2: I have uploaded the problematic model to a Google Drive, here: https://drive.google.com/file/d/1bSzvuzA0W2eujwhUGY3COjv7p3GTUtDO/view?usp=drive_link