Definitions

${KeithleyBasePV}

Everywhere this symbol is shown on this document, it means:

  • For the GMD Keithley: EM1K0:GMD:ETM:01
  • For the XGMD Keithley 1: EM2K0:XGMD:ETM:01
  • For the XGMD Keithley 2: EM2K0:XGMD:ETM:02
$(P)

Everywhere this symbol is shown on this document, it means:

  • For the GMD: EM1K0:GMD:HPS
  • For the XGMD: EM2K0:XGMD:HPS

Keithley dark current

Dark current is what we call the current measured by the Keithley when no beam is in the GMD chamber. According to DESY, the dark current is a random value varying from Keithley to Keithley and depends on the current range configured. It can also vary depending on air temperature and even triax cable position. To be clear, if you change the cable position you may observe a different dark current. Dark current can be negative or positive with no correlation with the configured range.

DESY's solution for this is to provide a dark current table with values that can be subtracted from the Keithley reading so we get as close as possible to 0 mJ when using the measured current to calculate the beam intensity. Users can type in values in case they see a beam intensity that is farther from zero than what is required.

Measurement of the dark current

To measure the dark current, while there's no beam:

  1. Read the PV ${KeithleyBasePV}:Reading for some time and take the average of the current.
  2. Change the Keithley range on the Kiethley display.
  3. Notice that when changing ranges, the current will change abruptly due to the switch of the internal electronics RC circuit. Sometimes a few minutes will be needed until the current stabilizes again.
  4. After the current stabilizes, repeat from step 1, until all ranges are measured.

We don't need to measure for ranges 2 mA and 20 mA. The RC boxes will be damaged if we ever reach this current level.

Results of the measurement from 09/01/2023

Values in Amperes.

Keithley rangesGMDXGMD 1XGMD 2
20 pA2.53E-131.45E-132.80E-13
200 pA2.50E-131.60E-132.80E-13
2 nA2.80E-133.50E-134.50E-13
20 nA2.50E-133.50E-134.00E-13
200 nA5.50E-133.00E-133.00E-13
2 uA-4.60E-111.67E-101.10E-10
20 uA-2.00E-111.70E-109.70E-11
200 uA2.70E-101.80E-10-4.00E-11
2 mA

Impossible current level because this would damage the RC boxes.

20 mA

Impossible current level because this would damage the RC boxes.

EPICS database

All the logic is implemented in the EPICS database gmdApp/Db/gmd-process.template. No C code was needed.

Two select records, one per Keithley, are used to store the dark current per Keithley range. Each range has its own PV linked in one of the INPA-INPJ inputs of the select record. All range PVs are autosaved.

The NVL field is linked to the correspondent Keithley SelectCurrentRange PV which is hosted by the Keithley IOC, an external IOC running in the PCDS network. Every time a user selects a different range using the Keithley display, the select record updates its VAL field selecting one of the inputs INPA-INPJ.

$(P):KeithleySum provides the sum of the two Keithleys, minus each dark current, reflected by the formula "A-C+B-D" in the CALC field. The Reading PV of each Keithley corresponds to the current in Amperes measured by the device.

Macros

In st.cmd, these macros are defined:

  • sioc-fees-gd01 / sioc-b084-gd01:
epicsEnvSet("Keithley1PV", "${AREA}:${POS}:ETM:01")
epicsEnvSet("Keithley2PV", "0")
epicsEnvSet("Keithley1Reading", ":Reading CP MS")
epicsEnvSet("Keithley2Reading", "")
  • sioc-fees-gd02 / sioc-b084-gd02:
epicsEnvSet("Keithley1PV", "${AREA}:${POS}:ETM:01")
epicsEnvSet("Keithley2PV", "${AREA}:${POS}:ETM:02")
epicsEnvSet("Keithley1Reading", ":Reading CP MS")
epicsEnvSet("Keithley2Reading", ":Reading CP MS")

They are passed on to the dbLoadRecords in iocBoot/common/gmd_common.cmd (see the second line below):

dbLoadRecords( "db/gmd-process.db", "P=$(P),SIG_LEN=2000,ACQ=$(IOC_NAME):ACQ:01,ACQ_CH=$(IOC_NAME):ACQ:01:CH1,
Keithley1PV=$(Keithley1PV),Keithley2PV=$(Keithley2PV),Keithley1Reading=$(Keithley1Reading),Keithley2Reading=$(Keithley2Reading),
TemperaturePV=$(TemperaturePV),PressurePV=$(PressurePV),GasTypePV=$(GasTypePV),EffectiveLength=$(EffectiveLength),
AVG_ENERGY_UPSTREAM_PV=$(AVG_ENERGY_UPSTREAM_PV),AVG_ENERGY_DOWNSTREAM_PV=$(AVG_ENERGY_DOWNSTREAM_PV),TPR=TPR:$(EED_AREA):$(IOC_UNIT):0" )

db/gmd-proces.db is created from gmdApp/Db/gmd-process.substitutions and gmdApp/Db/gmd-process.template.

Todo: describe macros in database

PyDM display

From the (X)GMD Keithley display, there's the button Dark Current Table that gives access to the table values to the user:

The user can see what is the current range selected on the Keithleys and type in the values in Amperes using scientific notation.

As the GMD has only one Keithley, the last column needs rules in PyDM to become invisible when the GMD display is opened, but visible when the XGMD is opened. This is the view from Qt Designer, with all widgets for the Keithley 2 column highlighted in blue:

Each one of these 12 widgets receive the same PyDM rule:

The logic is that the Visible property starts as false as Initial Value. In other words, if nothing changes, the widget will not be shown. The expression evaluates whether channel zero doesn't have the value 0. In context, it checks if the Keithley current is different from zero. With the GMD having only one Keithley, the PV ${KeithleyPV}:ETM:02:Reading doesn't exist. As PyDM identifies it as disconnected, the expression can't be evaluated and the widget stays invisible.

With the XGMD, ${KeithleyPV}:ETM:02:Reading exists and will never be zero. The expression evaluates as true and the widget becomes visible.

Here's the result when the second Keithley - ${KeithleyPV}:ETM:02 - doesn't exist:

Useful scripts

In gmdApp/initScripts/, there's the initDarkCurrentTables.sh script. This script is just a set of caput commands to be used in the first launch of a GMD release containing the Dark Current Table feature in production. After its first, and only, usage, autosave will be responsible for recording changes made by users. The script uses data from the table found in the section "Results of the measurement from 09/01/2023".

In gmdApp/testScripts/, there are two scripts that are connected to the dark current table feature:

  • switchKeith2.py
$ python gmdApp/testScripts/switchKeith2.py 
Usage: python switchKeith2.py <PV Base Name> <ON|OFF>

Example:
python switchKeith2.py EM1K0:GMD OFF

This is for testing the feature described in the PyDM display section when all widgets from the Keithley 2 column are hidden when only one Keithkey is available. The example above shows how to "turn off" the column on the display. Use this script while observing the PyDM display to test the behavior.

This is a very simple script:

if switch=="OFF":
    caput(basePV + ":ETM:02_CALC.DISV", 0)
    caput(basePV + ":ETM:02:Reading", 0)
elif switch=="ON":
    caput(basePV + ":ETM:02_CALC.DISV", 1)

These are PVs associated with records in the test_only.db database. This database is loaded only in the IOCs hosted in the test stand in B084. Never load this database in production because this will create duplicate PVs. Here are the relevant records:

test_only.db
record (calcout, "$(KEITH):ETM:02_CALC")
{
  field ("DESC", "Creates random numbers")
  field ("CALC", "RNDM * 0.75e-13 + 0.5e-12")
  field ("DOPT", "Use CALC")
  field ("OUT", "$(KEITH):ETM:02:Reading PP")
  field ("SCAN", "1 second")
}

record (ai, "$(KEITH):ETM:02:Reading")
{
  field ("DESC", "Keithley Reading")
  field( PINI, "YES" )
}

For turning the column off on the display, the first thing the script does is deactivate record processing of $(KEITH):ETM:02_CALC, using DISV. The second thing is to force a value zero in the $(KEITH):ETM:02:Reading PV. Reading equal to zero is the condition for the rule to make the widgets invisible (please refer to the PyDM display section).

For turning the column on again, the script releases the record processing of $(KEITH):ETM:02_CALC, and this record will update "Reading" again.

  • testKeithley.py


  • No labels