Last active
August 15, 2021 03:36
-
-
Save yoshida-eth0/f38f90de6b6028242e8ae01d250c26ee to your computer and use it in GitHub Desktop.
醤油造りにおける麹の仕込み配合から重量への換算、汲水の配合と塩分濃度の計算
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
require_relative './soy_source_recipe' | |
# 大豆 | |
soy_capacity = 1000.0 | |
soy_weight_rate = 0.72 | |
#soy_weight_rate = 0.6 | |
soy_water_content = 0.14 | |
soy_steaming_ratio = 2.4 | |
soy_cooling_ratio = 2.0 | |
soy = Ingredient.capacity(soy_capacity, soy_weight_rate, soy_water_content) | |
#soy = Ingredient.weight(soy_capacity, soy_weight_rate, soy_water_content) | |
# 小麦 | |
wheat_capacity = 1000.0 | |
wheat_weight_rate = 0.75 | |
wheat_water_content = 0.12 | |
wheat_roasting_ratio = 0.95 | |
wheat = Ingredient.capacity(wheat_capacity, wheat_weight_rate, wheat_water_content) | |
#wheat = Ingredient.weight(wheat_capacity, wheat_weight_rate, wheat_water_content) | |
# 汲水 | |
brine_ratio = 1.1 | |
brine_concentration = 0.223 | |
puts "[大豆]" | |
puts "原料体積: #{soy.capacity}L" | |
puts "原料重量: #{soy.weight}kg (#{soy.water_content*100}%)" | |
puts "水分を除いた原料重量: #{soy.dry_weight}kg" | |
steamed_soy = soy.processed(processed_ratio: soy_steaming_ratio) | |
puts "蒸豆重量: #{steamed_soy[:weight]}kg (#{steamed_soy[:water_content]*100}%)" | |
cooled_soy = soy.processed(processed_ratio: soy_cooling_ratio) | |
puts "放冷蒸豆重量: #{cooled_soy[:weight]}kg (#{cooled_soy[:water_content]*100}%)" | |
puts | |
puts "[小麦]" | |
puts "原料体積: #{wheat.capacity}L" | |
puts "原料重量: #{wheat.weight}kg (#{wheat.water_content*100}%)" | |
puts "水分を除いた原料重量: #{wheat.dry_weight}kg" | |
roasted_wheat = wheat.processed(processed_ratio: wheat_roasting_ratio) | |
puts "炒り小麦重量: #{roasted_wheat[:weight]}kg (#{roasted_wheat[:water_content]*100}%)" | |
puts | |
koji = Koji.new([soy, wheat]) | |
soy_ratio, wheat_ratio = koji.ratios | |
puts "[大豆:小麦]" | |
puts "原料割合: #{soy_ratio*100}:#{wheat_ratio*100}" | |
puts | |
morikomi_weight = cooled_soy[:weight] + roasted_wheat[:weight] | |
puts "[麹]" | |
puts "盛り込み時: #{morikomi_weight}kg (#{koji.water_content(morikomi_weight)*100}%)" | |
puts | |
brine = Brine.ratio(koji, brine_ratio, brine_concentration) | |
puts "[汲水]" | |
puts "塩水重量: #{brine.capacity}kg" | |
puts " - 水重量: #{brine.water}kg" | |
puts " - 塩重量: #{brine.salt}kg" | |
puts "塩分濃度: #{brine.concentration*100}%" | |
puts "汲水歩合: #{brine.ratio(koji)*10}水" | |
puts | |
puts "=====" | |
puts | |
puts "[麹水分量目標値]" | |
puts "盛り込み時: #{koji.weight(0.407)}kg (40.7%)" | |
puts "2番手入れ: #{koji.weight(0.344)}kg (34.4%)" | |
puts "出麹: #{koji.weight(0.276)}kg (27.6%)" | |
puts | |
puts "[諸味目標値]" | |
puts "重量: #{koji.weight(0.276) + brine.capacity}kg" | |
__END__ | |
% ruby example1.rb | |
[大豆] | |
原料体積: 1000.0L | |
原料重量: 720.0kg (14.000000000000002%) | |
水分を除いた原料重量: 619.2kg | |
蒸豆重量: 1728.0kg (64.16666666666666%) | |
放冷蒸豆重量: 1440.0kg (56.99999999999999%) | |
[小麦] | |
原料体積: 1000.0L | |
原料重量: 750.0kg (12.0%) | |
水分を除いた原料重量: 660.0kg | |
炒り小麦重量: 712.5kg (7.368421052631578%) | |
[大豆:小麦] | |
原料割合: 50.0:50.0 | |
[麹] | |
盛り込み時: 2152.5kg (40.57142857142857%) | |
[汲水] | |
塩水重量: 2200.0kg | |
- 水重量: 1709.4kg | |
- 塩重量: 490.6kg | |
塩分濃度: 22.3% | |
汲水歩合: 11.0水 | |
===== | |
[麹水分量目標値] | |
盛り込み時: 2157.1669477234404kg (40.7%) | |
2番手入れ: 1950.0kg (34.4%) | |
出麹: 1766.8508287292818kg (27.6%) | |
[諸味目標値] | |
重量: 3966.8508287292816kg |
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
require_relative './soy_source_recipe' | |
# 大豆 | |
soy_capacity = 260.0 * 0.8578680203045685 | |
soy_weight_rate = 0.72 | |
soy_water_content = 0.14 | |
soy_steamed_weight = 534.5 | |
soy_cooled_weight = 478.0 | |
soy = Ingredient.weight(soy_capacity, soy_weight_rate, soy_water_content) | |
# 小麦 | |
wheat_capacity = 100.0 | |
wheat_weight_rate = 0.75 | |
wheat_water_content = 0.12 | |
wheat = Ingredient.weight(wheat_capacity, wheat_weight_rate, wheat_water_content) | |
# 汲水 | |
brine_salt = 125 | |
brine_water = 500 | |
# 麹 | |
morikomi_weight = 571.5 | |
teire1_weight = 543.0 | |
teire2_weight = 490.5 | |
dekoji_weight = 362.0 | |
puts "[大豆]" | |
puts "原料体積: #{soy.capacity}ml" | |
puts "原料重量: #{soy.weight}g (#{soy.water_content*100}%)" | |
puts "水分を除いた原料重量: #{soy.dry_weight}g" | |
steamed_soy = soy.processed(processed_weight: soy_steamed_weight) | |
puts "蒸豆重量: #{steamed_soy[:weight]}g (#{steamed_soy[:water_content]*100}%)" | |
cooled_soy = soy.processed(processed_weight: soy_cooled_weight) | |
puts "放冷蒸豆重量: #{cooled_soy[:weight]}g (#{cooled_soy[:water_content]*100}%)" | |
puts | |
puts "[小麦]" | |
puts "原料体積: #{wheat.capacity}ml" | |
puts "原料重量: #{wheat.weight}g (#{wheat.water_content*100}%)" | |
puts "水分を除いた原料重量: #{wheat.dry_weight}g" | |
roasted_wheat = wheat.processed(processed_weight: morikomi_weight - cooled_soy[:weight]) | |
puts "炒り小麦重量: #{roasted_wheat[:weight]}g (#{roasted_wheat[:water_content]*100}%)" | |
puts | |
koji = Koji.new([soy, wheat]) | |
soy_ratio, wheat_ratio = koji.ratios | |
puts "[大豆:小麦]" | |
puts "原料割合: #{soy_ratio*100}:#{wheat_ratio*100}" | |
puts | |
puts "[麹]" | |
puts "盛り込み時: #{morikomi_weight}g (#{koji.water_content(morikomi_weight)*100}%)" | |
puts "1番手入れ: #{teire1_weight}g (#{koji.water_content(teire1_weight)*100}%)" | |
puts "2番手入れ: #{teire2_weight}g (#{koji.water_content(teire2_weight)*100}%)" | |
puts "出麹: #{dekoji_weight}g (#{koji.water_content(dekoji_weight)*100}%)" | |
puts | |
brine = Brine.weight(brine_water, brine_salt) | |
puts "[汲水]" | |
puts "塩水重量: #{brine.capacity}g" | |
puts " - 水重量: #{brine.water}g" | |
puts " - 塩重量: #{brine.salt}g" | |
puts "塩分濃度: #{brine.concentration*100}%" | |
puts "汲水歩合: #{brine.ratio(koji)*10}水" | |
puts | |
puts "=====" | |
puts | |
puts "[麹水分量目標値]" | |
puts "盛り込み時: #{koji.weight(0.407)}g (40.7%)" | |
puts "2番手入れ: #{koji.weight(0.344)}g (34.4%)" | |
puts "出麹: #{koji.weight(0.276)}g (27.6%)" | |
puts | |
puts "[諸味目標値]" | |
puts "重量: #{koji.weight(0.276) + brine.capacity}g" | |
__END__ | |
% ruby example2.rb | |
[大豆] | |
原料体積: 309.78567399887197ml | |
原料重量: 223.0456852791878g (14.000000000000002%) | |
水分を除いた原料重量: 191.8192893401015g | |
蒸豆重量: 534.5g (64.11238740129065%) | |
放冷蒸豆重量: 478.0g (59.870441560648224%) | |
[小麦] | |
原料体積: 133.33333333333334ml | |
原料重量: 100.0g (12.0%) | |
水分を除いた原料重量: 88.0g | |
炒り小麦重量: 93.5g (5.88235294117647%) | |
[大豆:小麦] | |
原料割合: 69.9102653853497:30.089734614650286 | |
[麹] | |
盛り込み時: 571.5g (51.03774464740132%) | |
1番手入れ: 543.0g (48.46790251563509%) | |
2番手入れ: 490.5g (42.95223458917401%) | |
出麹: 362.0g (22.70185377345263%) | |
[汲水] | |
塩水重量: 625.0g | |
- 水重量: 500.0g | |
- 塩重量: 125.0g | |
塩分濃度: 20.0% | |
汲水歩合: 14.104563100617323水 | |
===== | |
[麹水分量目標値] | |
盛り込み時: 471.87063969662984g (40.7%) | |
2番手入れ: 426.5537947257644g (34.4%) | |
出麹: 386.49073113273687g (27.6%) | |
[諸味目標値] | |
重量: 1011.4907311327369g |
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
class Ingredient | |
# 容量 | |
attr_reader :capacity | |
# 容量と重量の変換係数 | |
attr_reader :weight_rate | |
# 原料時点での水分量 | |
attr_reader :water_content | |
def initialize(capacity, weight_rate, water_content) | |
@capacity = capacity | |
@weight_rate = weight_rate | |
@water_content = water_content | |
end | |
# 原料重量 | |
def weight | |
capacity * weight_rate | |
end | |
# 水分を除いた原料重量 | |
def dry_weight | |
weight * (1.0 - water_content) | |
end | |
# 原料の加工 | |
def processed(processed_ratio: nil, processed_weight: nil) | |
if processed_ratio | |
processed_weight = weight * processed_ratio | |
end | |
if processed_weight | |
processed_ratio = processed_weight / weight | |
end | |
processed_water_content = (processed_weight - dry_weight) / processed_weight | |
{ | |
ratio: processed_ratio, | |
weight: processed_weight, | |
water_content: processed_water_content, | |
} | |
end | |
# 容量から | |
def self.capacity(capacity, weight_rate, water_content) | |
new(capacity, weight_rate, water_content) | |
end | |
# 重量から | |
def self.weight(weight, weight_rate, water_content) | |
new(weight / weight_rate, weight_rate, water_content) | |
end | |
end | |
class Koji | |
def initialize(ingredients) | |
@ingredients = ingredients | |
end | |
# 水分を除いた原料重量 | |
def dry_weight | |
@ingredients.map {|ing| ing.dry_weight}.sum | |
end | |
# 原料の容量 | |
def capacity | |
@ingredients.map {|ing| ing.capacity}.sum | |
end | |
# 各原料の割合 | |
def ratios | |
total = @ingredients.map {|ing| ing.capacity}.sum | |
@ingredients.map {|ing| ing.capacity / total} | |
end | |
# 加工後重量から水分量を計算 | |
def water_content(processed_weight) | |
(processed_weight - dry_weight) / processed_weight | |
end | |
# 水分量から加工後重量を計算 | |
def weight(water_content) | |
dry_weight / (1.0 - water_content) | |
end | |
end | |
module Brine | |
DEFAULT_CONCENTRATION = 0.223 | |
class Base | |
# 汲水歩合 | |
def ratio(koji) | |
capacity / koji.capacity | |
end | |
end | |
class Capacity < Base | |
# 容量 | |
attr_reader :capacity | |
# 塩分濃度 | |
attr_reader :concentration | |
def initialize(capacity, concentration=DEFAULT_CONCENTRATION) | |
@capacity = capacity.to_f | |
@concentration = concentration | |
end | |
# 塩重量 | |
def salt | |
capacity * concentration | |
end | |
# 水重量 | |
def water | |
capacity - salt | |
end | |
end | |
class Weight < Base | |
# 水重量 | |
attr_reader :water | |
# 塩重量 | |
attr_reader :salt | |
def initialize(water, salt) | |
@water = water.to_f | |
@salt = salt.to_f | |
end | |
# 容量 | |
def capacity | |
water + salt | |
end | |
# 塩分濃度 | |
def concentration | |
salt / capacity | |
end | |
end | |
# 容量から | |
def self.capacity(capacity, concentration=DEFAULT_CONCENTRATION) | |
Capacity.new(capacity, concentration) | |
end | |
# 汲水歩合から | |
def self.ratio(koji, ratio, concentration=DEFAULT_CONCENTRATION) | |
Capacity.new(koji.capacity * ratio, concentration) | |
end | |
# 重量から | |
def self.weight(water, salt) | |
Weight.new(water, salt) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment