Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
cryvisil/profiles.bob
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
367 lines (319 sloc)
11.9 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<display version="2.0.0"> | |
<name>profiles</name> | |
<width>250</width> | |
<height>570</height> | |
<scripts> | |
<script file="EmbeddedPy"> | |
<text><![CDATA[# Embedded python script | |
from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil | |
print 'Hello' | |
# widget.setPropertyValue('text', PVUtil.getString(pvs[0])) | |
profile_nr = PVUtil.createPV("loc://profile_nr",10) | |
profile_nr = PVUtil.getLong(profile_nr) | |
]]></text> | |
<pv_name>loc://profile_selection</pv_name> | |
</script> | |
<script file="EmbeddedPy"> | |
<text><![CDATA[# Embedded python script | |
from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil | |
print 'Hello' | |
# widget.setPropertyValue('text', PVUtil.getString(pvs[0])) | |
profilename = PVUtil.createPV("loc://profilename") | |
profilename = PVUtil.getString(profilename)]]></text> | |
<pv_name>loc://profile_selection</pv_name> | |
<pv_name>new-PV</pv_name> | |
</script> | |
</scripts> | |
<widget type="table" version="2.0.0"> | |
<name>profile_table</name> | |
<x>10</x> | |
<y>10</y> | |
<width>190</width> | |
<height>220</height> | |
<columns> | |
<column> | |
<name>Profiles</name> | |
<width>185</width> | |
<editable>false</editable> | |
</column> | |
</columns> | |
<scripts> | |
<script file="EmbeddedPy"> | |
<text><![CDATA[# Embedded python script | |
from org.csstudio.display.builder.runtime.script import PVUtil, ValueUtil | |
target = pvs[0] | |
input = pvs[1] | |
data = [] | |
for profile in PVUtil.getString(input).split("#"): | |
row_name = profile.split("?")[0] | |
row = [ row_name ] | |
data.append(row) | |
table = ValueUtil.createStringTableFromRows([ "Profiles" ], data) | |
widget.setPropertyValue("value", table) | |
]]></text> | |
<pv_name>loc://all_profiles<VTable></pv_name> | |
<pv_name>$(P):$(R):ALL-PROFILES</pv_name> | |
</script> | |
</scripts> | |
<editable>false</editable> | |
<row_selection_mode>true</row_selection_mode> | |
<selection_pv>loc://profile_selection<VTable></selection_pv> | |
</widget> | |
<widget type="group" version="2.0.0"> | |
<name>Group</name> | |
<x>10</x> | |
<y>240</y> | |
<width>190</width> | |
<height>230</height> | |
<style>2</style> | |
<widget type="action_button" version="3.0.0"> | |
<name>Action Button_3</name> | |
<actions execute_as_one="true"> | |
<action type="execute"> | |
<script file="EmbeddedPy"> | |
<text><![CDATA[# Embedded python script | |
from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil | |
print 'Hello' | |
# widget.setPropertyValue('text', PVUtil.getString(pvs[0])) | |
profilePV = PVUtil.createPV("CRYVISIL:TC09:ALL-PROFILES",5000) | |
selectionPV = PVUtil.createPV("loc://profile_selection<VTable>", 5000) | |
# get row number from selection PV, split until only index is left | |
profile_selection = int(PVUtil.getString(selectionPV).split(",")[0].split(" ")[1]) | |
# forward selected ramp to editor | |
profile_nr = PVUtil.createPV("loc://profile_nr<VLong>", 50) | |
PVUtil.writePV("loc://profile_nr<VLong>", profile_selection, 50) | |
# get the whole profile, extract selected ramp via selection number | |
profile = PVUtil.getString(profilePV).split("#")[profile_selection].split("?")[1] | |
profilename = PVUtil.getString(profilePV).split("#")[profile_selection].split("?")[0] | |
PVUtil.writePV("CRYVISIL:TC09:PROFILES", profile, 50) | |
PVUtil.writePV("loc://profilename", profilename, 50)]]></text> | |
</script> | |
<description>load profile</description> | |
</action> | |
<action type="open_display"> | |
<file>ramps.bob</file> | |
<macros> | |
<P>$(P)</P> | |
<R>$(R)</R> | |
</macros> | |
<target>window</target> | |
<description>open the editor</description> | |
</action> | |
</actions> | |
<text>Edit</text> | |
<x>19</x> | |
<y>9</y> | |
<width>150</width> | |
<tooltip>$(actions)</tooltip> | |
</widget> | |
<widget type="action_button" version="3.0.0"> | |
<name>Action Button_2</name> | |
<actions execute_as_one="true"> | |
<action type="execute"> | |
<script file="EmbeddedPy"> | |
<text><![CDATA[# Embedded python script | |
from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil | |
print 'Hello' | |
# widget.setPropertyValue('text', PVUtil.getString(pvs[0])) | |
allprofilePV = PVUtil.createPV("CRYVISIL:TC09:ALL-PROFILES",50) | |
profilePV = PVUtil.createPV("CRYVISIL:TC09:PROFILES",50) | |
PVUtil.writePV("CRYVISIL:TC09:PROFILES","",50) | |
PVUtil.writePV("loc://profilename","new profile",50) | |
# get the whole profile, extract selected ramp via selection number | |
profile_size = len(PVUtil.getString(allprofilePV).split("#")) | |
# forward selected ramp to editor | |
profile_nr = PVUtil.createPV("loc://profile_nr<VLong>", 10) | |
PVUtil.writePV("loc://profile_nr<VLong>", profile_size, 50)]]></text> | |
</script> | |
<description>Create New</description> | |
</action> | |
<action type="open_display"> | |
<file>ramps.bob</file> | |
<target>window</target> | |
<description>Create New</description> | |
</action> | |
</actions> | |
<text>Create new</text> | |
<x>19</x> | |
<y>49</y> | |
<width>150</width> | |
<tooltip>$(actions)</tooltip> | |
</widget> | |
<widget type="action_button" version="3.0.0"> | |
<name>Action Button_1</name> | |
<actions> | |
<action type="execute"> | |
<script file="EmbeddedPy"> | |
<text><![CDATA[# Embedded python script | |
from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil | |
print 'Hello' | |
# widget.setPropertyValue('text', PVUtil.getString(pvs[0])) | |
allprofilePV = PVUtil.createPV("CRYVISIL:TC09:ALL-PROFILES",50) | |
selectionPV = PVUtil.createPV("loc://profile_selection<VTable>", 10) | |
# get row number from selection PV, split until only index is left | |
selection = int(PVUtil.getString(selectionPV).split(",")[0].split(" ")[1]) | |
# get the whole profile, extract selected ramp via selection number | |
allprofile = PVUtil.getString(allprofilePV).split("#") | |
active_entry = allprofile[selection] | |
allprofile.insert(selection, active_entry) | |
PVUtil.writePV("CRYVISIL:TC09:ALL-PROFILES", "#".join(allprofile), 50) | |
# Locate the table widget by name | |
table = ScriptUtil.findWidgetByName(widget, "profile_table") | |
# Select row 0, col 0, row 1, col 2 | |
table.setSelection([ selection, 0 ])]]></text> | |
</script> | |
<description>Clone</description> | |
</action> | |
</actions> | |
<text>Clone</text> | |
<x>19</x> | |
<y>89</y> | |
<width>150</width> | |
<tooltip>$(actions)</tooltip> | |
</widget> | |
<widget type="action_button" version="3.0.0"> | |
<name>Action Button</name> | |
<actions> | |
<action type="execute"> | |
<script file="EmbeddedPy"> | |
<text><![CDATA[# Embedded python script | |
from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil | |
print 'Hello' | |
# widget.setPropertyValue('text', PVUtil.getString(pvs[0])) | |
allprofilePV = PVUtil.createPV("CRYVISIL:TC09:ALL-PROFILES",50) | |
selectionPV = PVUtil.createPV("loc://profile_selection<VTable>", 10) | |
# get row number from selection PV, split until only index is left | |
selection = int(PVUtil.getString(selectionPV).split(",")[0].split(" ")[1]) | |
# get the whole profile, extract selected ramp via selection number | |
allprofile = PVUtil.getString(allprofilePV).split("#") | |
del allprofile[selection] | |
PVUtil.writePV("CRYVISIL:TC09:ALL-PROFILES", "#".join(allprofile), 50)]]></text> | |
</script> | |
<description>delete</description> | |
</action> | |
</actions> | |
<text>Delete</text> | |
<x>19</x> | |
<y>129</y> | |
<width>150</width> | |
<tooltip>$(actions)</tooltip> | |
</widget> | |
<widget type="rectangle" version="2.0.0"> | |
<name>Rectangle_27</name> | |
<x>9</x> | |
<y>175</y> | |
<width>170</width> | |
<height>1</height> | |
<line_width>2</line_width> | |
<line_color> | |
<color red="0" green="0" blue="0"> | |
</color> | |
</line_color> | |
<background_color> | |
<color red="185" green="215" blue="237"> | |
</color> | |
</background_color> | |
</widget> | |
<widget type="action_button" version="3.0.0"> | |
<name>Action Button_6</name> | |
<actions execute_as_one="true"> | |
<action type="execute"> | |
<script file="EmbeddedPy"> | |
<text><![CDATA[# Embedded python script | |
from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil | |
import os | |
import subprocess | |
import sys | |
print 'Hello' | |
# widget.setPropertyValue('text', PVUtil.getString(pvs[0])) | |
profilePV = PVUtil.createPV("CRYVISIL:TC09:ALL-PROFILES",50) | |
selectionPV = PVUtil.createPV("loc://profile_selection<VTable>", 50) | |
# get row number from selection PV, split until only index is left | |
profile_selection = int(PVUtil.getString(selectionPV).split(",")[0].split(" ")[1]) | |
# forward selected ramp to profile | |
profile_nr = PVUtil.createPV("loc://profile_nr<VLong>", 50) | |
PVUtil.writePV("loc://profile_nr<VLong>", profile_selection, 50) | |
# get the whole profile, extract selected ramp via selection number | |
profile = PVUtil.getString(profilePV).split("#")[profile_selection].split("?")[1] | |
profilename = PVUtil.getString(profilePV).split("#")[profile_selection].split("?")[0] | |
print profile | |
# forward selected profile to tc | |
PVUtil.writePV("CRYVISIL:TC09:AMOUNT-PROFILES", len(PVUtil.getString(profilePV).split("#")), 50) | |
PVUtil.writePV("CRYVISIL:TC09:RUNNINGPROFILE", profile, 50) | |
PVUtil.writePV("loc://runningprofile<Vstring>", profilename, 50) | |
print "SET ACTIVE!" | |
# let tc execute selected profile | |
PVUtil.writePV("CRYVISIL:TC09:CONTROL:ACTIVE", 1, 50) | |
]]></text> | |
</script> | |
<description>Execute selected</description> | |
</action> | |
<action type="open_display"> | |
<file>profile_visualisation.bob</file> | |
<target>window</target> | |
<description>Open Visualisation</description> | |
</action> | |
<action type="execute"> | |
<script file="EmbeddedPy"> | |
<text><![CDATA[# Embedded python script | |
from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil | |
from jarray import array | |
import jarray | |
import time | |
# widget.setPropertyValue('text', PVUtil.getString(pvs[0])) | |
#PV's | |
pvx = PVUtil.createPV("CRYVISIL:TC09:CONTROL:time2" ,5000) | |
pvy1 = PVUtil.createPV("CRYVISIL:TC09:CONTROL:Power" ,5000) | |
pvy2 = PVUtil.createPV("CRYVISIL:TC09:CONTROL:Rate" ,5000) | |
pvy3 = PVUtil.createPV("CRYVISIL:TC09:CONTROL:Temperature" ,5000) | |
controlpv = PVUtil.createPV("CRYVISIL:TC09:CONTROL:ACTIVE" ,5000) | |
ramptypepv = PVUtil.createPV("CRYVISIL:TC09:EDIT:RAMP-TYPE" ,5000) | |
ramp_nr = PVUtil.createPV("loc://ramp_nr",10) | |
xaxis = PVUtil.createPV("loc://array_xxVDoubleArray" ,5000) | |
yaxis = PVUtil.createPV("loc://array_yyVDoubleArray" ,5000) | |
#Values | |
control = PVUtil.getLong(controlpv) | |
x = [] | |
y = [] | |
while control == 1: | |
control = PVUtil.getLong(controlpv) | |
ramptype = PVUtil.getLong(ramptypepv) | |
#ramp_nr = PVUtil.getLong(ramp_nr) -unnecessary- | |
if ramptype == 0 or ramptype ==1 or ramptype == 2: | |
xvalue = PVUtil.getDouble(pvx) | |
x.append(xvalue) | |
PVUtil.writePV("loc://array_xxVDoubleArray" ,x ,200) | |
yvalue = PVUtil.getDouble(pvy1) | |
y.append(yvalue) | |
PVUtil.writePV("loc://array_yyVDoubleArray" ,y ,200) | |
time.sleep(0.1) | |
if ramptype == 3 or ramptype == 5 or ramptype == 6 or ramptype == 7: | |
xvalue = PVUtil.getDouble(pvx) | |
x.append(xvalue) | |
PVUtil.writePV("loc://array_xxVDoubleArray" ,x ,200) | |
yvalue = PVUtil.getDouble(pvy2) | |
y.append(yvalue) | |
PVUtil.writePV("loc://array_yyVDoubleArray" ,y ,200) | |
time.sleep(0.1) | |
if ramptype == 4 or ramptype == 8: | |
xvalue = PVUtil.getVDouble(pvx) | |
x.append(xvalue) | |
PVUtil.writePV("loc://array_xxVDoubleArray" ,x ,200) | |
yvalue = PVUtil.getVDouble(pvy3) | |
y.append(yvalue) | |
PVUtil.writePV("loc://array_yyVDoubleArray" ,y ,200) | |
time.sleep(0.1) | |
]]></text> | |
</script> | |
<description>Execute Visualisation</description> | |
</action> | |
</actions> | |
<text>Execute selected</text> | |
<x>19</x> | |
<y>189</y> | |
<width>150</width> | |
<tooltip>$(actions)</tooltip> | |
</widget> | |
</widget> | |
</display> |