From eea3f10d985446123cafb4db0fcc434752444c61 Mon Sep 17 00:00:00 2001 From: Thierry Zamofing Date: Tue, 18 Sep 2018 11:05:44 +0200 Subject: [PATCH] add EVR subs file --- Readme.md | 14 ++ evr_PCIe-300DC.subs | 471 ++++++++++++++++++++++++++++++++++++++++++++ python/PBTuning.py | 81 +++++--- qt/ESB_MX_exp.ui | 42 ++++ 4 files changed, 583 insertions(+), 25 deletions(-) create mode 100644 evr_PCIe-300DC.subs diff --git a/Readme.md b/Readme.md index f5384d9..260d889 100644 --- a/Readme.md +++ b/Readme.md @@ -1001,3 +1001,17 @@ k*1/(1+T1*s+t2*s^2) ``` +EVR +--- +``` +check git modules: +mrfioc2 -> EVR config +PB_BSREAD -> sample how to configure user Flags + +Gate3[1].Chan[0].UserFlag -> is set to 0 when event triggered (mapped to output FronUnivOut4 in the EVR) + + +``` + + + diff --git a/evr_PCIe-300DC.subs b/evr_PCIe-300DC.subs new file mode 100644 index 0000000..65de843 --- /dev/null +++ b/evr_PCIe-300DC.subs @@ -0,0 +1,471 @@ +file "$(mrfioc2_TEMPLATES=db)/evr-pcie-300DC.db" +{ + { + + ## Global settings + ExtInhib-Sel=0, #0 = Use Inhibit, 1 = Always permitt : Use HW trigger inhibit (EVRTG only) + Link-Clk-SP=142.8, #50-150 : Event Link speed (MHz) + Time-Src-Sel=0, #0 = Event clk, 1 = Mapped codes, 2 = DBus4 : Source for timestamping clock. + Time-Clock-SP=0.0, #50-150 : Timestamp tick rate (MHz) + PLL-Bandwidth-Sel=4, #0 = HM, 1 = HL, 2 = MH, 3 = MM, 4 = ML: PLL Bandwidth Select (see Silicon Labs Si5317 datasheet) + + ## Delay compensation + DlyCompensation-Enabled-Sel=1, #0 = Disabled, 1 = Enabled: Enables or disables delay compensation + DlyCompensation-Target-SP=5000, # Delay compensation value in [ns]. Should be set to max(path + someDelta) of all receivers in the timing system. This value can also be retrieved from an external record (see macro below). + DlyCompensation-Source="SIN-TIMAST-TMA:EvrDC-SP CP", # delay compensation target value is sourced from the record referenced here. + # this value must be set the same for all EVRs in the timing network. This is why we have a single record which acts as a source for all EVRs in the same timing network. + # NOTE: The value of DlyCompensation-Source needs to include CP to ensure the value is updated when the source changes. + # The CP can not be hidden in the template file because this would lead to an invalid input link CP when no substitution value for DlyCompensation-Source is provided. + # Recommended setting for SwissFEL is SIN-TIMAST-TMA:EvrDC-SP CP + DlyCompensation-Source-Disa=0, #0 = Enabled, 1 = Disabled: enables or disables sourcing the delay compensation target value from record specified with 'DlyCompensation-Source' macro + + ## Prescalers + PS0-Div-SP=2, #2-4294967295 :Integer divisor between the Event Clock and the sub-unit output. + PS0-PulserMap-L-SP=0, #0-65535 :Trigger a pulser on prescaler rising edge. Pulsers 0-15 are bit-wise selectable + PS0-PulserMap-H-SP=0, #0-255 :Trigger a pulser on prescaler rising edge. Pulsers 16-23 are bit-wise selectable + PS1-Div-SP=2, #2-4294967295 :Integer divisor between the Event Clock and the sub-unit output. + PS1-PulserMap-L-SP=0, #0-65535 :Trigger a pulser on prescaler rising edge. Pulsers 0-15 are bit-wise selectable + PS1-PulserMap-H-SP=0, #0-255 :Trigger a pulser on prescaler rising edge. Pulsers 16-23 are bit-wise selectable + PS2-Div-SP=2, #2-4294967295 :Integer divisor between the Event Clock and the sub-unit output. + PS2-PulserMap-L-SP=0, #0-65535 :Trigger a pulser on prescaler rising edge. Pulsers 0-15 are bit-wise selectable + PS2-PulserMap-H-SP=0, #0-255 :Trigger a pulser on prescaler rising edge. Pulsers 16-23 are bit-wise selectable + PS3-Div-SP=2, #2-4294967295 :Integer divisor between the Event Clock and the sub-unit output. + PS3-PulserMap-L-SP=0, #0-65535 :Trigger a pulser on prescaler rising edge. Pulsers 0-15 are bit-wise selectable + PS3-PulserMap-H-SP=0, #0-255 :Trigger a pulser on prescaler rising edge. Pulsers 16-23 are bit-wise selectable + PS4-Div-SP=2, #2-4294967295 :Integer divisor between the Event Clock and the sub-unit output. + PS4-PulserMap-L-SP=0, #0-65535 :Trigger a pulser on prescaler rising edge. Pulsers 0-15 are bit-wise selectable + PS4-PulserMap-H-SP=0, #0-255 :Trigger a pulser on prescaler rising edge. Pulsers 16-23 are bit-wise selectable + PS5-Div-SP=2, #2-4294967295 :Integer divisor between the Event Clock and the sub-unit output. + PS5-PulserMap-L-SP=0, #0-65535 :Trigger a pulser on prescaler rising edge. Pulsers 0-15 are bit-wise selectable + PS5-PulserMap-H-SP=0, #0-255 :Trigger a pulser on prescaler rising edge. Pulsers 16-23 are bit-wise selectable + PS6-Div-SP=2, #2-4294967295 :Integer divisor between the Event Clock and the sub-unit output. + PS6-PulserMap-L-SP=0, #0-65535 :Trigger a pulser on prescaler rising edge. Pulsers 0-15 are bit-wise selectable + PS6-PulserMap-H-SP=0, #0-255 :Trigger a pulser on prescaler rising edge. Pulsers 16-23 are bit-wise selectable + PS7-Div-SP=2, #2-4294967295 :Integer divisor between the Event Clock and the sub-unit output. + PS7-PulserMap-L-SP=0, #0-65535 :Trigger a pulser on prescaler rising edge. Pulsers 0-15 are bit-wise selectable + PS7-PulserMap-H-SP=0, #0-255 :Trigger a pulser on prescaler rising edge. Pulsers 16-23 are bit-wise selectable + + ## Distributed bus + PulserMap-Dbus0-SP=0, #0-16777215 :Trigger a pulser on DBus bit rising edge. Pulsers 0-23 are bit-wise selectable + PulserMap-Dbus1-SP=0, #0-16777215 :Trigger a pulser on DBus bit rising edge. Pulsers 0-23 are bit-wise selectable + PulserMap-Dbus2-SP=0, #0-16777215 :Trigger a pulser on DBus bit rising edge. Pulsers 0-23 are bit-wise selectable + PulserMap-Dbus3-SP=0, #0-16777215 :Trigger a pulser on DBus bit rising edge. Pulsers 0-23 are bit-wise selectable + PulserMap-Dbus4-SP=0, #0-16777215 :Trigger a pulser on DBus bit rising edge. Pulsers 0-23 are bit-wise selectable + PulserMap-Dbus5-SP=0, #0-16777215 :Trigger a pulser on DBus bit rising edge. Pulsers 0-23 are bit-wise selectable + PulserMap-Dbus6-SP=0, #0-16777215 :Trigger a pulser on DBus bit rising edge. Pulsers 0-23 are bit-wise selectable + PulserMap-Dbus7-SP=0, #0-16777215 :Trigger a pulser on DBus bit rising edge. Pulsers 0-23 are bit-wise selectable + + + ## Pulsers + Pul0-Name-I="Pulser 0" #Description of the pulser. Maximum 40 characters allowed! + Pul0-Name-I.DESC="Pulse for WSC readout." #Secondary description of the pulser. Maximum 40 characters allowed! + Pul0-Ena-Sel=1, #0 = Disabled, 1 = Enabled + Pul0-Polarity-Sel=0, #0 = Active High, 1 = Active Low + Pul0-Delay-SP=0, #Pulser delay in us (DI 1 event at 5400, need to trigger for bunch at 7500) + Pul0-Width-SP=5000, #Pulser width in us + Pul0-Prescaler-SP=1, #0-65535 : Pulser prescaler + + Pul1-Name-I="Pulser 1" #Description of the pulser. Maximum 40 characters allowed! + Pul1-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! + Pul1-Ena-Sel=1, #0 = Disabled, 1 = Enabled + Pul1-Polarity-Sel=0, #0 = Active High, 1 = Active Low + Pul1-Delay-SP=0, #Pulser delay in us + Pul1-Width-SP=0, #Pulser width in us + Pul1-Prescaler-SP=1, #0-65535 : Pulser prescaler + + Pul2-Name-I="Pulser 2" #Description of the pulser. Maximum 40 characters allowed! + Pul2-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! + Pul2-Ena-Sel=1, #0 = Disabled, 1 = Enabled + Pul2-Polarity-Sel=0, #0 = Active High, 1 = Active Low + Pul2-Delay-SP=0, #Pulser delay in us + Pul2-Width-SP=0, #Pulser width in us + Pul2-Prescaler-SP=1, #0-65535 : Pulser prescaler + + Pul3-Name-I="Pulser 3" #Description of the pulser. Maximum 40 characters allowed! + Pul3-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! + Pul3-Ena-Sel=1, #0 = Disabled, 1 = Enabled + Pul3-Polarity-Sel=0, #0 = Active High, 1 = Active Low + Pul3-Delay-SP=0, #Pulser delay in us + Pul3-Width-SP=0, #Pulser width in us + Pul3-Prescaler-SP=1, #0-65535 : Pulser prescaler + + Pul4-Name-I="Pulser 4" #Description of the pulser. Maximum 40 characters allowed! + Pul4-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! + Pul4-Ena-Sel=1, #0 = Disabled, 1 = Enabled + Pul4-Polarity-Sel=0, #0 = Active High, 1 = Active Low + Pul4-Delay-SP=0, #Pulser delay in us + Pul4-Width-SP=0, #0-65535 : Width in us + + Pul5-Name-I="Pulser 5" #Description of the pulser. Maximum 40 characters allowed! + Pul5-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! + Pul5-Ena-Sel=1, #0 = Disabled, 1 = Enabled + Pul5-Polarity-Sel=0, #0 = Active High, 1 = Active Low + Pul5-Delay-SP=0, #Pulser delay in us + Pul5-Width-SP=0, #0-65535 : Width in us + + Pul6-Name-I="Pulser 6" #Description of the pulser. Maximum 40 characters allowed! + Pul6-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! + Pul6-Ena-Sel=1, #0 = Disabled, 1 = Enabled + Pul6-Polarity-Sel=0, #0 = Active High, 1 = Active Low + Pul6-Delay-SP=0, #Pulser delay in us + Pul6-Width-SP=0, #0-65535 : Width in us + + Pul7-Name-I="Pulser 7" #Description of the pulser. Maximum 40 characters allowed! + Pul7-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! + Pul7-Ena-Sel=1, #0 = Disabled, 1 = Enabled + Pul7-Polarity-Sel=0, #0 = Active High, 1 = Active Low + Pul7-Delay-SP=0, #Pulser delay in us + Pul7-Width-SP=0, #0-65535 : Width in us + + Pul8-Name-I="Pulser 8" #Description of the pulser. Maximum 40 characters allowed! + Pul8-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! + Pul8-Ena-Sel=1, #0 = Disabled, 1 = Enabled + Pul8-Polarity-Sel=0, #0 = Active High, 1 = Active Low + Pul8-Delay-SP=0, #Pulser delay in us + Pul8-Width-SP=0, #0-65535 : Width in us + + Pul9-Name-I="Pulser 9" #Description of the pulser. Maximum 40 characters allowed! + Pul9-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! + Pul9-Ena-Sel=1, #0 = Disabled, 1 = Enabled + Pul9-Polarity-Sel=0, #0 = Active High, 1 = Active Low + Pul9-Delay-SP=0, #Pulser delay in us + Pul9-Width-SP=0, #0-65535 : Width in us + + Pul10-Name-I="Pulser 10" #Description of the pulser. Maximum 40 characters allowed! + Pul10-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! + Pul10-Ena-Sel=1, #0 = Disabled, 1 = Enabled + Pul10-Polarity-Sel=0, #0 = Active High, 1 = Active Low + Pul10-Delay-SP=0, #Pulser delay in us + Pul10-Width-SP=0, #0-65535 : Width in us + + Pul11-Name-I="Pulser 11" #Description of the pulser. Maximum 40 characters allowed! + Pul11-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! + Pul11-Ena-Sel=1, #0 = Disabled, 1 = Enabled + Pul11-Polarity-Sel=0, #0 = Active High, 1 = Active Low + Pul11-Delay-SP=0, #Pulser delay in us + Pul11-Width-SP=0, #0-65535 : Width in us + + Pul12-Name-I="Pulser 12" #Description of the pulser. Maximum 40 characters allowed! + Pul12-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! + Pul12-Ena-Sel=1, #0 = Disabled, 1 = Enabled + Pul12-Polarity-Sel=0, #0 = Active High, 1 = Active Low + Pul12-Delay-SP=0, #Pulser delay in us + Pul12-Width-SP=0, #0-65535 : Width in us + + Pul13-Name-I="Pulser 13" #Description of the pulser. Maximum 40 characters allowed! + Pul13-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! + Pul13-Ena-Sel=1, #0 = Disabled, 1 = Enabled + Pul13-Polarity-Sel=0, #0 = Active High, 1 = Active Low + Pul13-Delay-SP=0, #Pulser delay in us + Pul13-Width-SP=0, #0-65535 : Width in us + + Pul14-Name-I="Pulser 14" #Description of the pulser. Maximum 40 characters allowed! + Pul14-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! + Pul14-Ena-Sel=1, #0 = Disabled, 1 = Enabled + Pul14-Polarity-Sel=0, #0 = Active High, 1 = Active Low + Pul14-Delay-SP=0, #Pulser delay in us + Pul14-Width-SP=0, #0-65535 : Width in us + + Pul15-Name-I="Pulser 15" #Description of the pulser. Maximum 40 characters allowed! + Pul15-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! + Pul15-Ena-Sel=1, #0 = Disabled, 1 = Enabled + Pul15-Polarity-Sel=0, #0 = Active High, 1 = Active Low + Pul15-Delay-SP=0, #Pulser delay in us + Pul15-Width-SP=0, #0-65535 : Width in us + + + ## Front panel outputs + # Available -Src-SP choices: + # 0 Pulser 0 + # 1 Pulser 1 + # 2 Pulser 2 + # 3 Pulser 3 + # 4 Pulser 4 + # 5 Pulser 5 + # 6 Pulser 6 + # 7 Pulser 7 + # 8 Pulser 8 + # 9 Pulser 9 + # 10 Pulser 10 + # 11 Pulser 11 + # 12 Pulser 12 + # 13 Pulser 13 + # 14 Pulser 14 + # 15 Pulser 15 + # 32 DBus 0 + # 33 DBus 1 + # 34 DBus 2 + # 35 DBus 3 + # 36 DBus 4 + # 37 DBus 5 + # 38 DBus 6 + # 39 Dbus 7 + # 40 Prescaler 0 + # 41 Prescaler 1 + # 42 Prescaler 2 + # 43 Prescaler 3 + # 44 Prescaler 4 + # 45 Prescaler 5 + # 46 Prescaler 6 + # 47 Prescaler 7 + # 63 Force Low + # 62 Force High + + + # Universal outputs + # Slot 0 + FrontUnivOut0-Name-I="" # Description of the output. Maximum 40 characters allowed! + FrontUnivOut0-Name-I.DESC="" # Secondary description of the output. Maximum 40 characters allowed! + FrontUnivOut0-Ena-SP=1, # Default to enabled + FrontUnivOut0-Src-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + FrontUnivOut0-Src2-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + + FrontUnivOut1-Name-I="" # Description of the output. Maximum 40 characters allowed! + FrontUnivOut1-Name-I.DESC="" # Secondary description of the output. Maximum 40 characters allowed! + FrontUnivOut1-Ena-SP=1, # Default to enabled + FrontUnivOut1-Src-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + FrontUnivOut1-Src2-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + + # Slot 1 + FrontUnivOut2-Name-I="" # Description of the output. Maximum 40 characters allowed! + FrontUnivOut2-Name-I.DESC="" # Secondary description of the output. Maximum 40 characters allowed! + FrontUnivOut2-Ena-SP=1, # Default to enabled + FrontUnivOut2-Src-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + FrontUnivOut2-Src2-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + + FrontUnivOut3-Name-I="" # Description of the output. Maximum 40 characters allowed! + FrontUnivOut3-Name-I.DESC="" # Secondary description of the output. Maximum 40 characters allowed! + FrontUnivOut3-Ena-SP=1, # Default to enabled + FrontUnivOut3-Src-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + FrontUnivOut3-Src2-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + + # Slot 2 + FrontUnivOut4-Name-I="" # Description of the output. Maximum 40 characters allowed! + FrontUnivOut4-Name-I.DESC="" # Secondary description of the output. Maximum 40 characters allowed! + FrontUnivOut4-Ena-SP=1, # Default to enabled + FrontUnivOut4-Src-SP=0, # Use pulser 0 which generates 5000 us long pulse + FrontUnivOut4-Src2-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + + FrontUnivOut5-Name-I="" # Description of the output. Maximum 40 characters allowed! + FrontUnivOut5-Name-I.DESC="" # Secondary description of the output. Maximum 40 characters allowed! + FrontUnivOut5-Ena-SP=1, # Default to enabled + FrontUnivOut5-Src-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + FrontUnivOut5-Src2-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + + # Slot 3 + FrontUnivOut6-Name-I="" # Description of the output. Maximum 40 characters allowed! + FrontUnivOut6-Name-I.DESC="" # Secondary description of the output. Maximum 40 characters allowed! + FrontUnivOut6-Ena-SP=1, # Default to enabled + FrontUnivOut6-Src-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + FrontUnivOut6-Src2-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + + FrontUnivOut7-Name-I="" # Description of the output. Maximum 40 characters allowed! + FrontUnivOut7-Name-I.DESC="" # Secondary description of the output. Maximum 40 characters allowed! + FrontUnivOut7-Ena-SP=1, # Default to enabled + FrontUnivOut7-Src-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + FrontUnivOut7-Src2-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + + # Slot 4 + FrontUnivOut8-Name-I="" # Description of the output. Maximum 40 characters allowed! + FrontUnivOut8-Name-I.DESC="" # Secondary description of the output. Maximum 40 characters allowed! + FrontUnivOut8-Ena-SP=1, # Default to enabled + FrontUnivOut8-Src-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + FrontUnivOut8-Src2-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + + FrontUnivOut9-Name-I="" # Description of the output. Maximum 40 characters allowed! + FrontUnivOut9-Name-I.DESC="" # Secondary description of the output. Maximum 40 characters allowed! + FrontUnivOut9-Ena-SP=1, # Default to enabled + FrontUnivOut9-Src-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + FrontUnivOut9-Src2-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + + # Slot 5 + FrontUnivOut10-Name-I="" # Description of the output. Maximum 40 characters allowed! + FrontUnivOut10-Name-I.DESC="" # Secondary description of the output. Maximum 40 characters allowed! + FrontUnivOut10-Ena-SP=1, # Default to enabled + FrontUnivOut10-Src-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + FrontUnivOut10-Src2-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + + FrontUnivOut11-Name-I="" # Description of the output. Maximum 40 characters allowed! + FrontUnivOut11-Name-I.DESC="" # Secondary description of the output. Maximum 40 characters allowed! + FrontUnivOut11-Ena-SP=1, # Default to enabled + FrontUnivOut11-Src-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + FrontUnivOut11-Src2-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + + # Slot 6 + FrontUnivOut12-Name-I="" # Description of the output. Maximum 40 characters allowed! + FrontUnivOut12-Name-I.DESC="" # Secondary description of the output. Maximum 40 characters allowed! + FrontUnivOut12-Ena-SP=1, # Default to enabled + FrontUnivOut12-Src-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + FrontUnivOut12-Src2-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + + FrontUnivOut13-Name-I="" # Description of the output. Maximum 40 characters allowed! + FrontUnivOut13-Name-I.DESC="" # Secondary description of the output. Maximum 40 characters allowed! + FrontUnivOut13-Ena-SP=1, # Default to enabled + FrontUnivOut13-Src-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + FrontUnivOut13-Src2-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + + # Slot 7 + FrontUnivOut14-Name-I="" # Description of the output. Maximum 40 characters allowed! + FrontUnivOut14-Name-I.DESC="" # Secondary description of the output. Maximum 40 characters allowed! + FrontUnivOut14-Ena-SP=1, # Default to enabled + FrontUnivOut14-Src-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + FrontUnivOut14-Src2-SP=63, # Defaults to Force low (if enabled -> Ena-SP) + + FrontUnivOut15-Name-I="" # Description of the output. Maximum 40 characters allowed! + FrontUnivOut15-Name-I.DESC="" # Secondary description of the output. Maximum 40 characters allowed! + FrontUnivOut15-Ena-SP=1, # Default to enabled + FrontUnivOut15-Src-SP=63 # Defaults to Force low (if enabled -> Ena-SP) + FrontUnivOut15-Src2-SP=63 # Defaults to Force low (if enabled -> Ena-SP) + + } + } + +## Mapping between hardware event code and a software (EPICS) database event +## In addition to firing an EPICS database event on each occurance of hardware event, a counter for the specific EVT is increased. +# +# Macros: +# SYS = System name (auto expanded by parent) +# DEVICE = Event receiver / timing card name (same as mrmEvrSetupVME()) Eg. EVR0. (auto expanded by parent) +# EVT = Event code (hardware). Set EVT=0 to disable. +# CODE = EPICS database event number (software) +# FLNK = If provided, forward links to the record after all records from this template are processed +# +file "$(mrfioc2_TEMPLATES=db)/evr-softEvent.template"{ +pattern { EVT, CODE, FLNK } + { "22", "22", "" } # ESA laser diag-1 + { "28", "28", "" } # BeamSync read-1 +} +# If you want to enable measuring the jitter on received events comment out the previous substitution and use this one instead +# +# Additinal macros: +# HIST_LEN = number of histogram bins created from frequency measurements. Default 200. +# HIST_ULIM = histogram upper limit. Default 12. +# HIST_LLIM = histogram lower limit. Default 8. +# +# NOTE: make sure your system supports the 'histogram' record before using this template! +# +#file "$(mrfioc2_TEMPLATES=db)/evr-softEvent-measure.template"{ +#pattern { EVT, CODE, FLNK } +# { "1", "1", "" } +# { "2", "2", "" } +# { "3", "3", "" } +#} + +## Mapping between hardware event code and a special function of the EVR +## Each event can be mapped only to one function! +## There are some default events, that allways trigger specific functions! +## Available functions: +## - Blink : An LED on the EVRs front panel will blink when the code is received. +## - Forward : The received code will be immediately retransmitted on the upstream event link. +## - Stop Log (default event 121): Freeze the circular event log buffer. An CPU interrupt will be raised which will cause the buffer to be downloaded. This might be a useful action to map to a fault event. +## - Log : Include this event code in the circular event log. +## - Heartbeat (default event 122): This event resets the heartbeat timeout timer. +## - Reset PS (default event 123): Resets the phase of all prescalers. +## - TS reset (default event 124): Transfers the seconds timestamp from the shift register and zeros the sub-seconds part. +## - TS tick (default event 125): When the timestamp source is 'Mapped code' then any event with this mapping will cause the sub-seconds part of the timestamp to increment. +## - Shift 1 (default event 113): Shifts the current value of the seconds timestamp shift register up by one bit and sets the low bit to 1. +## - Shift 0 (default event 112): Shifts the current value of the seconds timestamp shift register up by one bit and sets the low bit to 0. +## - FIFO : Bypass the automatic allocation mechanism and always include this code in the event FIFO. +# +# Macros: +# SYS = System name (auto expanded by parent) +# DEVICE = Event receiver / timing card name (same as mrmEvrSetupVME()) Eg. EVR0. (auto expanded by parent) +# EVT = Event code (hardware). Set EVNT=0 to disable. +# FUNC = Function to be mapped +# Choices are: "FIFO", "Latch TS", "Blink", "Forward", +# "Stop Log", "Log", "Heartbeat", "Reset PS", +# "TS reset", "TS tick", "Shift 1", "Shift 0", +# +file "$(mrfioc2_TEMPLATES=db)/evr-specialFunctionMap.template"{ +pattern { EVT, FUNC } + {"1", "Blink"} +} + +## Control for mapping a Pulser geneator to an event code in hardware. +## Each pulser-function combination can be mapped to multiple events. +## Available functions: +## - Trig : causes a received event to trigger a pulser. A Pulser based on pulser polarity, delay and width will be outputted. +## - Set : causes a received event to force a pulser into set state(based on pulser polarity). +## - Reset: causes a received event to force a pulser into reset state(based on pulser polarity). +# +## Pulser polarity defines the pulser set and reset state: +## - Active high: Output is logic high in set state and logic low in reset state +## - Active low: Output is logic low in set state and logic high in reset state +# +# Macros: +# SYS = system name (auto expanded by parent) +# DEVICE = Event receiver / timing card name (same as mrmEvrSetupVME()) Eg. EVR0. (auto expanded by parent) +# PID = Pulser ID # +# F = Pulser generator function +# Choices are: "Trig", "Set", "Reset" +# EVT = Initial event code +# ID = Mappings must have unique ID for each PID-F combination. +# Only mappings with ID=0 are displayed in the GUI +# +file "$(mrfioc2_TEMPLATES=db)/evr-pulserMap.template"{ +pattern {PID F, EVT, ID} + {0, Trig, 22, 0 } # ESA laser diag-1 + {1, Trig, 0, 0 } + {2, Trig, 0, 0 } + {3, Trig, 0, 0 } + {4, Trig, 0, 0 } + {5, Trig, 0, 0 } + {6, Trig, 0, 0 } + {7, Trig, 0, 0 } + {8, Trig, 0, 0 } + {9, Trig, 0, 0 } + {10, Trig, 0, 0 } + {11, Trig, 0, 0 } + {12, Trig, 0, 0 } + {13, Trig, 0, 0 } + {14, Trig, 0, 0 } + {15, Trig, 0, 0 } + + + {0, Set, 0, 0 } + {1, Set, 0, 0 } + {2, Set, 0, 0 } + {3, Set, 0, 0 } + {4, Set, 0, 0 } + {5, Set, 0, 0 } + {6, Set, 0, 0 } + {7, Set, 0, 0 } + {8, Set, 0, 0 } + {9, Set, 0, 0 } + {10, Set, 0, 0 } + {11, Set, 0, 0 } + {12, Set, 0, 0 } + {13, Set, 0, 0 } + {14, Set, 0, 0 } + {15, Set, 0, 0 } + + + {0, Reset, 0, 0 } + {1, Reset, 0, 0 } + {2, Reset, 0, 0 } + {3, Reset, 0, 0 } + {4, Reset, 0, 0 } + {5, Reset, 0, 0 } + {6, Reset, 0, 0 } + {7, Reset, 0, 0 } + {8, Reset, 0, 0 } + {9, Reset, 0, 0 } + {10, Reset, 0, 0 } + {11, Reset, 0, 0 } + {12, Reset, 0, 0 } + {13, Reset, 0, 0 } + {14, Reset, 0, 0 } + {15, Reset, 0, 0 } +} + +## Flash access support +## Uncomment this substitution to load records that expose read and write access to the flash chip on the device. +# +# Macros: +# SYS = System name (auto expanded by parent) +# DEVICE = Event receiver / timing card name (same as mrmEvrSetupVME()) Eg. EVR0. (auto expanded by parent) +# +#file "$(mrfioc2_TEMPLATES=db)/flash.template" +#{ +# {} +#} diff --git a/python/PBTuning.py b/python/PBTuning.py index 3e58a85..af05d36 100755 --- a/python/PBTuning.py +++ b/python/PBTuning.py @@ -80,6 +80,23 @@ class PBTuning: self.data = np.genfromtxt(fnLoc, delimiter=' ') return self.data + def init_stage(self): + args=self.args + host=args.host + gpasciiCommander='/home/zamofing_t/scripts/gpasciiCommander' + cmd=(gpasciiCommander ,'--host',host,'--cmd','enable plc1') + p = sprc.Popen(cmd, shell=False, stdin=sprc.PIPE, stdout=sprc.PIPE, stderr=sprc.PIPE) + retval = p.wait() + print(p.stderr.read());print(p.stdout.read()) + time.sleep(5) + cmd=(gpasciiCommander ,'--host',host,'--cmd','#1..2j=10000') + p = sprc.Popen(cmd, shell=False, stdin=sprc.PIPE, stdout=sprc.PIPE, stderr=sprc.PIPE) + retval = p.wait() + print(p.stderr.read());print(p.stdout.read()) + time.sleep(5) + + + def phase_amp(self,frq,rep): try: ax1=self.ax1 @@ -375,8 +392,8 @@ class PBTuning: den1 = np.poly1d([T1**2,2*T1*d1,1]) #first resonance frequency - f2=np.array([191,198]) - d2=np.array([.05,.05])#daempfung + f2=np.array([197,199]) + d2=np.array([.02,.02])#daempfung w2=f2*2*np.pi #rad/sec T2=1/w2 num2 = np.poly1d([T2[0]**2,2*T2[0]*d2[0],1]) @@ -412,8 +429,8 @@ class PBTuning: den1 = np.poly1d([T1**2,2*T1*d1,1]) #first resonance frequency - f2=np.array([57.8,63.8]) - d2=np.array([.06,.1])#daempfung + f2=np.array([57.8,61.8]) + d2=np.array([.05,.055])#daempfung w2=f2*2*np.pi #rad/sec T2=1/w2 num2 = np.poly1d([T2[0]**2,2*T2[0]*d2[0],1]) @@ -422,8 +439,8 @@ class PBTuning: #bode(mdl) #second resonance frequency - f3=np.array([130,141]) - d3=np.array([.05,.07])#daempfung + f3=np.array([138,151]) + d3=np.array([.04,.03])#daempfung w3=f3*2*np.pi #rad/sec T3=1/w3 num3 = np.poly1d([T3[0]**2,2*T3[0]*d3[0],1]) @@ -432,8 +449,8 @@ class PBTuning: #bode(mdl) #second resonance frequency - f4=np.array([405,415]) - d4=np.array([.02,.02])#daempfung + f4=np.array([410,417]) + d4=np.array([.015,.02])#daempfung w4=f4*2*np.pi #rad/sec T4=1/w4 num4 = np.poly1d([T4[0]**2,2*T4[0]*d4[0],1]) @@ -441,6 +458,12 @@ class PBTuning: #mdl= signal.lti(num3, den3) #num denum #bode(mdl) + f5=np.array([228,230]) + d5=np.array([.03,.03])#daempfung + w5=f5*2*np.pi #rad/sec + T5=1/w5 + num5 = np.poly1d([T5[0]**2,2*T5[0]*d5[0],1]) + den5 = np.poly1d([T5[1]**2,2*T5[1]*d5[1],1]) #current loop 2nd order approx @@ -453,8 +476,8 @@ class PBTuning: #mdl= signal.lti(num4, den4) #num denum #bode(mdl) - num=num1*num2*num3*num4*numc - den=den1*den2*den3*den4*denc + num=num1*num2*num3*num4*num5*numc + den=den1*den2*den3*den4*den5*denc mdl= signal.lti(num, den) #num denum bode(mdl) w=np.logspace(0,3,1000)*2*np.pi @@ -571,7 +594,6 @@ Examples:'''+''.join(map(lambda s:cmd+s, exampleCmd))+'\n ' mode=args.mode mot=args.mot if mode==1: - ol=True file=os.path.join(base,'sine_ol_mot%d.npz'%(mot)) #def bode_sine(self, openloop=True, motor=1, minFrq=1, maxFrq=300, numFrq=150, amp=10, file='/tmp/bode.npz'): tune.bode_sine(openloop=True,file=file,motor=mot) @@ -584,18 +606,25 @@ Examples:'''+''.join(map(lambda s:cmd+s, exampleCmd))+'\n ' tune.bode_chirp(openloop=True,file=file[:-4]+'c.npz',motor=mot,amp=50,minFrq=300,maxFrq=1500,tSec=10) tune.bode_chirp(openloop=True,file=file[:-4]+'d.npz',motor=mot,amp=100,minFrq=300,maxFrq=2000,tSec=10) elif mode==3: - ol=True file=os.path.join(base,'sine_cl_mot%d.npz'%(mot)) tune.bode_sine(openloop=False,file=file,motor=mot) elif mode==4: file=os.path.join(base,'chirp_cl_mot%d.npz'%(mot)) tune.bode_chirp(openloop=False,file=file,motor=mot) - elif mode==100: #testing - file=os.path.join(base,'chirp_ol_mot%d.npz'%(mot)) - #def bode_chirp(self,openloop=True,motor=1,minFrq=10,maxFrq=150,tSec=30.,amp=10,mode=1,file='/tmp/gather.npz'): - #tune.bode_chirp(openloop=True,file=file,motor=mot, minFrq=10, maxFrq=300, tSec=30) - tune.bode_chirp(openloop=True,file=file[:-4]+'TEST.npz',motor=mot,amp=100,minFrq=300,maxFrq=2000,tSec=10) - #tune.do_command('stepmove',1,100,500,0,0) + elif mode==5: #full recording open loop + for mot in (1,2): + tune.init_stage() + file=os.path.join(base,'sine_ol_mot%d.npz'%(mot)) + tune.bode_sine(openloop=True,file=file,motor=mot) + file=os.path.join(base,'chirp_ol_mot%d.npz'%(mot)) + tune.init_stage() + tune.bode_chirp(openloop=True,file=file[:-4]+'a.npz',motor=mot, minFrq=10, maxFrq=300, tSec=30) + tune.init_stage() + tune.bode_chirp(openloop=True,file=file[:-4]+'b.npz',motor=mot,amp=50,minFrq=100,maxFrq=500, tSec=30) + tune.init_stage() + tune.bode_chirp(openloop=True,file=file[:-4]+'c.npz',motor=mot,amp=50,minFrq=300,maxFrq=1500,tSec=10) + tune.init_stage() + tune.bode_chirp(openloop=True,file=file[:-4]+'d.npz',motor=mot,amp=100,minFrq=300,maxFrq=2000,tSec=10) plt.show() #------------------ Main Code ---------------------------------- #ssh_test() @@ -604,11 +633,13 @@ Examples:'''+''.join(map(lambda s:cmd+s, exampleCmd))+'\n ' #enable plc1 #./PBTuning.py --host SAR-CPPM-EXPMX1 --mode 1 --mot 1 --dir tmp +#./PBTuning.py --host SAR-CPPM-EXPMX1 --mode 1 --mot 2 --dir tmp +#-> at low frequencied the speed is too high and encoder looses steps + #enable plc1 -#./PBTuning.py --host SAR-CPPM-EXPMX1 --mode 2 --mot 1 --tag tmp -#enable plc1 -#./PBTuning.py --host SAR-CPPM-EXPMX1 --mode 1 --mot 2 --tag tmp -#enable plc1 -#./PBTuning.py --host SAR-CPPM-EXPMX1 --mode 2 --mot 2 --tag tmp -#enable plc1 -#./PBTuning.py --host SAR-CPPM-EXPMX1 --plot ext +#AFTER each chirp measurement do enable plc1 again! +#./PBTuning.py --host SAR-CPPM-EXPMX1 --mode 2 --mot 1 --dir tmp +#./PBTuning.py --host SAR-CPPM-EXPMX1 --mode 2 --mot 2 --dir tmp + + +#./PBTuning.py --host SAR-CPPM-EXPMX1 --plot tmp diff --git a/qt/ESB_MX_exp.ui b/qt/ESB_MX_exp.ui index 4e3b879..dd84f86 100644 --- a/qt/ESB_MX_exp.ui +++ b/qt/ESB_MX_exp.ui @@ -409,6 +409,48 @@ P=$(P),M=MOT_GIR_W false;false;false;false;false;false;false;false;false;false;false;false;false;false;false;false + + + + 340 + 580 + 151 + 30 + + + + -ESB_MX EVR + + + + 0 + 0 + 0 + + + + + 89 + 126 + 225 + + + + EVR + + + G_EVR_main.ui + + + SYS=$(P),DEVICE=EVR0,FF=PCIe + + + caRowColMenu::Menu + + + false;false;false;false;false;false;false;false;false;false;false;false;false;false;false;false + +