# This code integrates the beam intensity signal during the # time where the integration is activated (SWITCH = 1) # and the camera is acquiring (SHUTTER = 0). It also counts # the time during which the integration occured to compute # the average intensity. This average intensity is compared # to a threshold to indicate the camera whether the exposure # is sufficient. # field for a beam copy record(ai, "$(P)BEAMCPY") { field(DTYP, "Soft Channel") field(LINR, "LINEAR") field(INP, "$(AI) CP") field(SCAN, "Passive") } # this is a switch which can be set to activate/deactivate the counting record(bi, "$(P)SWITCH") { field(DTYP,"Soft Channel") field(ZNAM,"Low") field(ONAM,"High") } # this is a dummy switch which simulates the shutter record(bi, "$(P)DummyShutter") { field(DTYP,"Soft Channel") field(ZNAM,"Closed") field(ONAM,"Open") } # This is an accumulator for the beam intensity integral record(ai, "$(P)ACCINT") { field(DTYP, "Soft Channel") field(LINR, "LINEAR") } # This is an accumulator for the exposure time record(ai, "$(P)ACCTIME") { field(DTYP, "Soft Channel") field(LINR, "LINEAR") } # This is the threshold for acceptable intensity record(ai, "$(P)THRES") { field(DTYP, "Soft Channel") field(LINR, "LINEAR") } # This record computes the integral of the beam intensity # (gated by the SWITCH and SHUTTER signals) record(calcout, "$(P)BEAMINT") { field(SCAN,".1 second") field(INPA,"$(AI)") field(INPB,"$(P)SWITCH") field(INPC,"$(CAM)SHUTTER") field(INPD,"$(P)ACCINT") field(CALC,"(B >= 1) AND (C = 0)? D + 0.1*A : D") field(OUT,"$(P)ACCINT") field(OOPT,"On Change") field(DOPT,"Use CALC") } # This record computes the total exposure time # (gated by the SWITCH and SHUTTER signals) record(calcout, "$(P)EXPTIME") { field(SCAN,".1 second") field(INPA,"$(AI)") field(INPB,"$(P)SWITCH") field(INPC,"$(CAM)SHUTTER") field(INPD,"$(P)ACCTIME") field(CALC,"(B >= 1) AND (C = 0)? D + 0.1 : D") field(OUT,"$(P)ACCTIME") field(OOPT,"On Change") field(DOPT,"Use CALC") } # This record computes the average beam intensity record(calcout, "$(P)BEAMAVG") { field(SCAN,".1 second") field(INPA,"$(P)EXPTIME") field(INPB,"$(P)BEAMINT") field(CALC,"A > 0 ? B/A : 0") field(OOPT,"On Change") field(DOPT,"Use CALC") } # This record compares the average intensity to the threshold record(calcout, "$(P)EXPOK") { field(SCAN,".1 second") field(INPA,"$(P)BEAMAVG") field(INPB,"$(P)THRES") field(CALC,"A >= B ? 1 : 0") field(OUT,"$(CAM)AUX") field(OOPT,"On Change") field(DOPT,"Use CALC") }