"""Illustrative, not plant data. Percent moisture on wet basis.""" from math import isclose import json barley_wet=500 barley_dry=barley_wet*(1-.12) steep_dry=barley_dry*.01 respiration_dry=barley_dry*.04 rootlets_dry=barley_dry*.03 green_dry=barley_dry-steep_dry-respiration_dry green=green_dry/(1-.45) dried_unclean=green_dry/(1-.045) rootlets_wet=rootlets_dry/(1-.045) ship=(green_dry-rootlets_dry)/(1-.045) assert isclose(barley_dry,ship*.955+steep_dry+respiration_dry+rootlets_dry) assert isclose(green-ship,green-dried_unclean+rootlets_wet) def schedule(g,k,s,cycles=18): # Constant feasible interval; production times include release/preparation. t=max(g/ k,s) return dict(interval_h=t,germ_modules=k,kiln_h=s,starts=[i*t for i in range(cycles)],nominal_batches_per_day=24/t,nominal_t_330_days=330*24/t*ship/1000) scenarios=[schedule(96,3,30),schedule(96,4,30),schedule(96,4,24)] assert [d['interval_h'] for d in scenarios]==[32,30,24] for s in scenarios: s['effective_t_330_days_at_95pct_pass']=s['nominal_t_330_days']*.95 s['unit_cost_rub_per_t']=[f/s['effective_t_330_days_at_95pct_pass']+38000 for f in (1500000,1650000,1950000)] result=dict(barley_dry=barley_dry,steep_dry=steep_dry,respiration_dry=respiration_dry,rootlets_dry=rootlets_dry,green_dry=green_dry,green=green,dried_unclean=dried_unclean,rootlets_wet=rootlets_wet,ship=ship,kiln_water=green-dried_unclean,fraction_wet_yield=ship/barley_wet,scenarios=scenarios) print(json.dumps(result,indent=2))