Vidmas30 Posted November 30, 2019 Report Share Posted November 30, 2019 Good evening, all, I have a project where UniStream US5 controller with RS485 port is used to read data from 8 electricity meters. These are exactly the same model and parameters quantity and type also the same. I thought about making a struct for one meter with all variables needed and then copy and change struct name so I don't have to enter each of these variables for each meter. But there's no way to copy struct in UniLogic. Maybe someone of you has done something like this and can share some advice? One more thing: since no special logic needed, I'm planning to use PLC Communication Modbus Master's dialog to add slaves, enter all required data variable (about 50 each meter) and use toggle bit for each of the meter. I wonder if it's the best way to do this, because I need to read about 50 variables from each of slaves. Your thoughts about this would be highly appreciated. Thank you in advance. Quote Link to comment Share on other sites More sharing options...
dierkens Posted November 30, 2019 Report Share Posted November 30, 2019 Not sure it will work like that as I believe the MODBUS ID has to be set for each one individually. Quote Link to comment Share on other sites More sharing options...
Vidmas30 Posted December 1, 2019 Author Report Share Posted December 1, 2019 Hi, all, Some update: after some experimenting and reading, I found that tried to use not right approach - I tried to do separate struct for each of slaves with all the variables I need to read. So there were 37 operations with every slave. Then I used an arrays of INT32 (electricity metter gives information that way). Since in one operation metters can give 50 words (and I need 50 INT32's pf which 47 are consecutive), I ended up with 3 operations - 1st for 25 INT32, 2nd for 22 INT32 and 3rd for last 3 INT32. With periodic, when there are 2 operations it works flawless, but when there are 3 operations and set for every period 1000ms, there are problems (dropped increments). Then I set different times in every period and it helped. Could someone give more detailed explanation what this time setting in "every period" means? And how exactly PLC does read/write of the slaves according these settings? Because when looking to sessions counter, it looks like it goes simultaneously. With 2 slaves (I have on my desktop) it works just fine, hope everything will be ok with all 8. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Joe Tauser Posted December 1, 2019 MVP 2022 Report Share Posted December 1, 2019 A serial Modbus transaction can take up some time. The program builds the frame, sends it to the slave, and waits for the request. You demonstrated this to yourself when 3 operations started erroring out a 1000 ms. The "every period" is how often the PLC will trigger a transaction. If you have several slaves it will indeed send them out simultaneously. Which means it's not going to work very well in a serial configuration, as the responses from the slaves will crash into each other on the COM port. Maybe one of the Creators can chime in here and tell us if the PLC stages the requests under the hood. Otherwise I'd manage the calls to each meter by shifting the "Active" bit for each Modbus operation. Joe T. Quote Link to comment Share on other sites More sharing options...
Vidmas30 Posted December 2, 2019 Author Report Share Posted December 2, 2019 Thanks, Joe, Yes, it would be great to hear some information how PLC sorts this under the hood. Because if you need to use "Active" bit to make sure everything goes in order, then this "periodic" feature has no sense.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.