This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

simple closed loop control
#1
hello 
I used grp.checkwrite command in a resident script to write a true/false value on a switch actuator  
but some times due to power issue or other issues the command value is true while the F/B value is false (real Status), so the grp.checkwrite command will not write true on this value, while it should.

what is the best solution for this issue
Best Regards,
Reply
#2
You can set some periodical pooling on this object. There is parameter like this on the object.
------------------------------
Ctrl+F5
Reply
#3
That is logical behavior, if you write to the switch object for example 1/1/1 and your feedback is 1/2/1 then you need to know the value of 1/2/1 before writing to 1/1/1..  

grp.checkwrite checks in this case the internal value of the controller of 1/1/1 so the last sended value and this does not check the actual value of the feedback object 1/2/1.. the same counts for Daniels solution, this will get the value of 1/2/1 but writing to 1/1/1 does not change by it.

What you might want to do is send write always to the bus and use grp.write.

If you want to make the write depending on the feedback you need to send the feedback cyclic from the actuator, and make in your script a condition where you compare 1/2/1 with the new value you want to write to 1/1/1.
Reply
#4
You can specify the status object address for grp.checkwrite:
https://openrb.com/docs/lua.htm#grp.checkwrite
Reply
#5
Sorry, missed that one (oeps)….  Big Grin
Reply
#6
Thank you all 
Danial, Erwin, Admin
great feature I also missed it 
if I want to execute the command regardless delta 
I use this: grp.checkupdate('32/1/1',true,_,'32/1/2') !
Best Regards,
Reply
#7
(17.11.2021, 08:50)khalil Wrote: Thank you all 
Danial, Erwin, Admin
great feature I also missed it 
if I want to execute the command regardless delta 
I use this: grp.checkupdate('32/1/1',true,_,'32/1/2') !

is it right to use underscore (_) here or not.
and what to use if I want to neglect the delta?
best regards,
Best Regards,
Reply
#8
Better use nil because if _ is defined as a global variable somewhere then the code might not work. But it only matters for numeric values, for boolean values delta is not used so it can be anything.
Reply
#9
(22.11.2021, 06:59)admin Wrote: Better use nil because if _ is defined as a global variable somewhere then the code might not work. But it only matters for numeric values, for boolean values delta is not used so it can be anything.

Thank you admin
appreciate your time and effort helping us 
best regards,
Best Regards,
Reply


Forum Jump: