toji 2.11.0 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/example/calendar.ipynb +42 -51
  3. data/example/calendar.yaml +6 -6
  4. data/example/calendar_file.ipynb +35 -35
  5. data/example/example_core.rb +882 -230
  6. data/example/kake_ingredient.rb +21 -15
  7. data/example/koji_ingredient.rb +31 -21
  8. data/example/{koji_making.ipynb → koji_progress.ipynb} +14 -14
  9. data/example/{koji_making.rb → koji_progress.rb} +3 -2
  10. data/example/{koji_making.yaml → koji_progress.yaml} +8 -9
  11. data/example/{koji_making_multi.ipynb → koji_progress_multi.ipynb} +21 -22
  12. data/example/{moromi.ipynb → moromi_progress.ipynb} +22 -22
  13. data/example/{moromi.rb → moromi_progress.rb} +3 -2
  14. data/example/{moromi.yaml → moromi_progress.yaml} +0 -0
  15. data/example/moto_progress.ipynb +121 -0
  16. data/example/{moto.rb → moto_progress.rb} +3 -2
  17. data/example/{moto.yaml → moto_progress.yaml} +14 -15
  18. data/example/recipe.rb +44 -32
  19. data/lib/toji.rb +4 -2
  20. data/lib/toji/calendar.rb +12 -12
  21. data/lib/toji/calendar/date_column.rb +8 -8
  22. data/lib/toji/calendar/date_row.rb +6 -6
  23. data/lib/toji/ingredient.rb +6 -2
  24. data/lib/toji/ingredient/alcohol.rb +14 -0
  25. data/lib/toji/ingredient/base.rb +11 -0
  26. data/lib/toji/ingredient/kake.rb +3 -9
  27. data/lib/toji/ingredient/koji.rb +19 -10
  28. data/lib/toji/ingredient/lactic_acid.rb +14 -0
  29. data/lib/toji/ingredient/rice.rb +50 -4
  30. data/lib/toji/ingredient/tanekoji.rb +29 -0
  31. data/lib/toji/ingredient/water.rb +18 -0
  32. data/lib/toji/ingredient/yeast.rb +20 -0
  33. data/lib/toji/processing.rb +18 -0
  34. data/lib/toji/processing/base.rb +7 -0
  35. data/lib/toji/processing/cooled_rice.rb +22 -0
  36. data/lib/toji/processing/cooled_rice_element.rb +8 -0
  37. data/lib/toji/processing/dekoji.rb +22 -0
  38. data/lib/toji/processing/dekoji_element.rb +8 -0
  39. data/lib/toji/processing/kake_processing.rb +7 -0
  40. data/lib/toji/processing/koji_processing.rb +10 -0
  41. data/lib/toji/processing/rice_processing.rb +19 -0
  42. data/lib/toji/processing/soaked_rice.rb +49 -0
  43. data/lib/toji/processing/soaked_rice_element.rb +18 -0
  44. data/lib/toji/processing/steamed_rice.rb +22 -0
  45. data/lib/toji/processing/steamed_rice_element.rb +8 -0
  46. data/lib/toji/product.rb +11 -32
  47. data/lib/toji/product/schedule_factory.rb +80 -0
  48. data/lib/toji/progress.rb +23 -0
  49. data/lib/toji/progress/base_progress.rb +37 -0
  50. data/lib/toji/progress/base_state.rb +39 -0
  51. data/lib/toji/progress/builder.rb +53 -0
  52. data/lib/toji/progress/graph.rb +11 -0
  53. data/lib/toji/{brew → progress}/graph/ab.rb +4 -4
  54. data/lib/toji/{brew → progress}/graph/bmd.rb +2 -2
  55. data/lib/toji/{brew/graph/multi_progress.rb → progress/graph/multi_progress_note.rb} +11 -11
  56. data/lib/toji/{brew/graph/progress.rb → progress/graph/progress_note.rb} +20 -18
  57. data/lib/toji/progress/koji_progress.rb +15 -0
  58. data/lib/toji/progress/koji_state.rb +23 -0
  59. data/lib/toji/{brew/moromi.rb → progress/moromi_progress.rb} +9 -5
  60. data/lib/toji/progress/moromi_state.rb +77 -0
  61. data/lib/toji/progress/moto_progress.rb +15 -0
  62. data/lib/toji/progress/moto_state.rb +31 -0
  63. data/lib/toji/progress/progress.rb +15 -0
  64. data/lib/toji/progress/state.rb +9 -0
  65. data/lib/toji/progress/state/baume_to_nihonshudo.rb +21 -0
  66. data/lib/toji/progress/state/nihonshudo_to_baume.rb +21 -0
  67. data/lib/toji/recipe.rb +51 -39
  68. data/lib/toji/recipe/ab_expect.rb +2 -2
  69. data/lib/toji/recipe/action.rb +2 -2
  70. data/lib/toji/recipe/step.rb +99 -71
  71. data/lib/toji/schedule.rb +5 -0
  72. data/lib/toji/schedule/action_schedule.rb +9 -0
  73. data/lib/toji/{event → schedule}/base.rb +1 -1
  74. data/lib/toji/schedule/kake_schedule.rb +11 -0
  75. data/lib/toji/schedule/koji_schedule.rb +11 -0
  76. data/lib/toji/schedule/rice_schedule.rb +16 -0
  77. data/lib/toji/utils.rb +43 -0
  78. data/lib/toji/version.rb +1 -1
  79. metadata +59 -45
  80. data/lib/toji/brew.rb +0 -18
  81. data/lib/toji/brew/base.rb +0 -55
  82. data/lib/toji/brew/builder.rb +0 -98
  83. data/lib/toji/brew/graph.rb +0 -11
  84. data/lib/toji/brew/koji.rb +0 -11
  85. data/lib/toji/brew/moto.rb +0 -11
  86. data/lib/toji/brew/state.rb +0 -122
  87. data/lib/toji/brew/wrapped_state.rb +0 -109
  88. data/lib/toji/event.rb +0 -5
  89. data/lib/toji/event/action_event.rb +0 -12
  90. data/lib/toji/event/kake_event.rb +0 -13
  91. data/lib/toji/event/koji_event.rb +0 -19
  92. data/lib/toji/event/rice_event.rb +0 -34
  93. data/lib/toji/ingredient/kake/actual.rb +0 -26
  94. data/lib/toji/ingredient/kake/base.rb +0 -18
  95. data/lib/toji/ingredient/kake/expected.rb +0 -40
  96. data/lib/toji/ingredient/koji/actual.rb +0 -29
  97. data/lib/toji/ingredient/koji/actual_fermentable.rb +0 -15
  98. data/lib/toji/ingredient/koji/base.rb +0 -35
  99. data/lib/toji/ingredient/koji/expected.rb +0 -45
  100. data/lib/toji/ingredient/koji/expected_fermentable.rb +0 -15
  101. data/lib/toji/ingredient/koji_rate.rb +0 -16
  102. data/lib/toji/ingredient/rice/actual_steamable.rb +0 -27
  103. data/lib/toji/ingredient/rice/base.rb +0 -40
  104. data/lib/toji/ingredient/rice/expected_steamable.rb +0 -27
  105. data/lib/toji/ingredient/rice_rate.rb +0 -23
  106. data/lib/toji/product/event_factory.rb +0 -70
@@ -1,14 +1,15 @@
1
+ $LOAD_PATH << File.dirname(__FILE__) + "/../lib"
1
2
  require 'toji'
2
3
  require_relative 'example_core'
3
4
  require 'terminal-table'
4
5
 
5
6
 
6
- moromi = Example::Brew::Moromi.load_yaml_file(File.dirname(__FILE__)+"/moromi.yaml")
7
+ moromi = Example::Progress::MoromiProgress.load_yaml_file(File.dirname(__FILE__)+"/moromi_progress.yaml")
7
8
 
8
9
  table = Terminal::Table.new do |t|
9
10
  t << ["作業", "日数", "品温(度)", "操作室温", "ボーメ及び日本酒度", "アルコール度数", "BMD", "アルコール期待値(16.5 +3)", "経過時間", "日時"]
10
11
  t << :separator
11
- moromi.wrapped_states.each {|s|
12
+ moromi.states.each {|s|
12
13
  temp = s.temps.map(&:to_s).join(" / ")
13
14
  t << [s.mark, s.day_label, temp, s.room_temp, s.display_baume, s.alcohol, s.bmd&.round(2), s.expected_alcohol(16.5, +3, 1.5)&.round(2), s.elapsed_time, s.display_time]
14
15
  }
@@ -0,0 +1,121 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "data": {
10
+ "text/html": [
11
+ "\n",
12
+ " <script>\n",
13
+ " requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})\n",
14
+ " </script>\n",
15
+ "\n",
16
+ "\n",
17
+ "<div id=\"9d0ee2a7-322e-41db-838e-dfe6129038ea\" style=\"height: 100%; width: 100%;\"></div>\n",
18
+ "\n",
19
+ "<script>\n",
20
+ " require(['plotly'], function(Plotly) { \n",
21
+ "Plotly.newPlot(\n",
22
+ " '9d0ee2a7-322e-41db-838e-dfe6129038ea',\n",
23
+ " [{\"x\":[0.0,3600.0,86400.0,172800.0,172801.0,259200.0,259201.0,345600.0,345601.0,432000.0,518400.0,604800.0,691200.0,777600.0,864000.0,950400.0,1036800.0,1123200.0],\"y\":[12.0,20.0,14.0,8.0,11.0,10.0,13.0,12.0,15.0,14.0,20.0,20.0,20.0,20.0,15.0,12.0,10.0,9.0],\"text\":[\"01/16 00:00\",\"01/16 01:00\",\"01/17 00:00\",\"01/18 00:00\",\"01/18 00:00\",\"01/19 00:00\",\"01/19 00:00\",\"01/20 00:00\",\"01/20 00:00\",\"01/21 00:00\",\"01/22 00:00\",\"01/23 00:00\",\"01/24 00:00\",\"01/25 00:00\",\"01/26 00:00\",\"01/27 00:00\",\"01/28 00:00\",\"01/29 00:00\"],\"name\":\"temps\",\"line\":{\"dash\":\"solid\",\"shape\":\"linear\"},\"marker\":{\"color\":\"#1f77b4\"}},{\"x\":[86400.0,172800.0,259200.0,345600.0,432000.0,518400.0,604800.0,691200.0,777600.0,864000.0,950400.0,1036800.0,1123200.0],\"y\":[15.0,16.0,16.5,17.0,17.0,17.0,14.0,12.0,9.0,8.0,7.0,6.0,5.0],\"text\":[\"01/17 00:00\",\"01/18 00:00\",\"01/19 00:00\",\"01/20 00:00\",\"01/21 00:00\",\"01/22 00:00\",\"01/23 00:00\",\"01/24 00:00\",\"01/25 00:00\",\"01/26 00:00\",\"01/27 00:00\",\"01/28 00:00\",\"01/29 00:00\"],\"name\":\"baume\",\"line\":{\"dash\":\"solid\",\"shape\":\"linear\"},\"marker\":{\"color\":\"#9467bd\"}},{\"x\":[0.0,3600.0,86400.0,172800.0,259200.0,345600.0,432000.0,518400.0,604800.0,691200.0,777600.0,864000.0,950400.0,1036800.0,1123200.0],\"y\":[13.0,13.0,13.0,13.0,13.5,13.5,14.0,14.5,15.5,16.0,16.0,16.5,17.0,17.5,17.5],\"text\":[\"01/16 00:00\",\"01/16 01:00\",\"01/17 00:00\",\"01/18 00:00\",\"01/19 00:00\",\"01/20 00:00\",\"01/21 00:00\",\"01/22 00:00\",\"01/23 00:00\",\"01/24 00:00\",\"01/25 00:00\",\"01/26 00:00\",\"01/27 00:00\",\"01/28 00:00\",\"01/29 00:00\"],\"name\":\"acid\",\"line\":{\"dash\":\"solid\",\"shape\":\"linear\"},\"marker\":{\"color\":\"#8c564b\"}}],\n",
24
+ " {\"xaxis\":{\"dtick\":86400,\"tickvals\":[0,86400,172800,259200,345600,432000,518400,604800,691200,777600,864000,950400,1036800,1123200],\"ticktext\":[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\"]},\"annotations\":[{\"x\":0.0,\"y\":12.0,\"xref\":\"x\",\"yref\":\"y\",\"text\":\"水麹\",\"showarrow\":true,\"arrowhead\":1,\"ax\":0,\"ay\":-40},{\"x\":3600.0,\"y\":20.0,\"xref\":\"x\",\"yref\":\"y\",\"text\":\"仕込み\",\"showarrow\":true,\"arrowhead\":1,\"ax\":0,\"ay\":-40},{\"x\":86400.0,\"y\":14.0,\"xref\":\"x\",\"yref\":\"y\",\"text\":\"打瀬\",\"showarrow\":true,\"arrowhead\":1,\"ax\":0,\"ay\":-40},{\"x\":777600.0,\"y\":20.0,\"xref\":\"x\",\"yref\":\"y\",\"text\":\"分け\",\"showarrow\":true,\"arrowhead\":1,\"ax\":0,\"ay\":-40}]},\n",
25
+ " {\"linkText\":\"Export to plot.ly\",\"showLink\":true}\n",
26
+ ")\n",
27
+ "\n",
28
+ "window.addEventListener('resize', function() {\n",
29
+ " Plotly.Plots.resize(document.getElementById('9d0ee2a7-322e-41db-838e-dfe6129038ea'))\n",
30
+ "})\n",
31
+ " }) \n",
32
+ "</script>"
33
+ ],
34
+ "text/plain": [
35
+ "#<Plotly::Offline::HTML:0x00007fe9601f3cf8 @id=\"9d0ee2a7-322e-41db-838e-dfe6129038ea\", @data=[{:x=>[0.0, 3600.0, 86400.0, 172800.0, 172801.0, 259200.0, 259201.0, 345600.0, 345601.0, 432000.0, 518400.0, 604800.0, 691200.0, 777600.0, 864000.0, 950400.0, 1036800.0, 1123200.0], :y=>[12.0, 20.0, 14.0, 8.0, 11.0, 10.0, 13.0, 12.0, 15.0, 14.0, 20.0, 20.0, 20.0, 20.0, 15.0, 12.0, 10.0, 9.0], :text=>[\"01/16 00:00\", \"01/16 01:00\", \"01/17 00:00\", \"01/18 00:00\", \"01/18 00:00\", \"01/19 00:00\", \"01/19 00:00\", \"01/20 00:00\", \"01/20 00:00\", \"01/21 00:00\", \"01/22 00:00\", \"01/23 00:00\", \"01/24 00:00\", \"01/25 00:00\", \"01/26 00:00\", \"01/27 00:00\", \"01/28 00:00\", \"01/29 00:00\"], :name=>\"temps\", :line=>{:dash=>:solid, :shape=>:linear}, :marker=>{:color=>\"#1f77b4\"}}, {:x=>[86400.0, 172800.0, 259200.0, 345600.0, 432000.0, 518400.0, 604800.0, 691200.0, 777600.0, 864000.0, 950400.0, 1036800.0, 1123200.0], :y=>[15.0, 16.0, 16.5, 17.0, 17.0, 17.0, 14.0, 12.0, 9.0, 8.0, 7.0, 6.0, 5.0], :text=>[\"01/17 00:00\", \"01/18 00:00\", \"01/19 00:00\", \"01/20 00:00\", \"01/21 00:00\", \"01/22 00:00\", \"01/23 00:00\", \"01/24 00:00\", \"01/25 00:00\", \"01/26 00:00\", \"01/27 00:00\", \"01/28 00:00\", \"01/29 00:00\"], :name=>\"baume\", :line=>{:dash=>:solid, :shape=>:linear}, :marker=>{:color=>\"#9467bd\"}}, {:x=>[0.0, 3600.0, 86400.0, 172800.0, 259200.0, 345600.0, 432000.0, 518400.0, 604800.0, 691200.0, 777600.0, 864000.0, 950400.0, 1036800.0, 1123200.0], :y=>[13.0, 13.0, 13.0, 13.0, 13.5, 13.5, 14.0, 14.5, 15.5, 16.0, 16.0, 16.5, 17.0, 17.5, 17.5], :text=>[\"01/16 00:00\", \"01/16 01:00\", \"01/17 00:00\", \"01/18 00:00\", \"01/19 00:00\", \"01/20 00:00\", \"01/21 00:00\", \"01/22 00:00\", \"01/23 00:00\", \"01/24 00:00\", \"01/25 00:00\", \"01/26 00:00\", \"01/27 00:00\", \"01/28 00:00\", \"01/29 00:00\"], :name=>\"acid\", :line=>{:dash=>:solid, :shape=>:linear}, :marker=>{:color=>\"#8c564b\"}}], @layout={:xaxis=>{:dtick=>86400, :tickvals=>[0, 86400, 172800, 259200, 345600, 432000, 518400, 604800, 691200, 777600, 864000, 950400, 1036800, 1123200], :ticktext=>[\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\", \"13\", \"14\"]}, :annotations=>[{:x=>0.0, :y=>12.0, :xref=>\"x\", :yref=>\"y\", :text=>\"水麹\", :showarrow=>true, :arrowhead=>1, :ax=>0, :ay=>-40}, {:x=>3600.0, :y=>20.0, :xref=>\"x\", :yref=>\"y\", :text=>\"仕込み\", :showarrow=>true, :arrowhead=>1, :ax=>0, :ay=>-40}, {:x=>86400.0, :y=>14.0, :xref=>\"x\", :yref=>\"y\", :text=>\"打瀬\", :showarrow=>true, :arrowhead=>1, :ax=>0, :ay=>-40}, {:x=>777600.0, :y=>20.0, :xref=>\"x\", :yref=>\"y\", :text=>\"分け\", :showarrow=>true, :arrowhead=>1, :ax=>0, :ay=>-40}]}, @config={:linkText=>\"Export to plot.ly\", :showLink=>true}, @embedded=true>"
36
+ ]
37
+ },
38
+ "metadata": {},
39
+ "output_type": "display_data"
40
+ },
41
+ {
42
+ "data": {
43
+ "text/html": [
44
+ "\n",
45
+ " <script>\n",
46
+ " requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})\n",
47
+ " </script>\n",
48
+ "\n",
49
+ "\n",
50
+ "<div id=\"eda34d57-4ce4-4676-8f40-05b48811023e\" style=\"height: 100%; width: 100%;\"></div>\n",
51
+ "\n",
52
+ "<script>\n",
53
+ " require(['plotly'], function(Plotly) { \n",
54
+ "Plotly.newPlot(\n",
55
+ " 'eda34d57-4ce4-4676-8f40-05b48811023e',\n",
56
+ " [{\"type\":\"table\",\"header\":{\"values\":[\"day_label\",\"display_time\",\"mark\",\"temps\",\"baume\",\"acid\",\"warmings\"]},\"cells\":{\"values\":[[\"1\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\"],[\"01/16 00:00\",\"01/16 01:00\",\"01/17 00:00\",\"01/18 00:00\",\"01/19 00:00\",\"01/20 00:00\",\"01/21 00:00\",\"01/22 00:00\",\"01/23 00:00\",\"01/24 00:00\",\"01/25 00:00\",\"01/26 00:00\",\"01/27 00:00\",\"01/28 00:00\",\"01/29 00:00\"],[\"水麹\",\"仕込み\",\"打瀬\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"分け\",\"\",\"\",\"\",\"\"],[\"12.0\",\"20.0\",\"14.0\",\"8.0, 11.0\",\"10.0, 13.0\",\"12.0, 15.0\",\"14.0\",\"20.0\",\"20.0\",\"20.0\",\"20.0\",\"15.0\",\"12.0\",\"10.0\",\"9.0\"],[\"\",\"\",\"15.0\",\"16.0\",\"16.5\",\"17.0\",\"17.0\",\"17.0\",\"14.0\",\"12.0\",\"9.0\",\"8.0\",\"7.0\",\"6.0\",\"5.0\"],[\"13.0\",\"13.0\",\"13.0\",\"13.0\",\"13.5\",\"13.5\",\"14.0\",\"14.5\",\"15.5\",\"16.0\",\"16.0\",\"16.5\",\"17.0\",\"17.5\",\"17.5\"],[\"\",\"\",\"\",\"暖気\",\"暖気\",\"暖気\",\"行火\",\"行火\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]]}}],\n",
57
+ " {\"height\":650},\n",
58
+ " {\"linkText\":\"Export to plot.ly\",\"showLink\":true}\n",
59
+ ")\n",
60
+ "\n",
61
+ "window.addEventListener('resize', function() {\n",
62
+ " Plotly.Plots.resize(document.getElementById('eda34d57-4ce4-4676-8f40-05b48811023e'))\n",
63
+ "})\n",
64
+ " }) \n",
65
+ "</script>"
66
+ ],
67
+ "text/plain": [
68
+ "#<Plotly::Offline::HTML:0x00007fe9639b2838 @id=\"eda34d57-4ce4-4676-8f40-05b48811023e\", @data=[{:type=>:table, :header=>{:values=>[:day_label, :display_time, :mark, :temps, :baume, :acid, :warmings]}, :cells=>{:values=>[[\"1\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\", \"13\", \"14\"], [\"01/16 00:00\", \"01/16 01:00\", \"01/17 00:00\", \"01/18 00:00\", \"01/19 00:00\", \"01/20 00:00\", \"01/21 00:00\", \"01/22 00:00\", \"01/23 00:00\", \"01/24 00:00\", \"01/25 00:00\", \"01/26 00:00\", \"01/27 00:00\", \"01/28 00:00\", \"01/29 00:00\"], [\"水麹\", \"仕込み\", \"打瀬\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"分け\", \"\", \"\", \"\", \"\"], [\"12.0\", \"20.0\", \"14.0\", \"8.0, 11.0\", \"10.0, 13.0\", \"12.0, 15.0\", \"14.0\", \"20.0\", \"20.0\", \"20.0\", \"20.0\", \"15.0\", \"12.0\", \"10.0\", \"9.0\"], [\"\", \"\", \"15.0\", \"16.0\", \"16.5\", \"17.0\", \"17.0\", \"17.0\", \"14.0\", \"12.0\", \"9.0\", \"8.0\", \"7.0\", \"6.0\", \"5.0\"], [\"13.0\", \"13.0\", \"13.0\", \"13.0\", \"13.5\", \"13.5\", \"14.0\", \"14.5\", \"15.5\", \"16.0\", \"16.0\", \"16.5\", \"17.0\", \"17.5\", \"17.5\"], [\"\", \"\", \"\", \"暖気\", \"暖気\", \"暖気\", \"行火\", \"行火\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"]]}}], @layout={:height=>650}, @config={:linkText=>\"Export to plot.ly\", :showLink=>true}, @embedded=true>"
69
+ ]
70
+ },
71
+ "metadata": {},
72
+ "output_type": "display_data"
73
+ },
74
+ {
75
+ "data": {
76
+ "text/plain": [
77
+ "#<CZTop::Socket::PUB:0x7fe965404080 last_endpoint=\"tcp://127.0.0.1:58100\">"
78
+ ]
79
+ },
80
+ "execution_count": 1,
81
+ "metadata": {},
82
+ "output_type": "execute_result"
83
+ }
84
+ ],
85
+ "source": [
86
+ "$LOAD_PATH << File.dirname(__FILE__) + \"/../lib\"\n",
87
+ "require 'toji'\n",
88
+ "require './example_core'\n",
89
+ "require 'rbplotly'\n",
90
+ "\n",
91
+ "moto = Example::Progress::MotoProgress.load_yaml_file(\"moto_progress.yaml\")\n",
92
+ "moto.progress_note.plot.show\n",
93
+ "moto.progress_note.table.tap {|t|\n",
94
+ " t.layout.height = 650\n",
95
+ "}.show"
96
+ ]
97
+ },
98
+ {
99
+ "cell_type": "code",
100
+ "execution_count": null,
101
+ "metadata": {},
102
+ "outputs": [],
103
+ "source": []
104
+ }
105
+ ],
106
+ "metadata": {
107
+ "kernelspec": {
108
+ "display_name": "Ruby 2.7.1",
109
+ "language": "ruby",
110
+ "name": "ruby"
111
+ },
112
+ "language_info": {
113
+ "file_extension": ".rb",
114
+ "mimetype": "application/x-ruby",
115
+ "name": "ruby",
116
+ "version": "2.6.3"
117
+ }
118
+ },
119
+ "nbformat": 4,
120
+ "nbformat_minor": 2
121
+ }
@@ -1,13 +1,14 @@
1
+ $LOAD_PATH << File.dirname(__FILE__) + "/../lib"
1
2
  require 'toji'
2
3
  require_relative 'example_core'
3
4
  require 'terminal-table'
4
5
 
5
- moto = Example::Brew::Moto.load_yaml_file(File.dirname(__FILE__)+"/moto.yaml")
6
+ moto = Example::Progress::MotoProgress.load_yaml_file(File.dirname(__FILE__)+"/moto_progress.yaml")
6
7
 
7
8
  table = Terminal::Table.new do |t|
8
9
  t << ["作業", "日数", "品温(度)", "ボーメ", "酸度", "経過時間", "日時"]
9
10
  t << :separator
10
- moto.wrapped_states.each {|s|
11
+ moto.states.each {|s|
11
12
  temp = s.temps.map(&:to_s).join(" / ")
12
13
  t << [s.mark, s.day_label, temp, s.baume, s.acid, s.elapsed_time, s.display_time]
13
14
  }
@@ -1,76 +1,75 @@
1
1
  date_line: 0
2
2
  states:
3
3
  - time: 2019-01-16
4
- elapsed_time: 0
5
4
  mark: 水麹
6
5
  temps: 12.0
7
6
  acid: 13.0
8
- - elapsed_time: 3600
7
+ - time: 2019-01-16 01:00
9
8
  mark: 仕込み
10
9
  temps: 20.0
11
10
  acid: 13.0
12
- - elapsed_time: 86400
11
+ - time: 2019-01-17
13
12
  mark: 打瀬
14
13
  temps: 14.0
15
14
  baume: 15.0
16
15
  acid: 13.0
17
- - elapsed_time: 172800
16
+ - time: 2019-01-18
18
17
  temps:
19
18
  - 8.0
20
19
  - 11.0
21
20
  baume: 16.0
22
21
  acid: 13.0
23
22
  warmings: 暖気
24
- - elapsed_time: 259200
23
+ - time: 2019-01-19
25
24
  temps:
26
25
  - 10.0
27
26
  - 13.0
28
27
  baume: 16.5
29
28
  acid: 13.5
30
29
  warmings: 暖気
31
- - elapsed_time: 345600
30
+ - time: 2019-01-20
32
31
  temps:
33
32
  - 12.0
34
33
  - 15.0
35
34
  baume: 17.0
36
35
  acid: 13.5
37
36
  warmings: 暖気
38
- - elapsed_time: 432000
37
+ - time: 2019-01-21
39
38
  temps: 14.0
40
39
  baume: 17.0
41
40
  acid: 14.0
42
41
  warmings: 行火
43
- - elapsed_time: 518400
42
+ - time: 2019-01-22
44
43
  temps: 20.0
45
44
  baume: 17.0
46
45
  acid: 14.5
47
46
  warmings: 行火
48
- - elapsed_time: 604800
47
+ - time: 2019-01-23
49
48
  temps: 20.0
50
49
  baume: 14.0
51
50
  acid: 15.5
52
- - elapsed_time: 691200
51
+ - time: 2019-01-24
53
52
  temps: 20.0
54
53
  baume: 12.0
55
54
  acid: 16.0
56
- - elapsed_time: 777600
55
+ - time: 2019-01-25
57
56
  mark: 分け
58
57
  temps: 20.0
59
58
  baume: 9.0
60
59
  acid: 16.0
61
- - elapsed_time: 864000
60
+ - time: 2019-01-26
62
61
  temps: 15.0
63
62
  baume: 8.0
64
63
  acid: 16.5
65
- - elapsed_time: 950400
64
+ - time: 2019-01-27
66
65
  temps: 12.0
67
66
  baume: 7.0
68
67
  acid: 17.0
69
- - elapsed_time: 1036800
68
+ - time: 2019-01-28
70
69
  temps: 10.0
71
70
  baume: 6.0
72
71
  acid: 17.5
73
- - elapsed_time: 1123200
72
+ - time: 2019-01-29
74
73
  temps: 9.0
75
74
  baume: 5.0
76
75
  acid: 17.5
@@ -1,34 +1,33 @@
1
+ $LOAD_PATH << File.dirname(__FILE__) + "/../lib"
1
2
  require 'toji'
2
3
  require_relative 'example_core'
3
4
  require 'terminal-table'
4
5
 
5
- recipe = Example::Recipe::TEMPLATES[:sokujo_nada].scale(900).round(2)
6
- step_names = recipe.steps.map(&:name)
6
+ recipe = Example::Recipe::TEMPLATES[:sokujo_nada].scale_rice_total(900).round(2)
7
+ step_names = ["酛", "添", "仲", "留", "四段"].slice(0, recipe.steps.length)
7
8
 
8
9
  table = Terminal::Table.new do |t|
9
10
  t << [""] + step_names
10
11
  t << :separator
11
12
  t << ["[原料]"]
12
- t << ["酵母(g or 本)"] + recipe.steps.map(&:yeast)
13
- t << ["乳酸(ml)"] + recipe.steps.map(&:lactic_acid)
14
- t << ["掛米(g)"] + recipe.steps.map(&:kake)
15
- t << ["麹米(g)"] + recipe.steps.map(&:koji)
16
- t << ["汲水(ml)"] + recipe.steps.map(&:water)
17
- t << ["醸造アルコール(ml)"] + recipe.steps.map(&:alcohol)
13
+ t << ["酵母(g or 本)"] + recipe.steps.map{|s| s.yeasts.map(&:weight).sum}
14
+ t << ["乳酸(ml)"] + recipe.steps.map{|s| s.lactic_acids.map(&:weight).sum}
15
+ t << ["掛米(g)"] + recipe.steps.map(&:kake_total)
16
+ t << ["麹米(g)"] + recipe.steps.map(&:koji_total)
17
+ t << ["汲水(ml)"] + recipe.steps.map(&:water_total)
18
+ t << ["醸造アルコール(ml)"] + recipe.steps.map{|s| s.alcohols.map(&:weight).sum}
18
19
  t << :separator
19
20
  t << ["[合計]"]
20
21
  t << ["総米(g)"] + recipe.steps.map(&:rice_total)
21
- t << ["麹歩合(%)"] + recipe.steps.map{|s| s.koji_rate * 100}.map{|v| v&.round(2)}
22
- t << ["汲水歩合(%)"] + recipe.steps.map{|s| s.water_rate * 100}.map{|v| v&.round(2)}
22
+ t << ["麹歩合(%)"] + recipe.steps.map{|s| s.koji_ratio * 100}.map{|v| v&.round(2)}
23
+ t << ["汲水歩合(%)"] + recipe.steps.map{|s| s.water_ratio * 100}.map{|v| v&.round(2)}
23
24
  t << :separator
24
25
  t << ["[累計]"]
25
26
  t << ["総米(g)"] + recipe.cumulative_rice_totals
26
- t << ["白米比率"] + recipe.rice_rates.map{|v| v&.round(2)}
27
- t << ["酒母歩合(%)"] + recipe.cumulative_moto_rates.map{|s| s * 100}.map{|v| v&.round(2)}
27
+ t << ["白米比率"] + recipe.rice_ratios.map{|v| v&.round(2)}
28
+ t << ["酒母歩合(%)"] + recipe.cumulative_moto_ratios.map{|s| s * 100}.map{|v| v&.round(2)}
28
29
  t << ["タンク内容量(ml)"] + recipe.steps.map {|s|
29
- kake = Toji::Ingredient::Kake::Expected.create(s.kake)
30
- koji = Toji::Ingredient::Koji::Expected.create(s.koji)
31
- s.yeast.to_f + s.lactic_acid.to_f + kake.steamed.to_f + koji.dekoji.to_f + s.water.to_f + s.alcohol.to_f
30
+ s.yeasts.map(&:weight).sum + s.lactic_acids.map(&:weight).sum + s.kakes.map(&:steamed).sum + s.kojis.map(&:dekoji).sum + s.waters.map(&:weight).sum + s.alcohols.map(&:weight).sum
32
31
  }.then {|a|
33
32
  sum = 0.0
34
33
  a.map {|x| sum += x}
@@ -40,43 +39,56 @@ puts
40
39
 
41
40
  puts "掛米"
42
41
  table = Terminal::Table.new do |t|
43
- kakes = recipe.steps.map {|step|
44
- Toji::Ingredient::Kake::Expected.create(step.kake)
42
+ kakes = recipe.steps.map.with_index {|step,i|
43
+ [i, step.kakes[0]]
44
+ }.select {|a|
45
+ a[1]
45
46
  }
47
+ indexes = kakes.map(&:first)
48
+ kakes = kakes.map(&:last)
46
49
 
47
- t << ["工程", "原料"] + step_names
50
+ t << ["工程", "状態"] + indexes.map{|i| step_names[i]}
48
51
  t << :separator
49
- t << ["洗米・浸漬", "白米(g)"] + kakes.map(&:raw).map{|v| v&.round(2)}
50
- t << ["", "吸水増加量(ml)"] + kakes.map(&:soaking_water).map{|v| v&.round(2)}
52
+ t << ["", "白米(g)"] + kakes.map(&:weight).map{|v| v&.round(2)}
51
53
  t << :separator
52
- t << ["水切り", "浸漬米(g)"] + kakes.map(&:soaked).map{|v| v&.round(2)}
53
- t << ["", "汲水(ml)"] + kakes.map(&:steaming_water).map{|v| v&.round(2)}
54
+ t << ["洗米・浸漬", "浸漬米(g)"] + kakes.map(&:soaked).map{|v| v&.round(2)}
55
+ t << ["", "浸漬米吸水率"] + kakes.map(&:soaking_ratio).map{|v| v&.round(2)}
54
56
  t << :separator
55
57
  t << ["蒸し", "蒸米(g)"] + kakes.map(&:steamed).map{|v| v&.round(2)}
58
+ t << ["", "蒸米吸水率"] + kakes.map(&:steaming_ratio).map{|v| v&.round(2)}
59
+ t << :separator
60
+ t << ["放冷", "蒸米(g)"] + kakes.map(&:cooled).map{|v| v&.round(2)}
61
+ t << ["", "蒸米吸水率"] + kakes.map(&:cooling_ratio).map{|v| v&.round(2)}
56
62
  end
57
63
  puts table
58
64
  puts
59
65
 
60
66
  puts "麹"
61
67
  table = Terminal::Table.new do |t|
62
- kojis = recipe.steps.map {|step|
63
- Toji::Ingredient::Koji::Expected.create(step.koji)
68
+ kojis = recipe.steps.map.with_index {|step,i|
69
+ [i, step.kojis[0]]
70
+ }.select {|a|
71
+ a[1]
64
72
  }
73
+ indexes = kojis.map(&:first)
74
+ kojis = kojis.map(&:last)
65
75
 
66
- t << ["工程", "原料"] + step_names
76
+ t << ["工程", "状態"] + indexes.map{|i| step_names[i]}
67
77
  t << :separator
68
- t << ["洗米・浸漬", "白米(g)"] + kojis.map(&:raw).map{|v| v&.round(2)}
69
- t << ["", "吸水増加量(ml)"] + kojis.map(&:soaking_water).map{|v| v&.round(2)}
78
+ t << ["", "白米(g)"] + kojis.map(&:weight).map{|v| v&.round(2)}
70
79
  t << :separator
71
- t << ["水切り", "浸漬米(g)"] + kojis.map(&:soaked).map{|v| v&.round(2)}
72
- t << ["", "汲水(ml)"] + kojis.map(&:steaming_water).map{|v| v&.round(2)}
80
+ t << ["洗米・浸漬", "浸漬米(g)"] + kojis.map(&:soaked).map{|v| v&.round(2)}
81
+ t << ["", "浸漬米吸水率"] + kojis.map(&:soaking_ratio).map{|v| v&.round(2)}
73
82
  t << :separator
74
83
  t << ["蒸し", "蒸米(g)"] + kojis.map(&:steamed).map{|v| v&.round(2)}
84
+ t << ["", "蒸米吸水率"] + kojis.map(&:steaming_ratio).map{|v| v&.round(2)}
75
85
  t << :separator
76
- t << ["放冷・引込み", "蒸米(g)"] + kojis.map(&:cooled).map{|v| v&.round(2)}
77
- t << ["", "種麹(g)"] + kojis.map(&:tanekoji).map{|v| v&.round(2)}
86
+ t << ["放冷・引き込み", "蒸米(g)"] + kojis.map(&:cooled).map{|v| v&.round(2)}
87
+ t << ["", "蒸米吸水率"] + kojis.map(&:cooling_ratio).map{|v| v&.round(2)}
88
+ t << ["", "種麹(g)"] + kojis.map{|k| k.tanekojis.map(&:weight).sum}.map{|v| v&.round(2)}
78
89
  t << :separator
79
- t << ["製麹", "麹(g)"] + kojis.map(&:dekoji).map{|v| v&.round(2)}
90
+ t << ["出麹", "麹(g)"] + kojis.map(&:dekoji).map{|v| v&.round(2)}
91
+ t << ["", "出麹歩合"] + kojis.map(&:dekoji_ratio).map{|v| v&.round(2)}
80
92
  end
81
93
  puts table
82
94
  puts
@@ -4,10 +4,12 @@ require 'yaml'
4
4
 
5
5
  require 'toji/ingredient'
6
6
  require 'toji/recipe'
7
- require 'toji/brew'
7
+ require 'toji/progress'
8
8
  require 'toji/calendar'
9
- require 'toji/event'
9
+ require 'toji/schedule'
10
10
  require 'toji/product'
11
+ require 'toji/processing'
12
+ require 'toji/utils'
11
13
 
12
14
  module Toji
13
15
  class Error < StandardError; end
@@ -16,26 +16,26 @@ module Toji
16
16
  alias_method :add, :<<
17
17
 
18
18
  def date_rows
19
- events = @products.map{|product| product.rice_events}.flatten
19
+ schedules = @products.map{|product| product.rice_schedules}.flatten
20
20
 
21
21
  result = {}
22
- events.each {|event|
23
- result[event.date] ||= DateRow.new(event.date)
24
- result[event.date] << event
22
+ schedules.each {|schedule|
23
+ result[schedule.date] ||= DateRow.new(schedule.date)
24
+ result[schedule.date] << schedule
25
25
  }
26
26
 
27
27
  result
28
28
  end
29
29
 
30
30
  def table_data
31
- koji_events = @products.map{|product| product.koji_events}.flatten
32
- kake_events = @products.map{|product| product.kake_events}.flatten
33
- events = koji_events + kake_events
34
-
35
- koji_len = koji_events.map(&:group_index).max + 1
36
- kake_len = kake_events.map(&:group_index).max + 1
37
- min_date = events.map(&:date).min
38
- max_date = events.map(&:date).max
31
+ koji_schedules = @products.map{|product| product.koji_schedules}.flatten
32
+ kake_schedules = @products.map{|product| product.kake_schedules}.flatten
33
+ schedules = koji_schedules + kake_schedules
34
+
35
+ koji_len = koji_schedules.map{|schedule| schedule.step_indexes.first[:index]}.max + 1
36
+ kake_len = kake_schedules.map{|schedule| schedule.step_indexes.first[:index]}.max + 1
37
+ min_date = schedules.map(&:date).min
38
+ max_date = schedules.map(&:date).max
39
39
 
40
40
  headers = [:date]
41
41
 
@@ -1,22 +1,22 @@
1
1
  module Toji
2
2
  class Calendar
3
3
  class DateColumn
4
- attr_reader :rice_events
4
+ attr_reader :rice_schedules
5
5
 
6
6
  def initialize
7
- @rice_events = []
7
+ @rice_schedules = []
8
8
  end
9
9
 
10
- def <<(event)
11
- @rice_events << event
10
+ def <<(schedule)
11
+ @rice_schedules << schedule
12
12
  end
13
13
  alias_method :add, :<<
14
14
 
15
15
  def text
16
- @rice_events.map {|ev|
17
- name = ev.product.name
18
- raw = "%.17g" % ev.raw
19
- "#{name}: #{raw}"
16
+ @rice_schedules.map {|schedule|
17
+ name = schedule.product.name
18
+ weight = "%.17g" % schedule.expect.weight
19
+ "#{name}: #{weight}"
20
20
  }.join("<br>")
21
21
  end
22
22
  end