This is actually wrong. Proc 3 modules make machines :
- have +10% productivity (so for 10 craft cycles, you get 1 crafts per prod3 module, 4 bonus crafts with 4)
- have -15% speed (so each craft cycle lasts 15% more for each prod3 module, 60% slower with 4 prod3)
For a recipe needing n seconds to be crafted in a given AM, with 4 prod 3s, you'll craft 1.4 recipe every cycle, but every cycle will take you n*(1+60%), which is 1.6n
in other words, you craft 1.4x the quantity in 1.6x the time.
I'm still trying to figure out some parts of your code I don't get yet, but there is a small error : I think you can't have drain + working consumption at the same time : If I'm not mistaken, drain only occurs when idle.