Open dheeraj539 opened 3 years ago
As a general rule, you should avoid scripts. Specifically, scripts should never be used to "do" anything to the control system. See also https://github.com/ControlSystemStudio/phoebus/wiki/Display-Builder-Script-Compatibility
If you want to have some PV automatically return to 0 after having been set to 1, check for how to implement that on the IOC side. Learn about the EPICS database, see specifically BO record and its HIGH field for this, https://epics.anl.gov/base/R3-15/8-docs/boRecord.html
I think there might be some kind of lock on that PV
Check the example displays, Scripts, Solitaire or Conway, as examples for a script running concurrently with the display, and PV updates being reflected in the display.
There is a limit to one script executing at a time per display, so maybe you're trying to concurrently run two scripts?
Again, you should be able to completely implement all your displays for all your IOCs without having to use any scripts. After all that's what EPICS sites have been doing for decades. Scripts are only needed to implement silly game examples like Solitaire or Conway, or to interface with things outside of EPICS IOCs, like experiment schedule databases which are available via web services and you really think you need to display some of that within a display.
Thanks for the suggestion.
There is a limit to one script executing at a time per display, so maybe you're trying to concurrently run two scripts?
Sorry, I missed some info. The first led widget has a rule which checks the value of TEST: STATUS and changes color.
I think this rule script is blocked until the action button script is executed.
Correct me if I am wrong. Thanks!!
The first led widget has a rule which checks the value of TEST: STATUS and changes color.
Why do you need a rule for that? The primary purpose of the LED widget is to change color based on the value of a PV, it can do that on its own: Add LED widget, enter PV name, done. See example displays, LED
So what's happening could be:
Button writes 1, then starts the script which is sleeping for 10 seconds. During that time, the rule-based script has to wait. First script writes 0 and completes, rule-based script runs, but value is 0, so you see no change.
Overall this looks like a good example for using scripts to sabotage the display.
The "reset to zero" should be handled on the IOC, no script. The LED should just use a PV and built-in basic change-color-based-on-value functionality, no rule/script.
Yeah actually, I need to show different colors and texts for the led wrt some conditions.
So what's happening could be:
Button writes 1, then starts the script which is sleeping for 10 seconds. During that time, the rule-based script has to wait. First script writes 0 and completes, rule-based script runs, but value is 0, so you see no change.
Overall this looks like a good example for using scripts to sabotage the display.
The "reset to zero" should be handled on the IOC, no script. The LED should just use a PV and built-in basic change-color-based-on-value functionality, no rule/script.
Got it Thanks!!
Yeah actually, I need to show different colors and texts for the led wrt some conditions.
Then your underlying PV simply needs to have more values. Like values "OK, slight problem, big problem, dead". Not "OK, other" and "other" then has different meaning based on some other PV. Put the logic into the IOC. That way, the PV tells you what you need, you can check in "camonitor", archive it, ..., put it on the display without additional questions of how to do a script just to understand the meaning of the PV.
I have a display consisting of two widgets
The first widget(led on/off) has a PV TEST: STATUS
The second widget(action button) has two actions 1) Write Pv (writes 1 to TEST: STATUS) 2) Execute script (waits for 10 sec and writes 0 to TEST: STATUS) I am executing all actions as one
But the first led widget is not responding to the changes to PV TEST: STATUS when the action button is clicked.
I think there might be some kind of lock on that PV and as both widgets are on the same display which may be running as a single thread. I tried placing the action button on a different display, then it worked.
Any way we can run it on the same display?