Hi,
I’m seeing some odd behavior with an X/Y plot in CS-Studio. I have 3 rules setting these properties:
y_axes[0].autoscale
y_axes[0].maximum
y_axes[0].minimum
and 3 PVs for each of those. For example, the autoscale rule is simply:
try:
pvInt0 = PVUtil.getLong(pvs[0])
## Script Body
if pvInt0==0:
widget.setPropertyValue('y_axes[0].autoscale', False)
else:
widget.setPropertyValue('y_axes[0].autoscale', True)
except (Exception, lang.Exception) as e:
widget.setPropertyValue('y_axes[0].autoscale', True)
if not isinstance(e, PVUtil.PVHasNoValueException):
raise e
and that works fine. The pv0 is:
record(bo, "$(S)vAcq:ScaleAuto") {
field(DESC, "Waveform Autoscale")
field(PINI, "YES")
field(VAL, "1")
field(ZNAM, "Manual")
field(ONAM, "Auto")
}
However, the script for maximum and minimum don’t always work (mostly don’t work). Here’s the one for maximum:
try:
pvInt0 = PVUtil.getLong(pvs[0])
pvInt1 = PVUtil.getLong(pvs[1])
pv1 = PVUtil.getDouble(pvs[1])
## Script Body
if pvInt0==0:
widget.setPropertyValue('y_axes[0].maximum', pv1)
else:
widget.setPropertyValue('y_axes[0].maximum', 100.0)
except (Exception, lang.Exception) as e:
widget.setPropertyValue('y_axes[0].maximum', 100.0)
if not isinstance(e, PVUtil.PVHasNoValueException):
raise e
with pv0 the same as before, and the maximum one (pv1) being:
record(ao, "$(S)vAcq:ScaleMax") {
field(DESC, "Waveform Max Limit")
field(PINI, "YES")
field(VAL, "100")
field(PREC, "3")
field(EGU, "kV")
}
If I switch $(S)vAcq:ScaleAuto to Auto (1), it works fine and the plot autoscales. If I switch to Manual
(0), the scale doesn’t change. I can force it to work by forcing a monitor update (setting MDEL=-1 and processing the record) or by simply changing the value.
If I reload the screen after switching to Manual (0), mostly the plot ends up with a fixed Y axis from 0.0 to 10.0 (I’m not sure where the 10.0 comes from, as the
"$(S)vAcq:ScaleMax is not 10.0 and the default setting in the screen XML file is 100.0).
Any ideas?
I’m using the latest SNS CS-Studio build, as of a few days ago.
I know the user can edit the autoscale, max and min settings from the runtime settings window, but I want these settings autosaved and to persist between CS-Studio instances and between IOC reboots. I can
work around it I think, making use of that MDEL=-1 trick, but I’d like to understand where my scripts are going wrong.
Cheers,
Matt