System Management code
Dependencies: mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP
Fork of SystemManagement by
OperatingInfo.h
00001 #ifndef OPERATING_INFO_H 00002 #define OPERATING_INFO_H 00003 00004 #include "Constants.h" 00005 #include <stdint.h> 00006 #include <time.h> 00007 00008 enum OperatingMode { 00009 // MODES 00010 OKAY=1<<0, 00011 FAULT=1<<1, 00012 }; 00013 00014 // Items here will prevent moving from STANDBY to IDLE 00015 enum TopLevelFaults { 00016 WATCHDOG = 1<<0, // Last reset caused by WDT 00017 BROWNOUT = 1<<1, // Last reset caused by Brownout 00018 CAN_FAULT = 1<<2, // CAN buffer overflow 00019 00020 INT_OVER_TEMP = 1<<3, // Temp. sensor on Charge FET is over limit 00021 IMD_LATCH = 1<<4, // Fault detected on the IMD latch circuit 00022 AMS_LATCH = 1<<5, // Fault detected on the AMS latch circuit 00023 IMD_FAULT = 1<<6, // IMD not okay or not running 00024 DCDC_FAULT = 1<<7, 00025 GLVBAT_FAULT = 1<<8, 00026 FREEZE_FRAME = 1<<9, // There is an error freeze frame captured, waiting to be inspected by user 00027 }; 00028 00029 enum SignalFlags { 00030 SHUTDOWN_CLOSED = 1<<0, // Shutdown circuit ready (closed) 00031 AIRS_CLOSED = 1<<1, // AIRs Closed (CAN) 00032 CHARGER_DET = 1<<2, // Charger detected (CAN) 00033 }; 00034 00035 // Contains all of the relevant operating data gathered from sensors and the prcoessed outputs 00036 // NOTE there are no mutexes/protection mechanisms here! Ensure single producer, single consumer for every item 00037 class OperatingInfo 00038 { 00039 public: 00040 // Diagnostic data 00041 char mode; 00042 char signals; 00043 uint16_t faultCode; 00044 time_t SysTime; 00045 time_t startTime; 00046 signed char profileIndex; 00047 bool profileModded; 00048 00049 struct { // GLV-Battery related 00050 float current; 00051 float SOC; 00052 float Ah; 00053 float capacity; 00054 char error; 00055 } glvBat; 00056 00057 struct { // DC-DC converter and PWM channels 00058 char status; 00059 float current; 00060 struct { 00061 float pump1; 00062 float pump2; 00063 float fan1; 00064 float fan2; 00065 } request; 00066 struct { 00067 float pump1; 00068 float pump2; 00069 float fan1; 00070 float fan2; 00071 } actual; 00072 } dcdc; 00073 00074 struct { // IMD 00075 char status; 00076 float resistance; 00077 char error; 00078 } imd; 00079 00080 struct { // Latch circuit supervisor 00081 char imd; 00082 char ams; 00083 } latch; 00084 00085 char switchState; 00086 float internalTemp; 00087 }; 00088 class OperatingInfo_checkSum 00089 { 00090 public: 00091 OperatingInfo op; 00092 uint32_t BSDchecksum; 00093 }; 00094 #endif
Generated on Fri Jul 15 2022 06:07:18 by
1.7.2
