Page 1 of 1

[0.18.32] Multi-fluid train systems are now much harder

Posted: Wed Jun 17, 2020 2:42 am
by alercah
It is now considerably more difficult to have train systems that:
  1. Have more than one fluid unloaded (at different times) from the same station (and at the same position on the train).
  2. As 1, but (try to) reuse a wagon with multiple different fluids.
Full explanation here.

My suggestion for the primary fix is here.

Re: [0.18.32] Multi-fluid train systems are now much harder

Posted: Wed Jun 17, 2020 4:46 am
by boskid
And what is the bug here?

Re: [0.18.32] Multi-fluid train systems are now much harder

Posted: Wed Jun 17, 2020 5:09 am
by Nosferatu
As I understood it: The circuit network shows a train as empty when it is not which leaves you with a nearly empty train if you use circuit controlled pumps which makes the train unusable for future use.

Most relevant for Ltn mod users

Possible solutions I see:
- Allow filter pumps
- Change rounding behavior on fluids in circuit networks
- Autoflush nearly empty train wagons when a pump trys to pump in something different

Re: [0.18.32] Multi-fluid train systems are now much harder

Posted: Wed Jun 17, 2020 5:25 am
by Rseding91
Unless one of the other developers wants to change circuit networks I'm saying nothing here is broken.

Just don't use multi-fluid trains.

Re: [0.18.32] Multi-fluid train systems are now much harder

Posted: Wed Jun 17, 2020 5:31 am
by alercah
I can try to get a save set up tomorrow maybe, but here is an example of how to reproduce the regression, which I consider to be a bug:
  1. Make a train station. Put a train with a single fluid wagon at that station.
  2. Place a pump at that station, pumping front the wagon to a storage tank. Connect this storage tank to one input of an oil refinery set on advanced refining.
  3. Place a second pump at the station, connected to a second storage tank and in turn to the other input. Make sure the pump is lined up with a different nozzle on the wagon so that it won't compete with the other pump.
  4. Fill the train up with water and send it to the station.
  5. Then fill it up with crude oil and send it to the station again.
Expected (pre-0.18.32) behaviour:

At step 4, only the pump connected to the water input engages and connects to the wagon. The pump connected to the crude oil input does not. The pump empties the wagon of water.
At step 5, the reverse happens. The crude oil pump engages, and the pump drains the crude oil. The refinery proceeds to process the crude and water.

Actual behaviour:

At step 4, both pumps engage. They drain the wagon of water. Now you have your crude oil pipes filled with water.

Just to be clear, this isn't esoteric behaviour by any means. I did this in my first complete playthrough.

The attempted workaround, which is why people are complaining about the rounding, is to connect the pumps to the train station via the circuit network, and have the water pump only activate when water > 0, and the crude pump only activate when crude > 0.

Actual behaviour with workaround:

At step 4, the pump drains the wagon of crude until there is less than one unit remaining, at which point the circuit condition fails and the pump disengages.
You can't even do step 5 because the wagon still has water left in it and won't fill with crude oil.

There's a second workaround, which is to also add a timed latch to delay the disengagement by a few ticks. I haven't heard of anyone trying this, but I imagine it would be like this.

Hypothetical behaviour with second workaround:
Everything works fine until you get unlucky and your fluid system fills up to the point where the pump can't pump any more, and also has less than one unit left. The circuit condition fails and the pump, being backed up, doesn't drain the last drop before the latch closes and it disengages. Now your factory stops and you will have an exciting time trying to figure out why. Also, you now need to use combinators.

Re: [0.18.32] Multi-fluid train systems are now much harder

Posted: Wed Jun 17, 2020 5:35 am
by alercah
Rseding91 wrote: Wed Jun 17, 2020 5:25 am Unless one of the other developers wants to change circuit networks I'm saying nothing here is broken.

Just don't use multi-fluid trains.
This breaks setups that have worked since 0.17. And while I think multi-fluid trains are a bit beyond the beaten path for vanilla play (mostly being used in LTN-type networks, whether modded or not), multi-fluid stations are something completely natural for a space-conscious vanilla player to develop, and are also broken by this.

Edit: I see now that you were replying to Nosferatu. Nosferatu mischaracterized the actual bug I'm reporting in this thread: the regression on multi-fluid stations. The rounding issue, which has its own thread, is only cropping up now because it featured in the obvious but broken workaround when multi-fluid stations are being used. I do think that the rounding behaviour is broken, but unlike this issue, it is not a regression.

Re: [0.18.32] Multi-fluid train systems are now much harder

Posted: Wed Jun 17, 2020 5:02 pm
by warlordship
Since fluid systems are reserved according to the connections on machines they are connected to, I'd be very interested to see pumps only connect to a fluid wagon if the system it pumps into matches the fluid in the wagon. Then you could hook up 6 pumps to one side of a wagon, for 6 fluids (water, oil, acid, heavy, light, gas). This could make a sort of fluid sorting station.

Re: [0.18.32] Multi-fluid train systems are now much harder

Posted: Wed Jun 17, 2020 7:14 pm
by alercah
That is exactly how it used to work.

Re: [0.18.32] Multi-fluid train systems are now much harder

Posted: Fri Jun 19, 2020 11:27 pm
by alercah
Apologies for the delay on this. In the attached save, you can see my mixed unloading setup from an actual game I completed back in the 0.17.X releases. I updated the save to 0.18.31 in order to move the character into place and have pumps that drain the heavy oil and petroleum pipes next to the bays completely so as to properly demonstrate the bug.

The rightmost two stations near where the character is when you load are for unloading refining products. The middle and back bays are set up to allow for unloading of either petroleum or light/heavy oil depending on the content of the fluid wagon. This continues to work totally fine in 0.18.31. Depending on the content of the wagon, the correct pumps engage and drain it.

In 0.18.32, however, this is not the case. Now, when you load the save, the pipes, due to being empty up until the second pumps, there is no guarantee that the correct set of pumps engages. When I tried it with the attached save, heavy oil and light oil end up mixed in the same pipe system as petroleum, and in fact the second train to arrive isn't able to unload petroleum at all from the bottom car.

This is the regression from 0.18.0 and 0.18.31.

Re: [0.18.32] Multi-fluid train systems are now much harder

Posted: Sat Jun 20, 2020 12:06 am
by Rseding91
alercah wrote: Fri Jun 19, 2020 11:27 pm This is the regression from 0.18.0 and 0.18.31.
Yes, it's intended. Multi-fluid loading/unloading with the same fluid wagon was never an intended mechanic and just happened to work due to the old fluid mixing code. That code is gone and so is the ability to do what you're trying to do.

Re: [0.18.32] Multi-fluid train systems are now much harder

Posted: Sat Jun 20, 2020 12:10 am
by alercah
Thanks for the reply. That's unfortunate. I'm going to write up a post on why I think the 0.18.32 system sucks but I'll put it elsewhere.