Best practice for MC-Protocol Read

Hi all,

I'm successfully connected to a Mitsubishi PLC and I'm able to read addresses using MC-Read. I want to read several addresses that are not contiguous, so I haven't used the ,CNT syntax in the address string.

Is there a way to feed the MC READ node with a list of addresses as an array ? Or am I ok to just create 10 different MC READ nodes, one for each address I want to read ? Should I use the same inject node to trigger them all at the same time ?

Thanks for your help !

Do you have access to the PLC? Modifying the ladder to put all values you want into a contiguous area has 2 advantages...

  1. It provides a cross-referenceable addresses for maintenance personnel.
  2. Reading 10 items is 10x faster than 10 single reads.

Could you list out the addresses so I can see what areas and addresses you require?

1 Like

Hi ! Thanks for the fast response !

We have access to the PLC, but would prefer to avoid any config changes as it is still supported by the equipment manufacturer. Perhaps we should try to group as many contiguous sets as possible in to a few MC READ nodes ? Here is a list of the addresses we want to read:

D100
D102
D104
D106
D108
D110
D112
D121
D124
D128
D130
D134
D136
D145
D149
D2017
D2080
D270
D271
D280
D281
D282
D283
D288
D290
D30
D31
D32
D74
D8010
D8012
D8270
D84
D90
D92
M100
M101
M102
M103
M104
M107
M108
M109
M111
M112
M200
M24
M25
M40
M42
M45
M46
M47
M54
M75
X0
X1
Y20
Y21
Y22

I would definitely group together as few reads as possible.

THOUGHTS...

To read these addresses, I would break them up into 6 reads
You can probably do all 6 reads at the same time but personally, I would do them at least 30ms or so apart to avoid issues.

While reading 520 bytes of data may seem excessive (when you only want 30 values), 1 round trip to the PLC for 520 bytes is FAR FASTER than 30 round trips to the PLC. Also, as the MITSI Q Series COMM processing is part of the PLC scan, it is also kinder on the PLC SCAN time.
An additional benefit of reading all items in one go is that the data values are consistent

  • i.e. D30 is read on the same PLC SCAN asn D31 and D32 etc
  • This becomes important when data values are relative to each other & need to be consistent for logging or further calculations with each other.

Grouping & offsets (to help with byte offsets in buffer-parser

Demo...

Demo Flow (import using CTRL-I - requires node-red-contrib-buffer-parser)

[{"id":"45b5edc7195ba7c6","type":"MC Read","z":"a58fa62c.7c1eb8","name":"read D30,261","topic":"","connection":"8a67d1bd.c84ff","address":"D30,261","addressType":"str","outputFormat":0,"errorHandling":"throw","outputs":1,"x":464,"y":400,"wires":[["eea5d9718d76fbf0","900d7a64c0340d04","e712c5494e085c86"]]},{"id":"2e78ddf6fcd4de73","type":"inject","z":"a58fa62c.7c1eb8","name":"","props":[{"p":"payload.highnumber","v":"17169973925117969n","vt":"num"},{"p":"payload.highnumber-string","v":"17169973925117969","vt":"str"},{"p":"payload.lowernumber","v":"7169973925117969","vt":"num"},{"p":"payload.lowernumber-string","v":"7169973925117969","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":194,"y":400,"wires":[["45b5edc7195ba7c6","9f9b7266bc527743"]]},{"id":"79f29458d7d50d31","type":"debug","z":"a58fa62c.7c1eb8","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":898,"y":400,"wires":[]},{"id":"eea5d9718d76fbf0","type":"change","z":"a58fa62c.7c1eb8","name":"put D32 in payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.D32","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":706,"y":400,"wires":[["79f29458d7d50d31"]]},{"id":"900d7a64c0340d04","type":"change","z":"a58fa62c.7c1eb8","name":"put D74 in payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.D74","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":706,"y":448,"wires":[["25bda533abfa53cb"]]},{"id":"25bda533abfa53cb","type":"debug","z":"a58fa62c.7c1eb8","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":898,"y":448,"wires":[]},{"id":"e712c5494e085c86","type":"change","z":"a58fa62c.7c1eb8","name":"put D290 in payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.D290","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":716,"y":496,"wires":[["2f4037705390a459"]]},{"id":"2f4037705390a459","type":"debug","z":"a58fa62c.7c1eb8","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":898,"y":496,"wires":[]},{"id":"822a32821fa8cc7c","type":"MC Read","z":"a58fa62c.7c1eb8","name":"Read D2017,64","topic":"","connection":"8a67d1bd.c84ff","address":"D2017,64","addressType":"str","outputFormat":0,"errorHandling":"throw","outputs":1,"x":464,"y":576,"wires":[["3c50f581b6199752","9bc3a00a1ba0a0af"]]},{"id":"4f236a87a867b8da","type":"debug","z":"a58fa62c.7c1eb8","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":890,"y":576,"wires":[]},{"id":"3c50f581b6199752","type":"change","z":"a58fa62c.7c1eb8","name":"put D2017 in payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.D2017","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":708,"y":576,"wires":[["4f236a87a867b8da"]]},{"id":"9bc3a00a1ba0a0af","type":"change","z":"a58fa62c.7c1eb8","name":"put D2080 in payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.D2080","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":708,"y":624,"wires":[["85eeda2955fe857b"]]},{"id":"85eeda2955fe857b","type":"debug","z":"a58fa62c.7c1eb8","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":890,"y":624,"wires":[]},{"id":"9f9b7266bc527743","type":"delay","z":"a58fa62c.7c1eb8","name":"","pauseType":"delay","timeout":"30","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":262,"y":480,"wires":[["822a32821fa8cc7c"]]},{"id":"7ad5d79b5616b73e","type":"inject","z":"a58fa62c.7c1eb8","name":"","props":[{"p":"payload.highnumber","v":"17169973925117969n","vt":"num"},{"p":"payload.highnumber-string","v":"17169973925117969","vt":"str"},{"p":"payload.lowernumber","v":"7169973925117969","vt":"num"},{"p":"payload.lowernumber-string","v":"7169973925117969","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":190,"y":752,"wires":[["a348d9f3de5817bc","839ed009385deb76"]]},{"id":"a348d9f3de5817bc","type":"MC Read","z":"a58fa62c.7c1eb8","name":"read D30,261","topic":"","connection":"8a67d1bd.c84ff","address":"D30,261","addressType":"str","outputFormat":"1","errorHandling":"throw","outputs":1,"x":460,"y":752,"wires":[["bce96a67d38ebfd7"]]},{"id":"839ed009385deb76","type":"delay","z":"a58fa62c.7c1eb8","name":"","pauseType":"delay","timeout":"30","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":258,"y":832,"wires":[["a0513facf795638f"]]},{"id":"a0513facf795638f","type":"MC Read","z":"a58fa62c.7c1eb8","name":"Read D2017,64","topic":"","connection":"8a67d1bd.c84ff","address":"D2017,64","addressType":"str","outputFormat":"1","errorHandling":"throw","outputs":1,"x":460,"y":928,"wires":[["e3c72ca8ef3f9784"]]},{"id":"d494e85bcdf0c818","type":"debug","z":"a58fa62c.7c1eb8","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":894,"y":752,"wires":[]},{"id":"ddbfed8187f4fa3c","type":"debug","z":"a58fa62c.7c1eb8","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":894,"y":800,"wires":[]},{"id":"eb5324051bad9273","type":"debug","z":"a58fa62c.7c1eb8","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":886,"y":928,"wires":[]},{"id":"629eec6f949bfe21","type":"debug","z":"a58fa62c.7c1eb8","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":886,"y":976,"wires":[]},{"id":"88b8b57fd4fc3882","type":"debug","z":"a58fa62c.7c1eb8","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":894,"y":848,"wires":[]},{"id":"bce96a67d38ebfd7","type":"buffer-parser","z":"a58fa62c.7c1eb8","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"D32","offset":4,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"D74","offset":88,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"D290","offset":520,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"return","multipleResult":true,"fanOutMultipleResult":true,"setTopic":true,"outputs":3,"x":660,"y":752,"wires":[["d494e85bcdf0c818"],["ddbfed8187f4fa3c"],["88b8b57fd4fc3882"]]},{"id":"e3c72ca8ef3f9784","type":"buffer-parser","z":"a58fa62c.7c1eb8","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"D2017","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"D2080","offset":126,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"return","multipleResult":true,"fanOutMultipleResult":true,"setTopic":true,"outputs":2,"x":662,"y":928,"wires":[["eb5324051bad9273"],["629eec6f949bfe21"]]},{"id":"05d3a61b9e87404a","type":"inject","z":"a58fa62c.7c1eb8","name":"","props":[{"p":"payload.highnumber","v":"17169973925117969n","vt":"num"},{"p":"payload.highnumber-string","v":"17169973925117969","vt":"str"},{"p":"payload.lowernumber","v":"7169973925117969","vt":"num"},{"p":"payload.lowernumber-string","v":"7169973925117969","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":178,"y":1040,"wires":[["f6ae0bcbeb7a496e","fa8a36ce5b1c7af6"]]},{"id":"f6ae0bcbeb7a496e","type":"MC Read","z":"a58fa62c.7c1eb8","name":"read D30,261","topic":"","connection":"8a67d1bd.c84ff","address":"D30,261","addressType":"str","outputFormat":"1","errorHandling":"throw","outputs":1,"x":448,"y":1040,"wires":[["f59da30dc638860e"]]},{"id":"fa8a36ce5b1c7af6","type":"delay","z":"a58fa62c.7c1eb8","name":"","pauseType":"delay","timeout":"30","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":246,"y":1104,"wires":[["db05581fe4db7f21"]]},{"id":"f59da30dc638860e","type":"buffer-parser","z":"a58fa62c.7c1eb8","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"plc/mit1/D32","offset":4,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"plc/mit1/D74","offset":88,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"plc/mit1/D290","offset":520,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"return","multipleResult":true,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":648,"y":1040,"wires":[["8c79c4c28d18cca6"]]},{"id":"db05581fe4db7f21","type":"MC Read","z":"a58fa62c.7c1eb8","name":"Read D2017,64","topic":"","connection":"8a67d1bd.c84ff","address":"D2017,64","addressType":"str","outputFormat":"1","errorHandling":"throw","outputs":1,"x":448,"y":1104,"wires":[["80407c937e365737"]]},{"id":"80407c937e365737","type":"buffer-parser","z":"a58fa62c.7c1eb8","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"plc/mit1/D2017","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"plc/mit1/D2080","offset":126,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"return","multipleResult":true,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":650,"y":1104,"wires":[["8494a08eea4cde66"]]},{"id":"8494a08eea4cde66","type":"debug","z":"a58fa62c.7c1eb8","name":"to MQTT →","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"topic & \": \" & payload","statusType":"jsonata","x":854,"y":1104,"wires":[]},{"id":"8c79c4c28d18cca6","type":"debug","z":"a58fa62c.7c1eb8","name":"to MQTT →","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"topic & \": \" & payload","statusType":"jsonata","x":854,"y":1040,"wires":[]},{"id":"8a67d1bd.c84ff","type":"MC Protocol Connection","name":"","host":"localhost","port":"5003","protocol":"UDP","frame":"4E","plcType":"Q","ascii":false,"PLCStation":"","PCStation":"","PLCModuleNo":"","network":"","octalInputOutput":false,"timeout":"3000"}]
1 Like

Some proof...

1 Like

Wow ! Thanks Steve-Mcl ! This is a more detailed response than I could have wished for ! You have been a tremendous help, and I wish you a fantastic day !

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.