Jump to content

ElementConsumer does not respect capacityKG storage limitations


rezecib
  • Branch: Live Branch Fixed

ElementConsumer has a capacityKG member that is intended to limit how much of the storage it uses to consume elements. However, this member is never read, so the storage capacity itself can be exceeded by the ElementConsumer.

This comes into play with CO2 scrubbers, which use the default storage capacity of 2000 kg, but have an ElementConsumer for CO2 with capacityKG set to 5kg. Because it never limits its CO2 intake, once it has stored more than 2000 kg of CO2, the ConduitConsumer component respects the storage limitation and stops taking in water, which prevents the scrubber's ElementConverter from converting.

I believe this could be at least approximately fixed in the AddMassInternal method by checking for the current amount of storage used by the consumed element after calling storage.AddLiquid or storage.AddGas; if storage is met or exceeded, EnableConsumption(false) could be called.

There is also a separate bug that contributes to this where the scrubber randomly performs at 2/3rds efficiency periodically for no discernible reason, but I'm still investigating why that occurs.

I've attached my save file, which contains two scrubbers, one of which has already exceeded capacity (currently at 3041.5 kg), and the other of which is relatively close (1666.4 kg).


Steps to Reproduce
Make a CO2 Scrubber (I made one in an enclosed room with an atmo switch limiting it to running when pressure was above 1000g) Pump CO2 into the room via gas vent Let it run for a long time Observe stored CO2 endlessly accumulating Observe conversion cease once stored CO2 exceeds 2000kg



User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.

Need to subscribe to OnStorageChanged, and call OnActiveChanged from there. In OnActiveChanged perform the storage checks in addition to the operational checks. This prevents one or the other from switching it on and off when it shouldn't.

The 2/3rds efficiency comes from the water being satisfied but not the CO2 so the water scales back and uses what little CO2 it has.

Share this comment


Link to comment
Share on other sites

1 minute ago, Risu said:

The 2/3rds efficiency comes from the water being satisfied but not the CO2 so the water scales back and uses what little CO2 it has.

How would the CO2 not be satisfied when it has kgs of storage of each?

Share this comment


Link to comment
Share on other sites

1 minute ago, rezecib said:

How would the CO2 not be satisfied when it has kgs of storage of each?

The scrubber is actually one of the few element converters who never wait for enough mass to turn on. As it is always running it's constantly trying to convert what it can, so every time either water or CO2 is below the required amount it scales back the conversion to match the lowest amount available.
 

Share this comment


Link to comment
Share on other sites

6 minutes ago, Risu said:

The scrubber is actually one of the few element converters who never wait for enough mass to turn on. As it is always running it's constantly trying to convert what it can, so every time either water or CO2 is below the required amount it scales back the conversion to match the lowest amount available.

But I'm observing the 200 g/s conversion rate even when it has 20kg water and 1000+ kg of CO2. There is a real bug there, not just a confusing display.

In fact, the only reason why the storage of CO2 cascades out of control is because it keeps dropping to 200g/s periodically.

See (the area around the scrubber is also over pressure with CO2 while this is occurring):

ScrubberInefficiency.png

Edited by rezecib

Share this comment


Link to comment
Share on other sites

9 minutes ago, rezecib said:

But I'm observing the 200 g/s conversion rate even when it has 20kg water and 1000+ kg of CO2. There is a real bug there, not just a confusing display.

In fact, the only reason why the storage of CO2 cascade out of control is because it keeps dropping to 200g/s periodically.

Been watching the scrubbers in your save and I'm seeing the 2/3 thing occasionally but never the 666.67 polluted water that would indicate that the conversion scaled back, so something is causing the scrubber to go nonoperational for a tick to screw up the rolling average on the production counter. Might be the power grid actually.
 

Share this comment


Link to comment
Share on other sites

2 minutes ago, Risu said:

Might be the power grid actually.

At the time it is using 200 g/s, the power consumption of that subsystem is only 480W or 720W (depending on whether both pumps are running), with 800W generated. That particular subsystem is basically never strained and always has a full battery.

Edited by rezecib

Share this comment


Link to comment
Share on other sites

52 minutes ago, rezecib said:

At the time it is using 200 g/s, the power consumption of that subsystem is only 480W or 720W (depending on whether both pumps are running), with 800W generated. That particular subsystem is basically never strained and always has a full battery.

I increased the time scale from 3 seconds to 10 seconds and I think I may have an idea what it's doing.

20170619033123_1.jpg

It's likely discarding the game tick that the time window is reset.

Edit: Here's how it usually looks at 60 seconds.

20170619033915_1.jpg

Wonder if it's actually lag causing it to skip game ticks? Either way not seeing anything wrong with the scrubber itself there.

Edit 2: Watched it at slow speed for a few minutes and it stayed at this the whole time.

20170619040649_1.jpg
 

Edited by Risu

Share this comment


Link to comment
Share on other sites

9 hours ago, Risu said:

Either way not seeing anything wrong with the scrubber itself there.

It isn't just misreporting the usage, if you watch the storage it spikes when it dips into 200 g/s periods. Also, if it were actually consuming at 300g/s for both of them, then there would be no way for the storage to increase; the 7 natural gas generators can only produce 577.5 g/s of CO2, so they should be burning through their storage at a shared rate of 22.5 g/s.

I tried at all the normal game speeds and all of them ended up dipping into low-activity periods.

Share this comment


Link to comment
Share on other sites

The element consumer ticks every 0.25 seconds from the simulator. The converter ticks every 1 second from its own timer.
These timers do not line up directly. The scheduler may in fact be losing game ticks from lag.
The simulator timer can't go out of sync because the game depends on it.

So it can build up CO2 faster than it can convert.
 

Edited by Risu

Share this comment


Link to comment
Share on other sites

@Risu So that could be a bug with SchedulePeriodic in general?

I think I misinterpreted you when you said " not seeing anything wrong with the scrubber itself "-- I thought you meant that it was working properly and just skipping a tick in terms of accumulating numbers for display, but I guess you meant that nothing external is interfering with its function.

Share this comment


Link to comment
Share on other sites

Right. The scrubber is doing what it is suppose to with the components it was given. The components are just at fault.
I think the scheduler should be getting its updates from the simulator timer, not the unity engine like it is doing now.
This is not the right time for real time timers. :D

 

  • Like 1

Share this comment


Link to comment
Share on other sites

I'd imagine then, this can effect other buildings, like the Algae Terrarium as well?  When you drip water on it, as opposed to having Dupes feed it water?  If you over drip them, then they'd soak up more and more water the higher the lag gets?

Share this comment


Link to comment
Share on other sites

Came to report this same issue with scrubbers stopping conversion. I have the same setup as described by OP, enclosed room etc. One scrubber had 16,000 Kg of CO2 stored. Stops outputting polluted water or taking in water, keeps eating CO2.

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...