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/names.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.
182 lines (177 sloc)
4.73 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 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' | |
]; | |
} | |
} | |
} |