-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#156 - basic data set up for fault abstraction
- Loading branch information
Showing
10 changed files
with
191 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
angular-client/src/pages/fault-page/shared/fault-type/charger-fault-type.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Fault } from '../indiv-fault/fault.model'; | ||
import { FaultType, FaultTypeModel } from './fault-type.model'; | ||
|
||
export class ChargerFaultType implements FaultTypeModel { | ||
subscribeToFaults(): Fault<ChargerFaultType> { | ||
// TODO | ||
throw new Error('Method not implemented.'); | ||
} | ||
name = FaultType.Charger; | ||
recordedFaults: Fault<ChargerFaultType>[] = []; | ||
} |
11 changes: 11 additions & 0 deletions
11
angular-client/src/pages/fault-page/shared/fault-type/dti-fault-type.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Fault } from '../indiv-fault/fault.model'; | ||
import { FaultType, FaultTypeModel } from './fault-type.model'; | ||
|
||
export class DTIFaultType implements FaultTypeModel { | ||
subscribeToFaults(): Fault<DTIFaultType> { | ||
// TODO | ||
throw new Error('Method not implemented.'); | ||
} | ||
name = FaultType.DTI; | ||
recordedFaults: Fault<DTIFaultType>[] = []; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
angular-client/src/pages/fault-page/shared/fault-type/mpu-fault-type.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Fault } from '../indiv-fault/fault.model'; | ||
import { FaultType, FaultTypeModel } from './fault-type.model'; | ||
|
||
export class MPUFaultType implements FaultTypeModel { | ||
subscribeToFaults(): Fault<MPUFaultType> { | ||
// TODO | ||
throw new Error('Method not implemented.'); | ||
} | ||
name = FaultType.MPU; | ||
recordedFaults: Fault<MPUFaultType>[] = []; | ||
} |
38 changes: 34 additions & 4 deletions
38
angular-client/src/pages/fault-page/shared/indiv-fault/bms-fault.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,44 @@ | ||
import { Node } from 'src/utils/types.utils'; | ||
import { BMSFaultType } from '../fault-type/bms-fault-type.model'; | ||
import { Fault } from './fault.model'; | ||
|
||
export enum BMS_FAULTS_VALUES { | ||
CELLS_NOT_BALANCING = 1, | ||
CELL_VOLTAGE_TOO_LOW = 2, | ||
CELL_VOLTAGE_TOO_HIGH = 4, | ||
PACK_TOO_HOT = 8, | ||
OPEN_WIRING_FAULT = 16, | ||
INTERNAL_SOFTWARE_FAULT = 32, | ||
INTERNAL_THERMAL_ERROR = 64, | ||
INTERNAL_CELL_COMM_FAULT = 128, | ||
CURRENT_SENSOR_FAULT = 256, | ||
CHARGE_READING_MISMATCH = 512, | ||
LOW_CELL_VOLTAGE = 1024, | ||
WEAK_PACK_FAULT = 2048, | ||
EXTERNAL_CAN_FAULT = 4096, | ||
DISCHARGE_LIMIT_ENFORCEMENT_FAULT = 8192, | ||
CHARGER_SAFETY_RELAY = 16384, | ||
BATTERY_THERMISTOR = 32768, | ||
CHARGER_CAN_FAULT = 65536, | ||
CHARGER_LIMIT_ENFORCEMENT_FAULT = 131072 | ||
} | ||
|
||
export class BMSFault implements Fault<BMSFaultType> { | ||
name: String; | ||
name: BMS_FAULTS_VALUES; | ||
timeTriggered: number; | ||
format(): { type: String; name: String; timeTriggered: number } { | ||
throw new Error('Method not implemented.'); | ||
} | ||
constructor() { | ||
this.name = 'hello'; | ||
this.timeTriggered = 101011; | ||
/** | ||
* Constructs a new BMS fault base on a valid faultValue | ||
* @param faultValue | ||
* @param timeTriggered | ||
*/ | ||
constructor(faultValue: BMS_FAULTS_VALUES, timeTriggered: number) { | ||
this.name = faultValue; | ||
this.timeTriggered = timeTriggered; | ||
} | ||
getRelevantNodes(timeFrame: number): Node[] { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
angular-client/src/pages/fault-page/shared/indiv-fault/charger-fault.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Node } from 'src/utils/types.utils'; | ||
import { ChargerFaultType } from '../fault-type/charger-fault-type.model'; | ||
import { Fault } from './fault.model'; | ||
|
||
export enum CHARGER_FAULT_VALUES { | ||
COMM_TIMEOUT_FAULT = 'Comm Timeout', | ||
HARDWARE_FAILURE_FAULT = 'Hardware Failure', | ||
OVER_TEMP_FAULT = 'Over Temp', | ||
VOLTAGE_WRONG_FAULT = 'Voltage Wrong', | ||
WRONG_BAT_CONNECT_FAULT = 'Wrong Battery Connect' | ||
} | ||
|
||
export class ChargerFault implements Fault<ChargerFaultType> { | ||
name: CHARGER_FAULT_VALUES; | ||
timeTriggered: number; | ||
format(): { type: String; name: CHARGER_FAULT_VALUES; timeTriggered: number } { | ||
throw new Error('Method not implemented.'); | ||
} | ||
/** | ||
* Constructs a new Charger fault base on a valid faultValue | ||
* @param faultValue | ||
* @param timeTriggered | ||
*/ | ||
constructor(faultValue: CHARGER_FAULT_VALUES, timeTriggered: number) { | ||
this.name = faultValue; | ||
this.timeTriggered = timeTriggered; | ||
} | ||
getRelevantNodes(timeFrame: number): Node[] { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
angular-client/src/pages/fault-page/shared/indiv-fault/dti-fault.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Node } from 'src/utils/types.utils'; | ||
import { DTIFaultType } from '../fault-type/dti-fault-type.model'; | ||
import { Fault } from './fault.model'; | ||
|
||
export enum DTI_FAULTS_VALUES { | ||
OVER_VOLTAGE = 1, | ||
UNDER_VOLTAGE = 2, | ||
DRV = 3, | ||
ABS_OVER_CURRENT = 4, | ||
CTLR_OVER_TEMP = 5, | ||
MOTOR_OVER_TEMP = 6, | ||
SENSOR_WIRE_FAULT = 7, | ||
SENSOR_GENERAL_FAULT = 8, | ||
CAN_COMMAND_ERROR = 9, | ||
ANALOG_INPUT_ERROR = 10 | ||
} | ||
|
||
export class DTIFault implements Fault<DTIFaultType> { | ||
name: DTI_FAULTS_VALUES; | ||
timeTriggered: number; | ||
format(): { type: String; name: String; timeTriggered: number } { | ||
throw new Error('Method not implemented.'); | ||
} | ||
/** | ||
* Constructs a new DTI fault base on a valid | ||
* @param faultValue | ||
* @param timeTriggered | ||
*/ | ||
constructor(faultValue: DTI_FAULTS_VALUES, timeTriggered: number) { | ||
this.name = faultValue; | ||
this.timeTriggered = timeTriggered; | ||
} | ||
getRelevantNodes(timeFrame: number): Node[] { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} |
39 changes: 8 additions & 31 deletions
39
angular-client/src/pages/fault-page/shared/indiv-fault/fault.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,15 @@ | ||
import { Node } from 'src/utils/types.utils'; | ||
import { FaultTypeModel } from '../fault-type/fault-type.model'; | ||
import { BMS_FAULTS_VALUES } from './bms-fault.model'; | ||
import { CHARGER_FAULT_VALUES } from './charger-fault.model'; | ||
import { DTI_FAULTS_VALUES } from './dti-fault.model'; | ||
import { MPU_FAULTS_VALUES } from './mpu-fault.model'; | ||
|
||
export interface Fault<T extends FaultTypeModel> { | ||
name: String; | ||
name: AllFaultEnums; | ||
timeTriggered: number; | ||
format(): { type: String; name: String; timeTriggered: number }; | ||
getRelevantNodes(timeFrame: number): Node[]; | ||
} | ||
|
||
export type AllFaultEnums = BMS_FAULTS_VALUES; | ||
|
||
enum BMS_FAULTS_VALUES { | ||
CELLS_NOT_BALANCING = 1, | ||
CELL_VOLTAGE_TOO_LOW = 2, | ||
CELL_VOLTAGE_TOO_HIGH = 4, | ||
PACK_TOO_HOT = 8, | ||
OPEN_WIRING_FAULT = 16, | ||
INTERNAL_SOFTWARE_FAULT = 32, | ||
INTERNAL_THERMAL_ERROR = 64, | ||
INTERNAL_CELL_COMM_FAULT = 128, | ||
CURRENT_SENSOR_FAULT = 256, | ||
CHARGE_READING_MISMATCH = 512, | ||
LOW_CELL_VOLTAGE = 1024, | ||
WEAK_PACK_FAULT = 2048, | ||
EXTERNAL_CAN_FAULT = 4096, | ||
DISCHARGE_LIMIT_ENFORCEMENT_FAULT = 8192, | ||
CHARGER_SAFETY_RELAY = 16384, | ||
BATTERY_THERMISTOR = 32768, | ||
CHARGER_CAN_FAULT = 65536, | ||
CHARGER_LIMIT_ENFORCEMENT_FAULT = 131072 | ||
} | ||
|
||
enum CHARGER_FAULT_VALUES { | ||
COMM_TIMEOUT_FAULT = 'Comm Timeout', | ||
HARDWARE_FAILURE_FAULT = 'Hardware Failure', | ||
OVER_TEMP_FAULT = 'Over Temp', | ||
VOLTAGE_WRONG_FAULT = 'Voltage Wrong', | ||
WRONG_BAT_CONNECT_FAULT = 'Wrong Battery Connect' | ||
} | ||
export type AllFaultEnums = BMS_FAULTS_VALUES | CHARGER_FAULT_VALUES | DTI_FAULTS_VALUES | MPU_FAULTS_VALUES; |
44 changes: 44 additions & 0 deletions
44
angular-client/src/pages/fault-page/shared/indiv-fault/mpu-fault.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Node } from 'src/utils/types.utils'; | ||
import { DTIFaultType } from '../fault-type/dti-fault-type.model'; | ||
import { Fault } from './fault.model'; | ||
import { MPUFaultType } from '../fault-type/mpu-fault-type.model'; | ||
|
||
export enum MPU_FAULTS_VALUES { | ||
ONBOARD_TEMP_FAULT = 1, | ||
ONBOARD_PEDAL_FAULT = 2, | ||
IMU_FAULT = 4, | ||
CAN_DISPATCH_FAULT = 8, | ||
CAN_ROUTING_FAULT = 16, | ||
FUSE_MONITOR_FAULT = 32, | ||
SHUTDOWN_MONITOR_FAULT = 64, | ||
DTI_ROUTING_FAULT = 128, | ||
STEERINGIO_ROUTING_FAULT = 256, | ||
STATE_RECEIVED_FAULT = 512, | ||
INVALID_TRANSITION_FAULT = 1024, | ||
BMS_CAN_MONITOR_FAULT = 2048, | ||
BUTTONS_MONITOR_FAULT = 4096, | ||
BSPD_PREFAULT = 8192, | ||
LV_MONITOR_FAULT = 16384, | ||
BATTERY_THERMISTOR = 32768, | ||
RTDS_FAULT = 65536 | ||
} | ||
|
||
export class MPUFault implements Fault<MPUFaultType> { | ||
name: MPU_FAULTS_VALUES; | ||
timeTriggered: number; | ||
format(): { type: String; name: String; timeTriggered: number } { | ||
throw new Error('Method not implemented.'); | ||
} | ||
/** | ||
* Constructs a new MPU fault base on a valid faultValue | ||
* @param faultValue | ||
* @param timeTriggered | ||
*/ | ||
constructor(faultValue: MPU_FAULTS_VALUES, timeTriggered: number) { | ||
this.name = faultValue; | ||
this.timeTriggered = timeTriggered; | ||
} | ||
getRelevantNodes(timeFrame: number): Node[] { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} |