# # Copyright Canadian Light Source, Inc. All rights reserved. # - see licence.txt and licence_CAEN.txt for limitations on use. # # The following are for setting channel parameters # in user space # record( stringout, "$(DETch):name") { field( OUT, "$(PSNAME):$(SLOT):$(CHANNUM):name") field( DOL, "$(PSNAME):$(SLOT):$(CHANNUM):name PP NMS") } record( stringin, "$(DETch):location") { field( VAL, "$(PSNAME):$(SLOT):$(CHANNUM)") } # keeps the desired by expert enable/disable state of channel record( bi, "$(DETch):enable") { field( DESC, "Channel enabled in GUIes") field( SCAN, "Passive") field( ZNAM, "Disabled") field( ONAM, "Enabled") field( PINI, "YES") field( VAL, "1") } # keeps the alarm state of channel calculated using the following records record( mbbi, "$(DETch):alarm") { field( DESC, "Alarm Status") field( SCAN, "Passive") field( PINI, "YES") field( ZRVL, "0") field( ZRST, "NO_ALARM") field( ONVL, "1") field( ONST, "Alarmed") field( ZRSV, "NO_ALARM") field( ONSV, "MAJOR") field( VAL, "0") } # Alarm: will calculate the |v0set:fbk-vmon|0.5)||(B=1&&F>0.5&&G>0.5))?1:0") field(INPB, "$(DETch):status CPP MS") field(INPF, "$(DETch):alarm:delta CPP MS") field(INPG, "$(DETch):alarm:epsilon CPP MS") #field(FLNK, "$(DETch):alarm:calc") } # Alarm:cond1 will calculate the part of condition for enabled case # The formula is: # If the channel is switched on the above condition $(DETch):alarm:cond must be true (1) # If the channel is switched off the channel must be in either off or in the ramping down states. # The record processing will be initiated by setting monitors on input channels (CPP). record(calcout, "$(DETch):alarm:cond1") { field(DESC, "CALC the alarm value") field(OOPT, "Every Time") field(DOPT, "Use CALC") #field(CALC, "I=0||(I=1)&&((A=0&&(B=0||B=3))||(A=1&&((B=2&&ABS(D-E)0.5))?1:0") field(CALC, "((A=0&B=0)||(A=1&&H>0.5))?1:0") field(INPA, "$(DETch):pwonoff:fbk CPP MS") field(INPB, "$(DETch):status CPP MS") # field(INPF, "$(DETch):alarm:delta CPP MS") # the delta # field(INPG, "$(DETch):alarm:epsilon CPP MS") # the epsilon field(INPH, "$(DETch):alarm:cond CPP MS") # the long condition # field(INPI, "$(DETch):enable CPP MS") } # Alarm:calc will calculate the NO_ALARM condition, but will output 0 for NO_ALARM and 1 for Alarmed # The formula is: # If disabled NO_ALARM # If enabled the above cond1 should be satisfied # The record processing will be initiated by setting monitors on input channels (CPP). # It's output will be used by another calcout which will delay for several seconds and will initiate its processing. record(calcout, "$(DETch):alarm:calc") { field(DESC, "CALC the alarm value") #field( OUT, "$(DETch):alarm:delayed.VAL PP MS") field(OOPT, "Every Time") field(DOPT, "Use CALC") #field(CALC, "(A=0&&(B=0||B=3))||(A=1&&((B=2&&ABS(D-E)0.5))&&K=0))?0:1") # field(INPA, "$(DETch):pwonoff:fbk CPP MS") # field(INPB, "$(DETch):status CPP MS") # field(INPF, "$(DETch):alarm:delta CPP MS") # the delta # field(INPG, "$(DETch):alarm:epsilon CPP MS") # the epsilon # field(INPH, "$(DETch):alarm:cond CPP MS") # the long condition field(INPI, "$(DETch):enable CPP MS") field(INPJ, "$(DETch):alarm:cond1 CPP MS") field(INPK, "$(DETch):status.STAT CPP MS") } # Alarm: will have copy of $(DETch):alarm:calc but delayed by ODLY seconds # It will output value into intermediate MBBO record and initiate its processing. record(calcout, "$(DETch):alarm:delayed") { field(DESC, "delay the alarm value") field(SCAN, "2 second") field( OUT, "$(DETch):alarm:delay_out.VAL PP MS") field(OOPT, "Every Time") field(DOPT, "Use CALC") field(CALC, "A") field(INPA, "$(DETch):alarm:calc CPP MS") field(ODLY, "2") # delay 2 second } # Alarm: will keep the the delayed out status of alarm # Using FLNK will initiate comparison record processing record( mbbo, "$(DETch):alarm:delay_out") { field( DESC, "delay alarmed value cleanly") field( SCAN, "Passive") field( ZRVL, "0") field( ZRST, "NO_ALARM") field( ONVL, "1") field( ONST, "Alarmed") field( VAL, "0") field( OUT, "") field(FLNK, "$(DETch):alarm:compare") } # Alarm: Compare the current and delayed alarm statuses # Output into alarm record. # Read inputs without processing. # The alarm will be generated only when delayed and current statuses are alarmed. record(calcout, "$(DETch):alarm:compare") { field(DESC, "compare delayed and current alarm values") field( OUT, "$(DETch):alarm.VAL PP MS") field(OOPT, "Every Time") field(DOPT, "Use CALC") field(CALC, "A=1&&B>0.5?1:0") field(INPA, "$(DETch):alarm:delay_out NPP MS") field(INPB, "$(DETch):alarm:calc NPP MS") } # End of records for alarm status calculation record( ao, "$(DETch):v0set") { field( DESC, "Primary voltage setting") field( OUT, "$(PSNAME):$(SLOT):$(CHANNUM):v0set PP") field( PREC, "1") field( FLNK, "$(DETch):alarm:epsilon") } # init the v0set with v0set:fbk then disable v0set:init record(ao, "$(DETch):v0set:init") { field(DESC, "init v0set from v0set:fbk") field(DTYP, "Soft Channel") field(OMSL, "closed_loop") field(DOL, "$(DETch):v0set:fbk") field(OUT, "$(DETch):v0set NPP") field(DISV, "1") # field(DISA, "0") # field(SDIS, "testhv:initao_dis NPP") field(FLNK, "$(DETch):v0set:dis") } record(calcout, "$(DETch):v0set:dis") { field(DESC, "disable after init") field( OUT, "$(DETch):v0set:init.DISA NPP") field(CALC, "1") field(OOPT, "Every Time") field(DOPT, "Use CALC") field(ODLY, "40") # field(FLNK, "$(DETch):alarm:epsilon:C") field( FLNK, "$(DETch):alarm:epsilon") } record( ao, "$(DETch):v1set") { field( DESC, "Secondary voltage setting") field( OUT, "$(PSNAME):$(SLOT):$(CHANNUM):v1set PP") field( PREC, "1") } # init the v1set with v1set:fbk then disable v1set:init record(ao, "$(DETch):v1set:init") { field(DESC, "init v1set from v1set:fbk") field(DTYP, "Soft Channel") field(OMSL, "closed_loop") field(DOL, "$(DETch):v1set:fbk") field(OUT, "$(DETch):v1set NPP") field(DISV, "1") field(FLNK, "$(DETch):v1set:dis") } record(calcout, "$(DETch):v1set:dis") { field(DESC, "disable after init") field( OUT, "$(DETch):v1set:init.DISA NPP") field(CALC, "1") field(OOPT, "Every Time") field(DOPT, "Use CALC") field(ODLY, "40") } record( ao, "$(DETch):i0set") { field( DESC, "Primary current limit") field( OUT, "$(PSNAME):$(SLOT):$(CHANNUM):i0set PP") field( PREC, "1") } # init the v1set with i0set:fbk then disable i0set:init record(ao, "$(DETch):i0set:init") { field(DESC, "init i0set from i0set:fbk") field(DTYP, "Soft Channel") field(OMSL, "closed_loop") field(DOL, "$(DETch):i0set:fbk") field(OUT, "$(DETch):i0set NPP") field(DISV, "1") field(FLNK, "$(DETch):i0set:dis") } record(calcout, "$(DETch):i0set:dis") { field(DESC, "disable after init") field( OUT, "$(DETch):i0set:init.DISA NPP") field(CALC, "1") field(OOPT, "Every Time") field(DOPT, "Use CALC") field(ODLY, "40") } record( ao, "$(DETch):i1set") { field( DESC, "Secondary current limit") field( OUT, "$(PSNAME):$(SLOT):$(CHANNUM):i1set PP") field( PREC, "1") } # init the v1set with i1set:fbk then disable i1set:init record(ao, "$(DETch):i1set:init") { field(DESC, "init i1set from i1set:fbk") field(DTYP, "Soft Channel") field(OMSL, "closed_loop") field(DOL, "$(DETch):i1set:fbk") field(OUT, "$(DETch):i1set NPP") field(DISV, "1") field(FLNK, "$(DETch):i1set:dis") } record(calcout, "$(DETch):i1set:dis") { field(DESC, "disable after init") field( OUT, "$(DETch):i1set:init.DISA NPP") field(CALC, "1") field(OOPT, "Every Time") field(DOPT, "Use CALC") field(ODLY, "40") } record( ao, "$(DETch):rampup") { field( DESC, "Voltage ramp-up rate") field( OUT, "$(PSNAME):$(SLOT):$(CHANNUM):rampup PP") field( PREC, "0") } # init the rampup with rampup:fbk then disable rampup:init record(ao, "$(DETch):rampup:init") { field(DESC, "init rampup from rampup:fbk") field(DTYP, "Soft Channel") field(OMSL, "closed_loop") field(DOL, "$(DETch):rampup:fbk") field(OUT, "$(DETch):rampup NPP") field(DISV, "1") field(FLNK, "$(DETch):rampup:dis") } record(calcout, "$(DETch):rampup:dis") { field(DESC, "disable after init") field( OUT, "$(DETch):rampup:init.DISA NPP") field(CALC, "1") field(OOPT, "Every Time") field(DOPT, "Use CALC") field(ODLY, "40") } record( ao, "$(DETch):rampdn") { field( DESC, "Voltage ramp-down rate") field( OUT, "$(PSNAME):$(SLOT):$(CHANNUM):rampdn PP") field( PREC, "0") } # init the rampdn with rampdn:fbk then disable rampdn:init record(ao, "$(DETch):rampdn:init") { field(DESC, "init rampdn from rampdn:fbk") field(DTYP, "Soft Channel") field(OMSL, "closed_loop") field(DOL, "$(DETch):rampdn:fbk") field(OUT, "$(DETch):rampdn NPP") field(DISV, "1") field(FLNK, "$(DETch):rampdn:dis") } record(calcout, "$(DETch):rampdn:dis") { field(DESC, "disable after init") field( OUT, "$(DETch):rampdn:init.DISA NPP") field(CALC, "1") field(OOPT, "Every Time") field(DOPT, "Use CALC") field(ODLY, "40") } record( ao, "$(DETch):trip") { field( DESC, "Trip timeout") field( OUT, "$(PSNAME):$(SLOT):$(CHANNUM):trip PP") field( PREC, "1") } # init the trip with trip:fbk then disable trip:init record(ao, "$(DETch):trip:init") { field(DESC, "init trip from trip:fbk") field(DTYP, "Soft Channel") field(OMSL, "closed_loop") field(DOL, "$(DETch):trip:fbk") field(OUT, "$(DETch):trip NPP") field(DISV, "1") field(FLNK, "$(DETch):trip:dis") } record(calcout, "$(DETch):trip:dis") { field(DESC, "disable after init") field( OUT, "$(DETch):trip:init.DISA NPP") field(CALC, "1") field(OOPT, "Every Time") field(DOPT, "Use CALC") field(ODLY, "40") } record( ao, "$(DETch):svmax") { field( DESC, "Software voltage limit") field( OUT, "$(PSNAME):$(SLOT):$(CHANNUM):svmax PP") field( PREC, "1") } # init the svmax with svmax:fbk then disable svmax:init record(ao, "$(DETch):svmax:init") { field(DESC, "init svmax from svmax:fbk") field(DTYP, "Soft Channel") field(OMSL, "closed_loop") field(DOL, "$(DETch):svmax:fbk") field(OUT, "$(DETch):svmax NPP") field(DISV, "1") field(FLNK, "$(DETch):svmax:dis") } record(calcout, "$(DETch):svmax:dis") { field(DESC, "disable after init") field( OUT, "$(DETch):svmax:init.DISA NPP") field(CALC, "1") field(OOPT, "Every Time") field(DOPT, "Use CALC") field(ODLY, "40") } record( bo, "$(DETch):pwonoff") { field( DESC, "Power on/off") field( DTYP, "Soft Channel") field( OUT, "$(PSNAME):$(SLOT):$(CHANNUM):pwonoff PP") # field( OMSL, "closed_loop") # field( DOL, "$(PSNAME):$(SLOT):$(CHANNUM):pwonoff") field( ZNAM, "Off") field( ONAM, "On") } # init the pwonoff with pwonoff:fbk then disable pwonoff:init record(bo, "$(DETch):pwonoff:init") { field(DESC, "init pwonoff from pwonoff:fbk") field(DTYP, "Soft Channel") field(OMSL, "closed_loop") field(DOL, "$(DETch):pwonoff:fbk") field(OUT, "$(DETch):pwonoff NPP") field(DISV, "1") field(FLNK, "$(DETch):pwonoff:dis") } record(calcout, "$(DETch):pwonoff:dis") { field(DESC, "disable after init") field( OUT, "$(DETch):pwonoff:init.DISA NPP") field(CALC, "1") field(OOPT, "Every Time") field(DOPT, "Use CALC") field(ODLY, "40") } record( bo, "$(DETch):pwupmode") { field( DESC, "Power-up mode") field( OUT, "$(PSNAME):$(SLOT):$(CHANNUM):pwupmode PP") field( ZNAM, "Disable") field( ONAM, "Enable") } # init the pwupmode with pwupmode:fbk then disable pwupmode:init record(bo, "$(DETch):pwupmode:init") { field(DESC, "init pwupmode from pwupmode:fbk") field(DTYP, "Soft Channel") field(OMSL, "closed_loop") field(DOL, "$(DETch):pwupmode:fbk") field(OUT, "$(DETch):pwupmode NPP") field(DISV, "1") field(FLNK, "$(DETch):pwupmode:dis") } record(calcout, "$(DETch):pwupmode:dis") { field(DESC, "disable after init") field( OUT, "$(DETch):pwupmode:init.DISA NPP") field(CALC, "1") field(OOPT, "Every Time") field(DOPT, "Use CALC") field(ODLY, "40") } record( bo, "$(DETch):pwdnmode") { field( DESC, "Power-down mode") field( OUT, "$(PSNAME):$(SLOT):$(CHANNUM):pwdnmode PP") field( ZNAM, "KILL") field( ONAM, "Ramp") } # init the pwdnmode with pwdnmode:fbk then disable pwdnmode:init record(bo, "$(DETch):pwdnmode:init") { field(DESC, "init pwdnmode from pwdnmode:fbk") field(DTYP, "Soft Channel") field(OMSL, "closed_loop") field(DOL, "$(DETch):pwdnmode:fbk") field(OUT, "$(DETch):pwdnmode NPP") field(DISV, "1") field(FLNK, "$(DETch):pwdnmode:dis") } record(calcout, "$(DETch):pwdnmode:dis") { field(DESC, "disable after init") field( OUT, "$(DETch):pwdnmode:init.DISA NPP") field(CALC, "1") field(OOPT, "Every Time") field(DOPT, "Use CALC") field(ODLY, "40") } record( longout, "$(DETch):tripint") { field( DESC, "Internal trip connections") field( OUT, "$(PSNAME):$(SLOT):$(CHANNUM):tripint PP") } # init the tripint with tripint:fbk then disable tripint:init record(bo, "$(DETch):tripint:init") { field(DESC, "init tripint from tripint:fbk") field(DTYP, "Soft Channel") field(OMSL, "closed_loop") field(DOL, "$(DETch):tripint:fbk") field(OUT, "$(DETch):tripint NPP") field(DISV, "1") field(FLNK, "$(DETch):tripint:dis") } record(calcout, "$(DETch):tripint:dis") { field(DESC, "disable after init") field( OUT, "$(DETch):tripint:init.DISA NPP") field(CALC, "1") field(OOPT, "Every Time") field(DOPT, "Use CALC") field(ODLY, "40") } record( longout, "$(DETch):tripext") { field( DESC, "External trip connections") field( OUT, "$(PSNAME):$(SLOT):$(CHANNUM):tripext PP") } # init the tripext with tripext:fbk then disable tripext:init record(bo, "$(DETch):tripext:init") { field(DESC, "init tripext from tripext:fbk") field(DTYP, "Soft Channel") field(OMSL, "closed_loop") field(DOL, "$(DETch):tripext:fbk") field(OUT, "$(DETch):tripext NPP") field(DISV, "1") field(FLNK, "$(DETch):tripext:dis") } record(calcout, "$(DETch):tripext:dis") { field(DESC, "disable after init") field( OUT, "$(DETch):tripext:init.DISA NPP") field(CALC, "1") field(OOPT, "Every Time") field(DOPT, "Use CALC") field(ODLY, "40") } # # The following are for monitoring channel parameters (e.g. feedback) # in user space # record( stringin, "$(DETch):name:fbk") { field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):name:fbk CPP MS") field( SCAN, "Passive") field( PINI, "YES") field( VAL, "$(DETch)") } record( ai, "$(DETch):v0set:fbk") { field( DESC, "Primary voltage setting") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):v0set:fbk CPP MS") field( SCAN, "Passive") field( PREC, "1") field( FLNK, "$(DETch):v0set:init") } record( ai, "$(DETch):v1set:fbk") { field( DESC, "Secondary voltage setting") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):v1set:fbk CPP MS") field( SCAN, "Passive") field( PREC, "1") field( FLNK, "$(DETch):v1set:init") } record( ai, "$(DETch):i0set:fbk") { field( DESC, "Primary current limit") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):i0set:fbk CPP MS") field( SCAN, "Passive") field( FLNK, "$(DETch):i0set:init") field( PREC, "1") } record( ai, "$(DETch):i1set:fbk") { field( DESC, "Secondary current limit") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):i1set:fbk CPP MS") field( SCAN, "Passive") field( FLNK, "$(DETch):i1set:init") field( PREC, "1") } record( ai, "$(DETch):rampup:fbk") { field( DESC, "Voltage ramp-up rate") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):rampup:fbk CPP MS") field( SCAN, "Passive") field( FLNK, "$(DETch):rampup:init") field( PREC, "0") } record( ai, "$(DETch):rampdn:fbk") { field( DESC, "Voltage ramp-down rate") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):rampdn:fbk CPP MS") field( SCAN, "Passive") field( FLNK, "$(DETch):rampdn:init") field( PREC, "0") } record( ai, "$(DETch):trip:fbk") { field( DESC, "Trip timeout") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):trip:fbk CPP MS") field( SCAN, "Passive") field( FLNK, "$(DETch):trip:init") field( PREC, "1") } record( ai, "$(DETch):svmax:fbk") { field( DESC, "Software voltage limit") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):svmax:fbk CPP MS") field( SCAN, "Passive") field( FLNK, "$(DETch):svmax:init") field( PREC, "1") } record( ai, "$(DETch):hvmax") { field( DESC, "Hardware voltage limit") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):hvmax CPP MS") field( SCAN, "Passive") field( PREC, "1") } record( ai, "$(DETch):vmon") { field( DESC, "Measured voltage") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):vmon CPP MS") field( SCAN, "Passive") field( PREC, "1") } record( ai, "$(DETch):imon") { field( DESC, "Measured current") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):imon CPP MS") field( SCAN, "Passive") field( PREC, "1") } record( mbbi, "$(DETch):status") { field( DESC, "Status") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):status CPP MS") field( SCAN, "Passive") field( PINI, "YES") field( ZRVL, "0") field( ZRST, "Off") field( ONVL, "1") field( ONST, "On") field( TWVL, "2") field( TWST, "Ramping Up") field( THVL, "3") field( THST, "Ramping Down") field( FRVL, "4") field( FRST, "Over-Current") field( FVVL, "5") field( FVST, "Over-Voltage") field( SXVL, "6") field( SXST, "Under-Voltage") field( SVVL, "7") field( SVST, "External Trip") field( EIVL, "8") field( EIST, "Max V") field( NIVL, "9") field( NIST, "Ext. Disable") field( TEVL, "10") field( TEST, "Internal Trip") field( ELVL, "11") field( ELST, "Calib. Error") field( TVVL, "12") field( TVST, "Unplugged") field( VAL, "12") } record( bi, "$(DETch):pwonoff:fbk") { field( DESC, "Power on/off") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):pwonoff:fbk CPP MS") field( SCAN, "Passive") field( ZNAM, "Off") field( ONAM, "On") field( FLNK, "$(DETch):pwonoff:init") } record( bi, "$(DETch):pwupmode:fbk") { field( DESC, "Power-up mode") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):pwupmode:fbk CPP MS") field( SCAN, "Passive") field( ZNAM, "Disabled") field( ONAM, "Enabled") field( FLNK, "$(DETch):pwupmode:init") } record( bi, "$(DETch):pwdnmode:fbk") { field( DESC, "Power-down mode") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):pwdnmode:fbk CPP MS") field( SCAN, "Passive") field( ZNAM, "KILL") field( ONAM, "Ramp") field( FLNK, "$(DETch):pwdnmode:init") } record( longin, "$(DETch):tripint:fbk") { field( DESC, "Internal trip connections") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):tripint:fbk CPP MS") field( SCAN, "Passive") field( FLNK, "$(DETch):tripint:init") } record( longin, "$(DETch):tripext:fbk") { field( DESC, "External trip connections") field( INP, "$(PSNAME):$(SLOT):$(CHANNUM):tripext:fbk CPP MS") field( SCAN, "Passive") field( FLNK, "$(DETch):tripext:init") }