Giter VIP home page Giter VIP logo

synse-modbus-ip-plugin's People

Contributors

edaniszewski avatar fossabot avatar guesswhosamfoo avatar marcoceppi avatar matthewhink avatar timfallmk avatar wwitzel3 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

synse-modbus-ip-plugin's Issues

update to make generalized and leverage sdk1.0 changes

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.

HRF Speed Command Reading

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:

  • An intermittent scaling issue on the plugin side, which seems odd.
  • Bad data coming from the VEM PLC.
  • Something else.

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']

v3: plugin version info not being built into image correctly

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.

Modbus bulk read

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

Plugin falls over when one endpoint does not respond.

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

Panic appending nil reading on image 2.0.6

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:

modbus-panic-logs.txt

TODO:

  • Tests for when a nil reading is added to a read context.
  • nil check reading in the scheduler.
  • Why are we not getting data from the device in the first place.

Bulk Read Setup once on plugin initialization.

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.

Testing

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.

Aggregate reads to avoid round trips.

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.

Deprecation notice: vaporio/golang:1.11 is being removed

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.

Empty reading when endpoint is down. Should be nil value.

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"
    }
  }
]

Bulk Read Coils Limit

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.