/** * @module * @description this module contains the ids of the mpr and also * some mappings that make mpt, mpr output similar. */ type FlagColumns = Record; /** * flag column ID bytes to the corresponding bitmask and name * As different from column IDs, flag column IDs don't need to be * modified when reading from MPT files, they are exactly the same. */ export const flagColumns: FlagColumns = { 0x1: { bitMask: 0b00000011, name: 'mode' }, 0x2: { bitMask: 0b00000100, name: 'ox/red' }, 0x3: { bitMask: 0b00001000, name: 'error' }, 0x15: { bitMask: 0b00010000, name: 'control changes' }, 0x1f: { bitMask: 0b00100000, name: 'Ns changes' }, 0x41: { bitMask: 0b10000000, name: 'counter inc.' }, }; type DataColumns = Record< number, { dType: string; name: string; unit: string } >; /** * data columns look-up table by Id */ export const dataColumns: DataColumns = { 0x4: { dType: 'Float64', name: 'time', unit: 's' }, 0x5: { dType: 'Float32', name: 'control_V/I', unit: 'V/mA' }, 0x6: { dType: 'Float32', name: 'Ewe', unit: 'V' }, 0x7: { dType: 'Float64', name: 'dq', unit: 'mA·h' }, 0x8: { dType: 'Float32', name: 'I', unit: 'mA' }, 0x9: { dType: 'Float32', name: 'Ece', unit: 'V' }, 0xb: { dType: 'Float64', name: '', unit: 'mA' }, 0xd: { dType: 'Float64', name: '(Q-Qo)', unit: 'mA·h' }, 0x10: { dType: 'Float32', name: 'Analog IN 1', unit: 'V' }, 0x11: { dType: 'Float32', name: 'Analog IN 2', unit: 'V' }, 0x13: { dType: 'Float32', name: 'control_V', unit: 'V' }, 0x14: { dType: 'Float32', name: 'control_I', unit: 'mA' }, 0x17: { dType: 'Float64', name: 'dQ', unit: 'mA·h' }, 0x18: { dType: 'Float64', name: 'cycle number', unit: '' }, 0x20: { dType: 'Float32', name: 'freq', unit: 'Hz' }, 0x21: { dType: 'Float32', name: '|Ewe|', unit: 'V' }, 0x22: { dType: 'Float32', name: '|I|', unit: 'A' }, 0x23: { dType: 'Float32', name: 'Phase(Z)', unit: 'deg' }, 0x24: { dType: 'Float32', name: '|Z|', unit: 'Ohm' }, 0x25: { dType: 'Float32', name: 'Re(Z)', unit: 'Ohm' }, 0x26: { dType: 'Float32', name: '-Im(Z)', unit: 'Ohm' }, 0x27: { dType: 'Uint16', name: 'I Range', unit: '' }, 0x46: { dType: 'Float32', name: 'P', unit: 'W' }, 0x4a: { dType: 'Float64', name: 'Energy', unit: 'W·h' }, 0x4b: { dType: 'Float32', name: 'Analog OUT', unit: 'V' }, 0x4c: { dType: 'Float32', name: '', unit: 'mA' }, 0x4d: { dType: 'Float32', name: '', unit: 'V' }, 0x4e: { dType: 'Float32', name: 'Cs-2', unit: 'µF⁻²' }, 0x60: { dType: 'Float32', name: '|Ece|', unit: 'V' }, 0x62: { dType: 'Float32', name: 'Phase(Zce)', unit: 'deg' }, 0x63: { dType: 'Float32', name: '|Zce|', unit: 'Ohm' }, 0x64: { dType: 'Float32', name: 'Re(Zce)', unit: 'Ohm' }, 0x65: { dType: 'Float32', name: '-Im(Zce)', unit: 'Ohm' }, 0x7b: { dType: 'Float64', name: 'Energy charge', unit: 'W·h' }, 0x7c: { dType: 'Float64', name: 'Energy discharge', unit: 'W·h' }, 0x7d: { dType: 'Float64', name: 'Capacitance charge', unit: 'µF' }, 0x7e: { dType: 'Float64', name: 'Capacitance discharge', unit: 'µF' }, 0x83: { dType: 'Uint16', name: 'Ns', unit: '' }, 0xa3: { dType: 'Float32', name: '|Estack|', unit: 'V' }, 0xa8: { dType: 'Float32', name: 'Rcmp', unit: 'Ohm' }, 0xa9: { dType: 'Float32', name: 'Cs', unit: 'µF' }, 0xac: { dType: 'Float32', name: 'Cp', unit: 'µF' }, 0xad: { dType: 'Float32', name: 'Cp-2', unit: 'µF⁻²' }, 0xae: { dType: 'Float32', name: '', unit: 'V' }, 0xf1: { dType: 'Float32', name: '|E1|', unit: 'V' }, 0xf2: { dType: 'Float32', name: '|E2|', unit: 'V' }, 0x10f: { dType: 'Float32', name: 'Phase(Z1)', unit: 'deg' }, 0x110: { dType: 'Float32', name: 'Phase(Z2)', unit: 'deg' }, 0x12d: { dType: 'Float32', name: '|Z1|', unit: 'Ohm' }, 0x12e: { dType: 'Float32', name: '|Z2|', unit: 'Ohm' }, 0x14b: { dType: 'Float32', name: 'Re(Z1)', unit: 'Ohm' }, 0x14c: { dType: 'Float32', name: 'Re(Z2)', unit: 'Ohm' }, 0x169: { dType: 'Float32', name: '-Im(Z1)', unit: 'Ohm' }, 0x16a: { dType: 'Float32', name: '-Im(Z2)', unit: 'Ohm' }, 0x187: { dType: 'Float32', name: '', unit: 'V' }, 0x188: { dType: 'Float32', name: '', unit: 'V' }, 0x1a6: { dType: 'Float32', name: 'Phase(Zstack)', unit: 'deg' }, 0x1a7: { dType: 'Float32', name: '|Zstack|', unit: 'Ohm' }, 0x1a8: { dType: 'Float32', name: 'Re(Zstack)', unit: 'Ohm' }, 0x1a9: { dType: 'Float32', name: '-Im(Zstack)', unit: 'Ohm' }, 0x1aa: { dType: 'Float32', name: '', unit: 'V' }, 0x1ae: { dType: 'Float32', name: 'Phase(Zwe-ce)', unit: 'deg' }, 0x1af: { dType: 'Float32', name: '|Zwe-ce|', unit: 'Ohm' }, 0x1b0: { dType: 'Float32', name: 'Re(Zwe-ce)', unit: 'Ohm' }, 0x1b1: { dType: 'Float32', name: '-Im(Zwe-ce)', unit: 'Ohm' }, 0x1b2: { dType: 'Float32', name: '(Q-Qo)', unit: 'C' }, 0x1b3: { dType: 'Float32', name: 'dQ', unit: 'C' }, 0x1b9: { dType: 'Float32', name: '', unit: 'V' }, 0x1ce: { dType: 'Float32', name: 'Temperature', unit: '°C' }, 0x1d3: { dType: 'Float64', name: 'Q charge/discharge', unit: 'mA·h' }, 0x1d4: { dType: 'Uint32', name: 'half cycle', unit: '' }, 0x1d5: { dType: 'Uint32', name: 'z cycle', unit: '' }, 0x1d7: { dType: 'Float32', name: '', unit: 'V' }, 0x1d9: { dType: 'Float32', name: 'THD Ewe', unit: '%' }, 0x1da: { dType: 'Float32', name: 'THD I', unit: '%' }, 0x1dc: { dType: 'Float32', name: 'NSD Ewe', unit: '%' }, 0x1dd: { dType: 'Float32', name: 'NSD I', unit: '%' }, 0x1df: { dType: 'Float32', name: 'NSR Ewe', unit: '%' }, 0x1e0: { dType: 'Float32', name: 'NSR I', unit: '%' }, 0x1e6: { dType: 'Float32', name: '|Ewe h2|', unit: 'V' }, 0x1e7: { dType: 'Float32', name: '|Ewe h3|', unit: 'V' }, 0x1e8: { dType: 'Float32', name: '|Ewe h4|', unit: 'V' }, 0x1e9: { dType: 'Float32', name: '|Ewe h5|', unit: 'V' }, 0x1ea: { dType: 'Float32', name: '|Ewe h6|', unit: 'V' }, 0x1eb: { dType: 'Float32', name: '|Ewe h7|', unit: 'V' }, 0x1ec: { dType: 'Float32', name: '|I h2|', unit: 'A' }, 0x1ed: { dType: 'Float32', name: '|I h3|', unit: 'A' }, 0x1ee: { dType: 'Float32', name: '|I h4|', unit: 'A' }, 0x1ef: { dType: 'Float32', name: '|I h5|', unit: 'A' }, 0x1f0: { dType: 'Float32', name: '|I h6|', unit: 'A' }, 0x1f1: { dType: 'Float32', name: '|I h7|', unit: 'A' }, 0x1f2: { dType: 'Float32', name: '|Ece h2|', unit: 'V' }, 0x1f3: { dType: 'Float32', name: '|Ece h7|', unit: 'V' }, 0x1f4: { dType: 'Float32', name: '|Ece h7|', unit: 'V' }, 0x1f5: { dType: 'Float32', name: '|Ece h7|', unit: 'V' }, 0x1f6: { dType: 'Float32', name: '|Ece h7|', unit: 'V' }, 0x1f7: { dType: 'Float32', name: '|Ece h7|', unit: 'V' }, }; export type DataColumnsByName = Record< string, { [mprName: string]: string; unit: string } >; /** * Map MPT to same MPR Type, plus add unit and more concise names * the unit will be taken from the original MPT file, and it may help * to spot any errors in MPR. */ export const dataColumnsByName: DataColumnsByName = { 'Ri/Ohm': { name: 'Ri', unit: 'Ohm' }, '-Im(Z)/Ohm': { name: '-Im(Z)', unit: 'Ohm' }, '-Im(Zce)/Ohm': { name: '-Im(Zce)', unit: 'Ohm' }, '-Im(Zwe-ce)/Ohm': { name: '-Im(Zwe-ce)', unit: 'Ohm' }, '(Q-Qo)/C': { name: '(Q-Qo)', unit: 'C' }, '(Q-Qo)/mA.h': { name: '(Q-Qo)', unit: 'mA·h' }, '/V': { name: '', unit: 'V' }, '/V': { name: '', unit: 'V' }, '/mA': { name: '', unit: 'mA' }, '|Ece|/V': { name: '|Ece|', unit: 'V' }, '|Energy|/W.h': { name: '|Energy|', unit: 'W·h' }, '|Ewe|/V': { name: '|Ewe|', unit: 'V' }, '|I|/A': { name: '|I|', unit: 'A' }, '|Y|/Ohm-1': { name: '|Y|', unit: 'S' }, '|Z|/Ohm': { name: '|Z|', unit: 'Ohm' }, '|Zce|/Ohm': { name: '|Zce|', unit: 'Ohm' }, '|Zwe-ce|/Ohm': { name: '|Zwe-ce|', unit: 'Ohm' }, 'Analog IN 1/V': { name: 'Analog IN 1', unit: 'V' }, 'Analog IN 2/V': { name: 'Analog IN 2', unit: 'V' }, 'Capacitance charge/µF': { name: 'Capacitance charge', unit: 'µF' }, 'Capacitance discharge/µF': { name: 'Capacitance discharge', unit: 'µF' }, 'Capacity/mA.h': { name: 'Capacity', unit: 'mA·h' }, 'charge time/s': { name: 'charge time', unit: 's' }, 'Conductivity/S.cm-1': { name: 'Conductivity', unit: 'S/cm' }, 'control changes': { name: 'control changes', unit: '' }, 'control/mA': { name: 'control_I', unit: 'mA' }, 'control/V': { name: 'control_V', unit: 'V' }, 'control/V/mA': { name: 'control_V/I', unit: 'V/mA' }, 'counter inc.': { name: 'counter inc.', unit: '' }, 'Cp-2/µF-2': { name: 'Cp-2', unit: 'µF⁻²' }, 'Cp/µF': { name: 'Cp', unit: 'µF' }, 'Cs-2/µF-2': { name: 'Cs-2', unit: 'µF⁻²' }, 'Cs/µF': { name: 'Cs', unit: 'µF' }, 'cycle number': { name: 'cycle number', unit: '' }, 'cycle time/s': { name: 'cycle time', unit: 's' }, 'd(Q-Qo)/dE/mA.h/V': { name: 'd(Q-Qo)/dE', unit: 'mA·h/V' }, 'dI/dt/mA/s': { name: 'dI/dt', unit: 'mA/s' }, 'discharge time/s': { name: 'discharge time', unit: 's' }, 'dQ/C': { name: 'dQ', unit: 'C' }, 'dq/mA.h': { name: 'dq', unit: 'mA·h' }, 'dQ/mA.h': { name: 'dQ', unit: 'mA·h' }, 'Ece/V': { name: 'Ece', unit: 'V' }, 'Ecell/V': { name: 'Ecell', unit: 'V' }, 'Efficiency/%': { name: 'Efficiency', unit: '%' }, 'Energy charge/W.h': { name: 'Energy charge', unit: 'W·h' }, 'Energy discharge/W.h': { name: 'Energy discharge', unit: 'W·h' }, 'Energy/W.h': { name: 'Energy', unit: 'W·h' }, error: { name: 'error', unit: '' }, 'Ewe-Ece/V': { name: 'Ewe-Ece', unit: 'V' }, 'Ewe/V': { name: 'Ewe', unit: 'V' }, 'freq/Hz': { name: 'freq', unit: 'Hz' }, 'half cycle': { name: 'half cycle', unit: '' }, 'I Range': { name: 'I Range', unit: '' }, 'I/mA': { name: 'I', unit: 'mA' }, 'Im(Y)/Ohm-1': { name: 'Im(Y)', unit: 'S' }, mode: { name: 'mode', unit: '' }, 'Ns changes': { name: 'Ns changes', unit: '' }, Ns: { name: 'Ns', unit: '' }, 'NSD Ewe/%': { name: 'NSD Ewe', unit: '%' }, 'NSD I/%': { name: 'NSD I', unit: '%' }, 'NSR Ewe/%': { name: 'NSR Ewe', unit: '%' }, 'NSR I/%': { name: 'NSR I', unit: '%' }, 'ox/red': { name: 'ox/red', unit: '' }, 'P/W': { name: 'P', unit: 'W' }, 'Phase(Y)/deg': { name: 'Phase(Y)', unit: 'deg' }, 'Phase(Z)/deg': { name: 'Phase(Z)', unit: 'deg' }, 'Phase(Zce)/deg': { name: 'Phase(Zce)', unit: 'deg' }, 'Phase(Zwe-ce)/deg': { name: 'Phase(Zwe-ce)', unit: 'deg' }, 'Q charge/discharge/mA.h': { name: 'Q charge/discharge', unit: 'mA·h' }, 'Q charge/mA.h': { name: 'Q charge', unit: 'mA·h' }, 'Q charge/mA.h/g': { name: 'Q charge', unit: 'mA·h/g' }, 'Q discharge/mA.h': { name: 'Q discharge', unit: 'mA·h' }, 'Q discharge/mA.h/g': { name: 'Q discharge', unit: 'mA·h/g' }, 'R/Ohm': { name: 'R', unit: 'Ohm' }, 'Rcmp/Ohm': { name: 'Rcmp', unit: 'Ohm' }, 'Re(Y)/Ohm-1': { name: 'Re(Y)', unit: 'S' }, 'Re(Z)/Ohm': { name: 'Re(Z)', unit: 'Ohm' }, 'Re(Zce)/Ohm': { name: 'Re(Zce)', unit: 'Ohm' }, 'Re(Zwe-ce)/Ohm': { name: 'Re(Zwe-ce)', unit: 'Ohm' }, 'step time/s': { name: 'step time', unit: 's' }, 'THD Ewe/%': { name: 'THD Ewe', unit: '%' }, 'THD I/%': { name: 'THD I', unit: '%' }, 'time/s': { name: 'time', unit: 's' }, x: { name: 'x', unit: '' }, 'z cycle': { name: 'z cycle', unit: '' }, };