1.0.9 • Published 7 years ago

thermocouple v1.0.9

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Thermocouple Voltage Conversion

This library converts between voltage and temperature and vice versa for the 8 most common thermocouple types.

View a simple demo of it in action.

import Thermocouple from 'thermocouple';

let tempC = Thermocouple.millivoltsToTemp('e', 68.787);
let mVolts = Thermocouple.tempToMillivolts('k', 983.45);

millivoltsToTemp

static millivoltsToTemp(tcType: string, mVolts: number): number
ArgumentTypeDescription
tcTypestringThermocouple type. Valid types: 'b'|'e'|'j'|'k'|'n'|'r'|'s'|'t'
mVoltsnumberVoltage value in millivolts. Valid range depends on thermocouple type
returnsnumberTemperature in °C. Returns NaN if input is outside thermocouple range

tempToMillivolts

static tempToMillivolts(tcType: string, temp: number): number
ArgumentTypeDescription
tcTypestringThermocouple type. Valid types: 'b'|'e'|'j'|'k'|'n'|'r'|'s'|'t'
tempnumberTemperature value in °C. valid range depends on thermocouple type
returnsnumberVoltage in millivolts. Returns NaN if input is outside thermocouple range

Thermocouple specific classes

In addition, there are thermocouple specific classes which have similar methods plus access to the valid input ranges.

import { TypeKThermocouple } from 'thermocouple';

let typeK = new TypeKThermocouple();

let tempC = typeK.millivoltsToTemp(28.484);   // 684.62...
let mVolts = typeK.tempToMillivolts(983.45);  // 40.629...

let [minV, maxV] = typeK.voltageRange;        // [-6.458, 54.886]
let [minT, maxT] = typeK.tempRange;           // [-270, 1372]
let name = typek.name                         // 'k'

To build this library

> npm install && npm run build

To run the tests

> npm install && npm test
1.0.9

7 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago