Dear customer,
I think you want to use powerscene as modbus server.
PowerScene driver(communication , device ) app works as a client not a slave(server). so if you want to use modbus slave(server), you should use PowerScene data exchange.
Here is data exchage manual page(Link).
And also i attach sample project for modbus server.
Please refer attached file. Project id is 1 and password is 1.
Thanks
-------------------------------------------------------------
Dear Anygate,
I have created a simple modbus test case that does not seem to work correctly.
In Data Explorer:
- Communication: create testCommuniction Set Protocol Type to ModBus TCP, set Pro. Comm. Type to TCP/IP Server, set Pri. Address to localhost or 127.0.0.1, set Pri. Port to 502, select Driver Use.
- Device: Crate a testDevice, with the communcation set to the testCommunication. Set the device address to a unique int. Set polling intervals to 1000ms.
- Station: Create a testStation with an analogPoint called testAnalogPoint. Set the type to UInt8 ( I also tried float32, UInt16). Under Telemetry/Alarm, set address=1, Object: Input Register.
- In Calculation formula, create a simple script to increment this point by 1 every 1 second.
Run the scada server/HMI.
In python, use a lightly modified script based on an example script provided by pyModbusTCP (See below). Run the script on the same PC as Power Scene.
The script outputs "MBAP checking error"
It shows that it transmitted the following MBAP: C6 28 00 00 00 06 95. Note the transaction ID = C6 28
The response from PowerScene is: 00 01 00 00 00 06 95. Note the transaction ID is 00 01.
The transaction IDs should match in the reply from the server.
If you put this line in a loop `regs_l = c.read_input_registers(0,2)`, it can be seen that Power Scene is incrementing the transaction ID by 1 for each request sent to the server, regardless of the transaction ID in the query. I do not believe this is compliant with the MobBusTCP specifications.
Please let me know if I have configured something incorrectly.
Thank you,
RPE
==== Sample Script ====
import time
from pyModbusTCP.client import ModbusClient
ip = 'localhost'
port = 502
deviceID = {yourDeviceID}
timeout = 5
debug = True
# init modbus client
c = ModbusClient(ip, port, deviceID, timeout, debug)
c.open()
# read registers
regs_l = c.read_input_registers(0,2)
# if success display registers
if regs_l:
print('reg ad #0 to 9: %s' % regs_l)
else:
print('unable to read registers')
c.close()