diff --git a/src/app/statistics/statistics.component.html b/src/app/statistics/statistics.component.html
index 5b62f25..4bacc2d 100644
--- a/src/app/statistics/statistics.component.html
+++ b/src/app/statistics/statistics.component.html
@@ -107,67 +107,67 @@
Faults
-
Overcrank
+ Overcrank
Overcrank
-
High Engine
Temperature
+ High Engine
Temperature
High Engine
Temperature
-
Low Oil
Pressure
+ Low Oil
Pressure
Low Oil
Pressure
-
Overspeed
+ Overspeed
Overspeed
-
Emergency Stop
+ Emergency Stop
Emergency Stop
-
Low Fuel
+ Low Fuel
Low Fuel
-
Low Coolant
Level/Aux
+ Low Coolant
Level/Aux
Low Coolant
Level/Aux
-
Low Cranking
Voltage
+ Low Cranking
Voltage
Low Cranking
Voltage
-
Battery Voltage
(Hi/Lo)
+ Battery Voltage
(Hi/Lo)
Battery Voltage
(Hi/Lo)
-
Battery Charger
Fail
+ Battery Charger
Fail
Battery Charger
Fail
-
Common Fault
+ Common Fault
Common Fault
@@ -178,31 +178,31 @@
System Status
-
EPS Supplying
Load
+ EPS Supplying
Load
EPS Supplying
Load
-
Not-In-Auto
+ Not-In-Auto
Not-In-Auto
-
System Running
+ System Running
System Running
-
Generator
Running
+ Generator
Running
Generator
Running
-
Communication
Status
+ Communication
Status
Communication
Status
diff --git a/src/app/statistics/statistics.component.ts b/src/app/statistics/statistics.component.ts
index 6ea5ee5..9811e1f 100644
--- a/src/app/statistics/statistics.component.ts
+++ b/src/app/statistics/statistics.component.ts
@@ -3,6 +3,8 @@ import {MetricsService} from '../services/metrics.service';
import {HttpClient, HttpHeaders} from '@angular/common/http';
import { Router } from '@angular/router';
import {LoginService} from '../services/login.service';
+import { GeneratorState } from '../generator-object';
+import { GeneratorService } from '../services/generator.service';
@Component({
selector: 'app-statistics',
@@ -12,7 +14,7 @@ import {LoginService} from '../services/login.service';
export class StatisticsComponent implements OnInit {
- constructor(public data: MetricsService, private http: HttpClient, private router: Router, private login: LoginService) {
+ constructor(public data: MetricsService, public data2: GeneratorService, private http: HttpClient, private router: Router, private login: LoginService) {
@@ -58,8 +60,30 @@ export class StatisticsComponent implements OnInit {
public isMonth: boolean = false;
public isYear: boolean = false;
+
+ public isOvercrank: boolean = false;
+ public isHighEngineTemperature: boolean = false;
+ public isLowOilPressure: boolean = false;
+ public isOverspeed: boolean = false;
+ public isEmergencyStop: boolean = false;
+ public isLowFuel: boolean = false;
+ public isLowCoolant: boolean = false;
+ public isLowCrankingVoltage: boolean = false;
+ public isBatteryVoltage: boolean = false;
+ public isBatteryChargerFail: boolean = false;
+ public isCommonFault: boolean = false;
+ public isEPSSupplying: boolean = false;
+ public isNotInAuto: boolean = false;
+ public isSystemRunning: boolean = false;
+ public isGeneratorRunning: boolean = false;
+ public isCommunicationStatus: boolean = false;
+
+ public testArray: String[] = ["overcrank", "high_engine_temp"];
+
+ public generator : GeneratorState;
+
goToGraphGen()
{
this.router.navigateByUrl('/visualize-one');
@@ -97,6 +121,18 @@ export class StatisticsComponent implements OnInit {
return true;
}
}
+ statusChange(genStatus)
+ {
+
+ if(genStatus == "overcrank")
+ {
+ return this.isOvercrank = true;
+ }
+ else if(genStatus == "high_engine_temp")
+ {
+ return this.isHighEngineTemperature = true;
+ }
+ }
async ngOnInit() {
@@ -104,20 +140,21 @@ export class StatisticsComponent implements OnInit {
localStorage.removeItem('data_type');
localStorage.removeItem('fault_type');
const jsonToken = await this.login.getToken();
-
+ const gen_id = parseInt(localStorage.getItem('gen_id'),10);
+
try {
this.data.getDevMetrics(jsonToken).subscribe((data) => {
//console.log(data.outputs[1].dps[0][1]);
this.metric = data;
- console.log(this.metric.outputs[0].dps.length == 0);
+ //console.log(this.metric.outputs[0].dps.length == 0);
this.fuelTemp = this.lengthCheck(this.metric.outputs[0].dps);
- this.fuelTempCheck = this.setCheck(this.metric.outputs[0].dps);
- console.log(this.fuelTempCheck);
+ //this.fuelTempCheck = this.setCheck(this.metric.outputs[0].dps);
+ //console.log(this.fuelTempCheck);
//this.fuelTemp = this.metric.outputs[0].dps[0][1];
this.oilTemp = this.metric.outputs[1].dps[0][1];
@@ -138,6 +175,25 @@ export class StatisticsComponent implements OnInit {
});
+
+ this.generator = await this.data2.getGeneratorStatus(gen_id,jsonToken);
+
+ if (this.generator.fault_count != 0)
+ {
+ console.log("hi");
+ }
+ else
+ {
+ for(var i = 0; i< this.testArray.length; i++)
+ {
+ this.statusChange(this.testArray[i]);
+
+ }
+ console.log(this.isOvercrank);
+ console.log(this.isOvercrank);
+ }
+
+
} catch (err) {
return err;
}