diff --git a/db/EMU_BUFF_CHAN.template b/db/EMU_BUFF_CHAN.template index ef8a0ecbea13046aa54c86c5d1c168ef4adf6bc9..3ea024d8031d6f3d64989609b687229809c58695 100644 --- a/db/EMU_BUFF_CHAN.template +++ b/db/EMU_BUFF_CHAN.template @@ -5,13 +5,24 @@ record(compress, "$(DEVICE):BUFF-$(SIGNAL)-COMP") { field(INP,"$(DEVICE):$(SIGNAL)-COMP CPP") } - ## Reset buffer -record(bo,$(DEVICE):BUFF-$(SIGNAL)-COMP-RES){ +record(bo,$(DEVICE):BUFF-$(SIGNAL)-RES-BUFF){ + field(DOL,"$(MTRREC) CPP") + field(OUT,"$(DEVICE):BUFF-$(SIGNAL)-COMP.RES PP") +} + +## Reset buffer START +record(bo,$(DEVICE):BUFF-$(SIGNAL)-RES-BUFF){ field(DOL,"$(MTRREC) CPP") field(OUT,"$(DEVICE):BUFF-$(SIGNAL)-COMP.RES PP") } +## Reset +record(bo,$(DEVICE):BUFF-$(SIGNAL)-RES-WF){ + field(OUT,"$(DEVICE):BUFF-$(SIGNAL)-COMP.RES PP") + field(HIGH,"2") +} + ## WAVEFORM FINAL record(waveform, "$(DEVICE):BUFF-$(SIGNAL2)") { field(FTVL, "FLOAT") @@ -49,6 +60,11 @@ record(aSub, "$(DEVICE):BUFF-$(SIGNAL)-FUNC") { field(FTE, "LONG") field(NOE, "1") field(INPE, "$(DEVICE):$(SCAN_SLIT).NPTS") + +## Reset + field(FTF, "LONG") + field(NOF, "1") + field(INPF, "$(DEVICE):BUFF-$(SIGNAL)-RES-WF CPP") ######### OUTPUTS ######### ## ANGLE Waveform converted in MRAD (to save) @@ -59,3 +75,4 @@ record(aSub, "$(DEVICE):BUFF-$(SIGNAL)-FUNC") { ######### FUNCTION ####### field(SNAM, "CREATE_TAB") } + diff --git a/opi/EMU.opi b/opi/EMU.opi index 1c5b9f786ae36d6cbe04848355a1dd3ead6543af..ac28a497299e1fe0a52f551f0a491e5231855508 100644 --- a/opi/EMU.opi +++ b/opi/EMU.opi @@ -1202,8 +1202,8 @@ $(pv_value)</tooltip> <background_color> <color name="Major" red="255" green="0" blue="0" /> </background_color> - <width>91</width> - <x>48</x> + <width>79</width> + <x>138</x> <name>Abort Scan</name> <y>1056</y> <style>0</style> @@ -1235,7 +1235,7 @@ $(pv_value)</tooltip> <enabled>true</enabled> <wuid>1e771979:1565068c2e3:-2a01</wuid> <pv_value /> - <text>Start scan</text> + <text>START</text> <scripts /> <border_alarm_sensitive>false</border_alarm_sensitive> <height>55</height> @@ -1256,8 +1256,8 @@ $(pv_value)</tooltip> <background_color> <color name="IO Button" red="178" green="178" blue="178" /> </background_color> - <width>139</width> - <x>180</x> + <width>79</width> + <x>240</x> <name>Start Scan</name> <y>1056</y> <style>0</style> @@ -1270,7 +1270,7 @@ $(pv_value)</tooltip> <value>1</value> <timeout>10</timeout> <confirm_message></confirm_message> - <description>Start Scan</description> + <description>Start SCAN</description> </action> </actions> <font> @@ -2340,7 +2340,7 @@ $(pv_value)</tooltip> <color name="IO Background" red="255" green="255" blue="205" /> </background_color> <width>151</width> - <x>12</x> + <x>25</x> <name>Label Orientation_7</name> <y>132</y> <foreground_color> @@ -2455,7 +2455,7 @@ $(pv_value)</tooltip> </background_color> <width>100</width> <x>186</x> - <y>174</y> + <y>240</y> <maximum>1.7976931348623157E308</maximum> <foreground_color> <color name="Green On" red="0" green="255" blue="0" /> @@ -2494,9 +2494,9 @@ $(pv_value)</tooltip> <color name="IO Background" red="255" green="255" blue="205" /> </background_color> <width>172</width> - <x>6</x> + <x>15</x> <name>Label Orientation_1</name> - <y>180</y> + <y>246</y> <foreground_color> <color name="IO Foreground" red="0" green="0" blue="0" /> </foreground_color> @@ -2550,7 +2550,7 @@ $(pv_value)</tooltip> <width>70</width> <x>201</x> <name>Byte Monitor Template</name> - <y>264</y> + <y>402</y> <foreground_color> <color name="IO InputPV Fg" red="0" green="32" blue="92" /> </foreground_color> @@ -2590,7 +2590,7 @@ $(pv_value)</tooltip> <width>83</width> <x>52</x> <name>Label_164</name> - <y>268</y> + <y>406</y> <foreground_color> <color red="0" green="0" blue="0" /> </foreground_color> @@ -2630,7 +2630,7 @@ $(pv_value)</tooltip> <width>83</width> <x>52</x> <name>Label_164</name> - <y>309</y> + <y>448</y> <foreground_color> <color red="0" green="0" blue="0" /> </foreground_color> @@ -2684,7 +2684,7 @@ $(pv_value)</tooltip> <width>70</width> <x>201</x> <name>Byte Monitor Template</name> - <y>305</y> + <y>444</y> <foreground_color> <color name="IO InputPV Fg" red="0" green="32" blue="92" /> </foreground_color> @@ -2738,7 +2738,7 @@ $(pv_value)</tooltip> <width>70</width> <x>201</x> <name>Byte Monitor Template</name> - <y>347</y> + <y>330</y> <foreground_color> <color name="IO InputPV Fg" red="0" green="32" blue="92" /> </foreground_color> @@ -2778,7 +2778,7 @@ $(pv_value)</tooltip> <width>133</width> <x>30</x> <name>Label_164</name> - <y>351</y> + <y>334</y> <foreground_color> <color red="0" green="0" blue="0" /> </foreground_color> @@ -2834,7 +2834,7 @@ $(pv_value)</tooltip> </background_color> <width>100</width> <x>186</x> - <y>222</y> + <y>288</y> <maximum>1.7976931348623157E308</maximum> <foreground_color> <color name="Green On" red="0" green="255" blue="0" /> @@ -2875,7 +2875,7 @@ $(pv_value)</tooltip> <width>166</width> <x>12</x> <name>Label Orientation_1</name> - <y>228</y> + <y>294</y> <foreground_color> <color name="IO Foreground" red="0" green="0" blue="0" /> </foreground_color> @@ -2929,7 +2929,7 @@ $(pv_value)</tooltip> <width>70</width> <x>201</x> <name>Byte Monitor Template</name> - <y>390</y> + <y>366</y> <foreground_color> <color name="IO InputPV Fg" red="0" green="32" blue="92" /> </foreground_color> @@ -2947,7 +2947,7 @@ $(pv_value)</tooltip> <wuid>59fc39f9:158487e5950:-33a6</wuid> <transparent>true</transparent> <auto_size>false</auto_size> - <text>Motor placed</text> + <text>Motor is placed</text> <scripts /> <height>20</height> <border_width>1</border_width> @@ -2966,10 +2966,10 @@ $(pv_value)</tooltip> <background_color> <color red="255" green="255" blue="255" /> </background_color> - <width>96</width> - <x>52</x> + <width>110</width> + <x>38</x> <name>Label_164</name> - <y>394</y> + <y>370</y> <foreground_color> <color red="0" green="0" blue="0" /> </foreground_color> @@ -2978,6 +2978,236 @@ $(pv_value)</tooltip> <opifont.name fontName="OpenSans" height="10" style="1">Small Bold</opifont.name> </font> </widget> + <widget typeId="org.csstudio.opibuilder.widgets.Label" version="1.0.0"> + <border_style>0</border_style> + <tooltip></tooltip> + <horizontal_alignment>1</horizontal_alignment> + <rules /> + <enabled>true</enabled> + <wuid>59fc39f9:158487e5950:-26fe</wuid> + <transparent>true</transparent> + <auto_size>false</auto_size> + <text>HV is ramping ...</text> + <scripts /> + <height>20</height> + <border_width>1</border_width> + <scale_options> + <width_scalable>true</width_scalable> + <height_scalable>true</height_scalable> + <keep_wh_ratio>false</keep_wh_ratio> + </scale_options> + <visible>true</visible> + <vertical_alignment>1</vertical_alignment> + <border_color> + <color red="0" green="128" blue="255" /> + </border_color> + <widget_type>Label</widget_type> + <wrap_words>false</wrap_words> + <background_color> + <color red="255" green="255" blue="255" /> + </background_color> + <width>196</width> + <x>6</x> + <name>Label_164</name> + <y>178</y> + <foreground_color> + <color red="0" green="0" blue="0" /> + </foreground_color> + <actions hook="false" hook_all="false" /> + <font> + <opifont.name fontName="OpenSans" height="10" style="1">Small Bold</opifont.name> + </font> + </widget> + <widget typeId="org.csstudio.opibuilder.widgets.bytemonitor" version="1.0.0"> + <border_style>0</border_style> + <forecolor_alarm_sensitive>false</forecolor_alarm_sensitive> + <alarm_pulsing>false</alarm_pulsing> + <tooltip>$(pv_name) +$(pv_value)</tooltip> + <rules /> + <effect_3d>true</effect_3d> + <enabled>true</enabled> + <wuid>59fc39f9:158487e5950:-26ff</wuid> + <on_color> + <color name="Major" red="255" green="0" blue="0" /> + </on_color> + <horizontal>false</horizontal> + <pv_value /> + <numBits>1</numBits> + <scripts /> + <border_alarm_sensitive>true</border_alarm_sensitive> + <height>28</height> + <border_width>0</border_width> + <scale_options> + <width_scalable>true</width_scalable> + <height_scalable>true</height_scalable> + <keep_wh_ratio>false</keep_wh_ratio> + </scale_options> + <visible>true</visible> + <pv_name>${PREFIX_SCAN}:$(NAME_PS).BUSY</pv_name> + <border_color> + <color name="IO Border" red="215" green="215" blue="215" /> + </border_color> + <bitReverse>true</bitReverse> + <label /> + <widget_type>Byte Monitor</widget_type> + <off_color> + <color name="IO Grid" red="215" green="215" blue="215" /> + </off_color> + <backcolor_alarm_sensitive>false</backcolor_alarm_sensitive> + <background_color> + <color name="IO Background" red="255" green="255" blue="205" /> + </background_color> + <square_led>true</square_led> + <startBit>0</startBit> + <width>70</width> + <x>201</x> + <name>Byte Monitor Template</name> + <y>174</y> + <foreground_color> + <color name="IO InputPV Fg" red="0" green="32" blue="92" /> + </foreground_color> + <actions hook="false" hook_all="false" /> + <font> + <opifont.name fontName="arial" height="10" style="0">IO Normal</opifont.name> + </font> + </widget> + <widget typeId="org.csstudio.opibuilder.widgets.Rectangle" version="1.0.0"> + <border_style>0</border_style> + <forecolor_alarm_sensitive>false</forecolor_alarm_sensitive> + <line_width>4</line_width> + <horizontal_fill>true</horizontal_fill> + <alarm_pulsing>false</alarm_pulsing> + <tooltip>$(pv_name) +$(pv_value)</tooltip> + <rules> + <rule name="Visible" prop_id="visible" out_exp="false"> + <exp bool_exp="pv0==1"> + <value>true</value> + </exp> + <exp bool_exp="pv0==0"> + <value>false</value> + </exp> + <pv trig="true">${PREFIX_SCAN}:$(NAME_PS).BUSY</pv> + </rule> + </rules> + <enabled>true</enabled> + <wuid>59fc39f9:158487e5950:-2314</wuid> + <transparent>true</transparent> + <pv_value /> + <alpha>255</alpha> + <bg_gradient_color> + <color red="255" green="255" blue="255" /> + </bg_gradient_color> + <scripts /> + <border_alarm_sensitive>false</border_alarm_sensitive> + <height>207</height> + <border_width>1</border_width> + <scale_options> + <width_scalable>true</width_scalable> + <height_scalable>true</height_scalable> + <keep_wh_ratio>false</keep_wh_ratio> + </scale_options> + <visible>true</visible> + <pv_name>${PREFIX_SCAN}:$(NAME_PS).BUSY</pv_name> + <gradient>false</gradient> + <border_color> + <color name="Major" red="255" green="0" blue="0" /> + </border_color> + <anti_alias>true</anti_alias> + <line_style>0</line_style> + <widget_type>Rectangle</widget_type> + <fg_gradient_color> + <color red="255" green="255" blue="255" /> + </fg_gradient_color> + <backcolor_alarm_sensitive>false</backcolor_alarm_sensitive> + <background_color> + <color name="Major" red="255" green="0" blue="0" /> + </background_color> + <width>295</width> + <x>12</x> + <name>Rectangle</name> + <y>4</y> + <fill_level>0.0</fill_level> + <foreground_color> + <color red="255" green="0" blue="0" /> + </foreground_color> + <actions hook="false" hook_all="false" /> + <font> + <opifont.name fontName="Cantarell" height="11" style="0">Default</opifont.name> + </font> + <line_color> + <color name="Major" red="255" green="0" blue="0" /> + </line_color> + </widget> + <widget typeId="org.csstudio.opibuilder.widgets.Rectangle" version="1.0.0"> + <border_style>0</border_style> + <forecolor_alarm_sensitive>false</forecolor_alarm_sensitive> + <line_width>4</line_width> + <horizontal_fill>true</horizontal_fill> + <alarm_pulsing>false</alarm_pulsing> + <tooltip>$(pv_name) +$(pv_value)</tooltip> + <rules> + <rule name="Visible" prop_id="visible" out_exp="false"> + <exp bool_exp="pv0==1"> + <value>true</value> + </exp> + <exp bool_exp="pv0==0"> + <value>false</value> + </exp> + <pv trig="true">PMAC:MTR1.MOVN</pv> + </rule> + </rules> + <enabled>true</enabled> + <wuid>59fc39f9:158487e5950:-2172</wuid> + <transparent>true</transparent> + <pv_value /> + <alpha>255</alpha> + <bg_gradient_color> + <color red="255" green="255" blue="255" /> + </bg_gradient_color> + <scripts /> + <border_alarm_sensitive>false</border_alarm_sensitive> + <height>253</height> + <border_width>1</border_width> + <scale_options> + <width_scalable>true</width_scalable> + <height_scalable>true</height_scalable> + <keep_wh_ratio>false</keep_wh_ratio> + </scale_options> + <visible>true</visible> + <pv_name>PMAC:MTR1.MOVN</pv_name> + <gradient>false</gradient> + <border_color> + <color name="Major" red="255" green="0" blue="0" /> + </border_color> + <anti_alias>true</anti_alias> + <line_style>0</line_style> + <widget_type>Rectangle</widget_type> + <fg_gradient_color> + <color red="255" green="255" blue="255" /> + </fg_gradient_color> + <backcolor_alarm_sensitive>false</backcolor_alarm_sensitive> + <background_color> + <color name="Major" red="255" green="0" blue="0" /> + </background_color> + <width>295</width> + <x>12</x> + <name>Rectangle_1</name> + <y>228</y> + <fill_level>0.0</fill_level> + <foreground_color> + <color red="255" green="0" blue="0" /> + </foreground_color> + <actions hook="false" hook_all="false" /> + <font> + <opifont.name fontName="Cantarell" height="11" style="0">Default</opifont.name> + </font> + <line_color> + <color name="Major" red="255" green="0" blue="0" /> + </line_color> + </widget> </widget> </widget> <widget typeId="org.csstudio.opibuilder.widgets.Label" version="1.0.0"> @@ -3808,14 +4038,7 @@ $(pv_value)</tooltip> <alarm_pulsing>false</alarm_pulsing> <tooltip>$(pv_name)</tooltip> <push_action_index>0</push_action_index> - <rules> - <rule name="enable" prop_id="enabled" out_exp="false"> - <exp bool_exp="pv0 == 1"> - <value>false</value> - </exp> - <pv trig="true">$(P)_$(M):V_BRAKE_GET</pv> - </rule> - </rules> + <rules /> <enabled>true</enabled> <wuid>-16429ab9:1582e68df9a:-3721</wuid> <pv_value /> @@ -3927,14 +4150,7 @@ $(pv_value)</tooltip> <alarm_pulsing>false</alarm_pulsing> <tooltip>$(pv_name)</tooltip> <push_action_index>0</push_action_index> - <rules> - <rule name="enable" prop_id="enabled" out_exp="false"> - <exp bool_exp="pv0 == 1"> - <value>false</value> - </exp> - <pv trig="true">$(P)_$(M):V_BRAKE_GET</pv> - </rule> - </rules> + <rules /> <enabled>true</enabled> <wuid>-16429ab9:158444d4181:-720b</wuid> <pv_value /> @@ -4187,6 +4403,59 @@ $(pv_value)</tooltip> <opifont.name fontName="Cantarell" height="11" style="1">Default Bold</opifont.name> </font> </widget> + <widget typeId="org.csstudio.opibuilder.widgets.ActionButton" version="2.0.0"> + <toggle_button>false</toggle_button> + <border_style>0</border_style> + <forecolor_alarm_sensitive>false</forecolor_alarm_sensitive> + <alarm_pulsing>false</alarm_pulsing> + <tooltip>$(pv_name)</tooltip> + <push_action_index>0</push_action_index> + <rules /> + <enabled>true</enabled> + <wuid>59fc39f9:158487e5950:-16e5</wuid> + <pv_value /> + <text>Reset</text> + <scripts /> + <border_alarm_sensitive>false</border_alarm_sensitive> + <height>36</height> + <border_width>1</border_width> + <scale_options> + <width_scalable>true</width_scalable> + <height_scalable>true</height_scalable> + <keep_wh_ratio>false</keep_wh_ratio> + </scale_options> + <image></image> + <visible>true</visible> + <pv_name></pv_name> + <border_color> + <color name="Blue" red="0" green="128" blue="255" /> + </border_color> + <widget_type>Action Button</widget_type> + <backcolor_alarm_sensitive>false</backcolor_alarm_sensitive> + <background_color> + <color name="Button Grey" red="180" green="180" blue="180" /> + </background_color> + <width>72</width> + <x>48</x> + <name>Action Button_1</name> + <y>1066</y> + <style>0</style> + <foreground_color> + <color name="Black" red="0" green="0" blue="0" /> + </foreground_color> + <actions hook="false" hook_all="false"> + <action type="WRITE_PV"> + <pv_name>SCAN:BUFF-DET1-RES-WF</pv_name> + <value>1</value> + <timeout>10</timeout> + <confirm_message></confirm_message> + <description></description> + </action> + </actions> + <font> + <opifont.name fontName="Cantarell" height="11" style="1">Default Bold</opifont.name> + </font> + </widget> </widget> <widget typeId="org.csstudio.opibuilder.widgets.groupingContainer" version="1.0.0"> <border_style>0</border_style> diff --git a/src/EMU_CALCULS.c b/src/EMU_CALCULS.c index 46a450c5baef7e2fd25300cf83d73a5fe3fedb9f..f8e605180e8148b84da7eccc382bec93a0456327 100644 --- a/src/EMU_CALCULS.c +++ b/src/EMU_CALCULS.c @@ -74,13 +74,24 @@ static int CREATE_TAB(aSubRecord *precord) { long mtr_cpt = *(long *)precord->c; //Motor compter long nbAngle = *(long *)precord->d; // Nb Angle long nbPosition = *(long *)precord->e; // Nb position - int nelmComp = precord->nova; - int nelm = precord->novb; + long reset = *(long *)precord->f; // Reset + int nelmComp = precord->noa; + int nelm = precord->nob; float *ptr_WF_OUT=(float*)(precord->vala); int i; int cpt_for=0.0; - float val1; - float val2; + + /***** RESET DATA ******/ + if(reset==1) + { + for (i = 0 ; i < nelm; ++i) + { + *ptr_WF_OUT=0.0; + ptr_WF_OUT++; + } + printf("RESET"); + return 0; + } /***** REFILL old DATA ******/ if(mtr_cpt>1) @@ -117,3 +128,23 @@ static int CREATE_TAB(aSubRecord *precord) { } /* Note the function must be registered at the end. */ epicsRegisterFunction(CREATE_TAB); + + +/* +* This function allows to initiliaze the waveform for X' (ANGLE) and Y(CURRENT) +*/ +static int INIT_TAB(aSubRecord *precord) { + + int nelm = precord->nova; + float *ptr_WF_OUT=(float*)(precord->vala); + int i; + + for (i = 0 ; i < nelm; ++i) + { + *ptr_WF_OUT=0.0; + ptr_WF_OUT++; + } + return 0; +} +/* Note the function must be registered at the end. */ +epicsRegisterFunction(INIT_TAB); diff --git a/src/EMU_RAMP-CURRENT.st b/src/EMU_RAMP-CURRENT.st index 02664ec71bf27700a3edca80dfb1eea2a6ebaefb..5b2f26d998401adc2ffb99b5ba81b0cff2f61857 100644 --- a/src/EMU_RAMP-CURRENT.st +++ b/src/EMU_RAMP-CURRENT.st @@ -55,9 +55,9 @@ ss ss1 { when(efTestAndClear(PS2_Cons_flag)) { - if((PS2_Cons<limitCurr) && (PS2_Cons>-limitCurr)){FCCurr_Cons= 3;} + if((PS2_Cons<limitCurr) && (PS2_Cons>-limitCurr)){FCCurr_Cons= 5+(rand() * 0.000000001);} else{ - %%FCCurr_Cons= 0; + %%FCCurr_Cons= rand() * 0.000000001; } pvPut(FCCurr_Cons); }state ramp diff --git a/startup/EMU.cmd b/startup/EMU.cmd index 0190c6a708e4a62367ce1574f652591886417ed0..dc21f8aa117c628de4c3b951ec0ea4a2422aaffe 100644 --- a/startup/EMU.cmd +++ b/startup/EMU.cmd @@ -208,3 +208,7 @@ dbpf SCAN:PROC-AngleMin-SP -80 dbpf $(SCANPREFIX):$(SCAN_EF).NPTS 11 dbpf $(SCANPREFIX):$(SCAN_EF).PDLY 0.5 + + +dbpf SCAN:PROC-SIMU 1 +