I'd suggest limiting the demand to 50% of the input storage. With it set to 100%, I see long distance end consumers getting into oscillations of overflowing/running out/overflowing/... A number of factors contribute to cause this - supplier distance, production rates, size of input store, capacity of convois, etc., but limiting the size of the initial surge reduces the likely hood greatly. 75% would be fine too.
I am not understanding what you are asking. Currently demand is 100% of the desired consumption rate (which is based on actual work done). If storage overflows it gets reduced to 50% until it drops below the storage amount (this basically burns off excess in the line). Line length does not mater as a reliable flow of goods should arrive as fast as they are consumed. The only time oscillation will happen is if boosts are not reliable such as from power or passengers/mail as those may cause an increase/decrease in production such that the buffer amount cannot cope with the backlogged flow amount. However this adds difficulty to the game as now you also need to make sure boosts are reasonably stable (which they usually are if done properly). In worst case you are still looking at >50% production utilization.
If a 50% rate when overfull is a penalty for overflowing, then let's just set the penalty rate to 0%; Same as JITv1. Now, the need for the 'lost order' mechanic is gone, and intermediate factory inputs can work independently.
This 'lost order' creating a demand coupling between the inputs is the deal breaker with JITv2. Downstream factories end up starved despite there being sufficient supply available, and there's nothing the player can do about it; That's the deal breaker. With JITv1, the player is in control. It might require some micro-management to have the factories produce constantly, but it's possible. JITv2 - nope, the algorithm is in control. Again many factors involved, including the consumption rate of the end consumers. As you pointed out, as long as the end consumers use a high percentage of the intermediate factories output, things work ok. But have end consumers demand only 30% the output, and they end up at a mere 20% instead due to stalls caused by this coupling. A completely non-intuitive result.
The coupling is there to stop over-ordering a specific product. With your suggestion what will happen is it falls back to JIT1 problem where by it will go in bursts if you ever overflow. If 1 input is under-supplied then the other two will overflow (resulting in a collapse of the supply chain) which will take a while to empty (due to the one being under-supplied) resulting in it eventually falling below maximum storage (restarting supply) to run out of storage before the supply chain restarts so now you have your under supplied product in storage but are lacking the other two products to continue. During this time the under supplied product could overflow resulting in lost orders of the under supplied product.
The coupling will not cause stalls because it orders exactly what it needs. If a factory takes 1 coal and 3 iron ore to make a steel then it will order exactly 3 iron ore for every 1 coal. If one of them is under supplied (too few iron ore pits connected) then it will throttle back coal automatically so it is ordered at the rate which iron ore is. The industry will never stall because of a lack of coal since it will still receive coal shipments sufficiently (just slower to match the rate of iron ore). If this is not the case then there must be some error introduced by the fixed point mathematics (at most a few fractional units out). Some oscillation might occur initially as it will over-order until the correct production rate is reached.
A factory produces, or it does not. There is no working at 15%.
If this was the case things would be so much easier! Everything becomes simple pulse-width modulation behaviour of producing/idle and ordering/idle. However alas there is a production rate reduction applied to outputs. If an output has more than 11.9990234375 units then it will suffer from a diminishing production rate based upon current storage over maximum storage. This was not my idea (it has been in simutrans for ages) and even surprised me when applying the first implementation. I could easily remove this.
However it will not solve the spike loads on power networks issue. There is still a chance all industries connected may produce all at once causing an overload just to stop producing immediately after and the network being hardly used.
By production falling below 25%, I assume you mean output store above 75%... Cutting the boost is intentional here. If the factory is filling up, then it doesn't need to produce at the boosted rate, hence cutting power frees it up for another factory that can make better use of it.
No I literally mean production falling below 25% based on what I said above. Outputs suffer from diminishing production rate based on the current storage over the maximum storage. When it is 75% full it will only be producing at 25% unless the output storage maximum is less than 11.9990234375 units which is the cut-on for diminishing returns. It only makes sense that power follows this curve to some degree since otherwise at high output percentages you are paying up to 4 times the power for the same amount of production.
Again, removing this diminishing curve would fix some issues but still cause unmanageable spike loads on your power network followed by idle times. Smoothing it with the diminished rate will average power usage allowing networks to be more utilized while still providing reliable power.
The JITv1 logic is correct - the defined consumption ratios must be respected, and if the outputs are independent, then there should be two separate factories. However, IMO the second good should be produced at 50% as well, with the excess over output capacity discarded. i.e. The lowest output storage determines the base rate all the goods are produced at. I've seen cases where a factory is sufficiently supplied to produce enough to fully supply its consumers, yet it fails due to the 'waste' caused by producing at different rates. Really doesn't make any logical sense.
Both outputs are treated separately and produce at the given output percentages. Imagine a factory producing 100 units of production per month. With output A having a 100% multiplier and output B a 200% multiplier then it will produce at most 100 units of A and 200 units of B per month (it will make both in parallel). You cannot pull out 201 units per month of B even if you use 0 units of A because it still is limited to 200 units of B per month. Currently the raw material consumption was entirely based on the output with the most utilization so using 100 A and 200 B per month used the same raw materials as just 100 A or 200 B (equivalently 200 B or 100 A being discarded).
The change I propose is that the amount of raw material is based purely on the amount produced. The factory will still produce the same maximums of A and B however the only difference is that if one is not fully used the amount of raw materials consumed will decrease. You can still load the factory to 100% by maxing out both outputs and it will still consume 100% of maximum possible raw materials however unless you max out both A and B products it will consume less than 100% of maximum raw materials even if either A or B product is maxed.
Few factories in Simutrans produce multiple products from raw materials. This is aimed mostly at ones like the pak64 oil refinery which has a massive 300% crude oil consumption rate and a massive production of well over 6,000 units per month when well supplied (18,000 units of crude oil). Before running such a facility at maximum efficiency was very difficult as gasoline and plastic or printer ink and chemicals were hard to fully consume or distribute efficiently and 16,000 units of oil with a storage of only 600 odd was near impossible to keep constantly supplied. However with JIT2 flows one could easily max out gasoline or plastic and then supply it fully with crude oil. The result would be a huge amount of money even though half the products are being un-used. With this change such industries will use less raw materials unless both outputs are maxed out (so the 16,000 units of crude oil will be considerably less until you use chemicals fully as well). If such a mechanic is not intended then I suggest making separate plants for printer ink, chemicals etc.
Are 6 more bits needed? i.e. Are anomalies present due to using only 10? I expect some calculations may need to move from 32bit to 64 which should be avoided if possible. Last I checked, there were a couple places running close to the 32bit limit.
They were just being discarded anyway. Also the remainder is only using 10 bits of a 32 bit value. As such those extra 6 bits could go there with practically no overhead (maybe even less overhead as its fewer operations). The actual computation is already in 64 bits as a q26 (8 base production rate, 8 production factor and 10 delta time) which gives a theoretical production of 274877906943 million entire units of product per tick, which will overflow the 2097151 unit maximum storage easily. Adding the extra 6 bits of precision to the calculation should make very little difference to anything. Only possible thing against it is that it could possible slow the multiplication operation down slightly depending on how it is implemented in hardware (functional unit multipliers can have dynamic cycle run lengths based on the physical length of numbers involved) however I doubt that will make much of a difference seeing how it is already a simulated 64 bit operation.
I am guessing those 6 bits were probably lost before there was a remainder value or before it migrated to a 64bit intermediate.
At least for pak64, power is purposely short. If you want to not think, and have the game play itself, there's already settings to control this.
The problem with pak64 is that power has not been set up on several industries or is set to silly values. Coal mines consume almost the entire production of a coal power station and are not even boosted enough to supply the coal power station. Timber Plantations (forests basically) consume a load of power for not even getting a boost (clearly they are meant to consume no power like pak128). However pak64 having poor power balance is not an issue.
The issue I am talking about only occurs in very large networks where you have 20+ power stations connected together power 50+ industries. Currently at times you will be below 50% utilization of your power network while at other times you will be overloaded because at some stages industries stop production together or start production together. This is made worse by middle industries consuming up to 4 times the power for the same production. Since everything is becoming flow based it only makes sense to make power flow based. The result is that the utilization of your power network becomes steady based on the utilization of all industries.
That steel mill that is producing barely around the 25% cut-off for power mark due to flows currently consumes the same power as that steel mill that has constantly empty output storage producing at 100%. With variable power consumption that 25% used steel mill will now steadily use 25% of the power reducing its power consumption by 75% while keeping the power per product the same as the fully utilized factory.
Another example is that oil refinery that is barely used. Instead of consuming full power for long periods just to produce 10% output product and then stop consuming resulting in unreliable power consumption. Instead it will consume just around 10% of the power reliably.
Together the result should be a power network that has very few power fluctuations. Because power fluctuates less and is used more efficiently you will be able to reliably connect more industries to the same network. However since this is not necessarily a good thing from a game perspective (unlimited power) this is easily solved by making power more scarce and lowering the power fraction in the game settings.