########################################################################## # Description: # This database reads the stream from firmware # It converts raw data to user units # It reads a portion of the waveform into a record as per user request # # Macros: # DEVICE: Device prefix # ATTR : Device attribute # DESC : Device description # PORT : The asyn port name. It must match the port name given # when calling "YCPSWASYNConfig" on st.cmd # PARAM : The asyn parameter name. It must be defined in the # dictionary file and assigned to a register. ########################################################################## record(ao, "$(P):FAST_SLOPE") { field(DESC, "Slope of channel in EGU/raw") field(EGU, "$(EGU)") field(PINI, "YES") field(SCAN, "Passive") field(PREC, "3") field(VAL, "1") info(autosaveFields, "VAL") } # Buffer PV, to hold all the stream data # up to 10e6 points record(waveform, "$(P):FAST_WF_RAW-BUF") { field(DESC, "(Bay $(BAY), ch $(INP)) Buffer Data") field(DTYP, "asynInt16ArrayIn") field(NELM, "1000000") field(FTVL, "SHORT") field(SCAN, "I/O Intr") field(INP, "@asyn(YCPSWASYN_PORT,5)Stream_B$(BAY)_C$(INP):16") field(FLNK, "$(P):FAST_X_WF_RAW-BUF PP") field(ASG, "Internal") } # Interface PV, to display only the necessary data # range from the data received in the buffer record(subArray, "$(P):FAST_WF_RAW") { field(DESC, "(Bay $(BAY), ch $(INP)) Raw Subarray") field(INP, "$(P):FAST_WF_RAW-BUF") field(FTVL, "SHORT") field(MALM, "1000000") field(NELM, "1024") field(INDX, "0") field(FLNK, "$(P):FAST_WF_R2E PP") } # Interface PV, to display only the necessary data # range from the data received in the buffer in user units record(subArray, "$(P):FAST_WF") { field(DESC, "(Bay $(BAY), ch $(INP)) Subarray") field(INP, "$(P):FAST_WF_R2E.VALA") field(FTVL, "DOUBLE") field(MALM, "1000000") field(NELM, "1024") field(INDX, "0") field(EGU, "$(EGU)") } record(ao, "$(P):FAST_WF_START_EGU") { field(DESC, "(Bay $(BAY), ch $(INP)) Subarray start EGU") field(DRVH, "2857143") field(HOPR, "2857143") field(FLNK, "$(P):FAST_WF_START_CALC") info(autosaveFields, "VAL") field(PINI, "YES") } # PV to hold the start for the display array record(calcout, "$(P):FAST_WF_START_CALC") { field(DESC, "(Bay $(BAY), ch $(INP)) Subarray start EGU") field(FLNK, "$(P):FAST_WF_START") field(OUT, "$(P):FAST_WF_START") field(INPA, "$(P):FAST_WF_START_EGU") field(INPB, "$(P):FAST_CLK_FREQ CP") field(CALC, "FLOOR((2*A*B)/1000)") } record(ao, "$(P):FAST_WF_START") { field(DESC, "(Bay $(BAY), ch $(INP)) Subarray start") field(DRVH, "1000000") field(HOPR, "1000000") field(PINI, "NO") field(FLNK, "$(P):FAST_WF_SEQ") field(DOL, "$(P):FAST_WF_START_CALC") field(OMSL, "closed_loop") } record(ao, "$(P):FAST_WF_NELM_EGU") { field(DESC, "(Bay $(BAY), ch $(INP)) Subarray start EGU") field(DRVH, "2857143") field(HOPR, "2857143") field(FLNK, "$(P):FAST_WF_NELM_CALC") info(autosaveFields, "VAL") field(PINI, "YES") } # PV to hold the start for the display array record(calcout, "$(P):FAST_WF_NELM_CALC") { field(DESC, "(Bay $(BAY), ch $(INP)) Subarray start EGU") field(FLNK, "$(P):FAST_WF_NELM") field(OUT, "$(P):FAST_WF_NELM") field(INPA, "$(P):FAST_WF_NELM_EGU") field(INPB, "$(P):FAST_CLK_FREQ CP") field(CALC, "FLOOR((2*A*B)/1000)") } # PV to hold the length for the display array record(ao, "$(P):FAST_WF_NELM") { field(DESC, "(Bay $(BAY), ch $(INP)) Subarray length") field(PINI, "NO") field(FLNK, "$(P):FAST_WF_SEQ") field(DOL, "$(P):FAST_WF_NELM_CALC") field(OMSL, "closed_loop") } # PV to send data start and nelm to raw and wf PVs record(seq, "$(P):FAST_WF_SEQ") { field(DESC, "Update NELM and INDX value") field(DOL1, "$(P):FAST_WF_START") field(LNK1, "$(P):FAST_WF_RAW.INDX PP") field(DOL2, "$(P):FAST_WF_NELM") field(LNK2, "$(P):FAST_WF_RAW.NELM PP") field(DOL3, "$(P):FAST_WF_NELM") field(LNK3, "$(P):FAST_WF.NELM PP") field(DOL4, "$(P):FAST_WF_START") field(LNK4, "$(P):FAST_X_WF.INDX PP") field(DOL5, "$(P):FAST_WF_NELM") field(LNK5, "$(P):FAST_X_WF.NELM PP") field(ASG, "Internal") } record(calcout, "$(P):FAST_SLOPE_WF_CALC") { field(DESC, "(Bay $(BAY), ch $(INP)) WF slope") field(PREC, "3") field(EGU, "$(EGU)/raw") field(FLNK, "$(P):FAST_SLOPE_WF") field(CALC, "A*.5") field(INPA, "$(P):FAST_SLOPE CPP") } # PV to hold the slope for the display array (raw to egu conversion) record(ao, "$(P):FAST_SLOPE_WF") { field(DESC, "(Bay $(BAY), ch $(INP)) WF slope") field(PREC, "3") field(EGU, "$(EGU)/raw") field(PINI, "YES") field(FLNK, "$(P):FAST_WF_R2E") field(OMSL, "closed_loop") field(DOL, "$(P):FAST_SLOPE_WF_CALC") } # PV to hold the offset for the display array (raw to egu conversion) record(ao, "$(P):FAST_OFFSET_WF") { field(DESC, "(Bay $(BAY), ch $(INP)) WF offset in raw") field(PINI, "YES") field(FLNK, "$(P):FAST_WF_R2E") field(EGU, "raw") field(OMSL, "closed_loop") field(DOL, "$(P):FW_OFFSET") } # PV to enable debug mode for gain to voltage subroutine record(bo, "$(P):FAST_WF_DEBUG") { field(DESC, "Subroutine Debug") field(ONAM, "DEBUG ON") field(ZNAM, "DEBUG OFF") } # PV to calculate the interface pv in user units record (aSub, "$(P):FAST_WF_R2E") { field(DESC, "(Bay $(BAY), ch $(INP)) subarray raw to egu") field(SNAM, "calcWFinEGU") field(INPA, "$(P):FAST_WF_RAW PP") field(NOA, "1000000") field(FTA, "SHORT") field(INPB, "$(P):FAST_SLOPE_WF PP") field(FTB, "DOUBLE") field(INPC, "$(P):FAST_OFFSET_WF PP") field(FTC, "SHORT") field(INPD, "$(P):FAST_WF_DEBUG PP") field(OUTA, "$(P):FAST_WF") field(FLNK, "$(P):FAST_WF") field(NOVA, "1000000") field(FTVA, "DOUBLE") } # PV to enable debug mode for gain to voltage subroutine record(bo, "$(P):FAST_X_WF_DEBUG") { field(DESC, "Subroutine Debug") field(ONAM, "DEBUG ON") field(ZNAM, "DEBUG OFF") field(VAL, "0") } # Create a waveform with the sampling time. This will be the X axis of the # waveform. record (aSub, "$(P):FAST_X_WF_RAW-BUF") { field(SNAM, "calcTimeArray") field(FTA, "LONG") field(FTVA, "DOUBLE") field(NOVA, "1000000") field(INPA, "$(P):FAST_CLK_FREQ CP") field(INPB, "$(P):FAST_X_WF_DEBUG PP") field(OUTA, "$(P):FAST_X_WF") field(FLNK, "$(P):FAST_X_WF PP") } # Interface PV, to display only the necessary data # range from the data received in the buffer record(subArray, "$(P):FAST_X_WF") { field(DESC, "(Bay $(BAY), ch $(INP)) X Subarray") field(INP, "$(P):FAST_X_WF_RAW-BUF.VALA") field(FTVL, "DOUBLE") field(MALM, "1000000") field(NELM, "1024") field(INDX, "0") field(FLNK, "$(P):FAST_WF_RAW PP") field(EGU, "ns") }########################################################################## # Description: # This database works with LBLM Gain Control Chassis. # It adjusts the gain on the analog input through ATCA AMD DAQ channel # # Macros: # DEVICE: Device prefix # ATTR : Device attribute # PORT : The asyn port name. It must match the port name given # when calling "YCPSWASYNConfig" on st.cmd # PARAM : The asyn parameter name. It must be defined in the # dictionary file and assigned to a register. ########################################################################## # PV to set amplifier bypass record(bo, "$(P):FAST_AMP_BYP") { field(DESC, "Bypass amplifier") field(ONAM, "BYPASS") field(ZNAM, "NO BYPASS") field(FLNK, "$(P):FAST_AMP_BYP_SEQ") info(autosaveFields, "VAL") } # PV to set voltage and gain approritately when amplifier is bypassed. # Set Gain to -5.6dB and Voltage to -1.2V # Notes from Alan Fisher: # The chassis bypasses the amplifier if the DAC voltage is less than -1 V. There should be a bypass on/off switch that sets the DAC to something about -1.2 V (to be far from the transition). When bypassed, the path attenuates by -5.6 dB record(seq, "$(P):FAST_AMP_BYP_SEQ") { field(DESC, "Amplifier Bypass") field(DO1, "-5.6") field(LNK1, "$(P):FAST_AMP_GAIN PP") field(DO2, "-1.2") field(LNK2, "$(P):FAST_AMP_V PP") field(ASG, "Internal") } # PV that sets amplifier voltage in register units record(ao, "$(P):FAST_AMP_V"){ field(DTYP, "asynInt32") field(DESC, "Amplifier Voltage") field(LINR, "LINEAR") field(PINI, "YES") field(EGUL, "-1.67") field(EGUF, "1.66") field(PREC, "3") field(EGU, "V") field(DRVH, "1.6") field(DRVL, "-1.6") field(OUT, "@asyn(YCPSWASYN_PORT,1)DSG$(BAY)_VoltOut_$(GCH)") field(SCAN, "Passive") field(FLNK, "$(P):FAST_AMP_V_RBV") } # Readback PV for amplifier voltage in register units record(ai, "$(P):FAST_AMP_V_RBV"){ field(DTYP, "asynInt32") field(LINR, "LINEAR") field(PINI, "YES") field(EGUL, "-1.67") field(EGUF, "1.66") field(PREC, "3") field(EGU, "V") field(DESC, "Amplifier Voltage RBV in Volts") field(INP, "@asyn(YCPSWASYN_PORT,1)DSG$(BAY)_VoltOut_$(GCH)") field(SCAN, "1 second") } # PV that holds amplifier gain in dB # When amplifier is bypasses, disable use of this PV. record(ao, "$(P):FAST_AMP_GAIN") { field(DESC, "Amplifier Gain Requested") field(PINI, "NO") field(EGU, "dB") field(HOPR, "56.70") field(LOPR,"-27.05") field(DRVH, "56.70") field(DRVL,"-27.05") field(SCAN, "Passive") field(PREC, "2") field(DISV, "1") field(SDIS, "$(P):FAST_AMP_BYP") info(autosaveFields, "VAL") field(FLNK, "$(P):FAST_AMP_G2V") } # PV to enable debug mode for gain to voltage subroutine record(bo, "$(P):FAST_AMP_DEBUG") { field(DESC, "Subroutine Debug") field(ONAM, "DEBUG ON") field(ZNAM, "DEBUG OFF") } # PV to calculate gain to voltage record(aSub, "$(P):FAST_AMP_G2V") { field(DESC, " V calc Subroutine") field(INAM, "aInit") field(SNAM, "calcG2V") field(INPA, "$(P):FAST_AMP_GAIN PP") field(INPB, "$(P):FAST_AMP_DEBUG") field(OUTA, "$(P):FAST_AMP_V") field(FLNK, "$(P):FAST_AMP_V") field(PREC, "2") info(autosaveFields, "INPA") }record(bo, "$(P):AutoRearm") { field(DTYP, "asynUInt32Digital") field(DESC, "Waveform Stream On/Off") field(PINI, "YES") field(SCAN, "Passive") field(OUT, "@asynMask(YCPSWASYN_PORT,1,1)DM$(BAY)_TrigHwAutoReArm") field(ZNAM, "Disabled") field(ONAM, "Enabled") field(FLNK, "$(P):AutoRearm_RBV") } record(bi, "$(P):AutoRearm_RBV") { field(DTYP, "asynUInt32Digital") field(DESC, "Waveform Stream On/Off") field(PINI, "YES") field(SCAN, "1 second") field(INP, "@asynMask(YCPSWASYN_PORT,1,1)DM$(BAY)_TrigHwAutoReArm") field(ZNAM, "Disabled") field(ONAM, "Enabled") field(ZSV, "NO_ALARM") field(OSV, "NO_ALARM") field(FLNK, "$(P):AutoRearm_CALC") } record(calc, "$(P):AutoRearm_CALC") { field(DESC, "Waveform Stream On/Off") field(PINI, "YES") field(SCAN, "Passive") field(INPA, "$(P):AutoRearm") field(INPB, "$(P):AutoRearm_RBV") field(CALC, "A=B?1:0") field(FLNK, "$(P):AutoRearm_STAT") } record(bi, "$(P):AutoRearm_STAT") { field(DESC, "Waveform Stream On/Off") field(INP, "$(P):AutoRearm_CALC") field(ZNAM, "Mismatch") field(ZSV, "MAJOR") field(ONAM, "Ok") field(OSV, "NO_ALARM") field(SCAN, "Passive") } record(ai, "$(P):FAST_CLK_FREQ") { field(DTYP, "asynInt32") field(DESC, "AMC Clock frequency") field(EGU, "MHz") field(PINI, "YES") field(SCAN, "1 second") field(LINR, "LINEAR") field(EGUL, "0") field(EGUF, "0.065535") field(PREC, "2") field(ESLO, "1") field(EOFF, "0") field(INP, "@asyn(YCPSWASYN_PORT,0)AMCADC_AmcClkFreq_$(BAY)") }