Skip to content

Commit

Permalink
Merge pull request #162 from Northeastern-Electric-Racing/#155-BMS-page
Browse files Browse the repository at this point in the history
#155 Charging Page
  • Loading branch information
RChandler234 authored Jul 25, 2024
2 parents b0588b7 + 7f5de10 commit e32a39e
Show file tree
Hide file tree
Showing 87 changed files with 1,291 additions and 49 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added ArgosIOS/.DS_Store
Binary file not shown.
Binary file added ArgosIOS/Argos/.DS_Store
Binary file not shown.
Binary file added ArgosIOS/Argos/Components/.DS_Store
Binary file not shown.
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,5 +1,6 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import ChargingPage from 'src/pages/charging-page/charging-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 @@ -8,7 +9,8 @@ const routes: Routes = [
{ path: 'landing', component: LandingPage },
{ path: 'graph', component: GraphPage },
{ path: '', redirectTo: '/landing', pathMatch: 'full' },
{ path: 'map', component: Map }
{ path: 'map', component: Map },
{ path: 'charging', component: ChargingPage }
];

@NgModule({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
</ng-template>
<ng-template pTemplate="headless">
<sidebar-chip icon="home" value="Home" (click)="navigateTo('/landing')" />
<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')" />
</ng-template>
Expand Down
44 changes: 39 additions & 5 deletions angular-client/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { CarouselModule } from 'primeng/carousel';
import { ToastModule } from 'primeng/toast';
import { OrderListModule } from 'primeng/orderlist';
import LandingPage from 'src/pages/landing-page/landing-page.component';
import ChargingPage from 'src/pages/charging-page/charging-page.component';
import ChargingPageMobile from 'src/pages/charging-page/charging-page-mobile/charging-page-mobile.component';
import GraphSidebar from 'src/pages/graph-page/graph-sidebar/graph-sidebar.component';
import SidebarCard from 'src/components/sidebar-card/sidebar-card.component';
import AppContext from './context/app-context.component';
Expand All @@ -14,7 +16,6 @@ import LoadingPage from 'src/components/loading-page/loading-page.component';
import ErrorPage from 'src/components/error-page/error-page.component';
import Header from 'src/components/header/header.component';
import GraphHeader from 'src/pages/graph-page/graph-header/graph-header.component';
import { BatteryPercentageComponent } from 'src/components/battery/battery.component';
import { InfoBackgroundComponent } from 'src/components/info-background/info-background.component';
import { CircularPercentageComponent } from 'src/components/circular-percentage/circular-percentage.component';
import MoreDetails from 'src/components/more-details/more-details.component';
Expand All @@ -40,7 +41,6 @@ import { DialogService, DynamicDialogModule } from 'primeng/dynamicdialog';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ButtonModule } from 'primeng/button';
import { MessageService } from 'primeng/api';
import { BatteryInfoDisplay } from 'src/components/battery-info-display/battery-info-display';
import { GraphComponent } from 'src/components/graph/graph.component';
import { InfoGraph } from 'src/components/info-graph/info-graph.component';
import { GraphDialog } from 'src/components/graph-dialog/graph-dialog.component';
Expand Down Expand Up @@ -71,13 +71,32 @@ import MotorInfo from 'src/components/motor-info/motor-info.component';
import LandingPageMobile from 'src/pages/landing-page/landing-page-mobile/landing-page-mobile.component';
import RaspberryPiDesktop from 'src/components/raspberry-pi/raspberry-pi-desktop-content/raspberry-pi-desktop.component';
import RaspberryPiMobile from 'src/components/raspberry-pi/raspberry-pi-mobile-content/raspberry-pi-mobile.component';
import BatteryInfoDesktop from 'src/components/battery-info-display/battery-info-desktop/battery-info-desktop.component';
import BatteryInfoMobile from 'src/components/battery-info-display/battery-info-mobile/battery-info-mobile.component';
import { SwitchComponent } from 'src/components/switch/switch.component';
import { DoubleLineGraphComponent } from 'src/components/double-line-graph/double-line-graph.component';
import BatteryInfoDesktop from 'src/pages/charging-page/components/battery-info-display/battery-info-desktop/battery-info-desktop.component';
import BatteryInfoMobile from 'src/pages/charging-page/components/battery-info-display/battery-info-mobile/battery-info-mobile.component';
import BatteryStatusDisplay from 'src/pages/charging-page/components/battery-status-display/battery-status-display.component';
import StateOfChargeDisplay from 'src/pages/charging-page/components/state-of-charge/state-of-charge-display/state-of-charge-display.component';
import PackTemp from 'src/pages/charging-page/components/pack-temp/pack-temp.component';
import CellTempDisplay from 'src/pages/charging-page/components/cell-temp/cell-temp-display/cell-temp-display.component';
import CellTempGraph from 'src/pages/charging-page/components/cell-temp/cell-temp-graph/cell-temp-graph.component';
import CurrentDisplay from 'src/pages/charging-page/components/battery-current/current-display/current-display.component';
import FaultDisplay from 'src/pages/charging-page/components/fault-display/fault-display.component';
import BMSModeDisplay from 'src/pages/charging-page/components/BMS-mode/BMS-mode-display.component';
import HighLowCellDisplay from 'src/pages/charging-page/components/high-low-cell/high-low-cell-display/high-low-cell-display.component';
import HighLowCellGraph from 'src/pages/charging-page/components/high-low-cell/high-low-cell-graph/high-low-cell-graph.component';
import PackVoltageGraph from 'src/pages/charging-page/components/pack-voltage/pack-voltage-graph/pack-voltage-graph.component';
import PackVoltageDisplay from 'src/pages/charging-page/components/pack-voltage/pack-voltage-display/pack-voltage-display.component';
import ChargingStateComponent from 'src/pages/charging-page/components/charging-state/charging-state.component';
import { BatteryPercentageComponent } from 'src/pages/charging-page/components/battery-percentage/battery-percentage.component';
import { BatteryInfoDisplay } from 'src/pages/charging-page/components/battery-info-display/battery-info-display';

@NgModule({
declarations: [
AppContext,
LandingPage,
ChargingPage,
ChargingPageMobile,
GraphPage,
GraphSidebar,
GraphSidebarMobile,
Expand Down Expand Up @@ -133,7 +152,22 @@ import BatteryInfoMobile from 'src/components/battery-info-display/battery-info-
RaspberryPiDesktop,
RaspberryPiMobile,
BatteryInfoDesktop,
BatteryInfoMobile
BatteryInfoMobile,
BatteryStatusDisplay,
StateOfChargeDisplay,
PackTemp,
CellTempDisplay,
CellTempGraph,
CurrentDisplay,
FaultDisplay,
SwitchComponent,
BMSModeDisplay,
DoubleLineGraphComponent,
HighLowCellDisplay,
HighLowCellGraph,
PackVoltageGraph,
PackVoltageDisplay,
ChargingStateComponent
],
imports: [
BrowserModule,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:host {
display: block;
width: 100%;
height: 100%;
position: relative;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div style="height: 100%; width: 100%" [id]="graphContainerId"></div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
import { Component, Input, OnInit } from '@angular/core';
import * as ApexCharts from 'apexcharts';
import {
ApexAxisChartSeries,
ApexXAxis,
ApexYAxis,
ApexDataLabels,
ApexChart,
ApexMarkers,
ApexGrid,
ApexTooltip,
ApexFill,
ApexStroke,
ApexLegend
} from 'ng-apexcharts';
import { DialogService } from 'primeng/dynamicdialog';
import { GraphDialog } from '../graph-dialog/graph-dialog.component';
import { GraphData } from 'src/utils/types.utils';

type ChartOptions = {
series: ApexAxisChartSeries;
chart: ApexChart;
xaxis: ApexXAxis;
yaxis: ApexYAxis;
dataLabels: ApexDataLabels;
markers: ApexMarkers;
grid: ApexGrid;
tooltip: ApexTooltip;
fill: ApexFill;
stroke: ApexStroke;
legend: ApexLegend;
colors: string[];
};

@Component({
selector: 'double-line-graph',
templateUrl: './double-line-graph.component.html',
styleUrls: ['./double-line-graph.component.css'],
providers: [DialogService]
})
export class DoubleLineGraphComponent implements OnInit {
@Input() data1!: GraphData[];
@Input() color1!: string; // Must be hex
@Input() title1?: string;
@Input() data2!: GraphData[];
@Input() color2!: string; // Must be hex
@Input() title2?: string;
@Input() header?: string;
@Input() graphContainerId!: string;
options!: ChartOptions;
chart!: ApexCharts;
series: ApexAxisChartSeries = [];

constructor(public dialogService: DialogService) {}

openDialog = () => {
this.dialogService.open(GraphDialog, {
header: this.header,
data: {
data: this.data1,
color: this.color1,
title: this.title1
}
});
};

updateChart = () => {
this.series = [
{
name: this.title1,
data: this.data1
},
{
name: this.title2,
data: this.data2
}
];
this.chart.updateSeries(this.series);
setTimeout(() => {
this.updateChart();
}, 1000);
};

ngOnInit(): void {
this.series = [
{
name: this.title1,
data: this.data1
},
{
name: this.title2,
data: this.data2
}
];

this.options = {
series: this.series,
chart: {
id: 'graph',
type: 'line',
height: '100%',
zoom: {
autoScaleYaxis: true
},
animations: {
enabled: true,
easing: 'linear',
dynamicAnimation: {
speed: 1000
}
},
toolbar: {
show: false
}
// background: '#5A5A5A'
},
colors: [this.color1, this.color2], // Set series colors here
dataLabels: {
enabled: false
},
stroke: {
curve: 'straight',
width: 2
},
markers: {
size: 0
},
xaxis: {
type: 'category',
tickAmount: 2,
labels: {
show: true,
style: {
colors: '#FFFFFF'
},
formatter: (value) => {
return '' + new Date(value).getHours() + ':' + new Date(value).getMinutes() + ':' + new Date(value).getSeconds();
}
},
axisBorder: {
show: false
},
axisTicks: {
show: false
}
},
yaxis: {
tickAmount: 2,
labels: {
style: {
colors: '#FFFFFF'
}
}
},
tooltip: {
theme: 'dark',
x: {
// format by hours and minutes and seconds
format: 'M/d/yy, h:mm:ss'
}
},
fill: {
type: 'linear',
gradient: {
shadeIntensity: 1,
opacityFrom: 1,
opacityTo: 1,
stops: [0, 100, 0, 100]
}
},
grid: {
show: false
},
legend: {
labels: {
colors: '#fffff4' // Set legend label color to black
}
}
};

// Delay rendering to ensure the container is available
setTimeout(() => {
const chartContainer = document.getElementById(this.graphContainerId);
if (!chartContainer) {
console.log('Container with id ' + this.graphContainerId + ' not found');
return;
}

this.chart = new ApexCharts(chartContainer, this.options);
this.chart.render();
this.updateChart();
}, 100);
}
}
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion angular-client/src/components/graph/graph.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class GraphComponent implements OnInit {
type: 'category',
tickAmount: 2,
labels: {
show: false,
show: true,
style: {
colors: '#FFFFFF'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ mat-icon {
width: 100%;
}

.title-container {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}

.title {
display: flex;
flex-direction: row;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<div class="container" (click)="onClick()" [style]="{ 'background-color': backgroundColor }">
<div *ngIf="title" class="title">
<mat-icon *ngIf="icon" aria-hidden="false" [fontIcon]="icon"></mat-icon>
<mat-icon *ngIf="svgIcon" aria-hidden="false" [svgIcon]="svgIcon"></mat-icon>
<typography variant="info-title" content="{{ title }}" />
<div *ngIf="title" class="title-container">
<div class="title">
<mat-icon *ngIf="icon" aria-hidden="false" [fontIcon]="icon"></mat-icon>
<mat-icon *ngIf="svgIcon" aria-hidden="false" [svgIcon]="svgIcon"></mat-icon>
<typography variant="info-title" content="{{ title }}" />
</div>
<div *ngIf="button">
<mat-icon *ngIf="button" aria-hidden="false" (click)="button.onClick()" [fontIcon]="button.icon"></mat-icon>
</div>
</div>
<typography
*ngIf="onClick"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import Theme from 'src/services/theme.service';
* info displayed on the dashboard
*/

interface ButtonInputs {
onClick: () => void;
icon: string;
}

@Component({
selector: 'info-background',
templateUrl: './info-background.component.html',
Expand All @@ -17,4 +22,5 @@ export class InfoBackgroundComponent {
@Input() backgroundColor?: string = Theme.infoBackground;
@Input() title!: string;
@Input() onClick!: () => void;
@Input() button?: ButtonInputs;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
}

.latency-display-dot {
height: 17px;
width: 17px;
height: 10px;
width: 10px;
border-radius: 50%;
background-color: inherit;
margin-right: 20px;
margin-right: 10px;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<info-background title="Latency" icon="timelapse">
<hstack>
<typography variant="subheader" content="Latency:" />
<div class="latency-display-body">
<div class="latency-display-dot" [style.background-color]="mapColor(latency, medVal)"></div>
<typography variant="info-value" [content]="latency.toString()" />
<typography variant="info-unit" content="ms" />
<typography variant="subheader" [content]="latency.toString()" additionalStyles="font-size:25px" />
<typography variant="info-unit" content="ms" additionalStyles="padding-top: 5px; font-size:15px;" />
</div>
</info-background>
</hstack>
Loading

0 comments on commit e32a39e

Please sign in to comment.