toji 2.8.0 → 2.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/example/calendar.ipynb +42 -51
- data/example/calendar.yaml +6 -6
- data/example/calendar_file.ipynb +36 -36
- data/example/example_core.rb +877 -205
- data/example/kake_ingredient.rb +21 -15
- data/example/koji_ingredient.rb +31 -21
- data/example/{koji_making.ipynb → koji_progress.ipynb} +14 -14
- data/example/{koji_making.rb → koji_progress.rb} +3 -2
- data/example/{koji_making.yaml → koji_progress.yaml} +8 -9
- data/example/{koji_making_multi.ipynb → koji_progress_multi.ipynb} +21 -22
- data/example/{moromi.ipynb → moromi_progress.ipynb} +22 -22
- data/example/{moromi.rb → moromi_progress.rb} +3 -2
- data/example/{moromi.yaml → moromi_progress.yaml} +0 -0
- data/example/moto_progress.ipynb +121 -0
- data/example/{moto.rb → moto_progress.rb} +3 -2
- data/example/{moto.yaml → moto_progress.yaml} +14 -15
- data/example/recipe.rb +44 -32
- data/lib/toji.rb +4 -1
- data/lib/toji/calendar.rb +18 -18
- data/lib/toji/calendar/date_column.rb +7 -22
- data/lib/toji/calendar/date_row.rb +6 -6
- data/lib/toji/ingredient.rb +6 -2
- data/lib/toji/ingredient/alcohol.rb +14 -0
- data/lib/toji/ingredient/base.rb +11 -0
- data/lib/toji/ingredient/kake.rb +3 -9
- data/lib/toji/ingredient/koji.rb +19 -10
- data/lib/toji/ingredient/lactic_acid.rb +14 -0
- data/lib/toji/ingredient/rice.rb +50 -4
- data/lib/toji/ingredient/tanekoji.rb +29 -0
- data/lib/toji/ingredient/water.rb +18 -0
- data/lib/toji/ingredient/yeast.rb +20 -0
- data/lib/toji/processing.rb +18 -0
- data/lib/toji/processing/base.rb +7 -0
- data/lib/toji/processing/cooled_rice.rb +22 -0
- data/lib/toji/processing/cooled_rice_element.rb +8 -0
- data/lib/toji/processing/dekoji.rb +22 -0
- data/lib/toji/processing/dekoji_element.rb +8 -0
- data/lib/toji/processing/kake_processing.rb +7 -0
- data/lib/toji/processing/koji_processing.rb +10 -0
- data/lib/toji/processing/rice_processing.rb +19 -0
- data/lib/toji/processing/soaked_rice.rb +49 -0
- data/lib/toji/processing/soaked_rice_element.rb +18 -0
- data/lib/toji/processing/steamed_rice.rb +22 -0
- data/lib/toji/processing/steamed_rice_element.rb +8 -0
- data/lib/toji/product.rb +11 -83
- data/lib/toji/product/schedule_factory.rb +74 -0
- data/lib/toji/progress.rb +23 -0
- data/lib/toji/progress/base_progress.rb +37 -0
- data/lib/toji/progress/base_state.rb +39 -0
- data/lib/toji/progress/builder.rb +53 -0
- data/lib/toji/progress/graph.rb +11 -0
- data/lib/toji/{brew → progress}/graph/ab.rb +4 -4
- data/lib/toji/{brew → progress}/graph/bmd.rb +2 -2
- data/lib/toji/{brew/graph/multi_progress.rb → progress/graph/multi_progress_note.rb} +11 -11
- data/lib/toji/{brew/graph/progress.rb → progress/graph/progress_note.rb} +20 -18
- data/lib/toji/progress/koji_progress.rb +15 -0
- data/lib/toji/progress/koji_state.rb +23 -0
- data/lib/toji/{brew/moromi.rb → progress/moromi_progress.rb} +9 -5
- data/lib/toji/progress/moromi_state.rb +77 -0
- data/lib/toji/progress/moto_progress.rb +15 -0
- data/lib/toji/progress/moto_state.rb +31 -0
- data/lib/toji/progress/progress.rb +15 -0
- data/lib/toji/progress/state.rb +9 -0
- data/lib/toji/progress/state/baume_to_nihonshudo.rb +21 -0
- data/lib/toji/progress/state/nihonshudo_to_baume.rb +21 -0
- data/lib/toji/recipe.rb +54 -39
- data/lib/toji/recipe/ab_expect.rb +2 -2
- data/lib/toji/recipe/action.rb +8 -0
- data/lib/toji/recipe/step.rb +97 -71
- data/lib/toji/schedule.rb +5 -0
- data/lib/toji/schedule/action_schedule.rb +9 -0
- data/lib/toji/schedule/base.rb +9 -0
- data/lib/toji/schedule/kake_schedule.rb +11 -0
- data/lib/toji/schedule/koji_schedule.rb +11 -0
- data/lib/toji/schedule/rice_schedule.rb +16 -0
- data/lib/toji/utils.rb +43 -0
- data/lib/toji/version.rb +1 -1
- metadata +59 -40
- data/lib/toji/brew.rb +0 -18
- data/lib/toji/brew/base.rb +0 -55
- data/lib/toji/brew/builder.rb +0 -98
- data/lib/toji/brew/graph.rb +0 -11
- data/lib/toji/brew/koji.rb +0 -11
- data/lib/toji/brew/moto.rb +0 -11
- data/lib/toji/brew/state.rb +0 -122
- data/lib/toji/brew/wrapped_state.rb +0 -109
- data/lib/toji/ingredient/kake/actual.rb +0 -26
- data/lib/toji/ingredient/kake/base.rb +0 -18
- data/lib/toji/ingredient/kake/expected.rb +0 -40
- data/lib/toji/ingredient/koji/actual.rb +0 -29
- data/lib/toji/ingredient/koji/actual_fermentable.rb +0 -15
- data/lib/toji/ingredient/koji/base.rb +0 -35
- data/lib/toji/ingredient/koji/expected.rb +0 -45
- data/lib/toji/ingredient/koji/expected_fermentable.rb +0 -15
- data/lib/toji/ingredient/koji_rate.rb +0 -16
- data/lib/toji/ingredient/rice/actual_steamable.rb +0 -27
- data/lib/toji/ingredient/rice/base.rb +0 -40
- data/lib/toji/ingredient/rice/expected_steamable.rb +0 -27
- data/lib/toji/ingredient/rice_rate.rb +0 -23
- data/lib/toji/product/event.rb +0 -13
- data/lib/toji/product/rice_event.rb +0 -28
- data/lib/toji/product/rice_event_group.rb +0 -19
@@ -0,0 +1,21 @@
|
|
1
|
+
module Toji
|
2
|
+
module Progress
|
3
|
+
module State
|
4
|
+
module NihonshudoToBaume
|
5
|
+
def baume
|
6
|
+
if self.nihonshudo
|
7
|
+
self.nihonshudo / -10.0
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def baume=(val)
|
12
|
+
if val
|
13
|
+
self.nihonshudo = val.to_f * -10
|
14
|
+
else
|
15
|
+
self.nihonshudo = nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/toji/recipe.rb
CHANGED
@@ -1,44 +1,47 @@
|
|
1
1
|
require 'toji/recipe/step'
|
2
|
+
require 'toji/recipe/action'
|
2
3
|
require 'toji/recipe/ab_expect'
|
3
4
|
|
4
5
|
module Toji
|
5
6
|
module Recipe
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
def
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
attr_reader :steps
|
8
|
+
attr_reader :actions
|
9
|
+
attr_reader :has_moto
|
10
|
+
attr_reader :has_moromi
|
11
|
+
attr_reader :ab_coef
|
12
|
+
attr_reader :ab_expects
|
13
|
+
|
14
|
+
def scale_rice_total(rice_total)
|
15
|
+
ratio = rice_total / steps.map(&:rice_total).sum
|
16
|
+
scale(ratio)
|
17
|
+
end
|
18
|
+
|
19
|
+
def scale!(ratio)
|
20
|
+
steps.each {|step|
|
21
|
+
step.scale!(ratio)
|
17
22
|
}
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
def scale(ratio)
|
27
|
+
Utils.check_dup(self)
|
28
|
+
|
29
|
+
dst = self.dup
|
30
|
+
dst.scale!(ratio)
|
31
|
+
end
|
18
32
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
o.has_moromi = has_moromi
|
23
|
-
o.ab_coef = ab_coef
|
24
|
-
o.ab_expects = ab_expects.deep_dup
|
25
|
-
o.squeeze_interval_days = squeeze_interval_days
|
33
|
+
def round!(ndigit=0, mini_ndigit=nil, half: :up)
|
34
|
+
steps.each {|step|
|
35
|
+
step.round!(ndigit, mini_ndigit, half: half)
|
26
36
|
}
|
37
|
+
self
|
27
38
|
end
|
28
39
|
|
29
40
|
def round(ndigit=0, mini_ndigit=nil, half: :up)
|
30
|
-
|
31
|
-
step.round(ndigit, mini_ndigit, half: half)
|
32
|
-
}
|
41
|
+
Utils.check_dup(self)
|
33
42
|
|
34
|
-
self.
|
35
|
-
|
36
|
-
o.has_moto = has_moto
|
37
|
-
o.has_moromi = has_moromi
|
38
|
-
o.ab_coef = ab_coef
|
39
|
-
o.ab_expects = ab_expects.deep_dup
|
40
|
-
o.squeeze_interval_days = squeeze_interval_days
|
41
|
-
}
|
43
|
+
dst = self.dup
|
44
|
+
dst.round!(ndigit, mini_ndigit, half: half)
|
42
45
|
end
|
43
46
|
|
44
47
|
# 総米の累計
|
@@ -51,7 +54,7 @@ module Toji
|
|
51
54
|
end
|
52
55
|
|
53
56
|
# 酒母歩合の累計
|
54
|
-
def
|
57
|
+
def cumulative_moto_ratios
|
55
58
|
rice_total = steps.map(&:rice_total)
|
56
59
|
moto = rice_total.first
|
57
60
|
|
@@ -66,8 +69,8 @@ module Toji
|
|
66
69
|
# 汲水歩合が大きい高温糖化酒母では6%程度である
|
67
70
|
#
|
68
71
|
# 出典: 酒造教本 P96
|
69
|
-
def
|
70
|
-
|
72
|
+
def moto_ratio
|
73
|
+
cumulative_moto_ratios.last || 0.0
|
71
74
|
end
|
72
75
|
|
73
76
|
# 白米比率
|
@@ -78,22 +81,34 @@ module Toji
|
|
78
81
|
# 湧き抑え型 1 2 4 7 長期醪、甘口、おだやかな酒質
|
79
82
|
#
|
80
83
|
# 出典: 酒造教本 P95
|
81
|
-
def
|
84
|
+
def rice_ratios
|
82
85
|
steps.map {|step|
|
83
86
|
step.rice_total / steps.first.rice_total
|
84
87
|
}
|
85
88
|
end
|
86
89
|
|
87
90
|
def table_data
|
88
|
-
headers = [""] + steps.map
|
89
|
-
keys = [:rice_total, :
|
91
|
+
headers = [""] + steps.map.with_index{|s,i| :"Step#{i}"} + [:total]
|
92
|
+
keys = [["RiceTotal", :rice_total], ["Kake", :kakes], ["Koji", :kojis], ["Alcohol", :alcohols], ["Water", :waters], ["LacticAcid", :lactic_acids]]
|
90
93
|
|
91
|
-
cells = [keys]
|
94
|
+
cells = [keys.map(&:first)]
|
92
95
|
cells += steps.map {|step|
|
93
|
-
|
96
|
+
keys.map(&:last).map {|key|
|
97
|
+
vals = step.send(key)
|
98
|
+
if Numeric===vals
|
99
|
+
vals
|
100
|
+
else
|
101
|
+
vals.compact.map(&:weight).sum
|
102
|
+
end
|
103
|
+
}
|
94
104
|
}
|
95
|
-
cells << keys.map {|key|
|
96
|
-
steps.map(&key)
|
105
|
+
cells << keys.map(&:last).map {|key|
|
106
|
+
vals = steps.map(&key)
|
107
|
+
if Numeric===vals[0]
|
108
|
+
vals.sum
|
109
|
+
else
|
110
|
+
vals.flatten.compact.map(&:weight).sum
|
111
|
+
end
|
97
112
|
}
|
98
113
|
|
99
114
|
cells = cells.map {|cell|
|
data/lib/toji/recipe/step.rb
CHANGED
@@ -1,25 +1,31 @@
|
|
1
1
|
module Toji
|
2
2
|
module Recipe
|
3
3
|
module Step
|
4
|
-
attr_accessor :
|
5
|
-
attr_accessor :
|
6
|
-
attr_accessor :
|
7
|
-
attr_accessor :
|
8
|
-
attr_accessor :
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
4
|
+
attr_accessor :kojis
|
5
|
+
attr_accessor :kakes
|
6
|
+
attr_accessor :waters
|
7
|
+
attr_accessor :lactic_acids
|
8
|
+
attr_accessor :alcohols
|
9
|
+
attr_accessor :yeasts
|
10
|
+
|
11
|
+
# 麹米
|
12
|
+
def koji_total
|
13
|
+
(kojis || []).map(&:weight).map(&:to_f).sum.to_f
|
14
|
+
end
|
15
|
+
|
16
|
+
# 掛米
|
17
|
+
def kake_total
|
18
|
+
(kakes || []).map(&:weight).map(&:to_f).sum.to_f
|
19
|
+
end
|
19
20
|
|
20
21
|
# 総米
|
21
22
|
def rice_total
|
22
|
-
|
23
|
+
koji_total + kake_total
|
24
|
+
end
|
25
|
+
|
26
|
+
# 汲水
|
27
|
+
def water_total
|
28
|
+
(waters || []).map(&:weight).map(&:to_f).sum.to_f
|
23
29
|
end
|
24
30
|
|
25
31
|
# 麹歩合
|
@@ -27,8 +33,8 @@ module Toji
|
|
27
33
|
# 留め仕込みまでの総米重量の20〜22%が標準である
|
28
34
|
# なお、留め仕込みまでの麹歩合が20%を下回ると蒸米の溶解糖化に影響が出るので注意がいる
|
29
35
|
# 出典: 酒造教本 P95
|
30
|
-
def
|
31
|
-
val =
|
36
|
+
def koji_ratio
|
37
|
+
val = koji_total / rice_total
|
32
38
|
val.nan? ? 0.0 : val
|
33
39
|
end
|
34
40
|
|
@@ -41,54 +47,90 @@ module Toji
|
|
41
47
|
# 全体: 留までの総米に対し120〜130%、標準は125%、高級酒は130〜145%である
|
42
48
|
#
|
43
49
|
# 出典: 酒造教本 P96
|
44
|
-
def
|
45
|
-
val =
|
50
|
+
def water_ratio
|
51
|
+
val = water_total / rice_total
|
46
52
|
val.nan? ? 0.0 : val
|
47
53
|
end
|
48
54
|
|
49
|
-
def
|
55
|
+
def scale!(ratio)
|
56
|
+
kojis&.each {|koji|
|
57
|
+
koji.weight *= ratio
|
58
|
+
}
|
59
|
+
kakes&.each {|kake|
|
60
|
+
kake.weight *= ratio
|
61
|
+
}
|
62
|
+
waters&.each {|water|
|
63
|
+
water.weight *= ratio
|
64
|
+
}
|
65
|
+
lactic_acids&.each {|lactic_acid|
|
66
|
+
lactic_acid.weight *= ratio
|
67
|
+
}
|
68
|
+
alcohols&.each {|alcohol|
|
69
|
+
alcohol.weight *= ratio
|
70
|
+
}
|
71
|
+
yeasts&.each {|yeast|
|
72
|
+
yeast.weight *= ratio
|
73
|
+
}
|
74
|
+
self
|
75
|
+
end
|
76
|
+
|
77
|
+
def scale(ratio)
|
78
|
+
Utils.check_dup(self)
|
79
|
+
|
80
|
+
dst = self.dup
|
81
|
+
dst.scale!(ratio)
|
82
|
+
end
|
83
|
+
|
84
|
+
def round!(ndigit=0, mini_ndigit=nil, half: :up)
|
50
85
|
if !mini_ndigit
|
51
86
|
mini_ndigit = ndigit + 3
|
52
87
|
end
|
53
88
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
o.kake_soaked_rate = kake_soaked_rate.to_f
|
63
|
-
o.kake_steamed_rate = kake_steamed_rate.to_f
|
64
|
-
o.kake_interval_days = kake_interval_days.to_i
|
65
|
-
|
66
|
-
o.water = water.to_f.round(ndigit, half: half)
|
67
|
-
o.lactic_acid = lactic_acid.to_f.round(mini_ndigit, half: half)
|
68
|
-
o.alcohol = alcohol.to_f.round(ndigit, half: half)
|
69
|
-
o.yeast = yeast.to_f.round(mini_ndigit, half: half)
|
89
|
+
kojis&.each {|koji|
|
90
|
+
koji.weight = koji.weight.to_f.round(ndigit, half: half)
|
91
|
+
}
|
92
|
+
kakes&.each {|kake|
|
93
|
+
kake.weight = kake.weight.to_f.round(ndigit, half: half)
|
94
|
+
}
|
95
|
+
waters&.each {|water|
|
96
|
+
water.weight = water.weight.to_f.round(ndigit, half: half)
|
70
97
|
}
|
98
|
+
lactic_acids&.each {|lactic_acid|
|
99
|
+
lactic_acid.weight = lactic_acid.weight.to_f.round(mini_ndigit, half: half)
|
100
|
+
}
|
101
|
+
alcohols&.each {|alcohol|
|
102
|
+
alcohol.weight = alcohol.weight.to_f.round(ndigit, half: half)
|
103
|
+
}
|
104
|
+
yeasts&.each {|yeast|
|
105
|
+
yeast.weight = yeast.weight.to_f.round(mini_ndigit, half: half)
|
106
|
+
}
|
107
|
+
|
108
|
+
self
|
109
|
+
end
|
110
|
+
|
111
|
+
def round(ndigit=0, mini_ndigit=nil, half: :up)
|
112
|
+
Utils.check_dup(self)
|
113
|
+
|
114
|
+
dst = self.dup
|
115
|
+
dst.round!(ndigit, mini_ndigit, half: half)
|
71
116
|
end
|
72
117
|
|
73
118
|
def +(other)
|
74
119
|
if Step===other
|
75
|
-
self
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
o.alcohol = alcohol.to_f + other.alcohol.to_f
|
90
|
-
o.yeast = yeast.to_f + other.yeast.to_f
|
91
|
-
}
|
120
|
+
Utils.check_dup(self)
|
121
|
+
Utils.check_dup(other)
|
122
|
+
|
123
|
+
dst = self.dup
|
124
|
+
other = other.dup
|
125
|
+
|
126
|
+
dst.kojis = Utils.merge_ingredients(dst.kojis, other.kojis)
|
127
|
+
dst.kakes = Utils.merge_ingredients(dst.kakes, other.kakes)
|
128
|
+
dst.waters = Utils.merge_ingredients(dst.waters, other.waters)
|
129
|
+
dst.lactic_acids = Utils.merge_ingredients(dst.lactic_acids, other.lactic_acids)
|
130
|
+
dst.alcohols = Utils.merge_ingredients(dst.alcohols, other.alcohols)
|
131
|
+
dst.yeasts = Utils.merge_ingredients(dst.yeasts, other.yeasts)
|
132
|
+
|
133
|
+
dst
|
92
134
|
else
|
93
135
|
x, y = other.coerce(self)
|
94
136
|
x + y
|
@@ -97,23 +139,7 @@ module Toji
|
|
97
139
|
|
98
140
|
def *(other)
|
99
141
|
if Integer===other || Float===other
|
100
|
-
|
101
|
-
o.koji = koji.to_f * other
|
102
|
-
o.koji_soaked_rate = koji_soaked_rate.to_f
|
103
|
-
o.koji_steamed_rate = koji_steamed_rate.to_f
|
104
|
-
o.koji_dekoji_rate = koji_dekoji_rate.to_f
|
105
|
-
o.koji_interval_days = koji_interval_days.to_i
|
106
|
-
|
107
|
-
o.kake = kake.to_f * other
|
108
|
-
o.kake_soaked_rate = kake_soaked_rate.to_f
|
109
|
-
o.kake_steamed_rate = kake_steamed_rate.to_f
|
110
|
-
o.kake_interval_days = kake_interval_days.to_i
|
111
|
-
|
112
|
-
o.water = water.to_f * other
|
113
|
-
o.lactic_acid = lactic_acid.to_f * other
|
114
|
-
o.alcohol = alcohol.to_f * other
|
115
|
-
o.yeast = yeast.to_f * other
|
116
|
-
}
|
142
|
+
scale(other)
|
117
143
|
else
|
118
144
|
x, y = other.coerce(self)
|
119
145
|
x * y
|