-
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.
- Loading branch information
Showing
4 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
angular-client/src/pages/fault-page/shared/fault-type/bms-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 BMSFaultType implements FaultTypeModel { | ||
subscribeToFaults(): Fault<FaultTypeModel> { | ||
// TODO | ||
throw new Error('Method not implemented.'); | ||
} | ||
name = FaultType.BMS; | ||
recordedFaults: Fault<FaultTypeModel>[] = []; | ||
} |
19 changes: 19 additions & 0 deletions
19
angular-client/src/pages/fault-page/shared/fault-type/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,19 @@ | ||
import { Fault } from '../indiv-fault/fault.model'; | ||
/** | ||
* Represents a type of fault (e.g. BMS, TPU, Charger), | ||
* with a name (which would mach the previous examples) | ||
* and a list of recorded faults so far. | ||
* | ||
* It also gives the ability to subscribe to it's list of recored faults | ||
* which will allow for the subscriber to be updated everytime a new fault is recieved. | ||
*/ | ||
export interface FaultTypeModel { | ||
name: FaultType; | ||
recordedFaults: Array<Fault<FaultTypeModel>>; | ||
subscribeToFaults(): Fault<FaultTypeModel>; | ||
} | ||
|
||
export enum FaultType { | ||
BMS = 'BMS', | ||
Charger = 'Charger' | ||
} |
14 changes: 14 additions & 0 deletions
14
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { BMSFaultType } from '../fault-type/bms-fault-type.model'; | ||
import { Fault } from './fault.model'; | ||
|
||
export class BMSFault implements Fault<BMSFaultType> { | ||
name: String; | ||
timeTriggered: number; | ||
format(): { type: String; name: String; timeTriggered: number } { | ||
throw new Error('Method not implemented.'); | ||
} | ||
constructor() { | ||
this.name = 'hello'; | ||
this.timeTriggered = 101011; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { FaultTypeModel } from '../fault-type/fault-type.model'; | ||
|
||
export interface Fault<T extends FaultTypeModel> { | ||
name: String; | ||
timeTriggered: number; | ||
format(): { type: String; name: String; timeTriggered: number }; | ||
} | ||
|
||
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' | ||
} |