Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#156 fault page #211

Draft
wants to merge 23 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d2a799d
merge conflict
RChandler234 Aug 19, 2024
7afe86c
#156 - update README
RChandler234 Sep 21, 2024
da928ed
#156 - change graph page range
RChandler234 Sep 21, 2024
055041b
#156 - skeleton of frontend, draft of endpoint, need to test
RChandler234 Sep 22, 2024
48b0d6c
#156 - README Change
RChandler234 Sep 24, 2024
6bce55b
#156 - fix clippy
RChandler234 Sep 24, 2024
faae121
#156 - querying data with datatypename 30 sec before fault
RChandler234 Sep 26, 2024
54febe4
#156 - fault type asbtraction start
bracyw Oct 6, 2024
b3c0f6c
#156 - basic data set up for fault abstraction
bracyw Oct 8, 2024
8457630
#156 - got rid of unnecessary fault-type abstraction
bracyw Oct 26, 2024
73f8c69
Merge branch 'develop' into #156-fault-page
bracyw Oct 26, 2024
62e11be
#156 - querying data with datatypename 30 sec before fault
RChandler234 Sep 26, 2024
1fb4cfa
#156 - fixing stuff up
bracyw Oct 26, 2024
438ac70
#156 - trying to get branch back to normal
bracyw Oct 26, 2024
8dd2905
#156 - trying to get branch back to v3
bracyw Oct 26, 2024
e829a00
"#156 - skeleton of frontend, draft of endpoint, need to test"
RChandler234 Sep 22, 2024
4185c9e
"#156 - fix clippy"
RChandler234 Sep 24, 2024
7770268
"#156 - querying data with datatypename 30 sec before fault"
RChandler234 Sep 26, 2024
b480365
#156 added rough logic for both frontend and backend which should be …
bracyw Oct 27, 2024
485b20b
#156 - temp fix to querying for multiple node data by time
bracyw Oct 27, 2024
76c21ee
Merge branch 'develop' into #156-fault-page
bracyw Oct 27, 2024
bfb83b5
#156 - backend setup (MVP)... frontend abstraction (MVP)
bracyw Nov 3, 2024
5b68edb
#156 - backend setup, fault log working, NO fault info displayed yet.
bracyw Nov 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# Argos

### Initializing Submodule

To initialize the odyssey submodule run `git submodule update --init`

## Local Development

Setup angular-client and scylla-server:

[Angular Client](./angular-client/README.md)\
[Scylla Server](./scylla-server/README.md)

Once you've sucessfully setup Scylla and the Client, you can either run them separately, or follow the docker commands below to run them together.
Once you've sucessfully setup Scylla and the Client, you can either run them separately, use `npm run start` from the root directory to run them together, or follow the docker commands below to run them together.

## Production

Expand Down
4 changes: 4 additions & 0 deletions angular-client/src/api/data.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ import { urls } from './urls';
export const getDataByDataTypeNameAndRunId = (dataTypeName: string, runId: number): Promise<Response> => {
return fetch(urls.getDataByDataTypeNameAndRunId(dataTypeName, runId));
};

export const getDataByDatetime = (dateTime: string): Promise<Response> => {
return fetch(urls.getDataByDatetime(dateTime));
};
2 changes: 2 additions & 0 deletions angular-client/src/api/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const getAllSystems = () => `${baseURL}/systems`;

/* Data */
const getDataByDataTypeNameAndRunId = (dataTypeName: string, runId: number) => `${baseURL}/data/${dataTypeName}/${runId}`;
const getDataByDatetime = (dateTime: string) => `${baseURL}/dataByDatetime/${dateTime}`;

/* Runs */
const getRunById = (id: number) => `${baseURL}/runs/${id}`;
Expand All @@ -22,6 +23,7 @@ export const urls = {
getAllSystems,

getDataByDataTypeNameAndRunId,
getDataByDatetime,

getAllRuns,
getRunById,
Expand Down
4 changes: 3 additions & 1 deletion angular-client/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import ChargingPage from 'src/pages/charging-page/charging-page.component';
import FaultPage from 'src/pages/fault-page/fault-page.component';
import GraphPage from 'src/pages/graph-page/graph-page.component';
import LandingPage from 'src/pages/landing-page/landing-page.component';
import Map from 'src/pages/map/map.component';
Expand All @@ -10,7 +11,8 @@ const routes: Routes = [
{ path: 'graph', component: GraphPage },
{ path: '', redirectTo: '/landing', pathMatch: 'full' },
{ path: 'map', component: Map },
{ path: 'charging', component: ChargingPage }
{ path: 'charging', component: ChargingPage },
{ path: 'fault', component: FaultPage }
];

@NgModule({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
<sidebar-chip icon="ev_station" value="Charging" (click)="navigateTo('/charging')" />
<sidebar-chip icon="bar_chart" value="Graph" (click)="navigateTo('/graph')" />
<sidebar-chip icon="map" value="Map" (click)="navigateTo('/map')" />
<sidebar-chip icon="warning" value="Fault" (click)="navigateTo('/fault')" />
</ng-template>
</p-sidebar>
6 changes: 6 additions & 0 deletions angular-client/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,15 @@ import CombinedStatusMobile from 'src/pages/charging-page/components/combined-st
import PackVoltageMobileDisplay from 'src/pages/charging-page/components/pack-voltage/pack-voltage-display/pack-voltage-mobile/pack-voltage-mobile.component';
import HighLowCellMobile from 'src/pages/charging-page/components/high-low-cell/high-low-cell-display/high-low-cell-mobile/high-low-cell-mobile.component';
import CellTempMobile from 'src/pages/charging-page/components/cell-temp/cell-temp-display/cell-temp-mobile/cell-temp-mobile.component';
import FaultPage from 'src/pages/fault-page/fault-page.component';
import FaultLog from 'src/pages/fault-page/components/fault-log/fault-log.component';
import FaultBox from 'src/pages/fault-page/components/fault-display/fault-box.component';

@NgModule({
declarations: [
AppContext,
LandingPage,
FaultPage,
ChargingPage,
ChargingPageMobile,
GraphPage,
Expand Down Expand Up @@ -175,6 +179,8 @@ import CellTempMobile from 'src/pages/charging-page/components/cell-temp/cell-te
CellTempGraph,
CurrentDisplay,
FaultDisplay,
FaultLog,
FaultBox,
SwitchComponent,
BMSModeDisplay,
DoubleLineGraphComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.fault-box-body {
height: 95%;
display: flex;
align-items: left;
justify-content: left;
overflow-y: auto;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<info-background title="Current Fault">
<div style="width: 100%; padding-right: 5px; padding-left: 0px" class="fault-text-body"></div>
</info-background>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Component } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';

Check warning on line 3 in angular-client/src/pages/fault-page/components/fault-display/fault-box.component.ts

View workflow job for this annotation

GitHub Actions / run-linting-check

'IdentifierDataType' is defined but never used

@Component({
selector: 'fault-box',
templateUrl: './fault-box.component.html',
styleUrls: ['./fault-box.component.css']
})
export default class FaultBox {
constructor(private storage: Storage) {}

ngOnInit() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.fault-text-body {
height: 95%;
display: flex;
align-items: left;
justify-content: left;
overflow-y: auto;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<info-background title="Fault Log" svgIcon="warning" [button]="resetButton">
<div style="width: 100%; padding-right: 5px; padding-left: 0px" class="fault-text-body">
<vstack style="width: 100%">
<div style="height: 10px"></div>
<ng-container *ngFor="let fault of faults; index as i">
<div
[style]="
(i % 2 == 0) === faultsShifted
? 'background-color: #d4760b ; width: 100%; border-radius: 2px'
: 'background-color: #4d453c; width: 100%; border-radius: 2px'
"
(click)="setSelectedFault(fault)"
>
<div style="display: flex; flex-direction: row; justify-content: space-between; height: 45px; padding: 10px">
<typography variant="info-subtitle" [content]="fault.type" style="align-self: center"></typography>
<typography
variant="info-subtitle"
[content]="fault.name"
additionalStyles="font-weight: bold;"
style="align-self: center; padding-left: 5px"
></typography>
<typography variant="info-subtitle" [content]="fault.displayTime" style="align-self: center"></typography>
</div>
</div>
<div style="height: 2px"></div>
</ng-container>
<div style="height: 50px"></div>
</vstack>
</div>
</info-background>
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
import { Component, Input } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';

enum BMS_FAULTS_TYPES {
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 FaultType {
BMS = 'BMS',
Charger = 'Charger'
}

@Component({
selector: 'fault-log',
templateUrl: './fault-log.component.html',
styleUrls: ['./fault-log.component.css']
})
export default class FaultLog {
@Input() setSelectedFault!: (fault: { type: string; name: string; time: string; displayTime: string }) => void;
faults: { type: string; name: string; time: string; displayTime: string }[] = [];
faultsShifted: boolean = false;
resetButton = {
onClick: () => {
this.faults = [];
},
icon: 'restart_alt'
};
constructor(private storage: Storage) {}

ngOnInit() {
this.storage.get(IdentifierDataType.COMM_TIMEOUT_FAULT).subscribe((value) => {
this.addFault(parseInt(value.values[0]), 'Comm Timeout', FaultType.Charger, value.time);
});

this.storage.get(IdentifierDataType.HARDWARE_FAILURE_FAULT).subscribe((value) => {
this.addFault(parseInt(value.values[0]), 'Hardware Failure', FaultType.Charger, value.time);
});

this.storage.get(IdentifierDataType.OVER_TEMP_FAULT).subscribe((value) => {
this.addFault(parseInt(value.values[0]), 'Over Temp', FaultType.Charger, value.time);
});

this.storage.get(IdentifierDataType.VOLTAGE_WRONG_FAULT).subscribe((value) => {
this.addFault(parseInt(value.values[0]), 'Voltage Wrong', FaultType.Charger, value.time);
});

this.storage.get(IdentifierDataType.WRONG_BAT_CONNECT_FAULT).subscribe((value) => {
this.addFault(parseInt(value.values[0]), 'Wrong Battery Connect', FaultType.Charger, value.time);
});

this.storage.get(IdentifierDataType.BMS_FAULTS).subscribe((value) => {
const bmsFaultID = parseInt(value.values[0]);
this.addFault(bmsFaultID, this.getBMSFaultName(bmsFaultID), FaultType.BMS, value.time);
});
}

/**
* Adds the fault name, with the current time to the faults array, if the faultValue is NOT 0.
* Shifts through the fault array to keep only the most recent 50 faults.
*
* @param faultValue an string with an integer value.
* @param faultName the name of the fault, to be displayed.
*/
addFault(faultValue: number, faultName: string, faultType: FaultType, time: string) {
if (faultValue !== 0) {
if (this.faults.length >= 50) {
this.faults.pop();
}
this.faultsShifted = !this.faultsShifted;

this.faults.unshift({ type: faultType, name: faultName, displayTime: new Date(+time).toLocaleTimeString(), time });
}
}

/**
* This is based on the shepard enum for faults:
* https://github.com/Northeastern-Electric-Racing/ShepherdBMS-2/blob/6eb3f863ed131a15bdf98665532cb7807bbd2920/Core/Inc/datastructs.h#L39
*/
getBMSFaultName(faultValue: number): string {
let faultName = '';
switch (faultValue) {
case 0:
break;
case BMS_FAULTS_TYPES.CELLS_NOT_BALANCING:
faultName = 'Cells Not Balancing';
break;
case BMS_FAULTS_TYPES.CELL_VOLTAGE_TOO_LOW:
faultName = 'Cell Voltage too Low';
break;
case BMS_FAULTS_TYPES.CELL_VOLTAGE_TOO_HIGH:
faultName = 'Cell Voltage too High';
break;
case BMS_FAULTS_TYPES.PACK_TOO_HOT:
faultName = ' Pack too Hot';
break;
case BMS_FAULTS_TYPES.OPEN_WIRING_FAULT:
faultName = 'Open Wiring Fault';
break;
case BMS_FAULTS_TYPES.INTERNAL_SOFTWARE_FAULT:
faultName = 'Internal Software Fault';
break;
case BMS_FAULTS_TYPES.INTERNAL_THERMAL_ERROR:
faultName = 'Internal Thermal Error';
break;
case BMS_FAULTS_TYPES.INTERNAL_CELL_COMM_FAULT:
faultName = 'Internal Cell Comm Fault';
break;
case BMS_FAULTS_TYPES.CURRENT_SENSOR_FAULT:
faultName = 'Current Sensor Fault';
break;
case BMS_FAULTS_TYPES.CHARGE_READING_MISMATCH:
faultName = 'Charge Reading Mismatch';
break;
case BMS_FAULTS_TYPES.LOW_CELL_VOLTAGE:
faultName = 'Low Cell Voltage';
break;
case BMS_FAULTS_TYPES.WEAK_PACK_FAULT:
faultName = 'Weak Pack Fault';
break;
case BMS_FAULTS_TYPES.EXTERNAL_CAN_FAULT:
faultName = 'External Can Fault';
break;
case BMS_FAULTS_TYPES.DISCHARGE_LIMIT_ENFORCEMENT_FAULT:
faultName = 'Discharge Limit Enforcement Fault';
break;
case BMS_FAULTS_TYPES.CHARGER_SAFETY_RELAY:
faultName = 'Charger Safety Relay';
break;
case BMS_FAULTS_TYPES.BATTERY_THERMISTOR:
faultName = 'Battery Thermistor';
break;
case BMS_FAULTS_TYPES.CHARGER_CAN_FAULT:
faultName = 'Charger Can Fault';
break;
case BMS_FAULTS_TYPES.CHARGER_LIMIT_ENFORCEMENT_FAULT:
faultName = 'Charger Limit Enforcement Fault';
break;
}
return faultName;
}
}
6 changes: 6 additions & 0 deletions angular-client/src/pages/fault-page/fault-page.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.image-container {
/* background-image: url(../../assets/images/NERO.jpeg); */
background-size: cover;
background-position: center;
height: 100%;
}
29 changes: 29 additions & 0 deletions angular-client/src/pages/fault-page/fault-page.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<div class="image-container" style="margin-right: 16px; margin-left: 16px">
<sidebar-toggle style="position: absolute; margin-top: 16px; margin-left: 16px" />

<div *ngIf="isMobile; else isDesktop">
<typography style="margin-bottom: -30px; margin-top: -10px" variant="large-header" content="Fault Page Mobile View" />
</div>
<ng-template #isDesktop>
<vstack style="width: 100%" spacing="15px">
<div style="align-self: end; width: 100%; display: flex; justify-content: space-around">
<typography
style="margin-bottom: -30px; margin-top: -10px"
variant="large-header"
[content]="time | date: 'HH:mm:ss'"
/>
<typography
style="margin-bottom: -30px; margin-top: -10px"
variant="large-header"
content="{{ time | date: 'MM/dd/yyyy' }} | {{ location }} "
/>
<latency-display style="margin-bottom: -30px; margin-top: -10px" />
</div>
<div style="align-self: end; width: 100%; display: flex; justify-content: space-around">
<fault-log style="width: 30%" [setSelectedFault]="setSelectedFault" />
<fault-box style="width: 35%" />
<graph-sidebar-desktop style="width: 30%" [nodes]="[]" [selectDataType]="onSelectDataType" />
</div>
</vstack>
</ng-template>
</div>
Loading
Loading