Railcraft

Railcraft

34M Downloads

Boiler math question

Ruhrpottpatriot opened this issue · 8 comments

commented

Some small question about boiler math. I already read the following documents, but some questions remain.

a) What's the maximum temperature of a steam locomotive? I guess it's 500 like low pressure and hobbyist, but I'm not too sure. Writing that down in the wiki would be nice.
b) I calculated fuel cost as described in the links above, but I'm not to sure how that translates into how much fuel's actually used. I guess I have to divide the calculated cost through the HU value of the fuel and the result is the number of ticks (rounded up or down?) one unit of the fuel lasts, is that correct?
Example: a size 36 high pressure boiler at 1000°C uses 3686.40 If I fill the fire box with ethanol, which has a heat value of 16k, one unit of Ethanol lasts 4.34 ticks. Correct?

commented

The boiler calc should be current. You'd have to ask @Forecaster for more details.

The rest you'd probably need to poke at the code:
https://github.com/CovertJaguar/Railcraft/blob/mc-1.10.2/src/main/java/mods/railcraft/common/util/steam/SteamBoiler.java

commented

@Ruhrpottpatriot You're going to have to be more specific than "not working" if you want help. As for the change I'm pretty sure I implemented it long ago.

Oh. And my calculator has that feature. It's conveniently called "Time Simulation".

commented
commented

Thanks for answering the questions. However, there's a problem with the calculator you linked. The math in that calculator only goes up to 8.3. If I read https://dl.dropboxusercontent.com/u/38558957/Minecraft/Railcraft/boiler_changes.txt correctly, there was a change in 8.3.2. Also, the calculator isn't working for me neither in FF nor in Chrome.

Also: I'm currently writing my own calculator for steam boilers with some features your linked calculator does not have (or at least I plan to do that once I get the foundation done). The feature I needed that question answered for calculates me the amount of fuel I need for a given time t.
The math linked in the dropbox document only gives me the equation how much fuel the boiler uses, not how much fuel of a given type I need.

commented

@Forecaster I added a issue in the calculator page Forecaster/RailcraftCalculatorFuel#1
I was slightly confused, since the calculator page give 8.3.0.0, but the fuel calculations were updated in 8.3.2.0 so I thought you hadn't updated it.

And yes, your calculator can do a time simulation, however that's not enough for me. I started that project as a way to refresh my Haskell skills, but it grew into something more. I mainly need it as an offline calculator, since most of the time I play minecraft I have no internet.

It seems I missed that time simulation mode at first glance, but I need that function as a basis for some other calculations. After I've implemented heatup and cooldown I plan to implement a feature which tells you how much steam engines a boiler can supply. Then I plan to add a comparison feature which takes a fuel amount per tick and compares it against the fuel usage per tick and then spits out a report.

@CovertJaguar Thanks for the link, I'll look into it.

commented

When the boiler has too little fuel in it's buffer it consumes another item to refill it.

Yes, but if I understood the boiler math correctly a boiler of size x uses n amount of fuel units per tick. This is the second equation in the last link in of my initial post multiplied by the size. A unit of fuel f then has a heat value from which n is subtracted and compared against zero.
Example: Let's look at a size 36 high pressure boiler at max temp with ethanol as fuel.
By the math the boiler uses 8-36*8*1/80+4/5*1000+4*1000/1000*36*1*x where x is the fuelPerSteamMultiplier, from the railcraft config. Let's set it to 1 for simplicity.
The boiler then uses 4742/5 or 948.4 units of fuel per cycle. One heavy boiler cycle is eight ticks long. This means our boiler uses (4742/5)/8 =2371/20 = 118.55 fuel units per tick.
From that result I then can calculate how much fuel my system gets per tick. If the fuel usage is less than fuel production I'm all good, if it's less I need to tweak my production.
I use ticks, because that's what the engine uses. Going by seconds can only be an estimate, since sometimes the engine skips ticks to keep up.
That's what I meant with "compare the fuel amount per tick against usage per tick"

"Fuel amount per tick" is not a thing items have.

Mathematically speaking, yes. A boiler uses n amount of fuel per cycle, which is calculated by the getFuelPerCycle function. The tick function then takes that value and subtracts it from the HU value of a given fuel. If the result is less than zero the fuel amount in the boiler is reduced by one and we start at the beginning.
The value a boiler substracts is the fuel amount per tick. Maybe the wording was bad. fuel used per tick is probably better. Then again my code looks like this, so bad wording is to be expected:

fuelPerTank ::  Float -> Float -> Float
fuelPerTank t m = f + h * (t / m) + p * (m / 1000)

Which I now see is wrong. It's the math at the beginning of this document, but the java code below is something different altogether. Need to fix that.

That said. Everything I said only holds true, if I understood the math correctly. That's why I asked. I can't just take the java code and drop it into Haskell. The language simply won't allow that.

The trickiest part of all of this is the heatup period, which is a curve, as opposed to a linear equation

One word: Integration

commented

@Ruhrpottpatriot The calculator does the engine thing too. This information is included in the MJ and RF energy reports.

As for your bug report (which you chose to put on the repo for the fuel list for some reason, instead of putting a comment on the calculator itself) the actual issue is that it can't find the localization value for the error and is instead displaying the key. I will investigate this.

Also I'm not sure what you mean by "compare the fuel amount per tick against usage per tick". "Fuel amount per tick" is not a thing items have. When the boiler has too little fuel in it's buffer it consumes another item to refill it. It's basically a question of "which item has the highest fuel value?" (It's probably the coal coke block), and that needs to be balanced against how easy the item is to produce. Which is why most people use charcoal, because in most modpacks you get a positive loop from that.

Basically the only thing of interest is "how much fuel does this item provide vs how much does the boiler need" which is what my calculator does.

The trickiest part of all of this is the heatup period, which is a curve, as opposed to a flat equation like what you use to calculate fuel use with a static heat value (ie when the boiler is fully heated). That is why my calculator takes a while to run, it's running a tick simulation similar to what the boiler does in-game, but not restricted to 20 ticks per second. This produces accurate time and fuel use values. The same is done for the cooldown phase, though the boiler cools down a lot faster than it heats up, and doesn't use any fuel of course, so this is purely for energy reports.

commented

You don't need to explain the math to me. I already made a working calculator. And yes, your wording was bad which is why I corrected you.

And I have no idea what you mean by integration. And I don't care.

I'm going to close this issue since it seems you have the information you wanted now.