Script execution priority - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Script execution priority (/showthread.php?tid=387) |
Script execution priority - Mirco - 13.09.2016 Hi everybody! I have a big problem, with the execution of my project and I hope you will have some advise. I have to read/write datas from/to 4 different PLCs in the same Modbus RTU network. There are 14 different script (6 resident, 6 event and 2 scheduler) that exchange data via modbus RTU. To avoid that one or more script start before the finish of the script that is in execution, I use this code: Code: repeat Sometimes it happened that 2 or more script started at the same time and they were both executed. This couse timeout and wrong slave errors because scripts set the communication with different slaves. I hope you will understand my problem, I'm not very good in english Mirco RE: Script execution priority - admin - 13.09.2016 You can use built-in modbus mapper and create a profile for each PLC. This way you won't have any sync issues. You can also use modbus mapper as a proxy, I'll provide an example later on. RE: Script execution priority - Mirco - 13.09.2016 (13.09.2016, 07:17)admin Wrote: You can use built-in modbus mapper and create a profile for each PLC. This way you won't have any sync issues. You can also use modbus mapper as a proxy, I'll provide an example later on. I can't, because I have to manipulate datas before writenig it into an object (for example: my PLC use 2 byte integer registers, and I have to convert it in 2 byte float for the visualization) or I have to don't read some registers if a condition is checked. RE: Script execution priority - admin - 14.09.2016 You can use proxy which will be available in RC2 firmware. First, you have to enable RTU in modbus mapper, then you can use it in scripts like this: Code: mbproxy = require('mbproxy') In your code you will just have to replace luamodbus require/open/connect with proxy functions and you won't have any issues with simultaneous port access from several scripts RE: Script execution priority - Mirco - 16.09.2016 (14.09.2016, 08:40)admin Wrote: You can use proxy which will be available in RC2 firmware. First, you have to enable RTU in modbus mapper, then you can use it in scripts like this: Thanks for your help! I tried it yesterday, but unfortunatelly the Schneider HomeLYnk and SpaceLYnk.. (Next time I will buy your LogicMachine) Do you have a library that can I import, or something else that can I do? Thanks again for your help! RE: Script execution priority - admin - 16.09.2016 Please contact us via e-mail RE: Script execution priority - Mirco - 02.12.2016 Does this code work if I use Modbus TCP instead of Modbus RTU? RE: Script execution priority - admin - 02.12.2016 No, there's no point as TCP can be used simultaneously unlike RS485. RE: Script execution priority - esteve.budia - 15.05.2018 Is this solution validated yet in Wiser / SL 2.1.1 ? thx |