engineering_calculator 1.0.0 → 2.0.0
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.
- data/Gemfile +1 -2
- data/bin/engineering_calculator +5 -0
- data/engineering-calculator.gemspec +2 -2
- data/lib/engineering_calculator/calculator/gas_dynamics_calculator.rb +143 -0
- data/lib/engineering_calculator/calculator/support/action_manager.rb +49 -0
- data/lib/engineering_calculator/calculator/support/float_extend.rb +6 -0
- data/lib/engineering_calculator/calculator/support/output_manager.rb +104 -0
- data/lib/engineering_calculator/calculator.rb +92 -0
- data/lib/engineering_calculator/gas_dynamics.rb +158 -139
- data/lib/engineering_calculator/version.rb +1 -1
- data/lib/engineering_calculator.rb +10 -3
- data/spec/Gemfile +4 -0
- data/spec/spec_helper.rb +8 -0
- data/spec/tests/action_test.rb +21 -0
- data/spec/tests/calculator_test.rb +27 -0
- data/spec/tests/gas_dynamics_test.rb +292 -0
- data/spec/tests/output_test.rb +42 -0
- metadata +26 -7
data/Gemfile
CHANGED
@@ -4,9 +4,9 @@ require File.expand_path('../lib/engineering_calculator/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Thomas Muntaner"]
|
6
6
|
gem.email = ["thomas.muntaner@gmail.com"]
|
7
|
-
gem.description = %q{
|
7
|
+
gem.description = %q{Engineering calculator for ruby}
|
8
8
|
gem.summary = %q{Engineering Calculator}
|
9
|
-
gem.homepage = "http://
|
9
|
+
gem.homepage = "http://engineering-calculator.herokuapp.com"
|
10
10
|
|
11
11
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
12
|
gem.files = `git ls-files`.split("\n")
|
@@ -0,0 +1,143 @@
|
|
1
|
+
require "gas_dynamics"
|
2
|
+
|
3
|
+
module EngineeringCalculator
|
4
|
+
class GasDynamicsCalculator
|
5
|
+
@@functions = ['fanno',
|
6
|
+
'isentropic',
|
7
|
+
'normal_shock',
|
8
|
+
'oblique',
|
9
|
+
'prandtl_compression',
|
10
|
+
'prandtl_expansion',
|
11
|
+
'rayleigh']
|
12
|
+
|
13
|
+
def self.functions
|
14
|
+
display_functions
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.function(fun)
|
18
|
+
if @@functions.include?(fun)
|
19
|
+
perform(fun)
|
20
|
+
else
|
21
|
+
display_functions
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def self.perform(fun)
|
28
|
+
case fun
|
29
|
+
when 'fanno'
|
30
|
+
fanno
|
31
|
+
when 'isentropic'
|
32
|
+
isentropic
|
33
|
+
when 'normal_shock'
|
34
|
+
normal_shock
|
35
|
+
when 'oblique'
|
36
|
+
oblique
|
37
|
+
when 'prandtl_expansion'
|
38
|
+
prandtl_expansion
|
39
|
+
when 'prandtl_compression'
|
40
|
+
prandtl_compression
|
41
|
+
when 'rayleigh'
|
42
|
+
rayleigh
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.display_functions
|
47
|
+
OutputManager.function_output_list(@@functions, "Gas Dynamics Functions")
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.fanno
|
51
|
+
OutputManager.prompt("m:")
|
52
|
+
m = gets.chomp.to_f
|
53
|
+
OutputManager.prompt("gamma(1.4):")
|
54
|
+
gamma = gets.chomp.to_f
|
55
|
+
if m > 0 and gamma > 1
|
56
|
+
OutputManager.output_results(GasDynamics.fanno(m,gamma))
|
57
|
+
else
|
58
|
+
OutputManager.warning("Invalid Values")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.isentropic
|
63
|
+
OutputManager.prompt("m:")
|
64
|
+
m = gets.chomp.to_f
|
65
|
+
OutputManager.prompt("gamma(1.4):")
|
66
|
+
gamma = gets.chomp.to_f
|
67
|
+
if m > 0 and gamma > 1
|
68
|
+
OutputManager.output_results(GasDynamics.isentropic(m,gamma))
|
69
|
+
else
|
70
|
+
OutputManager.warning("Invalid Values")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.normal_shock
|
75
|
+
OutputManager.prompt("mx:")
|
76
|
+
mx = gets.chomp.to_f
|
77
|
+
OutputManager.prompt("gamma(1.4):")
|
78
|
+
gamma = gets.chomp.to_f
|
79
|
+
if mx > 0 and gamma > 1
|
80
|
+
OutputManager.output_results(GasDynamics.normal_shock(mx,gamma))
|
81
|
+
else
|
82
|
+
OutputManager.warning("Invalid Values")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.oblique
|
87
|
+
OutputManager.prompt("mx:")
|
88
|
+
mx = gets.chomp.to_f
|
89
|
+
OutputManager.prompt("gamma(1.4):")
|
90
|
+
gamma = gets.chomp.to_f
|
91
|
+
OutputManager.prompt("Turning Angle:")
|
92
|
+
delta = gets.chomp.to_f
|
93
|
+
|
94
|
+
if mx > 0 and gamma > 1
|
95
|
+
OutputManager.output_results(GasDynamics.oblique(mx,gamma,delta))
|
96
|
+
else
|
97
|
+
OutputManager.warning("Invalid Values")
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.prandtl_compression
|
102
|
+
OutputManager.prompt("mx:")
|
103
|
+
mx = gets.chomp.to_f
|
104
|
+
OutputManager.prompt("gamma(1.4):")
|
105
|
+
gamma = gets.chomp.to_f
|
106
|
+
OutputManager.prompt("Turning Angle:")
|
107
|
+
delta = gets.chomp.to_f
|
108
|
+
|
109
|
+
if mx > 0 and gamma > 1
|
110
|
+
OutputManager.output_results(GasDynamics.prandtl_compression(mx,gamma,delta))
|
111
|
+
else
|
112
|
+
OutputManager.warning("Invalid Values")
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.prandtl_expansion
|
117
|
+
OutputManager.prompt("mx:")
|
118
|
+
mx = gets.chomp.to_f
|
119
|
+
OutputManager.prompt("gamma(1.4):")
|
120
|
+
gamma = gets.chomp.to_f
|
121
|
+
OutputManager.prompt("Turning Angle:")
|
122
|
+
delta = gets.chomp.to_f
|
123
|
+
|
124
|
+
if mx > 0 and gamma > 1
|
125
|
+
OutputManager.output_results(GasDynamics.prandtl_expansion(mx,gamma,delta))
|
126
|
+
else
|
127
|
+
OutputManager.warning("Invalid Values")
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def self.rayleigh
|
132
|
+
OutputManager.prompt("m:")
|
133
|
+
m = gets.chomp.to_f
|
134
|
+
OutputManager.prompt("gamma(1.4):")
|
135
|
+
gamma = gets.chomp.to_f
|
136
|
+
if m > 0 and gamma > 1
|
137
|
+
OutputManager.output_results(GasDynamics.rayleigh(m,gamma))
|
138
|
+
else
|
139
|
+
OutputManager.warning("Invalid Values")
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module EngineeringCalculator
|
2
|
+
class ActionManager
|
3
|
+
|
4
|
+
@@actions = ['use','calculators','quit', 'function', 'functions']
|
5
|
+
|
6
|
+
def self.action?(action)
|
7
|
+
is_action?(action)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.actions
|
11
|
+
formatted_actions(@@actions)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.perform(call,args=nil)
|
15
|
+
call_method(call,args)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def self.formatted_actions(actions)
|
21
|
+
actions.join(", ")
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.is_action?(action)
|
25
|
+
return true if @@actions.include?(action)
|
26
|
+
return false
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.call_method(call,args=nil)
|
30
|
+
case call
|
31
|
+
when 'use'
|
32
|
+
Calculator.use_calculator(args)
|
33
|
+
when 'calculators'
|
34
|
+
Calculator.calculator_list
|
35
|
+
when 'functions'
|
36
|
+
Calculator.functions
|
37
|
+
when 'function'
|
38
|
+
Calculator.function(args)
|
39
|
+
when 'quit'
|
40
|
+
return :quit
|
41
|
+
else
|
42
|
+
OutputManager.warning("Invalid action")
|
43
|
+
return false
|
44
|
+
end
|
45
|
+
return true
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
module EngineeringCalculator
|
2
|
+
class OutputManager
|
3
|
+
|
4
|
+
def self.title(text)
|
5
|
+
text "#{text.center(60).upcase}"
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.prompt(text)
|
9
|
+
print "#{text} "
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.message(text)
|
13
|
+
text "#{text.center(60)}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.warning(text)
|
17
|
+
text "#{text.center(60)}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.display_actions
|
21
|
+
text "Valid actions: #{ActionManager.actions}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.display_welcome
|
25
|
+
text "<<< Engineering Calculator >>>"
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.display_goodbye
|
29
|
+
text "<<< Goodbye >>>"
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.output_list(array,title = nil)
|
33
|
+
format_list(array,title)
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.function_output_list(array,title = nil)
|
37
|
+
format_function_list(array,title)
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.output_results(results={})
|
41
|
+
format_output_results(results)
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def self.format_function_list(array,title=nil)
|
47
|
+
if title != nil
|
48
|
+
puts "\n"
|
49
|
+
puts "-" * 60
|
50
|
+
text "#{title.center(60).upcase}"
|
51
|
+
i = 0
|
52
|
+
array.each do |item|
|
53
|
+
i = i+1
|
54
|
+
list "#{item}"
|
55
|
+
end
|
56
|
+
puts "\n"
|
57
|
+
puts "-" * 60
|
58
|
+
puts "\n"
|
59
|
+
else
|
60
|
+
list array.join(",")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.format_list(array,title=nil)
|
65
|
+
if title != nil
|
66
|
+
puts "\n"
|
67
|
+
puts "-" * 60
|
68
|
+
text "#{title.center(60).upcase}"
|
69
|
+
i = 0
|
70
|
+
array.each do |item|
|
71
|
+
i = i+1
|
72
|
+
list "#{i}\) #{item}"
|
73
|
+
end
|
74
|
+
puts "\n"
|
75
|
+
puts "-" * 60
|
76
|
+
puts "\n"
|
77
|
+
else
|
78
|
+
list array.join(",")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.format_output_results(results={})
|
83
|
+
puts "\n"
|
84
|
+
puts "-" * 60
|
85
|
+
title("Results")
|
86
|
+
results.each do |key,value|
|
87
|
+
puts "#{key}".ljust(20) + "#{value.to_f.precision(4)}".ljust(40)
|
88
|
+
end
|
89
|
+
puts "\n"
|
90
|
+
puts "-" * 60
|
91
|
+
puts "\n"
|
92
|
+
end
|
93
|
+
|
94
|
+
private
|
95
|
+
|
96
|
+
def self.text(text = "")
|
97
|
+
puts "\n#{text.center(60)}\n\n"
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.list(text= "")
|
101
|
+
puts "#{text.ljust(60,' ')}"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require "calculator/support/action_manager"
|
2
|
+
require "calculator/support/output_manager"
|
3
|
+
require "calculator/support/float_extend"
|
4
|
+
require "calculator/gas_dynamics_calculator"
|
5
|
+
|
6
|
+
module EngineeringCalculator
|
7
|
+
class Calculator
|
8
|
+
|
9
|
+
@calculators = ["Gas Dynamics"]
|
10
|
+
@@current_calculator = nil
|
11
|
+
|
12
|
+
def launch
|
13
|
+
OutputManager.display_welcome
|
14
|
+
main_loop
|
15
|
+
end
|
16
|
+
|
17
|
+
def main_loop
|
18
|
+
response = nil
|
19
|
+
OutputManager.display_actions
|
20
|
+
while response != :quit
|
21
|
+
response = prompt_user
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.calculator_list
|
26
|
+
make_calculator_list
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.use_calculator(calculator_number)
|
30
|
+
set_calculator(calculator_number)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.functions
|
34
|
+
list_functions
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.function(fun)
|
38
|
+
perform(fun)
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def self.perform(fun)
|
44
|
+
case @@current_calculator
|
45
|
+
when 1
|
46
|
+
GasDynamicsCalculator.function(fun)
|
47
|
+
else
|
48
|
+
OutputManager.warning("Please use a calculator first")
|
49
|
+
return false
|
50
|
+
end
|
51
|
+
return true
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.list_functions
|
55
|
+
case @@current_calculator
|
56
|
+
when 1
|
57
|
+
GasDynamicsCalculator.functions
|
58
|
+
else
|
59
|
+
OutputManager.warning("Please use a calculator first")
|
60
|
+
return false
|
61
|
+
end
|
62
|
+
return true
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.set_calculator(calculator_number)
|
66
|
+
num_in_array = calculator_number.to_i - 1
|
67
|
+
if num_in_array < @calculators.count and num_in_array != -1
|
68
|
+
OutputManager.message("Calculator: #{@calculators[num_in_array]}")
|
69
|
+
@@current_calculator = calculator_number.to_i
|
70
|
+
return true
|
71
|
+
else
|
72
|
+
OutputManager.output_list(@calculators,"Available Calculators")
|
73
|
+
return false
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.make_calculator_list
|
78
|
+
OutputManager.output_list(@calculators,"Available Calculators")
|
79
|
+
return true
|
80
|
+
end
|
81
|
+
|
82
|
+
def prompt_user
|
83
|
+
input = nil
|
84
|
+
until ActionManager.action?(input) do
|
85
|
+
OutputManager.prompt(">")
|
86
|
+
input,args = gets.chomp.split(" ")
|
87
|
+
end
|
88
|
+
ActionManager.perform(input,args)
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
@@ -2,158 +2,177 @@ require "helpers"
|
|
2
2
|
|
3
3
|
module EngineeringCalculator
|
4
4
|
module GasDynamics
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
5
|
+
|
6
|
+
def self.fanno(m,gamma)
|
7
|
+
m = m.to_f
|
8
|
+
gamma = gamma.to_f
|
9
|
+
|
10
|
+
p_ratio = 1/m * 1/Math.sqrt((2/(gamma+1)*(1+(gamma-1)/2*pow(m, 2))))
|
11
|
+
rho_ratio = 1/m * Math.sqrt((2/(gamma+1)) * (1+(gamma-1)/2*pow(m, 2)))
|
12
|
+
t_ratio = 1/(2/(gamma+1)*(1+(gamma-1)/2*pow(m, 2)))
|
13
|
+
u_ratio = m * 1/Math.sqrt(2/(gamma+1) * (1 + (gamma-1)/2*pow(m, 2)))
|
14
|
+
po_ratio = 1/m * pow(2/(gamma+1) * (1+(gamma-1)/2*pow(m, 2)),(gamma+1)/(gamma-1)/2)
|
15
|
+
fanno_param = (1-pow(m, 2))/(gamma*pow(m, 2)) + (gamma+1)/(gamma*2)*Math.log(pow(m, 2)/(2/(gamma+1)*(1+(gamma-1)/2*pow(m, 2))))
|
16
|
+
|
17
|
+
result = {
|
18
|
+
p_ratio: p_ratio,
|
19
|
+
rho_ratio: rho_ratio,
|
20
|
+
t_ratio: t_ratio,
|
21
|
+
u_ratio: u_ratio,
|
22
|
+
po_ratio: po_ratio,
|
23
|
+
fanno_param: fanno_param
|
24
|
+
}
|
21
25
|
end
|
22
|
-
|
23
|
-
|
24
|
-
|
26
|
+
|
27
|
+
def self.isentropic(m,gamma)
|
28
|
+
m = m.to_f
|
29
|
+
gamma = gamma.to_f
|
30
|
+
|
31
|
+
ratio_t = pow(1 + (gamma - 1)/2 * pow(m, 2), -1)
|
32
|
+
ratio_p = pow(1 + (gamma - 1)/2 * pow(m, 2), -gamma/(gamma-1))
|
25
33
|
ratio_rho = pow(1 + (gamma - 1)/2 * pow(m, 2), -1/(gamma-1))
|
26
|
-
ratio_a
|
34
|
+
ratio_a = pow((gamma + 1)/2, -((gamma + 1)/(gamma - 1)/2))/m * pow(1 + (gamma - 1)/2 * pow(m, 2), ((gamma + 1)/(gamma - 1))/2)
|
35
|
+
|
27
36
|
result = {
|
28
|
-
:ratio_t
|
29
|
-
:ratio_p
|
30
|
-
:ratio_rho
|
31
|
-
:ratio_a
|
37
|
+
ratio_t: ratio_t,
|
38
|
+
ratio_p: ratio_p,
|
39
|
+
ratio_rho: ratio_rho,
|
40
|
+
ratio_a: ratio_a
|
32
41
|
}
|
33
|
-
return result
|
34
42
|
end
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
43
|
+
|
44
|
+
def self.normal_shock(mx,gamma)
|
45
|
+
my = Math.sqrt((pow(mx,2)*(gamma-1)+2)/(2*gamma*pow(mx,2)-(gamma-1)))
|
46
|
+
py_px = 2*gamma* pow(mx,2) /(gamma+1)-(gamma-1)/(gamma+1)
|
47
|
+
rhoy_rhox = (gamma+1)*pow(mx,2)/((gamma-1)*pow(mx,2)+2)
|
48
|
+
ty_tx = (1 + (gamma - 1)/2 * pow(mx, 2))*(2*gamma/(gamma - 1) * pow(mx, 2) - 1)/(pow(mx, 2)*(2*gamma/(gamma - 1) + (gamma - 1)/2))
|
49
|
+
poy_pox = pow((gamma + 1)/2 * pow(mx, 2)/(1 + (gamma - 1)/2 * pow(mx, 2)), gamma/(gamma - 1)) * pow(1/(2 * gamma/(gamma+1) * pow(mx,2) - (gamma-1)/(gamma+1)), 1/(gamma - 1));
|
50
|
+
|
41
51
|
result = {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
52
|
+
my: my,
|
53
|
+
py_px: py_px,
|
54
|
+
rhoy_rhox: rhoy_rhox,
|
55
|
+
ty_tx: ty_tx,
|
56
|
+
poy_pox: poy_pox
|
47
57
|
}
|
48
|
-
return result
|
49
58
|
end
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
59
|
+
|
60
|
+
def self.oblique(mx,gamma,delta)
|
61
|
+
pi = Math::PI
|
62
|
+
beta = delta*pi/180 # Initial guess that beta and delta coincide.
|
63
|
+
e = 1
|
64
|
+
rhs = Math.tan(delta*pi/180)
|
65
|
+
|
66
|
+
while (e >= 1*10**(-5))
|
67
|
+
lhs = 2*(1/Math.tan(beta))*(pow(mx,2)*pow(Math.sin(beta),2)-1)/(pow(mx,2)*(gamma+Math.cos(2*beta))+2)
|
68
|
+
e = rhs - lhs
|
69
|
+
beta = beta + 0.00001
|
70
|
+
end
|
71
|
+
|
72
|
+
ratio_rho = (gamma+1) * pow(mx, 2)*pow(Math.sin(beta), 2) / ((gamma-1)*pow(mx, 2)*pow(Math.sin(beta), 2)+2)
|
73
|
+
beta = beta*180/pi;
|
74
|
+
ratio_p = 1+2*gamma/(gamma+1)*(pow(mx,2)*pow(Math.sin(beta*pi/180),2)-1);
|
75
|
+
ratio_t = ratio_p*pow((gamma+1)*pow(mx,2)*pow(Math.sin(beta*pi/180),2)/((gamma-1)*pow(mx,2)*pow(Math.sin(beta*pi/180),2)+2),-1);
|
76
|
+
my = (1/Math.sin((beta-delta)*pi/180))*pow((1+0.5*(gamma-1)*pow(mx,2)*pow(Math.sin(beta*pi/180),2))/(gamma*pow(mx,2)*pow(Math.sin(beta*pi/180),2)-0.5*(gamma-1)),0.5);
|
77
|
+
ratio_px = pow(1 + (gamma - 1)/2 * pow(mx, 2), -gamma/(gamma-1));
|
78
|
+
ratio_py = pow(1 + (gamma - 1)/2 * pow(my, 2), -gamma/(gamma-1));
|
79
|
+
ratio_po = ratio_px/ratio_py*ratio_p;
|
80
|
+
|
81
|
+
result = {
|
82
|
+
my: my,
|
83
|
+
ratio_rho: ratio_rho,
|
84
|
+
beta: beta,
|
85
|
+
ratio_p: ratio_p,
|
86
|
+
ratio_t: ratio_t,
|
87
|
+
ratio_po: ratio_po
|
88
|
+
}
|
80
89
|
end
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
90
|
+
|
91
|
+
def self.prandtl_compression(mx,gamma,turning_angle)
|
92
|
+
|
93
|
+
pi = Math::PI
|
94
|
+
nux = Math.sqrt((gamma+1)/(gamma-1)) * Math.atan(Math.sqrt((gamma-1)/(gamma+1)*(pow(mx, 2)-1))) - Math.atan(Math.sqrt(pow(mx, 2)-1))
|
95
|
+
turningAngle = turning_angle*pi/180
|
96
|
+
nuy = nux - turningAngle
|
97
|
+
my = 1
|
98
|
+
e = 1
|
99
|
+
|
100
|
+
while (e >= 0.00001)
|
101
|
+
nuy_test = Math.sqrt((gamma+1)/(gamma-1)) * Math.atan(Math.sqrt((gamma-1)/(gamma+1)*(pow(my, 2)-1))) - Math.atan(Math.sqrt(pow(my, 2)-1))
|
102
|
+
e = nuy - nuy_test
|
103
|
+
my = my+0.00001
|
104
|
+
end
|
105
|
+
|
106
|
+
my = my-0.00001
|
107
|
+
ty_tx = (1+(gamma-1)/2*pow(mx, 2))/(1+(gamma-1)/2*pow(my, 2))
|
108
|
+
py_px = pow((1+(gamma-1)/2*pow(mx, 2))/(1+(gamma-1)/2*pow(my, 2)), gamma/(gamma-1))
|
109
|
+
rhoy_rhox = pow((1+(gamma-1)/2*pow(mx, 2))/(1+(gamma-1)/2*pow(my, 2)), 1/(gamma-1))
|
110
|
+
mux = Math.asin(1/mx)
|
111
|
+
muy = Math.asin(1/my)
|
112
|
+
|
113
|
+
result = {
|
114
|
+
ty_tx: ty_tx,
|
115
|
+
py_px: py_px,
|
116
|
+
rhoy_rhox: rhoy_rhox,
|
117
|
+
my: my,
|
118
|
+
nux: nux*180/pi,
|
119
|
+
nuy: nuy*180/pi,
|
120
|
+
mux: mux*180/pi,
|
121
|
+
muy: muy*180/pi,
|
122
|
+
}
|
110
123
|
end
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
124
|
+
|
125
|
+
def self.prandtl_expansion(mx,gamma,turning_angle)
|
126
|
+
|
127
|
+
pi = Math::PI
|
128
|
+
nux = Math.sqrt((gamma+1)/(gamma-1)) * Math.atan(Math.sqrt((gamma-1)/(gamma+1)*(pow(mx, 2)-1))) - Math.atan(Math.sqrt(pow(mx, 2)-1))
|
129
|
+
turningAngle = turning_angle*pi/180
|
130
|
+
nuy = nux + turningAngle
|
131
|
+
my = 1
|
132
|
+
e = 1
|
133
|
+
|
134
|
+
while (e >= 0.00001)
|
135
|
+
nuy_test = Math.sqrt((gamma+1)/(gamma-1)) * Math.atan(Math.sqrt((gamma-1)/(gamma+1)*(pow(my, 2)-1))) - Math.atan(Math.sqrt(pow(my, 2)-1))
|
136
|
+
e = nuy - nuy_test
|
137
|
+
my = my+0.00001
|
138
|
+
end
|
139
|
+
|
140
|
+
my = my-0.00001
|
141
|
+
ty_tx = (1+(gamma-1)/2*pow(mx, 2))/(1+(gamma-1)/2*pow(my, 2))
|
142
|
+
py_px = pow((1+(gamma-1)/2*pow(mx, 2))/(1+(gamma-1)/2*pow(my, 2)), gamma/(gamma-1))
|
143
|
+
rhoy_rhox = pow((1+(gamma-1)/2*pow(mx, 2))/(1+(gamma-1)/2*pow(my, 2)), 1/(gamma-1))
|
144
|
+
mux = Math.asin(1/mx)
|
145
|
+
muy = Math.asin(1/my)
|
146
|
+
|
147
|
+
result = {
|
148
|
+
ty_tx: ty_tx,
|
149
|
+
py_px: py_px,
|
150
|
+
rhoy_rhox: rhoy_rhox,
|
151
|
+
my: my,
|
152
|
+
nux: nux*180/pi,
|
153
|
+
nuy: nuy*180/pi,
|
154
|
+
mux: mux*180/pi,
|
155
|
+
muy: muy*180/pi,
|
156
|
+
}
|
140
157
|
end
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
158
|
+
|
159
|
+
def self.rayleigh(m,gamma)
|
160
|
+
p_ratio = (gamma+1)/(1+gamma*pow(m, 2));
|
161
|
+
rho_ratio = (1+gamma*pow(m,2))/((1+gamma)*pow(m,2));
|
162
|
+
t_ratio = pow(gamma+1, 2)*pow(m, 2)/pow(1+gamma*pow(m, 2), 2);
|
163
|
+
u_ratio = (gamma+1)*pow(m, 2)/(1+gamma*pow(m, 2));
|
164
|
+
po_ratio = (gamma+1)/(1+gamma*pow(m, 2)) * pow(2/(gamma+1)*(1+(gamma-1)/2*pow(m, 2)), gamma/(gamma-1));
|
165
|
+
to_ratio = 2*(gamma+1)*pow(m, 2)/pow(1+gamma*pow(m, 2),2) * (1+(gamma-1)/2*pow(m, 2));
|
166
|
+
|
148
167
|
result = {
|
149
|
-
:p_ratio
|
150
|
-
:rho_ratio
|
151
|
-
:t_ratio
|
152
|
-
:u_ratio
|
153
|
-
:po_ratio
|
154
|
-
:to_ratio
|
168
|
+
p_ratio: p_ratio,
|
169
|
+
rho_ratio: rho_ratio,
|
170
|
+
t_ratio: t_ratio,
|
171
|
+
u_ratio: u_ratio,
|
172
|
+
po_ratio: po_ratio,
|
173
|
+
to_ratio: to_ratio
|
155
174
|
}
|
156
|
-
return result
|
157
175
|
end
|
176
|
+
|
158
177
|
end
|
159
178
|
end
|
@@ -1,6 +1,13 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
APP_ROOT = File.dirname(__FILE__)
|
2
|
+
$:.unshift( File.join( APP_ROOT, 'engineering_calculator'))
|
3
3
|
|
4
|
-
|
4
|
+
require "version"
|
5
|
+
require "gas_dynamics"
|
6
|
+
require "calculator"
|
5
7
|
|
8
|
+
module EngineeringCalculator
|
9
|
+
def self.init
|
10
|
+
calculator = Calculator.new
|
11
|
+
calculator.launch
|
12
|
+
end
|
6
13
|
end
|
data/spec/Gemfile
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "engineering_calculator/calculator/support/action_manager"
|
3
|
+
|
4
|
+
describe "actions" do
|
5
|
+
|
6
|
+
it "should return true for a valid action" do
|
7
|
+
EngineeringCalculator::ActionManager.action?("calculators").should be_true
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should not return true for an invalid actio" do
|
11
|
+
EngineeringCalculator::ActionManager.action?("sdfsdfsdf").should be_false
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should perform a valid action" do
|
15
|
+
EngineeringCalculator::ActionManager.perform("calculators").should be_true
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should not perform an invalid action" do
|
19
|
+
EngineeringCalculator::ActionManager.perform("calculatorssdfsdf").should be_false
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "engineering_calculator/calculator"
|
3
|
+
|
4
|
+
describe "calculator" do
|
5
|
+
|
6
|
+
it "should make a calculator list" do
|
7
|
+
EngineeringCalculator::Calculator.calculator_list.should be_true
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "calculator activation" do
|
11
|
+
it "should be able to use calculator for valid calculator number" do
|
12
|
+
EngineeringCalculator::Calculator.use_calculator(1)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should be not able to use calculator for string calculator number" do
|
16
|
+
EngineeringCalculator::Calculator.use_calculator("")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be not able to use calculator for zero as a calculator number" do
|
20
|
+
EngineeringCalculator::Calculator.use_calculator(0)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be not able to use calculator for a calculator number of calculators" do
|
24
|
+
EngineeringCalculator::Calculator.use_calculator(50000)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,292 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "gas_dynamics"
|
3
|
+
require "engineering_calculator/calculator/support/float_extend"
|
4
|
+
|
5
|
+
describe "gas dynamics" do
|
6
|
+
|
7
|
+
describe "fanno" do
|
8
|
+
it "should give correct value for m=1 and gamma=1.4" do
|
9
|
+
results = EngineeringCalculator::GasDynamics.fanno(1,1.4)
|
10
|
+
|
11
|
+
results.each do |key,value|
|
12
|
+
results[key] = value.precision(4)
|
13
|
+
end
|
14
|
+
|
15
|
+
results.should eq({
|
16
|
+
p_ratio: 1.0,
|
17
|
+
rho_ratio: 1.0,
|
18
|
+
t_ratio: 1.0,
|
19
|
+
u_ratio: 1.0,
|
20
|
+
po_ratio: 1.0,
|
21
|
+
fanno_param: 0.0
|
22
|
+
})
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should give correct value for m=1.1 and gamma=1.4" do
|
26
|
+
results = EngineeringCalculator::GasDynamics.fanno(1.1,1.4)
|
27
|
+
|
28
|
+
results.each do |key,value|
|
29
|
+
results[key] = value.precision(4)
|
30
|
+
end
|
31
|
+
|
32
|
+
results.should eq({
|
33
|
+
p_ratio: 0.8936,
|
34
|
+
rho_ratio: 0.9249,
|
35
|
+
t_ratio: 0.9662,
|
36
|
+
u_ratio: 1.0812,
|
37
|
+
po_ratio: 1.0079,
|
38
|
+
fanno_param: 0.0099
|
39
|
+
})
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should give correct value for m=20 and gamma=1.4" do
|
43
|
+
results = EngineeringCalculator::GasDynamics.fanno(20,1.4)
|
44
|
+
|
45
|
+
results.each do |key,value|
|
46
|
+
results[key] = value.precision(4)
|
47
|
+
end
|
48
|
+
|
49
|
+
results.should eq({
|
50
|
+
p_ratio: 0.0061,
|
51
|
+
rho_ratio: 0.4108,
|
52
|
+
t_ratio: 0.0148,
|
53
|
+
u_ratio: 2.4343,
|
54
|
+
po_ratio: 15377.3438,
|
55
|
+
fanno_param: 0.8126
|
56
|
+
})
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "isentropic" do
|
61
|
+
it "should give correct value for m=1 and gamma=1.4" do
|
62
|
+
results = EngineeringCalculator::GasDynamics.isentropic(1,1.4)
|
63
|
+
|
64
|
+
results.each do |key,value|
|
65
|
+
results[key] = value.precision(4)
|
66
|
+
end
|
67
|
+
|
68
|
+
results.should eq({
|
69
|
+
ratio_t: 0.8333,
|
70
|
+
ratio_p: 0.5283,
|
71
|
+
ratio_rho: 0.6339,
|
72
|
+
ratio_a: 1.0
|
73
|
+
})
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should give correct value for m=.1 and gamma=1.4" do
|
77
|
+
results = EngineeringCalculator::GasDynamics.isentropic(0.1,1.4)
|
78
|
+
|
79
|
+
results.each do |key,value|
|
80
|
+
results[key] = value.precision(4)
|
81
|
+
end
|
82
|
+
|
83
|
+
results.should eq({
|
84
|
+
ratio_t: 0.998,
|
85
|
+
ratio_p: 0.993,
|
86
|
+
ratio_rho: 0.995,
|
87
|
+
ratio_a: 5.8218
|
88
|
+
})
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should give correct value for m=.5 and gamma=1.4" do
|
92
|
+
results = EngineeringCalculator::GasDynamics.isentropic(0.5,1.4)
|
93
|
+
|
94
|
+
results.each do |key,value|
|
95
|
+
results[key] = value.precision(4)
|
96
|
+
end
|
97
|
+
|
98
|
+
results.should eq({
|
99
|
+
ratio_t: 0.9524,
|
100
|
+
ratio_p: 0.843,
|
101
|
+
ratio_rho: 0.8852,
|
102
|
+
ratio_a: 1.3398
|
103
|
+
})
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe "normal_shock" do
|
108
|
+
it "should give correct value for m=1 and gamma=1.4" do
|
109
|
+
results = EngineeringCalculator::GasDynamics.normal_shock(1,1.4)
|
110
|
+
|
111
|
+
results.each do |key,value|
|
112
|
+
results[key] = value.precision(4)
|
113
|
+
end
|
114
|
+
|
115
|
+
results.should eq({
|
116
|
+
my: 1.0,
|
117
|
+
py_px: 1.0,
|
118
|
+
rhoy_rhox: 1.0,
|
119
|
+
ty_tx: 1.0,
|
120
|
+
poy_pox: 1.0
|
121
|
+
})
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should give correct value for m=1.4 and gamma=1.4" do
|
125
|
+
results = EngineeringCalculator::GasDynamics.normal_shock(1.4,1.4)
|
126
|
+
|
127
|
+
results.each do |key,value|
|
128
|
+
results[key] = value.precision(4)
|
129
|
+
end
|
130
|
+
|
131
|
+
results.should eq({
|
132
|
+
my: 0.7397,
|
133
|
+
py_px: 2.12,
|
134
|
+
rhoy_rhox: 1.6897,
|
135
|
+
ty_tx: 1.2547,
|
136
|
+
poy_pox: 0.9582
|
137
|
+
})
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
describe "oblique" do
|
142
|
+
it "should give correct value for m=1, gamma=1.4, delta=0" do
|
143
|
+
results = EngineeringCalculator::GasDynamics.oblique(1,1.4,0)
|
144
|
+
|
145
|
+
results.each do |key,value|
|
146
|
+
results[key] = value.precision(4)
|
147
|
+
end
|
148
|
+
|
149
|
+
results.should eq({
|
150
|
+
my: 1.0005,
|
151
|
+
ratio_rho: 0.9996,
|
152
|
+
beta: 88.6887,
|
153
|
+
ratio_p: 0.9994,
|
154
|
+
ratio_t: 0.9998,
|
155
|
+
ratio_po: 1.0
|
156
|
+
})
|
157
|
+
end
|
158
|
+
|
159
|
+
it "should give correct value for m=1, gamma=1.4, delta=20" do
|
160
|
+
results = EngineeringCalculator::GasDynamics.oblique(1.4,1.4,20)
|
161
|
+
|
162
|
+
results.each do |key,value|
|
163
|
+
results[key] = value.precision(4)
|
164
|
+
end
|
165
|
+
|
166
|
+
results.should eq({
|
167
|
+
my: 2.1961,
|
168
|
+
ratio_rho: 0.4789,
|
169
|
+
beta: 151.9384,
|
170
|
+
ratio_p: 0.3394,
|
171
|
+
ratio_t: 0.7086,
|
172
|
+
ratio_po: 1.1333
|
173
|
+
})
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
describe "prandtl-compression" do
|
178
|
+
it "should give correct value for m=1, gamma=1.4,delta=0" do
|
179
|
+
results = EngineeringCalculator::GasDynamics.prandtl_compression(1,1.4,0)
|
180
|
+
|
181
|
+
results.each do |key,value|
|
182
|
+
results[key] = value.precision(4)
|
183
|
+
end
|
184
|
+
|
185
|
+
results.should eq({
|
186
|
+
ty_tx: 1.0,
|
187
|
+
py_px: 1.0,
|
188
|
+
rhoy_rhox: 1.0,
|
189
|
+
my: 1.0,
|
190
|
+
nux: 0.0,
|
191
|
+
nuy: 0.0,
|
192
|
+
mux: 90.0,
|
193
|
+
muy: 90.0
|
194
|
+
})
|
195
|
+
end
|
196
|
+
|
197
|
+
it "should give correct value for m=1.4, gamma=1.4,delta=20" do
|
198
|
+
results = EngineeringCalculator::GasDynamics.prandtl_compression(1.4,1.4,20)
|
199
|
+
|
200
|
+
results.each do |key,value|
|
201
|
+
results[key] = value.precision(4)
|
202
|
+
end
|
203
|
+
|
204
|
+
results.should eq({
|
205
|
+
ty_tx: 1.16,
|
206
|
+
py_px: 1.6811,
|
207
|
+
rhoy_rhox: 1.4493,
|
208
|
+
my: 1.0,
|
209
|
+
nux: 8.987,
|
210
|
+
nuy: -11.013,
|
211
|
+
mux: 45.5847,
|
212
|
+
muy: 90.0
|
213
|
+
})
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
describe "prandtl-expansion" do
|
218
|
+
it "should give correct value for m=1, gamma=1.4,delta=0" do
|
219
|
+
results = EngineeringCalculator::GasDynamics.prandtl_expansion(1,1.4,0)
|
220
|
+
|
221
|
+
results.each do |key,value|
|
222
|
+
results[key] = value.precision(4)
|
223
|
+
end
|
224
|
+
|
225
|
+
results.should eq({
|
226
|
+
ty_tx: 1.0,
|
227
|
+
py_px: 1.0,
|
228
|
+
rhoy_rhox: 1.0,
|
229
|
+
my: 1.0,
|
230
|
+
nux: 0.0,
|
231
|
+
nuy: 0.0,
|
232
|
+
mux: 90.0,
|
233
|
+
muy: 90.0
|
234
|
+
})
|
235
|
+
end
|
236
|
+
|
237
|
+
it "should give correct value for m=1, gamma=1.4,delta=20" do
|
238
|
+
results = EngineeringCalculator::GasDynamics.prandtl_expansion(1,1.4,20)
|
239
|
+
|
240
|
+
results.each do |key,value|
|
241
|
+
results[key] = value.precision(4)
|
242
|
+
end
|
243
|
+
|
244
|
+
results.should eq({
|
245
|
+
ty_tx: 0.7362,
|
246
|
+
py_px: 0.3423,
|
247
|
+
rhoy_rhox: 0.465,
|
248
|
+
my: 1.775,
|
249
|
+
nux: 0.0,
|
250
|
+
nuy: 20.0,
|
251
|
+
mux: 90.0,
|
252
|
+
muy: 34.2908
|
253
|
+
})
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
describe "rayleigh" do
|
258
|
+
it "should give correct value for m=1, gamma=1.4" do
|
259
|
+
results = EngineeringCalculator::GasDynamics.rayleigh(1,1.4)
|
260
|
+
|
261
|
+
results.each do |key,value|
|
262
|
+
results[key] = value.precision(4)
|
263
|
+
end
|
264
|
+
|
265
|
+
results.should eq({
|
266
|
+
p_ratio: 1.0,
|
267
|
+
rho_ratio: 1.0,
|
268
|
+
t_ratio: 1.0,
|
269
|
+
u_ratio: 1.0,
|
270
|
+
po_ratio: 1.0,
|
271
|
+
to_ratio: 1.0
|
272
|
+
})
|
273
|
+
end
|
274
|
+
|
275
|
+
it "should give correct value for m=1.4, gamma=1.4" do
|
276
|
+
results = EngineeringCalculator::GasDynamics.rayleigh(1.4,1.4)
|
277
|
+
|
278
|
+
results.each do |key,value|
|
279
|
+
results[key] = value.precision(4)
|
280
|
+
end
|
281
|
+
|
282
|
+
results.should eq({
|
283
|
+
p_ratio: 0.641,
|
284
|
+
rho_ratio: 0.7959,
|
285
|
+
t_ratio: 0.8054,
|
286
|
+
u_ratio: 1.2564,
|
287
|
+
po_ratio: 1.0777,
|
288
|
+
to_ratio: 0.9343
|
289
|
+
})
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "engineering_calculator/calculator/support/output_manager"
|
3
|
+
|
4
|
+
describe "output" do
|
5
|
+
|
6
|
+
it "should be able to use message" do
|
7
|
+
EngineeringCalculator::OutputManager.message("text").should be_nil
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be able to use title" do
|
11
|
+
EngineeringCalculator::OutputManager.title("text").should be_nil
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should be able to use prompt" do
|
15
|
+
EngineeringCalculator::OutputManager.message("prompt").should be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should be able to use display_actions" do
|
19
|
+
EngineeringCalculator::OutputManager.display_actions.should be_nil
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should be able to use display_welcome" do
|
23
|
+
EngineeringCalculator::OutputManager.display_welcome.should be_nil
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should be able to use display_goodbye" do
|
27
|
+
EngineeringCalculator::OutputManager.display_goodbye.should be_nil
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "output list" do
|
31
|
+
it "should be able to use output_list with empty array and no title" do
|
32
|
+
EngineeringCalculator::OutputManager.output_list([]).should be_nil
|
33
|
+
end
|
34
|
+
it "should be able to use output_list with array and no title" do
|
35
|
+
EngineeringCalculator::OutputManager.output_list(["sdfsdf"]).should be_nil
|
36
|
+
end
|
37
|
+
it "should be able to use output_list with array and title" do
|
38
|
+
EngineeringCalculator::OutputManager.output_list(["sdfsdf"], "title").should be_nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineering_calculator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,13 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-26 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description:
|
14
|
+
description: Engineering calculator for ruby
|
15
15
|
email:
|
16
16
|
- thomas.muntaner@gmail.com
|
17
|
-
executables:
|
17
|
+
executables:
|
18
|
+
- engineering_calculator
|
18
19
|
extensions: []
|
19
20
|
extra_rdoc_files: []
|
20
21
|
files:
|
@@ -23,12 +24,24 @@ files:
|
|
23
24
|
- LICENSE
|
24
25
|
- README.md
|
25
26
|
- Rakefile
|
27
|
+
- bin/engineering_calculator
|
26
28
|
- engineering-calculator.gemspec
|
27
29
|
- lib/engineering_calculator.rb
|
30
|
+
- lib/engineering_calculator/calculator.rb
|
31
|
+
- lib/engineering_calculator/calculator/gas_dynamics_calculator.rb
|
32
|
+
- lib/engineering_calculator/calculator/support/action_manager.rb
|
33
|
+
- lib/engineering_calculator/calculator/support/float_extend.rb
|
34
|
+
- lib/engineering_calculator/calculator/support/output_manager.rb
|
28
35
|
- lib/engineering_calculator/gas_dynamics.rb
|
29
36
|
- lib/engineering_calculator/version.rb
|
30
37
|
- lib/helpers.rb
|
31
|
-
|
38
|
+
- spec/Gemfile
|
39
|
+
- spec/spec_helper.rb
|
40
|
+
- spec/tests/action_test.rb
|
41
|
+
- spec/tests/calculator_test.rb
|
42
|
+
- spec/tests/gas_dynamics_test.rb
|
43
|
+
- spec/tests/output_test.rb
|
44
|
+
homepage: http://engineering-calculator.herokuapp.com
|
32
45
|
licenses: []
|
33
46
|
post_install_message:
|
34
47
|
rdoc_options: []
|
@@ -48,8 +61,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
61
|
version: '0'
|
49
62
|
requirements: []
|
50
63
|
rubyforge_project:
|
51
|
-
rubygems_version: 1.8.
|
64
|
+
rubygems_version: 1.8.24
|
52
65
|
signing_key:
|
53
66
|
specification_version: 3
|
54
67
|
summary: Engineering Calculator
|
55
|
-
test_files:
|
68
|
+
test_files:
|
69
|
+
- spec/Gemfile
|
70
|
+
- spec/spec_helper.rb
|
71
|
+
- spec/tests/action_test.rb
|
72
|
+
- spec/tests/calculator_test.rb
|
73
|
+
- spec/tests/gas_dynamics_test.rb
|
74
|
+
- spec/tests/output_test.rb
|