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.

While Loop for reading values
#13
(19.01.2021, 15:00)tomnord Wrote:
Code:
input = event.getvalue()

if input == true then
  grp.removetags('Damper_1_Angle', 'Supply')
else
  grp.addtags('Damper_1_Angle', 'Supply')
end
This worked fine. This script is eventbased and used in all fault GA's. Will have to enter the Alias for each damper, but that is a one time thing.

Could this have been done easier?

Hi

Just to give my toughts....

I am doing smililar things as you describe here in many projects. What I have found to be the best way is to aloways use a very strict naming policy. By doing that I can find the address for fault (as you mention here) by replacin the code for temp with the code for fault.

To find the address I need I can then do something like this;
Code:
adresse = string.gsub(grp.find(event.dst).name, 'TRIGGER_OUTPUT', 'TRIGGER_INPUT')
LOCK = grp.getvalue('32/1/2')

if not LOCK then
  grp.write(adresse, event.getvalue())
end

Here I replace the TRIGGER_OUTPUT with TRIGGER_INPUT to find the address to forward the value to if the locking is not true.

You could do the same by simply replacing 'TEMPERATURE' with 'FAULT', or whatever would be your naming policy.
There are 10 kinds of people in the world; those who can read binary and those who don't  Cool
Reply


Messages In This Thread
While Loop for reading values - by tomnord - 06.01.2021, 09:10
RE: While Loop for reading values - by admin - 06.01.2021, 13:12
While Loop for reading values - by tomnord - 06.01.2021, 13:27
RE: While Loop for reading values - by admin - 06.01.2021, 13:33
RE: While Loop for reading values - by Daniel - 19.01.2021, 13:07
RE: While Loop for reading values - by admin - 19.01.2021, 13:30
RE: While Loop for reading values - by admin - 19.01.2021, 14:43
RE: While Loop for reading values - by Trond Hoyem - 25.01.2021, 12:29

Forum Jump: