deanhiller / databus

time series data in cassandra with visualization(NREL's opensource databus project)
Other
53 stars 21 forks source link

modbus client doesn't start #11

Closed hopcroft closed 11 years ago

hopcroft commented 11 years ago

Can't start the modbus client. Log file:

hopcroft@capacitance2:~/modbus/logs$ tail -f logback.log 
2013-06-28 15:39:17,899 [-] [pool-3-thread-1] g.n.m.ModBusClient run
WARN: Exception
java.lang.ArrayIndexOutOfBoundsException: 1
    at gov.nrel.modbusclient.ModBusClient.poll(ModBusClient.java:326) ~[modbus.jar:na]
    at gov.nrel.modbusclient.ModBusClient$1.run(ModBusClient.java:188) ~[modbus.jar:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) [na:1.6.0_27]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.6.0_27]
    at java.lang.Thread.run(Thread.java:679) [na:1.6.0_27]
2013-06-28 15:39:18,894 [-] [main] g.n.m.ModBusClient main
INFO: exiting

My meters.csv file:

Serial Number,Model,Description,Building,Phenomena,Zone,IP,Slave
pa.b2.elec:2DL1-1209.freq.pv,PM820,Panel 1209 (1209 [208V]) Frequency,2L,Electricity,,16.94.16.42,Slave 4
pa.b2.elec:2DL1-1209.real-pwr-tot.pv,PM820,Panel 1209 (1209 [208V]) Real Power Phase Total,2L,Electricity,,16.94.16.42,Slave 4

The first entry in my meterModel.json file (just for an example):

"PM820": {
        "3phaseRealPower":{
            "type":"direct",
            "registers":[
            {
                "register":1143,
                "type":"TWO_BYTE_INT_SIGNED",
                "modifier":10.0
            }]
        },

The ModBusClient.poperties file:

databus-url=https://localhost:9000
# The database is the database you plan to have the modbus tables in
database=Database1
# The user with write access to the database specified above this line
user=robot-modbus1
# The password for the user for authentication
#key=941RCGA.B2.1JGZZ11OZOCEZ
key=3C8OH9NOK0.CAPACITANCE2.18K10W4Y5XQJI

thread-pool-size=10
#the poll time of each device
estimated-poll-time=60000
# set to 0 for infinite loop
number-of-iterations=0

#Unused properties, leave commented out unless you know what you are doing
#deviceTable=modbusstreamMeta
#streamTable=modbusdeviceMeta
DATABUS_HOST_URL=http://localhost:9000/
modName=modRaw
hopcroft commented 11 years ago

Further modbus questions:

deanhiller commented 11 years ago

I am working on custom chart fixes for phil to wire up the dashboard this morning and will look at this modbus issue this afternoon. We already have other customers with the same exact needs for the dashboard fixes so it became highest priority and performance is being worked right after that now.

deanhiller commented 11 years ago

ok, there are two issues here.

  1. we didn't have a default for the port before and required /
  2. the csv file ip address PREVIOUS to my fix must be of the format / so your csv is missing / on each line as we do not know the port numbers of your modbus device.

NOTE: I have committed a change allowing either or / and we default the port to 502. If your device is not listening on port 502, you can configure it to a different port. For some reason our devices here listen on a bunch of different ports.

thanks, Dean

hopcroft commented 11 years ago

Some progress, but still not there:

1) I had the wrong user key in the .properties file. But when I change the key in the file and re-start the modbus client, it does not seem to take the change, and the old key appears in the log file. Same for the modbus.csv file. Are the conf/* files cached somewhere?

2) The Serial Number appears to be used as the name of a new Table in the Database. This implies that the unique identifier (Serial Number) must follow the rules for a Table name, i.e. only alphanumeric. Is it possible to add some punctuation besides "_"? (we have a set of names which use "." and "-")

hopcroft commented 11 years ago

ok, got up to get a coffee, came back, tried again, and it took the new configuration values. It still doesn't work, but it looks like a worse error in the log. I'll open a new ticket. Thanks