MOMA Consumables

From 699wiki
Jump to navigation Jump to search

A MOMA consumable is defined as any piece of hardware in the MOMA instrument that has a limited lifetime. What exactly "lifetime" means is dependent on the specific piece of hardware we are interested in and a single consumable may have more than one way to define its lifetime. This page details the logic we use to extract the data for each consumable. Note that this is the master reference, which means the engineers and scientists should ensure that the logic detailed here is correct. All consumable data is available on XINA Online at

WRP Consumable

On Time

WRP on time is determined by calculating the total time that PWM_SPEED (HKID 832) is above 500 RPM.


The number of WRP cycles is determined by counting the number of times the PWM speed (HKID 832) goes about 30,000 RPM.

NOTE: This current logic counts some of the failed WRP Startups as a cycle. See trend for failed startups.

Filament Consumable

On Time

Filament 1 and Filament 2 on time are determined by calculating the amount of time that SEB IS_EMON_A and IS_EMON_B (HKIDs 17 and 18) are greater than 1 uA.


Filament 1 and Filament 2 cycles are determined by counting the number of times the filaments transition from off to on. A few notes about the algorithm:

  • if the digital status packet indicates that the SEB is off, then the state of the filaments is considered to be off.
  • a filament is considered to be on if if its on "on bit" (HKIDs 102, 105) is set to 1, and if the FIL_VMON is above 2.5V. Otherwise, it is assumed to be off.
  • if the FIL_VMON is not being sampled, then only the "on bits" (HKIDs 102, 105) are used to determine if the filaments are on.

EM Consumable

On Time

EM 1 and EM 2 on times are determined by summing the on times for all scans, and then looking for any time when the EMs were constantly on outside of scanning.

SEB sequences are examined to determine the on time for individual scans. In order to avoid double-counting scans, only sum packet (packet type 27) scans are examined when in EI mode, and only science packet (packet type 26) scans are examined when in LDI mode.

Additionally, outside of science scans, the total time that the EMs are on are summed. This is determined by summing the amount of time that EM A and EM B are below -1900 V. HKIDs 22 and 23 are examined in this phase of the algorithm.

Bradley Tse pointed out a flaw in this algorithm:

There is a corner case where that may introduce its own problems. If the user stops the script after the Sequence was dumped but before scanning started (maybe because they noticed one of the parameters was incorrect), then that means the SebSequences will be duplicated. And so EM on time for all scans after that (until the next Sequence Dump) will have 2x the amount (or however many times the script was stopped before scans occurred)

Full Cycles and Soft Cycles

Thanks to Bryant O'Brien for promptly providing this description.

EM Cycles are determined through two passes of the data.

The first pass of EM Cycles are counted from the scan status packets. The cycles are calculated differently depending on the type of mode the test is in.

If in LDI mode [1], if HKID 222 (SCN_EM1) or HKID 223 (SCN_EM2) is below the -1900V threshold, then a full cycle is added to the corresponding detector’s count. If in Dark Counts mode [2], no full cycles are added here, as typically a Dark Counts run contains only 1 full cycle total. If in EI mode [3], soft counts are added to EM1 if HKID17 (IS_EMON_A) is greater than 9, and the same procedure for EM2 and HKID18 (EMON_B).

The timestamps of the scan packets are used to determine gaps in time when scans are not occurring during the test. A second pass through but looking specifically in the gaps and the binned HK data is necessary to avoid missing any full or soft cycles.

Here, HKID47 (SEB: EM_1_DAC0_SET) and HKID48 (SEB: EM_2_DAC1_SET) are looked through individually. If the HK value is > -50V, the detector is OFF. If the HK value is < -1900 the detector is ON. Full cycles are added for each occurrence where a detector changes from the OFF state to the ON state within a gap.

[1] - LDI Mode is when Filaments are OFF ([HKIDs 17/18] < 9), and the RF (HKID 235) is ON (End Amplitude >= 500A)

[2] - Dark Counts Mode is when Filaments are OFF ([HKIDs 17/18] < 9), and the RF (HKID 235) is OFF (End Amplitude < 500A)

[3] - EI Mode is when a Filament is ON ([HKIDs 17 or 18] > 9)

EM Counts

EM 1 and EM 2 counts are calculated according to the logic below. If the most recent DAC value (HKIDs 222 and 223) is zero, then ions are not counted against the multiplier.

   # dummy variable to help when counting ions in science packet (packet 26) scans
   temp_counts = 0 
   for each packet in the file: 
       if the packet indicates that filament A or filament B is on (HKIDs 105 and 102):
           set the current scan type to EI
           set the current scan type to LDI 
       else if the packet type is a scan status packet (type 25): 
          if we're in LDI mode: 
              count temp_counts against whichever EM is on (or both, if they're both on) 
              set temp_counts back to 0
       else if the current mode is LDI mode and the current packet type is a science packet (type 26): 
           temp_counts += packet.total_ion_count() 
       else if the current mode is EI mode and the current packet type is a sum packet (type 27): 
           count packet.total_ion_count() against whichever EM is on (or both, if they're both on) 
       # special-case code for handling dark count scans: 
       else if the current mode is LDI, and the current packet is a sum packet (type 27), and the packet's RF DAC value (HKID 405) < 50:
           count packet.total_ion_count() against whichver EM is on (or both, if they're both on)

Laser Consumable

Laser Shots

Laser shots are determined by summing the number of main pulses (HKID 1050) and the number of pre pulses (HKID 1001).

Valve Consumable

Valve Cycles

Valve cycles are determined by examining the message log and counting the number of times a valve transitions from closed to opened. When counting valve cycles for a TID, the state of the valve cycles in the previous TID is accounted for. The exact regexes used (as of Feb 22) are:

   VALVE_OPENED_REGEX = r'.*valve \d opened$'
   VALVE_CLOSED_REGEX = r'.*valve \d closed$'

Bus Energy Consumable

Bus 1 energy is calculated by summing HKID 939, and then dividing that sum by 3600 to get watt-hours.

Bus 2 energy and Bus 3 energy are calculated in the same way, except HKIDs 940 and 941 are used.

Bus 4 energy is always assumed to be zero.



This is the sum of the durations of all TIDs. Currently, each TID's duration is calculated by simply subtracting earliest_packet.timestamp from last_packet.timestamp. However, we plan on making this calculation more accurate by ignoring rover simulation packets.

Aperture Valve

This is the number of times the "apv open" message appears in the message log. NOTE: This does not account for APV opens during commissioning since the "apv open" message is out output.