batMON smartCORE module
Description
The batmon module is the interface between the smartIO batMON battery monitoring system and the smartCORE. Various battery parameters are
- written to smartCHANNELS in the form of live data if the system is running
- recorded as historical data during the system's idle phase and downloaded from batMON during the system's switch-on phase and stored in a file provided for this purpose.
Operating states
The following diagram illustrates the operating states of the batMON.

Interfaces & protocols used
- CAN bus
- OSF format
JSON configuration
The following section describes the entire JSON configuration of the module and explains the individual parameters.
Example configuration (minimum)
{
"module": "batmon",
"factory": "batmon",
"config":{}
}
Example configuration (maximum)
{
"module": "batmon",
"factory": "batmon",
"config":{
"priority":80,
"timeoutMs":1000,
"readBufferSize":8192,
"writeBufferSize":8192,
"canInterface": "can1",
"fileName":"/sde/<tag>/<date>/<date>_<time>.osf",
"fileTag": "preview",
"measurementTimeChannelName": "Batmon.Parameter.MeasurementTime",
"shutDownTimeChannelName": "Batmon.Parameter.ShutDownTime",
"bootTimeChannelName": "Batmon.Parameter.BootTime",
"wakeUpTimeChannelName": "Batmon.Parameter.WakeUpTime",
"voltageDropDelayTimeChannelName": "Batmon.Parameter.VoltageDropDelayTime",
"vAlwaysOffChannelName": "Batmon.Parameter.VAlwaysOff",
"vAlwaysOnChannelName": "Batmon.Parameter.VAlwaysOn",
"powerSupplyVoltageChannelName": "Batmon.PowerSupplyVoltage",
"powerSupplyCurrentChannelName": "Batmon.PowerSupplyCurrent",
"temperatureMOSFETChannelName": "Batmon.TemperatureMOSFET",
"temperatureChannelName": "Batmon.Temperature",
"resistanceChannelName": "Batmon.Resistance",
"operatingModeChannelName": "Batmon.PluginState",
"configurationErrorChannelName": "Batmon.ConfigurationError",
"batteryStatusChannelName": "Batmon.BatteryStatus",
"terminal15StatusChannelName": "Batmon.Terminal15Status",
"shutDownCounterChannelName": "Batmon.ShutDownCounter",
"bootCounterChannelName": "Batmon.BootCounter",
"wakeUpEventChannelName": "Batmon.WakeUpEvent",
"shutDownEventChannelName": "Batmon.ShutDownEvent",
"requestEnergySaveChannelName": "Batmon.RequestEnergySave",
"aboutToShutDownChannelName": "Batmon.AboutToShutDown",
"criticalPowerStateChannelName": "Batmon.CriticalPowerState",
"lowPowerStateChannelName": "Batmon.LowPowerState",
"firmwareVersionsChannelName": "firmwareVersions",
"wakeUpTime":3600,
"measurementTime":60,
"shutDownTime":90,
"bootTime":900,
"voltageDropDelayTime":10,
"voltageAlwaysOnMV":23000,
"voltageAlwaysOffMV":20500,
"canIdValues123":120,
"canIdValues456":121,
"canIdStatus":125,
"canIdSetRtcRXD":10,
"canIdSetRtcTXD":11,
"canIdRXD":128,
"canIdTXD":129,
"canIdParameter1":130,
"canIdParameter2":131,
"canIdParameter3":132
}
}
Parameter list
| Parameter name | Required | Data type | Meaningful value range | Default | Description |
|---|---|---|---|---|---|
| priority | No | INT | 1 ... 99 | 80 | Scheduling priority of the CAN bus interface |
| timeoutMs | No | INT | 1 ... | 1000 | Interval between periodically executed parts of the module |
| readBufferSize | No | INT | 1 ... | 8192 | Number of buffered CAN bus messages (read direction) |
| writeBufferSize | No | INT | 1 ... | 8192 | Number of buffered CAN bus messages (write direction) |
| canInterface | No | STRING | "can0", "can1", ... | "can1" | CAN bus interface |
| fileName | No | STRING | valid OSF path template | "/sde/<tag>/<date>/<date>_<time>.osf" | Historical OSF file |
| fileTag | No | STRING | "preview" | Tag attributes of the historical OSF file | |
| measurementTimeChannelName | No | STRING | "<module>.Parameter.MeasurementTime" | Channel with set measurement interval Parameter | |
| shutDownTimeChannelName | No | STRING | "<module>.Parameter.ShutDownTime" | Channel with set shutdown time Parameter | |
| bootTimeChannelName | No | STRING | "<module>.Parameter.BootTime" | Channel with set boot time Parameter | |
| wakeUpTimeChannelName | No | STRING | "<module>.Parameter.WakeUpTime" | Channel with set wake-up time Parameter | |
| voltageDropDelayTimeChannelName | No | STRING | "<module>.Parameter.VoltageDropDelayTime" | Channel with set voltage drop tolerance time parameter | |
| vAlwaysOffChannelName | No | STRING | "<module>.Parameter.VAlwaysOff" | Channel with set parameter of the lower switching threshold | |
| vAlwaysOnChannelName | No | STRING | "<module>.Parameter.VAlwaysOn" | Channel with set parameter of the upper switching threshold | |
| powerSupplyVoltageChannelName | No | STRING | "<module>.PowerSupplyVoltage" | Supply voltage (U_Sup) | |
| powerSupplyCurrentChannelName | No | STRING | "<module>.PowerSupplyCurrent" | Supply current (I_Sup) | |
| temperatureMOSFETChannelName | No | STRING | "<module>.TemperatureMOSFET" | Temperature of the MOSFET (T_MOS) | |
| temperatureChannelName | No | STRING | "<module>.Temperature" | Temperature of the batMON (T_bM) | |
| resistanceChannelName | No | STRING | "<module>.Resistance" | Resistance of the batMON (R_bM) | |
| operatingModeChannelName | No | STRING | "<module>.PluginState" | batMON plugin state (raw state machine value) | |
| configurationErrorChannelName | No | STRING | "<module>.ConfigurationError" | batMON configuration error | |
| batteryStatusChannelName | No | STRING | "<module>. "BatteryStatus" | batMON BatteryStatus | |
| terminal15StatusChannelName | No | STRING | "<module>.Terminal15Status" | batMON Status of terminal 15 | |
| shutDownCounterChannelName | No | STRING | "<module>.ShutDownCounter" | batMON Countdown within which the shutdown must be completed | |
| bootCounterChannelName | No | STRING | "<module>.BootCounter" | batMON Countdown within which the system startup must be completed | |
| wakeUpEventChannelName | No | STRING | "<module>.WakeUpEvent" | batMON Wakeup event | |
| requestEnergySaveChannelName | No | STRING | "<module>.RequestEnergySave" | BOOL latch: set once energy-saving has been requested at least once since module startup (ECO mode, KL15 switch-off edge in AlwaysOn mode, or acknowledged shutdown command); reset only on module restart | |
| aboutToShutDownChannelName | No | STRING | "<module>.AboutToShutDown" | BOOLesche batMON channel for notification of imminent shutdown | |
| criticalPowerStateChannelName | No | STRING | "<module>.CriticalPowerState" | BOOLesche batMON channel for notification of a critical power state | |
| lowPowerStateChannelName | No | STRING | "<module>.LowPowerState" | BOOLesche batMON channel for notification of a low power state | |
| firmwareVersionsChannelName | No | STRING | "<module>.FirmwareVersion" | STRING Channel with FW and PIC FW version information | |
| wakeUpTime | No | INT | 600 ... 7200 | 3600 | batMON Wake-up time [s] |
| measurementTime | No | INT | 30 ... 300 | 60 | batMON Measuring interval [s] |
| shutDownTime | No | INT | 30 ... 120 | 90 | batMON Shutdown time [s] |
| bootTime | No | INT | 60 ... 120 | 900 | batMON Boot time [s] |
| voltageDropDelayTime | No | INT | 10 | batMON Voltage drop-in tolerance time [s] | |
| voltageAlwaysOnMV | No | INT | (voltageAlwaysOffMV + 2000) ... 150000 | 23000 | batMON Switch-on threshold for continuous operation [mV] |
| voltageAlwaysOffMV | No | INT | 18500 ... (voltageAlwaysOnMV - 2000) | 20500 | batMON Switch-off threshold [mV] |
| canIdValues123 | No | INT | valid/unique CAN ID | 120 | batMON CAN bus ID for message (U_Sup,I_Sup,T_MOS) |
| canIdValues456 | No | INT | valid/unique CAN ID | 121 | batMON CAN bus ID for message (T_bM) |
| canIdStatus | No | INT | valid/unique CAN ID | 125 | batMON CAN bus ID for status message |
| canIdSetRtcRXD | No | INT | valid/unique CAN ID | 10 | batMON CAN bus ID for setting the RTC |
| canIdSetRtcTXD | No/Discarded | INT | valid/unique CAN ID | 11 | batMON CAN bus ID for setting the RTC (acknowledgement) |
| canIdParameter1 | No | INT | valid/unique CAN ID | 130 | batMON CAN bus ID for the first parameter report frame |
| canIdParameter2 | No | INT | valid/unique CAN ID | 131 | batMON CAN bus ID for the second parameter report frame |
| canIdParameter3 | No | INT | valid/unique CAN ID | 132 | batMON CAN-Bus ID for the third Parameter Report Frame |
Parameter Enums
Plugin state (OperatingMode)
| Value | Enum | State |
|---|---|---|
| 0 | bsInit | Initializing |
| 1 | bsBoot | Booting |
| 2 | bsBootInternCom | Booting: internal communication |
| 3 | bsSynchronizeRtc | Booting: synchronizing RTC |
| 4 | bsGetFirmwareVersion | Booting: reading firmware version |
| 5 | bsGetHistory | Booting: downloading historical data |
| 6 | bsGetParameter | Booting: reading parameters |
| 7 | bsUpdateParameter | Booting: writing parameters |
| 8 | bsWakeup | Waking up |
| 9 | bsRunning | Running |
| 10 | bsCmdShutdown | Running: processing shutdown command |
| 11 | bsResynchronizeRtc | Running: re-synchronizing RTC |
| 12 | bsNotifyShutDown | Notifying shutdown |
| 13 | bsAboutToShutDown | Shutdown initiated |
| 14 | bsPostponeShutDown | Shutdown postponed |
| 15 | bsShutdown | Shutting down |
batMON smartIO device status
| Value | Meaning |
|---|---|
| 0 | initial after a cold start / reset |
| 1 | Standby (monitoring idle state timer, voltages, terminal 15, ...) |
| 2 | Switched on (MOSFET switched on, monitoring of input voltage |
| 3 | System start (waiting for the system to start up) |
| 4 | Monitoring (waiting for system shutdown condition) |
| 5 | Switching off (waiting for the system to switch off) |
| 6 | Switched off (MOSFET switched off, capacitors are discharged) |
Configuration error
| Value | Enum | Meaning |
|---|---|---|
| -3 | VoltageAlwaysOnTooHigh | voltageAlwaysOnMV too high |
| -2 | VoltageAlwaysOnTooLow | voltageAlwaysOnMV too low |
| -1 | VoltageAlwaysOffTooLow | voltageAlwaysOffMV too low |
| 0 | OK | OK |
| 1 | WrongMeasurementTime | wrong measurementTime |
| 2 | WrongShutdownTime | wrong shutDownTime |
| 3 | WrongBootTime | wrong bootTime |
| 4 | WrongWakeUpTime | wrong wakeUpTime |
| 5 | WrongVAlwaysOn | wrong voltageAlwaysOnMV |
| 6 | WrongVAlwaysOff | wrong voltageAlwaysOffMV |
| 7 | WrongVoltageDropDelayTime | wrong voltageDropDelayTime |
Battery status
| Value | Meaning |
|---|---|
| 0 | unknown |
| 1 | permanently switched on |
| 2 | energy saving mode |
| 3 | permanently switched off |
| 4 | permanently switched off (below power supply switch-on voltage) |
Status of terminal 15
| Value | Meaning |
|---|---|
| 0 | unknown/not available |
| 1 | switch-on edge |
| 2 | switch-off edge |
Wake-up event
| Value | Enum | Meaning | Following operating mode |
|---|---|---|---|
| 0 | eWakeUp_none | no event | undefined |
| 1 | eWakeUp_KL15_ON | Terminal 15 switch-on edge | Retrieval of historical data + continuous operation |
| 2 | eWakeUp_Ubatt_Always_OFF | U_batt below Always-OFF threshold | Alarming + shutdown |
| 3 | eWakeUp_Ubatt_Always_ON | U_batt above Always-ON threshold | Retrieval of historical data + continuous operation |
| 4 | eWakeUp_Ubatt_Timer | Periodic wakeup in energy-saving mode (timer) | Retrieval of historical data + energy-saving mode |
| 5 | eWakeUp_Ubatt_LowPower | (deprecated) | Retrieval of historical data + energy-saving mode |
| 6 | eWakeUp_CAN_Timer | Wakeup after sleep actively requested via CAN | Retrieval of historical data + continuous operation |
Shutdown event
| Value | Enum | Meaning | Description |
|---|---|---|---|
| 0 | eShutdown_none | none | no event |
| 1 | eShutdown_KL15 | Terminal 15 | Shutdown via terminal 15 (e.g. ignition key) |
| 2 | eShutdown_Ubatt_Always_OFF | U_batt below Always-OFF threshold | Shutdown because U_batt fell below the Always-OFF threshold |
| 3 | eShutdown_CAN | CAN bus message | Shutdown due to a CAN bus message |
| 4 | eShutdown_OverCurrent | Overcurrent (fault) | Shutdown due to exceeded current |
| 5 | eShutdown_OverTemperature | Overtemperature (fault) | Shutdown due to exceeded temperature |
| 6–8 | — | RESERVED | |
| 9 | eShutdown_MOSFET_Failure | MOSFET failure (fault) | Shutdown due to MOSFET failure |
| 10 | ePowerOff_KL15_Ubatt_Always_OFF | Terminal 15 and Always-OFF threshold | Shutdown because U_batt fell below the Always-OFF threshold (terminal 15 present) |
| 11 | ePowerOff_ECO_Mode | Eco mode | Shutdown after completed measurement, U_batt below Always-ON threshold |
| 12 | ePowerOff_Underrange_Intrexis | Undershoot | Undershoot of the MOSFET switch-on voltage |
| 15 | eShutdown_Unknown | unknown | unknown shutdown event |
Call interface functions
requestDelayedShutdown
Function for the shutdown delay
| Parameters | Type | Description |
|---|---|---|
| sender | STRING | Unique sender identifier (e.g. module instance) |
| delay | INT | Delay [ms] < 64k |
Module information
| Information | Value |
|---|---|
| Author | optiMEAS GmbH |
| since smartCORE | 0.101 |
| module type | producer & consumer (request energy save) |
| Dependencies | "canbus" or "candbc" smartMODULE (on smartDEVICES), functioning CAN bus interface (on other platforms) |