question

Nicolas Beltran avatar image
Nicolas Beltran asked

Modbus TCP,Multiplus

Hi,

i would like to know what is the parameter to control power (kW) that gave the batteries, using Modbus TCP from CCGX and if can i modify ?

Modbus TCPmodifications
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

2 Answers
cquinones (Victron Energy Staff) avatar image
cquinones (Victron Energy Staff) answered ·

Hola Nicolas,


Como realizar Mod bus TCP

https://www.victronenergy.com/live/ccgx:modbustcp_faq


Libro blanco de comunicaciones página 3

https://www.victronenergy.com/upload/documents/Whitepaper-Data-communication-with-Victron-Energy-products_EN.pdf


Descargarse el mapa de memoria Mod-TCP register list

https://www.victronenergy.com/panel-systems-remote-monitoring/color-control#whitepapers

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

juan manuel tirado avatar image
juan manuel tirado answered ·

Hola. Estoy intentando escribir un script python que me controle el Grid Set Point, para poder variarlo desde una RaspberryPi.

Mi conocimiento de Python es muy bajo, asi que me he guiado por ejemplos que he visto por la red.

El caso es que cuando cargo un valor igual a 0 o superior, (numero entero) no hay problema.

Pero no me deja cargar valores negativos, aunque en el mapa de registros el 2700 (grid set point) aparece como int16 (-32668 a 32668)

La parte que me da problema es esta:


if Fase_carga == 4:

a = 10

client.write_register(2700,a,unit = 100)


Cuando a es negativo me da error:


Traceback (most recent call last):

File "prueba5 individual.py", line 42, in <module>

client.write_register(2700,a,unit = 100)

File "/home/pi/.local/lib/python2.7/site-packages/pymodbus/client/common.py", line 92, in write_register

return self.execute(request)

File "/home/pi/.local/lib/python2.7/site-packages/pymodbus/client/sync.py", line 106, in execute

return self.transaction.execute(request)

File "/home/pi/.local/lib/python2.7/site-packages/pymodbus/transaction.py", line 149, in execute

broadcast=broadcast

File "/home/pi/.local/lib/python2.7/site-packages/pymodbus/transaction.py", line 213, in _transact

packet = self.client.framer.buildPacket(packet)

File "/home/pi/.local/lib/python2.7/site-packages/pymodbus/framer/socket_framer.py", line 206, in buildPacket

data = message.encode()

File "/home/pi/.local/lib/python2.7/site-packages/pymodbus/register_write_message.py", line 42, in encode

packet += struct.pack('>H', self.value)

struct.error: integer out of range for 'H' format code



------------------

(program exited with code: 1)

Press return to continue




2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Related Resources

Modbus TCP Basics

Experiments, Modifications and Adaptions. Mods (Modifications) can be made to Victron Software by the Community. Please use the modifications space for enthusiasts who want to push what is possible, without official Victron Support.