Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
example graph output with real data
  • Loading branch information
rrc12004 committed Mar 13, 2019
1 parent 0d19775 commit a7e2af6
Show file tree
Hide file tree
Showing 12 changed files with 465 additions and 21 deletions.
55 changes: 46 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -22,6 +22,7 @@
"@angular/platform-browser": "^6.1.10",
"@angular/platform-browser-dynamic": "^6.1.10",
"@angular/router": "^6.1.10",
"chart.js": "^2.7.3",
"core-js": "^2.6.3",
"hammerjs": "^2.0.8",
"rxjs": "^6.2.2",
Expand Down
16 changes: 9 additions & 7 deletions src/app/header/header.component.html
Expand Up @@ -7,28 +7,30 @@
</button>

<div class="collapse navbar-collapse" id="navbarSupportedContent">

<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-image" id="dash-image" (click)="resetGenerator()"><img src="assets/images/home.png"
<a class="nav-image" id="dash-image" (click)="resetGenerator()"><img src="assets/images/home.png"
class=" d-block img-fluid py-3 pl-3" alt="Dashboard Image" height="42" width="42"></a>
</li>
<li class="nav-item ">
<a class="nav-link" id="visualize-link" (click)="resetGenAndVisualize()">Visualization</a>
<li class="nav-item">
<a class="nav-image" id="visualize-image" (click)="resetGenAndVisualize()"><img src="assets/images/graph.jpg"
class=" d-block img-fluid py-3 pl-3" alt="Visualization Image" height="42" width="42"></a>
</li>
</ul>

<form class="form-inline my-2 my-lg-0">
<a class="nav-left-image" id="logout-image" (click)="resetAndClear()"><img src="assets/images/logout.png"
class=" d-block img-fluid py-3 pl-3" alt="Logout Image" height="42" width="42"></a>
<a class="nav-left-image" id="logout-image" (click)="resetAndClear()"><img
src="assets/images/logout.png" class=" d-block img-fluid py-3 pl-3" alt="Logout Image"
height="42" width="42"></a>
</form>

</div>
</nav>

<div class="clearfix">
<a class="logo" id="logo-image" (click)="resetGenerator()"><img src="assets/images/logo2.png"
class=" d-block img-fluid py-3 pl-3" alt="Kinsley image"></a>
class=" d-block img-fluid py-3 pl-3" alt="Kinsley image"></a>
<!-- <a class="logo" routerLink="/generator-search"><img src="assets/images/logo2.png" class=" d-block img-fluid py-3 pl-3"
alt="Kinsley image"></a> -->
</div>
Expand Down
12 changes: 12 additions & 0 deletions src/app/services/names.service.spec.ts
@@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';

import { NamesService } from './names.service';

describe('NamesService', () => {
beforeEach(() => TestBed.configureTestingModule({}));

it('should be created', () => {
const service: NamesService = TestBed.get(NamesService);
expect(service).toBeTruthy();
});
});
182 changes: 182 additions & 0 deletions src/app/services/names.service.ts
@@ -0,0 +1,182 @@
import { Injectable } from '@angular/core';

@Injectable({
providedIn: 'root'
})
export class NamesService {

constructor() { }

convertNames(input, type) {
const convChart = [
['L1 - L2 Voltage', 'l1.l2.voltage'],
['L2 - L3 Voltage', 'l2.l3.voltage'],
['L3 - L1 Voltage', 'l3.l1.voltage'],
['L1 - L0 Voltage', 'l1.l0.voltage'],
['L2 - L0 Voltage', 'l2.l0.voltage'],
['L3 - L0 Voltage', 'l3.l0.voltage'],
['L1 Current', 'l1.current'],
['L2 Current', 'l2.current'],
['L3 Current', 'l3.current'],
['Frequency', 'frequency'],
['Total kW', 'total.kw'],
['Percent of Rated kW', 'rate.kw'],
['Total Power Factor', 'total.pf'],
['L1 kW', 'l1.kw'],
['L1 Power Factor', 'l1.pf'],
['L2 kW', 'l2.kw'],
['L2 Power Factor', 'l2.pf'],
['L3 kW', 'l3.kw'],
['L3 Power Factor', 'l3.pf'],
['Total kVAR', 'total.kvar'],
['L1 kVAR', 'l1.kvar'],
['L2 kVAR', 'l2.kvar'],
['L3 kVAR', 'l3.kvar'],
['Total kVA', 'total.kva'],
['L1 kVA', 'l1.kva'],
['L2 kVA', 'l2.kva'],
['L3 kVA', 'l3.kva'],
// 'Current Lead / Lag',
// 'Reserved For Future Use',
// 'Reserved For Future Use',
// 'Reserved For Future Use',
// 'Reserved For Future Use',
['Oil Pressure *', 'oil.pressure'],
['Coolant Temperature *', 'coolant.temp'],
['Engine Speed *', 'engine.rpm'],
['Local Battery Voltage *', 'battery.voltage'],
['Fuel Pressure *', 'fuel.pressure'],
['Fuel Temperature *', 'fuel.temp'],
['Fuel Rate *', 'fuel.rate'],
// 'Used Last Run *',
['Coolant Pressure *', 'coolant.pressure'],
['Coolant Level *', 'coolant.level'],
['Lube Oil Temperature *', 'oil.temp'],
['Oil Level *', 'oil.level'],
['Crankcase Pressure *', 'crankcase.pressure'],
['Ambient Temperature *', 'ambient.temp'],
['ECM Battery Voltage *', 'ecm.battery.voltage'],
// 'ECM Status',
['Intake Air Temperature', 'intake.temp'],
['Intake Air Pressure', 'intake.pressure']
];

let conv;
if (type === 'layman') {
for (conv of convChart) {
if (conv[1] === input) {
return conv[0];
}
}
} else if (type === 'metric') {
for (conv of convChart) {
if (conv[0] === input) {
return conv[1];
}
}
}
}

getAllNames(type) {
if (type === 'layman') {
return [
'L1 - L2 Voltage',
'L2 - L3 Voltage',
'L3 - L1 Voltage',
'L1 - L0 Voltage',
'L2 - L0 Voltage',
'L3 - L0 Voltage',
'L1 Current',
'L2 Current',
'L3 Current',
'Frequency',
'Total kW',
'Percent of Rated kW',
'Total Power Factor',
'L1 kW',
'L1 Power Factor',
'L2 kW',
'L2 Power Factor',
'L3 kW',
'L3 Power Factor',
'Total kVAR',
'L1 kVAR',
'L2 kVAR',
'L3 kVAR',
'Total kVA',
'L1 kVA',
'L2 kVA',
'L3 kVA',
// 'Current Lead / Lag',
// 'Reserved For Future Use',
// 'Reserved For Future Use',
// 'Reserved For Future Use',
// 'Reserved For Future Use',
'Oil Pressure *',
'Coolant Temperature *',
'Engine Speed *',
'Local Battery Voltage *',
'Fuel Pressure *',
'Fuel Temperature *',
'Fuel Rate *',
// 'Used Last Run *',
'Coolant Pressure *',
'Coolant Level *',
'Lube Oil Temperature *',
'Oil Level *',
'Crankcase Pressure *',
'Ambient Temperature *',
'ECM Battery Voltage *',
// 'ECM Status',
'Intake Air Temperature',
'Intake Air Pressure'
];
} else if (type === 'metric') {
return [
'l1.l2.voltage',
'l2.l3.voltage',
'l3.l1.voltage',
'l1.l0.voltage',
'l2.l0.voltage',
'l3.l0.voltage',
'l1.current',
'l2.current',
'l3.current',
'frequency',
'total.kw',
'rate.kw',
'total.pf',
'l1.kw',
'l1.pf',
'l2.kw',
'l2.pf',
'l3.kw',
'l3.pf',
'total.kvar',
'l1.kvar',
'l2.kvar',
'l3.kvar',
'total.kva',
'l1.kva',
'l2.kva',
'l3.kva',
'oil.pressure',
'coolant.temp',
'engine.rpm',
'battery.voltage',
'fuel.pressure',
'fuel.temp',
'fuel.rate',
'coolant.pressure',
'coolant.level',
'oil.temp',
'oil.level',
'crankcase.pressure',
'ambient.temp',
'ecm.battery.voltage',
'intake.temp',
'intake.pressure'
];
}
}
}
12 changes: 12 additions & 0 deletions src/app/services/visualize.service.spec.ts
@@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';

import { VisualizeService } from './visualize.service';

describe('VisualizeService', () => {
beforeEach(() => TestBed.configureTestingModule({}));

it('should be created', () => {
const service: VisualizeService = TestBed.get(VisualizeService);
expect(service).toBeTruthy();
});
});
19 changes: 19 additions & 0 deletions src/app/services/visualize.service.ts
@@ -0,0 +1,19 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

@Injectable({
providedIn: 'root'
})
export class VisualizeService {

constructor(private http: HttpClient) { }

getData(token, query) {
return this.http.get('http://sd5-backend.engr.uconn.edu/data/query' + query, {
headers: {
Authorization: 'Bearer ' + token
}
});
}

}
23 changes: 23 additions & 0 deletions src/app/visualize-all/visualize-all.component.css
@@ -0,0 +1,23 @@
div#textinput {
width: 300px;
}

select#gen_select {
width: 300px;
}

select#func_select {
width: 300px;
}

select#data_select {
width: 300px;
}

select#time_type_select {
width: 300px;
}

p#visMessage {
color: white;
}

0 comments on commit a7e2af6

Please sign in to comment.