tuscan 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tuscan/iec60584.rb +5 -5
- data/lib/tuscan/version.rb +1 -1
- data/spec/tuscan/iec60584_spec.rb +4 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fc9226af75e400bfc1c8a095db8be159c0ca294
|
4
|
+
data.tar.gz: a049b6fc63953e5a25359e94ff826f3dfab366cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f53a6bea76ff795794069fd214a3c644d274476e5a165f4a606f70e05456dfc6d7d882f1b3759d3eaf21ee10d1dcc053c29314474e0f731296587c10d9c33ee
|
7
|
+
data.tar.gz: f871a8d69c78318dc01a4a9298bd8fbcbf16d67d526984dfb3398d26ca11c0a64bbd873d89d447b9df6be9c4f9d5c9a83cd32d736af171bec7855531340b7d37
|
data/lib/tuscan/iec60584.rb
CHANGED
@@ -3,14 +3,14 @@ module Tuscan
|
|
3
3
|
extend self
|
4
4
|
|
5
5
|
def t90 emf, type:, a: 0.0, b: 0.0, c: 0.0, d: 0.0, err: 1e-3, num: 10
|
6
|
-
emfc = emf - emfdev(t90r(emf, type, err, num), a, b, c, d)
|
7
|
-
t90r emfc, type, err, num
|
6
|
+
emfc = emf - emfdev(t90r(emf, type: type, err: err, num: num), a, b, c, d)
|
7
|
+
t90r emfc, type: type, err: err, num: num
|
8
8
|
end
|
9
9
|
alias_method :t, :t90
|
10
10
|
alias_method :temperature, :t90
|
11
11
|
|
12
12
|
def emf t90, type:, a: 0.0, b: 0.0, c: 0.0, d: 0.0, err: 1e-3, num: 10
|
13
|
-
guess = emfr t90, type
|
13
|
+
guess = emfr t90, type: type
|
14
14
|
delta = 1e-2
|
15
15
|
args = { type: type, a: a, b: b, c: c, d: d, err: err, num: num }
|
16
16
|
Rical.inverse_for f: method(:t90), fargs: args, x0: guess - delta, x1: guess + delta,
|
@@ -19,12 +19,12 @@ module Tuscan
|
|
19
19
|
alias_method :v, :emf
|
20
20
|
alias_method :voltage, :emf
|
21
21
|
|
22
|
-
def emfr t90, type
|
22
|
+
def emfr t90, type:
|
23
23
|
raise RangeError, 't90 is outside the valid range' if out_of_range? t90, type
|
24
24
|
emfr_unbound t90, type
|
25
25
|
end
|
26
26
|
|
27
|
-
def t90r emf, type
|
27
|
+
def t90r emf, type:, err: 1e-3, num: 10
|
28
28
|
guess = t90r_guess emf, type
|
29
29
|
Rical.inverse_for f: method(:emfr_unbound), fargs: type, x0: guess - 0.5, x1: guess + 0.5,
|
30
30
|
y: emf, method: :secant, num: num, err: err * 1e-3
|
data/lib/tuscan/version.rb
CHANGED
@@ -7,8 +7,6 @@ require 'spec_helper'
|
|
7
7
|
module Tuscan
|
8
8
|
describe Iec60584 do
|
9
9
|
context 'reference functions' do
|
10
|
-
err = 1e-3
|
11
|
-
num = 10
|
12
10
|
examples = {
|
13
11
|
b: [
|
14
12
|
{ emf: 0.006197, t90: 60.0 },
|
@@ -93,7 +91,7 @@ module Tuscan
|
|
93
91
|
context "on a type #{type.upcase} thermocouple" do
|
94
92
|
examples[type].each do |example|
|
95
93
|
it "yields #{example[:emf]} mV when t90 equals #{example[:t90]} ºC" do
|
96
|
-
expect(Iec60584.emfr
|
94
|
+
expect(Iec60584.emfr example[:t90], type: type).to be_within(1e-6).of(example[:emf])
|
97
95
|
end
|
98
96
|
end
|
99
97
|
end
|
@@ -105,7 +103,7 @@ module Tuscan
|
|
105
103
|
context "on a type #{type.upcase} thermocouple" do
|
106
104
|
examples[type].each do |example|
|
107
105
|
it "yields #{example[:t90]} ºC when emf equals #{example[:emf]} mV" do
|
108
|
-
expect(Iec60584.t90r
|
106
|
+
expect(Iec60584.t90r example[:emf], type: type).to be_within(1e-3).of(example[:t90])
|
109
107
|
end
|
110
108
|
end
|
111
109
|
end
|
@@ -117,12 +115,12 @@ module Tuscan
|
|
117
115
|
context "on a type #{type.upcase} thermocouple" do
|
118
116
|
t90lo = examples[type].first[:t90] - 1.0
|
119
117
|
it "raises RangeError when t90 is #{t90lo} ºC" do
|
120
|
-
expect{ Iec60584.emfr t90lo, type }.to raise_error RangeError
|
118
|
+
expect{ Iec60584.emfr t90lo, type: type }.to raise_error RangeError
|
121
119
|
end
|
122
120
|
|
123
121
|
t90hi = examples[type].last[:t90] + 1.0
|
124
122
|
it "raises RangeError when t90 is #{t90hi} ºC" do
|
125
|
-
expect{ Iec60584.emfr t90hi, type }.to raise_error RangeError
|
123
|
+
expect{ Iec60584.emfr t90hi, type: type }.to raise_error RangeError
|
126
124
|
end
|
127
125
|
end
|
128
126
|
end
|