Is there a way to create a "Toggle Switch" using a button in Graphics Studio? I'm trying to set it up so that the button will reference the current status (i.e. Mode.Actual = CAS) and change it to the other status (i.e. Mode.Actual = MAN).
Hi Micah,
Yes, there is.
You can create a button that has a custom script responsible for writing the right mode based on the current mode and updates its caption to avoid confusion. You could try this and adjust it to your loop name:
var current_mode current_mode = (await DLSYS.ReadAsync("LIC-101/PID1/MODE.ACTUAL")).Value if (current_mode == 8) { DLSYS.WriteAsync("LIC-101/PID1/MODE.TARGET", 16) /* Change Controller Mode to AUTO */ Dsp.Button1.Label = "Change to MAN" /* Change label to indicate next click will be to Manual */ } if (current_mode == 16) { DLSYS.WriteAsync("LIC-101/PID1/MODE.TARGET", 8) /* Change Controller Mode to MAN */ Dsp.Button1.Label = "Change to AUTO" /* Change label to indicate next click will be to Auto */ }
In order for the button label to be correct, add this script to the display OnOpen script:
var current_mode current_mode = (await DLSYS.ReadAsync("LIC-101/PID1/MODE.ACTUAL")).Value if (current_mode == 8) { Dsp.Button1.Label = "Change to AUTO" } if (current_mode == 16) { Dsp.Button1.Label = "Change to MAN" }
Controller mode values are:
8 = Manual
16 = Automatic
32 = Cascade
I hope this helps,
Camilo Fadul
Camilo Fadul | DeltaV Solution Marketing Director
https://www.linkedin.com/in/cfadul
In reply to Camilo Fadul:
In reply to Micah Dudley:
The OnOpen script field can be found at the display level (nothing selected). Look for the Configuration Pane on the right-hand side of the screen.
The second tab on that Configuration Pane is the Interaction tab. You will see the OnOpen field first on the list.