########################################################################## # 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. ########################################################################## # Buffer PV, to hold all the stream data # up to 10e6 points record(waveform, "$(DEVICE):$(ATTR)_WF_RAW-BUF") { field(DESC, "$(DESC) Buffer Data") field(DTYP, "asynInt16ArrayIn") field(NELM, "1000000") field(FTVL, "SHORT") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),5)$(PARAM)") field(FLNK, "$(DEVICE):$(ATTR)_WF_RAW PP") field(ASG, "Internal") } # Interface PV, to display only the necessary data # range from the data received in the buffer record(subArray, "$(DEVICE):$(ATTR)_WF_RAW") { field(DESC, "$(DESC) Raw Subarray") field(INP, "$(DEVICE):$(ATTR)_WF_RAW-BUF") field(FTVL, "SHORT") field(MALM, "1000000") field(NELM, "1024") field(INDX, "0") field(FLNK, "$(DEVICE):$(ATTR)_WF_R2E PP") } # Interface PV, to display only the necessary data # range from the data received in the buffer in user units record(subArray, "$(DEVICE):$(ATTR)_WF") { field(DESC, "$(DESC) Subarray") field(INP, "$(DEVICE):$(ATTR)_WF_R2E.VALA") field(FTVL, "DOUBLE") field(MALM, "1000000") field(NELM, "1024") field(INDX, "0") field(EGU, "mV") field(FLNK, "$(DEVICE):$(ATTR)_WF_RAW_U16 PP") } # Interface PV, to display only the necessary data # range from the data received in unsigned array record(subArray, "$(DEVICE):$(ATTR)_SIG") { field(DESC, "Subarray") field(INP, "$(DEVICE):$(ATTR)_WF_RAW_U16.VALA") field(FTVL, "SHORT") field(MALM, "1000000") field(NELM, "1024") field(INDX, "0") field(FLNK, "$(DEVICE):$(ATTR)_SIG_MULT PP") } # PV to hold the start for the display array record(ao, "$(DEVICE):$(ATTR)_WF_START") { field(DESC, "$(DESC) Subarray start") field(DRVH, "1000000") field(HOPR, "1000000") field(PINI, "YES") field(FLNK, "$(DEVICE):$(ATTR)_WF_SEQ") info(autosaveFields, "VAL") } # PV to hold the length for the display array record(ao, "$(DEVICE):$(ATTR)_WF_NELM") { field(DESC, "$(DESC) Subarray length") field(DRVH, "1000000") field(HOPR, "1000000") field(PINI, "YES") field(FLNK, "$(DEVICE):$(ATTR)_WF_SEQ") info(autosaveFields, "VAL") } # PV to send data start and nelm to raw and wf PVs record(seq, "$(DEVICE):$(ATTR)_WF_SEQ") { field(DESC, "Update NELM and INDX value") field(DOL1, "$(DEVICE):$(ATTR)_WF_START") field(LNK1, "$(DEVICE):$(ATTR)_WF_RAW.INDX PP") field(DOL2, "$(DEVICE):$(ATTR)_WF_START") field(LNK2, "$(DEVICE):$(ATTR)_WF.INDX PP") field(DOL3, "$(DEVICE):$(ATTR)_WF_START") field(LNK3, "$(DEVICE):$(ATTR)_SIG.INDX PP") field(DOL4, "$(DEVICE):$(ATTR)_WF_START") field(LNK4, "$(DEVICE):$(ATTR)_SIG_DECONVOLVED.INDX PP") field(DOL5, "$(DEVICE):$(ATTR)_WF_NELM") field(LNK5, "$(DEVICE):$(ATTR)_WF_RAW.NELM PP") field(DOL6, "$(DEVICE):$(ATTR)_WF_NELM") field(LNK6, "$(DEVICE):$(ATTR)_WF.NELM PP") field(DOL7, "$(DEVICE):$(ATTR)_WF_NELM") field(LNK7, "$(DEVICE):$(ATTR)_SIG_MULT.NELM PP") field(DOL8, "$(DEVICE):$(ATTR)_WF_NELM") field(LNK8, "$(DEVICE):$(ATTR)_SIG_DECONVOLVED.NELM PP") field(DOL8, "$(DEVICE):$(ATTR)_WF_NELM") field(LNK8, "$(DEVICE):$(ATTR)_WF_TIME.NELM PP") field(DOL9, "$(DEVICE):$(ATTR)_WF_NELM") field(LNK9, "$(DEVICE):$(ATTR)_SIG.NELM PP") field(DOLA, "$(DEVICE):$(ATTR)_WF_NELM") field(LNKA, "$(DEVICE):$(ATTR)_WF_Z.NELM PP") field(ASG, "Internal") } # PV to hold the slope for the display array (raw to egu conversion) record(ao, "$(DEVICE):$(ATTR)_SLOPE_WF") { field(DESC, "$(DESC) WF slope") field(PREC, "2") field(EGU, "mV/raw") field(PINI, "YES") field(FLNK, "$(DEVICE):$(ATTR)_WF_R2E") info(autosaveFields, "VAL") } # PV to hold the offset for the display array (raw to egu conversion) record(ao, "$(DEVICE):$(ATTR)_OFFSET_WF") { field(DESC, "$(DESC) WF offset in raw") field(PINI, "YES") field(FLNK, "$(DEVICE):$(ATTR)_WF_R2E") field(EGU, "raw") info(autosaveFields, "VAL") } # PV to enable debug mode for gain to voltage subroutine record(bo, "$(DEVICE):$(ATTR)_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, "$(DEVICE):$(ATTR)_WF_R2E") { field(DESC, "$(DESC) subarray raw to egu") field(SNAM, "calcWFinEGU") field(INPA, "$(DEVICE):$(ATTR)_WF_RAW PP") field(NOA, "1000000") field(FTA, "SHORT") field(INPB, "$(DEVICE):$(ATTR)_SLOPE_WF PP") field(FTB, "DOUBLE") field(INPC, "$(DEVICE):$(ATTR)_OFFSET_WF PP") field(FTC, "SHORT") field(INPD, "$(DEVICE):$(ATTR)_WF_DEBUG PP") field(OUTA, "$(DEVICE):$(ATTR)_WF") field(FLNK, "$(DEVICE):$(ATTR)_WF") field(NOVA, "1000000") field(FTVA, "DOUBLE") field(FLNK, "$(DEVICE):$(ATTR)_WF_RAW_U16 PP") } # Pv to calculate an unsiged 16 bit array from a signed array record (aSub, "$(DEVICE):$(ATTR)_WF_RAW_U16") { field(DESC, "Slow raw waveform") field(SNAM, "calcRWF16") field(INPA, "$(DEVICE):$(ATTR)_WF_RAW PP") field(NOA, "1000000") field(FTA, "SHORT") field(NOVA,"1000000") field(FTVA, "SHORT") field(OUTA, "$(DEVICE):$(ATTR)_SIG") field(FLNK, "$(DEVICE):$(ATTR)_SIG") } # Waveform for matrix multiplication record(waveform, "$(DEVICE):$(ATTR)_SIG_MULT_WF") { field(DESC, "Multiplier to loss WF") field(NELM, "1024") field(FTVL, "SHORT") field(FLNK, "$(DEVICE):$(ATTR)_SIG_MULT") } # Interface PV, to display only the necessary data # range from mult record(subArray, "$(DEVICE):$(ATTR)_SIG_MULT") { field(DESC, "waveform Subarray") field(INP, "$(DEVICE):$(ATTR)_SIG_MULT_WF") field(FTVL, "SHORT") field(MALM, "1024") field(NELM, "1024") field(INDX, "0") field(FLNK, "$(DEVICE):$(ATTR)_SIG_DECONVOLVED PP") } # Calculated waveform when multiplying with deconvolution matrix record (acalcout, "$(DEVICE):$(ATTR)_SIG_DECONVOLVED") { field(DESC, "Raw times deconvolution matrix") field(INAA, "$(DEVICE):$(ATTR)_SIG PP") field(INBB, "$(DEVICE):$(ATTR)_SIG_MULT PP") field(NELM, "1024") field(CALC, "AA * BB") field(FLNK, "$(DEVICE):$(ATTR)_WF_TIME_CLC PP") } # Create a waveform with the sampling time. This will be the X axis of the # waveform. record (aSub, "$(DEVICE):$(ATTR)_WF_TIME_CLC") { field(SNAM, "calcTimeArray") field(FTA, "LONG") field(FTVA, "DOUBLE") field(NOVA, "1000000") field(INPA, "$(P):ClkFreq PP") field(OUTA, "$(DEVICE):$(ATTR)_WF_TIME") field(FLNK, "$(DEVICE):$(ATTR)_WF_TIME") } # Interface PV, to display X axis of waveform record(subArray, "$(DEVICE):$(ATTR)_WF_TIME") { field(DESC, "Subarray") field(INP, "$(DEVICE):$(ATTR)_WF_TIME_CLC.VALA") field(FTVL, "DOUBLE") field(MALM, "1000000") field(NELM, "1024") field(INDX, "0") field(FLNK, "$(DEVICE):$(ATTR)_WF_Z_CLC") } #Desired scaling for time to Z record (ao, "$(DEVICE):$(ATTR)_WF_SLOPE_Z") { field(DESC, "scaling factor for time to Z") field(PREC, "4") field(EGU, "m/ns") field(VAL, "0.166") info(autosaveFields, "VAL") } #Desired start of Z record (ao, "$(DEVICE):$(ATTR)_WF_OFFSET_Z") { field(DESC, "start Z for LBLM") field(PREC, "4") field(EGU, "m") field(VAL, "9.9") info(autosaveFields, "VAL") } #Desired reference for T record (ao, "$(DEVICE):$(ATTR)_WF_TIME_REF") { field(DESC, "Tref for LBLM") field(PREC, "4") field(EGU, "ns") field(VAL, "185") info(autosaveFields, "VAL") } # waveform of Z start. record (acalcout, "$(DEVICE):$(ATTR)_WF_Z_CLC") { field(DESC, "WF Z calc") field(CALC, "(AA * ARR(A)) + ARR (B) -ARR(C*A)") field(NELM, "1024") field(INPA, "$(DEVICE):$(ATTR)_WF_SLOPE_Z CP NMS") field(INPB, "$(DEVICE):$(ATTR)_WF_OFFSET_Z CP NMS") field(INPC, "$(DEVICE):$(ATTR)_WF_TIME_REF CP NMS") field(INAA, "$(DEVICE):$(ATTR)_WF_TIME CP NMS") field(FLNK, "$(DEVICE):$(ATTR)_WF_Z") } # Interface PV, to display X axis of waveform in Z locations record(subArray, "$(DEVICE):$(ATTR)_WF_Z") { field(DESC, "Subarray") field(INP, "$(DEVICE):$(ATTR)_WF_Z_CLC.AVAL") field(FTVL, "DOUBLE") field(MALM, "1000000") field(NELM, "1024") field(INDX, "0") }