1) My first problem is how to display a pv value that multiplied by 1E6;
Ideally, you add a calc record to the IOC to create your scaled PV.
Then you can just display the PV “as is”.
I have tried Text Update widget in CSS Boy opi and write a EmbeddedScript for the widget which is as follows:
import Package(Packages.org.csstudio.opibuilder.scriptUtil);
var pv0=PVUtil.getDouble(pvs[0]);
widget.setPropertyValue=("pv_value",pv0=pv0*1E6);
The Text Update widget displays the value of the PV.
If you have a script that also updates the value of the widget, they both fight each other.
Use a Label widget, then update its text:
var pv0=PVUtil.getDouble(pvs[0]);
widget.setPropertyValue=(“text", “The scaled value is %g” % pv0*1E6);
Ideally, though, avoid the script and just create a proper PV in the first place.
2 ) My second question:
In order to display the unit, I place a Label widget and set its Text as "Sv/h" and I hope the Text changed to "uSv/h" correspond to the
pv value that multiplied by 1E6.
How is the text supposed to change? Hope is not a good strategy for this case.
You can again attach a script to the Label widget that sets the label’s “text” property based on the value of some PV.
Ideally, though, avoid the script and create a proper PV in the first place:
record(calc, “scaled_value")
{
field(INPA, “that_original_value CP”)
field(CALC, “A*1E6”)
field(EGU, "uSv/h”)
}
==> Now you just add a Text Update widget, enter the “scaled_value” as a PV name, done.
-Kay