You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: Support formulas in the Write PV action value field #3941
It would useful to be able to use formulas in the "Value" field of a "Write PV" action. This would simplify many use cases that would otherwise require scripting, which we aim to minimise at ISIS. Below are some examples of where we would find this feature helpful.
Assign the value of one PV to another
e.g. PV Name: destination, Value: =`source`
We have a display that shows suggested steering magnet setpoints calculated by some diagnostics next to the current magnet setpoints, then there are buttons to assign the suggested to the actual setpoints if the operator chooses to use them. This requires a short script to implement, but would be simpler with the requested feature.
Custom increment buttons
e.g. PV Name: $(pv_name), Value: =`$(pv_name)` + 1
We have some displays where users are used to having more increment/decrement options than the spinner or thumbwheel widgets provide. Being able to do in-place addition, subtraction, multiplication, etc would make this possible without scripting.
Ideally, I think there should be some indication of what is going to be written.
should the value only be calculate when the user presses the write button? ( in this case it might be more difficult to address the previous point cause the value is not know until it is written )
In another view, the GUI shouldn't "do" anything. The GUI shouldn't try to figure out what an appropriate setpoint might be.
Move that to the IOC. In this case, add something like this:
.. and in the GUI have the button write 1 to CopySetpoint1.PROC.
If you need more than just a "copy", use the "calcout" record to compute the appropriate setpoint.
That way, you can use EDM or MEDM or any other EPICS display tool, or caput from the command line.
In my example the calculations are done by an IOC on a diagnostic device, I don't want the Phoebus screen to "do" anything. The GUI is just providing a simple mechanism to apply the value from one IOC to another. I could implement it with an extra record as shown but I prefer to keep my diagnostics IOCs as simple as possible. It could also be done by the magnet IOC at the other end but to keep it simple the magnet doesn't need to know that a particular diagnostic exists. To me the formula way is the simplest solution, this isn't business logic, just a nicety to save operators copying a value or making mistakes.
As for magnet vs. diagnostics IOC, I assume your magnet IOC has the "Setpoint" and the diag IOC has the "CalculatedSetpoint".
You now have at least 3 options:
Place the "CopySetpoint" record in the magnet IOC so it can "pull" the calculated setpoint from the diag IOC
Place the "CopySetpoint" record in the diagnostics IOC so it can "push" the calculated setpoint to the magnet IOC
Place the "CopySetpoint" record in a new "automation" or "helper" IOC so it can "copy" the calculated setpoint from the diag IOC to the magnet IOC
There are valid arguments for each option. EPICS really doesn't care. You can simply move that "Copy" record between IOCs, and database links will magically morph into network links.
Activity
shroffk commentedon Sep 29, 2026
This is broadly a good idea.
I would like to add this as a codeathon project.
kasemir commentedon Sep 29, 2026
In another view, the GUI shouldn't "do" anything. The GUI shouldn't try to figure out what an appropriate setpoint might be.
Move that to the IOC. In this case, add something like this:
.. and in the GUI have the button write 1 to
CopySetpoint1.PROC.If you need more than just a "copy", use the "calcout" record to compute the appropriate setpoint.
That way, you can use EDM or MEDM or any other EPICS display tool, or
caputfrom the command line.shroffk commentedon Sep 29, 2026
Order of preferred solutions best to worse
Doing it in the IOC ( as Kay showed ) > Doing it via formula functions > via some script ( what you are trying to avoid )
rosstitmarsh commentedon Sep 29, 2026
In my example the calculations are done by an IOC on a diagnostic device, I don't want the Phoebus screen to "do" anything. The GUI is just providing a simple mechanism to apply the value from one IOC to another. I could implement it with an extra record as shown but I prefer to keep my diagnostics IOCs as simple as possible. It could also be done by the magnet IOC at the other end but to keep it simple the magnet doesn't need to know that a particular diagnostic exists. To me the formula way is the simplest solution, this isn't business logic, just a nicety to save operators copying a value or making mistakes.
georgweiss commentedon Sep 30, 2026
Isn't that a classic EPICS pattern? I'd second @kasemir here.
Wouldn't that put potential complications on the front end (=Phoebus)?
kasemir commentedon Sep 30, 2026
As for magnet vs. diagnostics IOC, I assume your magnet IOC has the "Setpoint" and the diag IOC has the "CalculatedSetpoint".
You now have at least 3 options:
There are valid arguments for each option. EPICS really doesn't care. You can simply move that "Copy" record between IOCs, and database links will magically morph into network links.