Hello everyone
I am very new at Ignition so excuse me if the question has been answered already but I could not find it on the forum.
Can anyone put me on the right track to design a simple window in ignition in which a 7 day timer can be programmed to toggle a single bit(tag) in a micrologix plc.
All I need is the client to be able to set time of start and stop of an automatic sequence of a water fountain just as you would program start and stop times in a 7 days timer.
Thanks in advance to anyone that can help me
Dan
Hello
I don’t think I have phrased it very well.
All I need is to change the value of a bool tag at certain times during the day, and I want to be able to do it from the ignition client, maybe by binding properties to the calendar component?
Thanks
Ok, there is a couple of different ways you can do this. The easiest way is to do the following:
- Select the Root Container. Right click on it and select Customizers > Custom Properties.
- Add a new custom property called “trigger” that is an integer.
- Bind the “trigger” property to the following expression:
dateFormat(now(5000), "HH:mm") = "08:00" || dateFormat(now(5000), "HH:mm") = "12:00" || dateFormat(now(5000), "HH:mm") = "16:00"
The now(5000) function will poll every 5 seconds. The property will be a 1 when the current time is either 8am, 12pm, or 4pm. I hard coded the times but you can bring them in from text fields on the window or something that the user can select. - Lastly, we need to write to your tag when this value goes to a 1. Right click on the Root Container again and select Event Handlers…
- Select propertyChange on the left and select the Script Editor tab on the right.
- Enter in the following script:
if event.propertyName == "trigger": value = newValue.value if value: system.tag.writeToTag("Path/To/Tag", 1)
It will write a 1 to the tag “Path/To/Tag” when the trigger is a 1. Hope this helps you get started.
1 Like
Thank you very much for your prompt reply. I will try it over the week end.