Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
PowerPanel-Frontend/src/app/services/data.service.ts
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
108 lines (102 sloc)
5.15 KB
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
import { Injectable } from '@angular/core'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class DataService { | |
convChart = [ | |
['l1.l2.voltage', '400001', 'L1 - L2 Voltage', 'RO', 'WORD', 'Volts AC'], | |
['l2.l3.voltage', '400002', 'L2 - L3 Voltage', 'RO', 'WORD', 'Volts AC'], | |
['l3.l1.voltage', '400003', 'L3 - L1 Voltage', 'RO', 'WORD', 'Volts AC'], | |
['l1.l0.voltage', '400004', 'L1 - L0 Voltage', 'RO', 'WORD', 'Volts AC'], | |
['l2.l0.voltage', '400005', 'L2 - L0 Voltage', 'RO', 'WORD', 'Volts AC'], | |
['l3.l0.voltage', '400006', 'L3 - L0 Voltage', 'RO', 'WORD', 'Volts AC'], | |
['l1.current', '400007', 'L1 Current', 'RO', 'WORD', 'Amps AC'], | |
['l2.current', '400008', 'L2 Current', 'RO', 'WORD', 'Amps AC'], | |
['l3.current', '400009', 'L3 Current', 'RO', 'WORD', 'Amps AC'], | |
['frequency', '400010', 'Frequency', 'RO', 'WORD', 'Hz X 100'], | |
['total.kw', '400011', 'Total kW', 'RO', 'WORD', 'kW'], | |
['rate.kw', '400012', 'Percent of Rated kW', 'RO', 'WORD', '% Rated kW'], | |
['total.pf', '400013', 'Total Power Factor', 'RO', 'SWORD', 'PF X 100 (SIGNED)'], | |
['l1.kw', '400014', 'L1 kW', 'RO', 'WORD', 'kW'], | |
['l1.pf', '400015', 'L1 Power Factor', 'RO', 'SWORD', 'PF X 100 (SIGNED)'], | |
['l2.kw', '400016', 'L2 kW', 'RO', 'WORD', 'kW'], | |
['l2.pf', '400017', 'L2 Power Factor', 'RO', 'SWORD', 'PF X 100 (SIGNED)'], | |
['l3.kw', '400018', 'L3 kW', 'RO', 'WORD', 'kW'], | |
['l3.pf', '400019', 'L3 Power Factor', 'RO', 'SWORD', 'PF X 100 (SIGNED)'], | |
['total.kvar', '400020', 'Total kVAR', 'RO', 'SWORD', 'kVAR (SIGNED)'], | |
['l1.kvar', '400021', 'L1 kVAR', 'RO', 'SWORD', 'kVAR (SIGNED)'], | |
['l2.kvar', '400022', 'L2 kVAR', 'RO', 'SWORD', 'kVAR (SIGNED)'], | |
['l3.kvar', '400023', 'L3 kVAR', 'RO', 'SWORD', 'kVAR (SIGNED)'], | |
['total.kva', '400024', 'Total kVA', 'RO', 'WORD', 'kVA'], | |
['l1.kva', '400025', 'L1 kVA', 'RO', 'WORD', 'kVA'], | |
['l2.kva', '400026', 'L2 kVA', 'RO', 'WORD', 'kVA'], | |
['l3.kva', '400027', 'L3 kVA', 'RO', 'WORD', 'kVA'], | |
[, '400028', 'Current Lead/Lag', 'RO', 'WORD', | |
'Bits 0-1 Total Current - Leading = 10 Lagging = 01 Bits 2-3 L1 Current -' + | |
'Leading = 10 Lagging = 01 Bits 4-5 L2 Current - Leading = 10 Lagging = 01 Bits 6-7 L3 Current - Leading = 10 Lagging = 01'], | |
[, '400029', 'Reserved For Future Use', 'RO', 'WORD', 'Returns 0 (zero)'], | |
[, '400030', 'Reserved For Future Use', 'RO', 'WORD', 'Returns 0 (zero)'], | |
[, '400031', 'Reserved For Future Use', 'RO', 'WORD', 'Returns 0 (zero)'], | |
[, '400032', 'Reserved For Future Use', 'RO', 'WORD', 'Returns 0 (zero)'], | |
['oil.pressure', '400033', 'Oil Pressure*', 'RO', 'WORD', 'kPa/psi'], | |
['coolant.temp', '400034', 'Coolant Temperature*', 'RO', 'SWORD', 'Degrees C/Degrees F'], | |
['engine.rpm', '400035', 'Engine Speed*', 'RO', 'WORD', 'RPM'], | |
['battery.voltage', '400036', 'Local Battery Voltage*', 'RO', 'WORD', 'Volts DC X 10'], | |
['fuel.pressure', '400037', 'Fuel Pressure*', 'RO', 'WORD', 'kPa/psi DDEC/MDEC/ADEC only'], | |
['fuel.temp', '400038', 'Fuel Temperature*', 'RO', 'SWORD', 'Degrees C/Degrees F DDEC/MDEC/ADEC only'], | |
['fuel.rate', '400039', 'Fuel Rate*', 'RO', 'WORD', 'Liters/Hour X 100 or Gallons/Hour X 100 DDEC only'], | |
[, '400040', 'Used Last Run*', 'RO', 'WORD', 'Liters/Gallons DDEC only'], | |
['coolant.pressure', '400041', 'Coolant Pressure*', 'RO', 'WORD', 'kPa/psi DDEC only'], | |
['coolant.level', '400042', 'Coolant Level*', 'RO', 'WORD', '% X 10 DDEC only'], | |
['oil.temp', '400043', 'Lube Oil Temperature*', 'RO', 'SWORD', 'Degrees C/Degrees F DDEC/MDEC/ADEC/Waukesha only'], | |
['oil.level', '400044', 'Oil Level*', 'RO', 'WORD', '% X 10 DDEC only'], | |
['crankcase.pressure', '400045', 'Crankcase Pressure*', 'RO', 'WORD', 'kPa/psi DDEC only'], | |
['ambient.temp', '400046', 'Ambient Temperature *', 'RO', 'SWORD', 'Degrees C/Degrees F DDEC only'], | |
['ecm.battery.voltage', '400047', 'ECM Battery Voltage*', 'RO', 'WORD', 'Volts DC X 10 DDEC/MDEC/ADEC only'], | |
[, '400048', 'ECM Status', 'RO', 'WORD', '0 = DDEC-Equipped, 1 = Non-ECM, 2 = MDEC/ADEC-Equipped'], | |
['intake.temp', '400049', 'Intake Air Temperature', 'RO', 'SWORD', 'Degrees C/Degrees F MDEC/ADEC/Waukesha only'], | |
['intake.pressure', '400050', 'Intake Air Pressure', 'RO', 'WORD', 'Degrees C/Degrees F MDEC/ADEC only'] | |
]; | |
constructor() { } | |
getUnits(metric) { | |
let conv; | |
for (conv of this.convChart) { | |
if (conv[0] === metric) { | |
return conv[5]; | |
} | |
} | |
} | |
convertNames(input, type) { // "type" you are converting to | |
let conv; | |
if (type === 'layman') { | |
for (conv of this.convChart) { | |
if (conv[0] === input) { | |
return conv[2]; | |
} | |
} | |
} else if (type === 'metric') { | |
for (conv of this.convChart) { | |
if (conv[2] === input) { | |
return conv[0]; | |
} | |
} | |
} | |
} | |
getAllNames(type) { | |
if (type === 'layman') { | |
const layArray = []; | |
let conv; | |
for (conv of this.convChart) { | |
layArray.push(conv[2]); | |
} | |
return layArray; | |
} else if (type === 'metric') { | |
const metArray = []; | |
let conv; | |
for (conv of this.convChart) { | |
metArray.push(conv[2]); | |
} | |
return metArray; | |
} | |
} | |
} |