Hi,
I'm using a Siemens S7 PLC. In the project I have for example several times which are
Time_Of_Day
type.
In my Node-red flow, I declared two PLC reading : one for periodic reading and the second for alarm reading. These time variable are in DB1, so I was thinking about doing something like DB1,DWORD(n bytes)
where n bytes is the number of bytes to start reading as explained in the documentation.
I didn't test it yet because I encountered issues with the PLC : to resume DB are optimized blocks and I can't acces it directly through the node-red flow (it's require to develop our own DB with non-optimized block access, so we are working on it). But that's not the point of my topic.
As you suggested me to take the Time type variable as a DWORD
I was wondering if it was possible to convert it as DWORD or do I have to change the Time_Of_Day type to DWORD type in the PLC project?
It's really complicated for me to change the PLC project as I am working in a company which is not really OK to do so. If it's not possible, maybe I should try using python snap7
library.
I share the following node-red flow :
[{"id":"deb43bae.942068","type":"tab","label":"Flow 1"},{"id":"bf5af5bb.011788","type":"s7 endpoint","z":"","address":"10.129.142.231","port":"102","rack":"0","slot":"1","localtsaphi":"01","localtsaplo":"00","remotetsaphi":"01","remotetsaplo":"00","connmode":"rack-slot","cycletime":"10000","timeout":"1500","verbose":"default","name":"","vartable":[{"addr":"M01","name":"DistillationTemperature"},{"addr":"M02","name":"DistillationTemps"},{"addr":"M03","name":"TestVar"}]},{"id":"357536b.18b63ca","type":"serial-port","z":"","serialport":"/dev/ttyS0","serialbaud":"115200","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"false","out":"char","addchar":false},{"id":"7d303c14.273924","type":"debug","z":"deb43bae.942068","name":"","active":true,"console":"false","complete":"payload","x":689.6666259765625,"y":299.44445610046387,"wires":[]},{"id":"f8b3f8d5.595128","type":"exec","z":"deb43bae.942068","command":"python /home/heptane/scripts/periodic.py","addpay":true,"append":"","useSpawn":true,"timer":"","name":"","x":577.9444274902344,"y":86.27777671813965,"wires":[[],[],[]]},{"id":"1a902f7b.2c2bc1","type":"s7 in","z":"deb43bae.942068","endpoint":"bf5af5bb.011788","mode":"all","variable":"","diff":false,"name":"Periodic","x":69,"y":66,"wires":[["f3691d36.09404"]]},{"id":"f3691d36.09404","type":"trigger","z":"deb43bae.942068","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"1","extend":false,"units":"min","reset":"","name":"","x":198.33334350585938,"y":143.22221565246582,"wires":[["1119e083.efa10f"]]},{"id":"313a5900.3ba498","type":"s7 in","z":"deb43bae.942068","endpoint":"bf5af5bb.011788","mode":"all","variable":"","diff":false,"name":"Alarm","x":59,"y":243.99999809265137,"wires":[["415d7610.36b988"]]},{"id":"1119e083.efa10f","type":"json","z":"deb43bae.942068","name":"","x":339.11114501953125,"y":104.44443321228027,"wires":[["f8b3f8d5.595128"]]},{"id":"f44c48e8.c6f0a8","type":"exec","z":"deb43bae.942068","command":"python /home/heptane/scripts/alarm.py","addpay":true,"append":"","useSpawn":true,"timer":"","name":"","x":417.111083984375,"y":331.6666259765625,"wires":[["7d303c14.273924"],["7d303c14.273924"],[]]},{"id":"415d7610.36b988","type":"json","z":"deb43bae.942068","name":"","x":216.22220611572266,"y":253.88888931274414,"wires":[[]]},{"id":"1c1d0cc.53b53f3","type":"status","z":"deb43bae.942068","name":"","scope":["313a5900.3ba498","1a902f7b.2c2bc1"],"x":65,"y":336,"wires":[["d1550a86.664e08"]]},{"id":"a879e9b4.af72c8","type":"debug","z":"deb43bae.942068","name":"","active":true,"console":"false","complete":"payload","x":762.2500114440918,"y":382.7500057220459,"wires":[]},{"id":"d1550a86.664e08","type":"function","z":"deb43bae.942068","name":"","func":"msg.payload = msg.status;\nreturn msg;","outputs":1,"noerr":0,"x":213.5,"y":405,"wires":[["aa62953d.edce58"]]},{"id":"aa62953d.edce58","type":"json","z":"deb43bae.942068","name":"","x":348,"y":401,"wires":[["192a3e93.a1e041"]]},{"id":"192a3e93.a1e041","type":"exec","z":"deb43bae.942068","command":"python /home/heptane/scripts/keepalive.py","addpay":true,"append":"","useSpawn":true,"timer":"","name":"","x":575.5000076293945,"y":478.75000762939453,"wires":[["a879e9b4.af72c8"],["a879e9b4.af72c8"],[]]}]
Best regards!