vapor-ware / synse-modbus-ip-plugin Goto Github PK
View Code? Open in Web Editor NEWModbus over TCP/IP plugin for Synse
License: GNU General Public License v3.0
Modbus over TCP/IP plugin for Synse
License: GNU General Public License v3.0
The carousel operates via Modbus over IP, so we need to create a plugin to allow for portal control via Synse Server.
this plugin was updated to use sdk1.0, but keeps feature parity with how it was implemented beforehand (e.g. hardcoded single device)
once things are verified working with sdk1.0 and a release is created for it, work can be done on this plugin to make it more generalized.
Most of the time we read a percentage between 0 and 100. Sometimes we get readings that look like they are off by a factor of 10. It only seems to happen on this register. This is happening on both sides. This could be:
We just need to figure it out.
Sample out of bounds readings. See the value field:
East Liberty:
[2020-03-02 16:25:35,084] site_tests:49 (ERROR) - --- FAIL: Read pCOWeb HRF Speed Command ---
[2020-03-02 16:25:35,084] site_tests:51 (ERROR) - scan_device: {'id': '3675d174-bb14-5ec6-92c4-606efb48655c', 'alias': '', 'info': 'HRF Speed Command', 'type': 'fan', 'plugin': '59aa69eb-a5da-569f-aaa4-3ebbdb72530b', 'tags': ['autofan/device', 'system/id:3675d174-bb14-5ec6-92c4-606efb48655c', 'system/type:fan'], 'metadata': {'model': 'pCOWeb'}}
[2020-03-02 16:25:35,084] site_tests:53 (ERROR) - reading: [{'device': '3675d174-bb14-5ec6-92c4-606efb48655c', 'timestamp': '2020-03-02T21:23:54Z', 'type': 'percentage', 'device_type': 'fan', 'unit': {'name': 'percent', 'symbol': '%'}, 'value': 300, 'context': {'model': 'pCOWeb'}}]
[2020-03-02 16:49:56,233] site_tests:49 (ERROR) - --- FAIL: Read pCOWeb HRF Speed Command ---
[2020-03-02 16:49:56,233] site_tests:51 (ERROR) - scan_device: {'id': '3675d174-bb14-5ec6-92c4-606efb48655c', 'alias': '', 'info': 'HRF Speed Command', 'type': 'fan', 'plugin': '59aa69eb-a5da-569f-aaa4-3ebbdb72530b', 'tags': ['autofan/device', 'system/id:3675d174-bb14-5ec6-92c4-606efb48655c', 'system/type:fan'], 'metadata': {'model': 'pCOWeb'}}
[2020-03-02 16:49:56,233] site_tests:53 (ERROR) - reading: [{'device': '3675d174-bb14-5ec6-92c4-606efb48655c', 'timestamp': '2020-03-02T21:48:13Z', 'type': 'percentage', 'device_type': 'fan', 'unit': {'name': 'percent', 'symbol': '%'}, 'value': 300, 'context': {'model': 'pCOWeb'}}]
[2020-03-02 16:49:56,233] site_tests:55 (ERROR) - data: ['reading[value] out of range']
[2020-03-02 16:52:15,983] site_tests:49 (ERROR) - --- FAIL: Read pCOWeb HRF Speed Command ---
[2020-03-02 16:52:15,983] site_tests:51 (ERROR) - scan_device: {'id': '3675d174-bb14-5ec6-92c4-606efb48655c', 'alias': '', 'info': 'HRF Speed Command', 'type': 'fan', 'plugin': '59aa69eb-a5da-569f-aaa4-3ebbdb72530b', 'tags': ['autofan/device', 'system/id:3675d174-bb14-5ec6-92c4-606efb48655c', 'system/type:fan'], 'metadata': {'model': 'pCOWeb'}}
[2020-03-02 16:52:15,983] site_tests:53 (ERROR) - reading: [{'device': '3675d174-bb14-5ec6-92c4-606efb48655c', 'timestamp': '2020-03-02T21:50:33Z', 'type': 'percentage', 'device_type': 'fan', 'unit': {'name': 'percent', 'symbol': '%'}, 'value': 300, 'context': {'model': 'pCOWeb'}}]
[2020-03-02 16:52:15,983] site_tests:55 (ERROR) - data: ['reading[value] out of range']
Crane:
[2020-03-02 17:39:02,902] site_tests:49 (ERROR) - --- FAIL: Read pCOWeb HRF Speed Command ---
[2020-03-02 17:39:02,902] site_tests:51 (ERROR) - scan_device: {'id': '6cfa5bc7-9e9a-559d-a030-d4ec529d14a4', 'alias': '', 'info': 'HRF Speed Command', 'type': 'fan', 'plugin': '59aa69eb-a5da-569f-aaa4-3ebbdb72530b', 'tags': ['autofan/device', 'system/id:6cfa5bc7-9e9a-559d-a030-d4ec529d14a4', 'system/type:fan'], 'metadata': {'model': 'pCOWeb'}}
[2020-03-02 17:39:02,902] site_tests:53 (ERROR) - reading: [{'device': '6cfa5bc7-9e9a-559d-a030-d4ec529d14a4', 'timestamp': '2020-03-02T22:34:21Z', 'type': 'percentage', 'device_type': 'fan', 'unit': {'name': 'percent', 'symbol': '%'}, 'value': 300, 'context': {'model': 'pCOWeb'}}]
[2020-03-02 17:39:02,902] site_tests:55 (ERROR) - data: ['reading[value] out of range']
[2020-03-02 17:54:35,941] site_tests:49 (ERROR) - --- FAIL: Read pCOWeb HRF Speed Command ---
[2020-03-02 17:54:35,941] site_tests:51 (ERROR) - scan_device: {'id': '6cfa5bc7-9e9a-559d-a030-d4ec529d14a4', 'alias': '', 'info': 'HRF Speed Command', 'type': 'fan', 'plugin': '59aa69eb-a5da-569f-aaa4-3ebbdb72530b', 'tags': ['autofan/device', 'system/id:6cfa5bc7-9e9a-559d-a030-d4ec529d14a4', 'system/type:fan'], 'metadata': {'model': 'pCOWeb'}}
[2020-03-02 17:54:35,941] site_tests:53 (ERROR) - reading: [{'device': '6cfa5bc7-9e9a-559d-a030-d4ec529d14a4', 'timestamp': '2020-03-02T22:49:52Z', 'type': 'percentage', 'device_type': 'fan', 'unit': {'name': 'percent', 'symbol': '%'}, 'value': 359, 'context': {'model': 'pCOWeb'}}]
[2020-03-02 17:54:35,941] site_tests:55 (ERROR) - data: ['reading[value] out of range']
[2020-03-02 18:09:56,528] site_tests:49 (ERROR) - --- FAIL: Read pCOWeb HRF Speed Command ---
[2020-03-02 18:09:56,528] site_tests:51 (ERROR) - scan_device: {'id': '6cfa5bc7-9e9a-559d-a030-d4ec529d14a4', 'alias': '', 'info': 'HRF Speed Command', 'type': 'fan', 'plugin': '59aa69eb-a5da-569f-aaa4-3ebbdb72530b', 'tags': ['autofan/device', 'system/id:6cfa5bc7-9e9a-559d-a030-d4ec529d14a4', 'system/type:fan'], 'metadata': {'model': 'pCOWeb'}}
[2020-03-02 18:09:56,528] site_tests:53 (ERROR) - reading: [{'device': '6cfa5bc7-9e9a-559d-a030-d4ec529d14a4', 'timestamp': '2020-03-02T23:05:18Z', 'type': 'percentage', 'device_type': 'fan', 'unit': {'name': 'percent', 'symbol': '%'}, 'value': 347, 'context': {'model': 'pCOWeb'}}]
[2020-03-02 18:09:56,528] site_tests:55 (ERROR) - data: ['reading[value] out of range']
based on log output from synse server with an instance of the modbus-ip-plugin running, it doesn't look like the plugin exposes the build-time version info
timestamp='2020-02-04T13:09:56.920670Z' logger='synse_server.plugin' level='debug' event='loaded plugin info' id='59aa69eb-a5da-569f-aaa4-3ebbdb72530b' version={'plugin_version': '-', 'sdk_version': '3.0.0-alpha.3', 'build_date': '-', 'git_commit': '-', 'git_tag': '-', 'arch': 'amd64', 'os': 'linux'} addr='10.42.5.63:5004' tag='vaporio/modbus-ip'
This is probably an issue in the goreleaser config.
PR coming. Saves round trips versus the HVAC.
Something is odd with the modbus plugin. We're not reading values where we should be.
Synse read:
ubuntu@w1:~$ export SYNSE_IP=10.42.4.226
ubuntu@w1:~$ curl http://${SYNSE_IP}:5000/v3/read/05a3062d-bc77-5005-a00e-b67e11af005f
[
]
Protocol Client direct read:
ubuntu@w1:~$ sudo -HE env PATH=$PATH ./pcli mip 10.193.9.244:502 get coil 33
DEBU[0000] readCoil 0x0033, decimal 51
INFO[0000] false
We saw this at Wrigley yesterday. Prod repro is consistent.
if one EGauge (modbus TCP device) is not configured correctly (or does not respond), they all bomb since the plugin falls over.
I was hoping to have a simplified repro of this today but failed.
I suspect, but don't know, that we need the plugin, synse, and a client hitting synse to reproduce.
goroutine 554 [running]:
github.com/vapor-ware/synse-modbus-ip-plugin/vendor/github.com/vapor-ware/synse-sdk/sdk.(*Reading).encode(0x0, 0xc000229c18)
/go/src/github.com/vapor-ware/synse-modbus-ip-plugin/vendor/github.com/vapor-ware/synse-sdk/sdk/models.go:50 +0x4a
github.com/vapor-ware/synse-modbus-ip-plugin/vendor/github.com/vapor-ware/synse-sdk/sdk.(*server).ReadCached(0xc00015e210, 0xc00000b540, 0xa2a060, 0xc00053c670, 0xc00015e210, 0x75b6eb)
/go/src/github.com/vapor-ware/synse-modbus-ip-plugin/vendor/github.com/vapor-ware/synse-sdk/sdk/server.go:380 +0x138
github.com/vapor-ware/synse-modbus-ip-plugin/vendor/github.com/vapor-ware/synse-server-grpc/go._Plugin_ReadCached_Handler(0x965200, 0xc00015e210, 0xa29ac0, 0xc0006840c0, 0xdf8b30, 0xc000285710)
/go/src/github.com/vapor-ware/synse-modbus-ip-plugin/vendor/github.com/vapor-ware/synse-server-grpc/go/synse.pb.go:1693 +0x109
github.com/vapor-ware/synse-modbus-ip-plugin/vendor/google.golang.org/grpc.(*Server).processStreamingRPC(0xc0004bad80, 0xa2ade0, 0xc000498a80, 0xc000354100, 0xc0004dfaa0, 0xdd0760, 0x0, 0x0, 0x0)
/go/src/github.com/vapor-ware/synse-modbus-ip-plugin/vendor/google.golang.org/grpc/server.go:1170 +0xac7
github.com/vapor-ware/synse-modbus-ip-plugin/vendor/google.golang.org/grpc.(*Server).handleStream(0xc0004bad80, 0xa2ade0, 0xc000498a80, 0xc000354100, 0x0)
/go/src/github.com/vapor-ware/synse-modbus-ip-plugin/vendor/google.golang.org/grpc/server.go:1249 +0xcfa
github.com/vapor-ware/synse-modbus-ip-plugin/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc000468130, 0xc0004bad80, 0xa2ade0, 0xc000498a80, 0xc000354100)
/go/src/github.com/vapor-ware/synse-modbus-ip-plugin/vendor/google.golang.org/grpc/server.go:685 +0x9f
created by github.com/vapor-ware/synse-modbus-ip-plugin/vendor/google.golang.org/grpc.(*Server).serveStreams.func1
/go/src/github.com/vapor-ware/synse-modbus-ip-plugin/vendor/google.golang.org/grpc/server.go:683 +0xa1
As usual there are at least two issues here. First off we are getting no reading from the device for some reason. Second is that a plugin cannot currently append a nil reading to a read context in synse v3 as in v2.
The panic is happening here in the scheduler since rctx.Reading is nil there is no
rtcx.Reading.Value.
https://github.com/vapor-ware/synse-sdk/blob/daad6cb4f63a975772e0584783ca7c7e5e6823f6/sdk/scheduler.go#L487
Logs:
TODO:
auto_fan will need these, likely other components as well. (Turntable)
Nice to have. Not currently a requirement.
Setup code for bulk reads is currently done every time. We only really need to do this once with an sdk.DeviceAction at setup.
Furthermore we can read coils and read_only_coils in the same network round trip, so too with holding_register and read_only_holding_register.
This may be a ticket that never goes away. There are a bunch of FUTURE comments in the code about tests we could use but do not currently have. Some of these tests may be a lot of work.
Probably not the highest priority unless things start breaking.
We can id modbus devices by ip and port.
When we need to read registers that are sequentially addressed, we can perform those reads in one round trip and unpacking the results. This will help from overwhelming small modbus devices.
We can do this with writes as well, but writes are far more infrequent.
We have added support for 1.12 and 1.13 Golang images. Upstream Docker project has already removed support for building 1.11 images and we will be doing so as well. This repo makes use of 1.11 in either it's .jenkins
or Dockerfile
and should be updated and tested with either 1.12 or 1.13 of Golang.
We used to give nil reading values when we were not able to successfully read a device. Now the device read gives an empty result set and the read all endpoint just omits the reading.
VSM controller is down. Query Service Entrance Door Switch
ubuntu@w1:~/src/vem-access/burnin/site_tests$ curl http://${SYNSE_IP}:5000/v3/read/1b679647-c421-5c35-a38b-3eb71b43bf2f
[
]
We should get something like this:
[
{
"device": "1b679647-c421-5c35-a38b-3eb71b43bf2f",
"timestamp": "2020-05-11T22:30:13Z",
"type": "status",
"device_type": "status",
"unit": null,
"value": null,
"context": {
"model": "Vapor VSM"
}
}
]
Nice to have. Not currently a requirement.
The maximum number of holding registers or input registers that can be read on a bulk read network round trip is 123. Currently so too with coils.
The maximum amount of coils should be 123 * 16 = 1968.
This ticket is to change that limit to 1968, assuming the modbus library handles it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.