Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMPROVEMENT] Add apparent power definition (VA)
Signed-off-by: Simone Conti <s.conti@itnok.com>
- Loading branch information
Showing
5 changed files
with
128 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
var apparentPower; | ||
|
||
apparentPower = { | ||
VA: { | ||
name: { | ||
singular: 'Volt-Ampere' | ||
, plural: 'Volt-Amperes' | ||
} | ||
, to_anchor: 1 | ||
} | ||
, mVA: { | ||
name: { | ||
singular: 'Millivolt-Ampere' | ||
, plural: 'Millivolt-Amperes' | ||
} | ||
, to_anchor: .001 | ||
} | ||
, kVA: { | ||
name: { | ||
singular: 'Kilovolt-Ampere' | ||
, plural: 'Kilovolt-Amperes' | ||
} | ||
, to_anchor: 1000 | ||
} | ||
, MVA: { | ||
name: { | ||
singular: 'Megavolt-Ampere' | ||
, plural: 'Megavolt-Amperes' | ||
} | ||
, to_anchor: 1000000 | ||
} | ||
, GVA: { | ||
name: { | ||
singular: 'Gigavolt-Ampere' | ||
, plural: 'Gigavolt-Amperes' | ||
} | ||
, to_anchor: 1000000000 | ||
} | ||
}; | ||
|
||
module.exports = { | ||
metric: apparentPower | ||
, _anchors: { | ||
metric: { | ||
unit: 'VA' | ||
, ratio: 1 | ||
} | ||
} | ||
}; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
var convert = require('../lib') | ||
, assert = require('assert') | ||
, tests = {}; | ||
|
||
tests['VA to VA'] = function () { | ||
assert.strictEqual( convert(1).from('VA').to('VA') , 1); | ||
}; | ||
|
||
tests['mVA to mVA'] = function () { | ||
assert.strictEqual( convert(1).from('mVA').to('mVA') , 1); | ||
}; | ||
|
||
tests['kVA to kVA'] = function () { | ||
assert.strictEqual( convert(1).from('kVA').to('kVA') , 1); | ||
}; | ||
|
||
tests['MVA to MVA'] = function () { | ||
assert.strictEqual( convert(1).from('MVA').to('MVA') , 1); | ||
}; | ||
|
||
tests['GVA to GVA'] = function () { | ||
assert.strictEqual( convert(1).from('GVA').to('GVA') , 1); | ||
}; | ||
|
||
tests['VA to mVA'] = function () { | ||
assert.strictEqual( convert(1).from('VA').to('mVA') , 1000); | ||
}; | ||
|
||
tests['VA to kVA'] = function () { | ||
assert.strictEqual( convert(1).from('VA').to('kVA') , 0.001); | ||
}; | ||
|
||
tests['VA to MVA'] = function () { | ||
assert.strictEqual( convert(1).from('VA').to('MVA') , 0.000001); | ||
}; | ||
|
||
tests['VA to GVA'] = function () { | ||
assert.strictEqual( convert(1).from('VA').to('GVA') , 0.000000001); | ||
}; | ||
|
||
tests['GVA to mVA'] = function () { | ||
assert.strictEqual( convert(1).from('GVA').to('mVA'), 1000000000000); | ||
} | ||
|
||
tests['MVA to mVA'] = function () { | ||
assert.strictEqual( convert(1).from('MVA').to('mVA'), 1000000000); | ||
} | ||
|
||
tests['kVA to mVA'] = function () { | ||
assert.strictEqual( convert(1).from('kVA').to('mVA'), 1000000); | ||
} | ||
|
||
tests['mVA to kVA'] = function () { | ||
assert.strictEqual( convert(1).from('mVA').to('kVA'), 0.000001); | ||
} | ||
|
||
tests['mVA to VA'] = function () { | ||
assert.strictEqual( convert(1).from('mVA').to('VA'), 0.001); | ||
} | ||
|
||
tests['kVA to VA'] = function () { | ||
assert.strictEqual( convert(1).from('kVA').to('VA'), 1000); | ||
} | ||
|
||
module.exports = tests; |
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
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