config: seed plant params from Pot.water_mass at server startup
Sud._parse_data now falls through to pot_config for all hardware keys (mass, material, L, Td) — EMPTY_SUD no longer shadows them. brewpi.py seeds pot/tc plant params from Pot.water_mass on startup so the simulated plant is configured before any sud is loaded. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+4
-17
@@ -61,19 +61,6 @@ EMPTY_SUD = {
|
||||
'Name': '',
|
||||
'Description': '',
|
||||
'pot': {
|
||||
'mass': 0,
|
||||
'material': None,
|
||||
# Pot energy loss coefficient [W/(kg*K)] and transport propagation
|
||||
# delay [s] - see derive_plant_params(). Defaults match the generic
|
||||
# values brewpi.py used to hardcode for every brew alike.
|
||||
'L': 0.2,
|
||||
'Td': 30,
|
||||
# Initial grain_mass/water_mass - what's actually in the pot before
|
||||
# the brew starts (e.g. water added but no malt yet), as opposed to
|
||||
# default.step's pot.grain_mass/pot.water_mass, which is just inert
|
||||
# template filler for steps that don't override it. Lets a caller
|
||||
# derive starting plant params directly (see SudTask.recv()'s Load
|
||||
# handler) without having to parse the first step out of the schedule.
|
||||
'grain_mass': 0,
|
||||
'water_mass': 0,
|
||||
},
|
||||
@@ -123,10 +110,10 @@ class Sud(AttributeChange):
|
||||
pot_data = data.get('pot', {})
|
||||
pot_mass = pot_data.get('mass', pot_config.get('mass', 0))
|
||||
pot_material = pot_data.get('material', pot_config.get('material'))
|
||||
L = pot_data.get('L', pot_config.get('L', EMPTY_SUD['pot']['L']))
|
||||
Td = pot_data.get('Td', pot_config.get('Td', EMPTY_SUD['pot']['Td']))
|
||||
grain_mass = pot_data.get('grain_mass', EMPTY_SUD['pot']['grain_mass'])
|
||||
water_mass = pot_data.get('water_mass', EMPTY_SUD['pot']['water_mass'])
|
||||
L = pot_data.get('L', pot_config.get('L', 0.2))
|
||||
Td = pot_data.get('Td', pot_config.get('Td', 30))
|
||||
grain_mass = pot_data.get('grain_mass', 0)
|
||||
water_mass = pot_data.get('water_mass', 0)
|
||||
|
||||
return name, description, schedule, pot_mass, pot_material, L, Td, grain_mass, water_mass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user