Stationeers

Stationeers

Not enough ratings
Multi-Gas Smelting in the Advanced Furnace
By TMarkos
Fuel alone works for most smelting, but pumping in gas at a preset temperature allows more control. Pumping in a dynamic mixture of gases at varying temperatures allows for extreme control. I am sharing some of my findings after making an automated system to handle this gas management process, in the hopes that it might be helpful to others.

In particular, I will cover some of the basic equations and relations necessary to set up a precise gas-based smelting control system. There are a lot of resources out there that describe the necessary information, but they're often quite technical or are written with a high degree of math and physics knowledge in mind; I will attempt to lay these out in the terms that helped me, a dummy, understand them effectively.
   
Award
Favorite
Favorited
Unfavorite
What is this guide?
This is not a step-by-step guide to setting up gas smelting. Instead, this is a collection of the useful pieces of information required to construct a maximally-efficient gas-driven smelter, to save on research, to provide some minimal guidance, and to serve as a basis for developing your own solution to an interesting problem.

For clarity, this is not a guide on how to develop a basic gas smelting setup. This is for people who want to calculate the precise mixture of gases that is needed to bring their furnace to a specific temperature and pressure, delivering it in the shortest amount of time with the least usage of source gas. In short, this is overkill. It is very, very functional once set up, however, and quite satisfying to watch in operation.

I will discuss the considerations for setup of your furnace and IC logic, provide an overview of the basic math governing gas mixing, give some examples of formulae and IC script that will be useful in constructing a gas mixer, then talk a bit about ancillary topics like fuel combustion and how it can complement a gas smelting setup.
Why bother with gas smelting?
Most things in Stationeers have a tradeoff between complexity and efficiency/control, and the furnace is no exception. It is simple enough to throw fuel in and strategically vent, supplement or neglect it until the contents are at the desired temperature and pressure. This takes time, however, and it is nice to have a more manageable process.

Fuel injection is one step down this path, but it comes with its own issues. First, while it is possible to calculate the total energy release from combustion of a set amount of fuel, the slow and incomplete combustion that results is not ideal for rapid, precise smelting. It is enough to get you close to a target, but often requires some fiddling to hit the precise temperature windows required by metals like hastelloy and electrum.

Gas smelting, by contrast, makes use of things you probably already have lying around - gases, usually at some semi-controlled temperature. On atmospheric planets the air can serve as a useful ingredient as well, particularly on Venus and Vulcan.
Gas Requirements
Depending on what your appetite is for complexity, you can set up a gas injection system a few different ways. The primary and most important gas required is a super-hot gas, one that is at some temperature above 1800K. That is hot enough to smelt anything in the game, including Stellite. For efficiency, hotter is better here.

It is easy enough to source a gas like this, as you can simply combust fuel in an insulated tank to get a large amount of gas at above 2000K with very little setup. The waste feed from an H2 Combustor is ideal for this purpose as well, once you've filtered out the water.

By itself, this will let you hit your temperature thresholds. However, some alloys require high pressure but relatively low temperature, like Waspaloy. Reaching these targets quickly is more easily done if you have a cold gas. Doesn't need to be super-cold, something at around 273-313K (0-40C) works fine. This allows you to hit those pressure targets easily.

There is no functional limit left, once these two gases are incorporated into your setup, but there is a use case for a third gas, which I will call the utility gas. Ideally this is something that is cheap and plentiful, like mid-temperature furnace waste, hot atmospheric gas from Vulcan/Venus, or anything else you have lying around that is above 373.15K (100C). Having this plentiful gas around lets you process your ore into the furnace, degas it and perform your setup work without tapping into your usually-more-limited stores of superhot and cool gas.

Which gases, though?
It really doesn't matter that much, save for two considerations. First, you will want to be mindful of oxidizer/volatile combinations. If you are smelting with the volatile-rich Vulcan atmosphere and choose oxygen as your cooling gas, you will find that it does not cool the furnace very effectively. Using a neutral gas like CO2, pollutant or nitrogen will allow nonreactive processing even of oxidizer-bearing ores like silver, lead and gold.

Second, when using gases for temperature control their specific heat is important. I will cover this in more detail in the following sections, but each gas has a quality (viewable on the Stationpedia!) that describes how much energy it takes to heat them up by one degree kelvin. A gas with a higher specific heat has a greater capacity to carry energy, and therefore makes for a better coolant or heating gas. Pollutant and CO2 are better, in this respect, while nitrogen, oxygen and volatiles are less effective.
Furnace Infrastructure
The furnace is a 1000L tank that has two turbo volume pumps (100L capacity) bolted onto it, one for intake and one for output. A practical consequence of this is that if you attach a pipe network onto the input and give it a volume of 100L (ten pipe segments) or below, the furnace will be able to completely empty out the contents of this pipe into its internal volume every tick, assuming the intake pump is set to maximum.

Where the input can only accept a single pipe, a ten-segment pipe can be shaped however you like and will happily hook into all your various gas inputs. Since the contents of the pipe empty every tick, this effectively lets you hook every input directly into the furnace, precisely controlling the contents it takes in each turn.
As an example...
This is how I have my 100L staging pipe set up. There are additional segments extending downward into the frame to ensure I have the proper volume. The four volume pumps are for volatiles, which also serves as my cold gas, oxygen, hot vulcan atmosphere (utility) and combustor waste (superhot). The furnace is directly connected to the black pipe through the wall to the right.

All piping and tanks used in your furnace construction must be insulated. Uninsulated pipes are only in the game to provide opportunities for players to blow themselves up in funny ways. Since this is a guide about precise temperature control, use insulated pipes.

Furnace insulation itself is a matter of personal choice; it is easy to make a furnace that will hold heat fairly well by injecting around 70mol of gas into a single sealed cell containing the furnace. Evacuating the atmosphere from the cell is simpler and works equally well to stop the furnace from cooking you, but it will experience some radiant heat loss. I personally find completely-insulated furnaces to be a bit cheesy and use vacuum, but it doesn't really matter for the purposes of this guide - a properly tuned system will maintain temperature regardless of your insulation or lack thereof.

Gas inputs
Use volume pumps. There is a use case for regulators, mixers and all the other stuff you can make for controlling gas flow, but in this particular case you want volume pumps.

The reason for this is an equation I'm going to reference very often: PV=nRT. This is the ideal gas equation, and is probably the most important piece of math in Stationeers. It states that Pressure (kPa) times Volume (L) is equal to Moles of gas (n) times the Ideal Gas Constant (R, 8.3144626 or rgas in IC10 script) times Temperature (K). This means that if you know the pressure and temperature of your input, you can plug those numbers into the equation to find out either how many moles of gas are in each liter of input, or to find out what setting to apply to the pump in order to intake a precise quantity of gas.

This means you will also need a pipe analyzer or a connection to the source gas tank on each input line.

O2 and volatiles lines should be unmixed gas, since the volume pumps can take care of any mixing. It affords additional capability that way, like the choice of using either as a cold gas to suit your needs.

Control
It is technically possible to do all this with logic kits, but that would be silly. I am going to talk about IC10-driven solutions to the problem of furnace management, and you will want at least one IC housing on the same network as your furnace, pumps and analyzers. It is also helpful to have a few LED screens so that you can precisely view the pressure and temperature of your furnace as it operates. I've also found that consoles using the graph display circuitboard are helpful in understanding the temperature and pressure changes of the furnace.

To allow a graph console to operate, you will need to continously write the required value to a logic memory chip, either via IC10 or a logic writer. Select the chip from the console and it will start up the graph.

Finally, it is a good idea to have some basic controls for the activation/deactivation of the furnace, including one that will tell your automation to stop what it's doing and vent the furnace.

IC10 Structure
Given the number of calculations and operations required, it is probably desirable to use multiple chips in the creation of your furnace logic. This presents a coordination problem, however, since multiple chips must be kept in sync with each other to avoid errors. There are many ways to resolve this, but the one I will be recommending here is to have a central chip that governs the progression of furnace activity, accompanied by functional chips that each control portions of that activity.

This central chip identifies the conditions and triggers that shift the furnace between modes of operation, then sends out a signal to the other chips letting them know what mode the furnace is in. My convention is to title this the “opmode”, or operation mode, which takes the form of an integer.

The central chip will therefore have code that looks like this:

move opmode 0 # Default case, the “Idle” opmode. brne condition_a value_a 2 # a relative branching conditional move opmode 1 # The mode set by the first condition breq condition_b value_b 2 # a second conditional move opmode 2 # The mode set by the second condition … s db Setting opmode # Write the opmode to the IC housing’s Setting value

Meanwhile one of the secondary chips would pick up this opmode like so:

alias icmain d0 # Identify the primary housing main: yield # code the chip always runs goes here, like display updates l opmode icmain Setting # Load in the opmode beq opmode 1 oreprocess # Jump to the defined function for an opmode beq opmode 2 smelt # Each of these functions ends with “j main” bgtz opmode main # Return to main for opmodes not on this chip # code the chip runs when idle is here, for opmode 0 j main

In the example above, the chip has functions that run in opmodes 1 and 2, but will yield otherwise. Another chip could have instructions for opmode 3, for example, and another for 4 and 5. There is no practical limit to how many chips you can coordinate in this way.

If necessary, it is also possible for a secondary chip to set its own opmode. A tertiary chip can then monitor that housing’s setting and perform a similar function. As long as the logic is structured so that only one chip is running its active functions (those that write values to the furnace and pumps) at any one point in time, then the chance of error due to overlap should be minimized.

It is also important to consider dependencies in your code. If you have code that updates displays or outputs the value of a calculation to memory for general use, that code should be in a position where it runs regardless of the opmode. If you have enough of these functions, it may make sense to dedicate a chip entirely to running these support operations so that your main chips can save their space for more crucial tasks.

Batch Name Operations
Given the number of devices involved, it is likely that you will need to reference or write to more than six unique devices per chip. For things like the opmode-setting IC housing, where you’re only referencing them once per loop, it is often better to avoid dedicating a pin to them and instead use the batch name operators sbn and lbn.

If you’ve set up solar panel operations on IC before, you’re familiar with the sb operator. It is essentially equivalent to a batch writer, and takes a prefab ID to then write to all matching devices on the network. The counterpart function, lb, is equivalent to a batch reader.

The named versions of these functions, sbn and lbn, take an additional name hash parameter that limits their scope to only devices with a matching prefab hash and a matching name hash - i.e. a specific named device on your network.

You can find the name hash of an item using the Configuration cartridge in your tablet, or by going to one of several sites (I like https://ic10.dev/ for this) that are able to show you the name hash for any particular name. It is also possible to convert hashes in script:

lbn opmode -128473777 -623372820 Setting 1 lbn opmode HASH(“StructureCircuitHousing”) HASH(“IC Primary”) Setting 1 # These two functions are equivalent, but the latter will inflate your script filesize

The final parameter in these commands is the batch mode, which governs how the mode summarizes the values it retrieves if there are multiples. Since you will be addressing single named devices most of the time, this doesn’t matter much - but it does impact the values returned if there is an error. I usually recommend Sum (1) as the batch mode setting. It will return 0 if the device is not found. The others return NaN, Inf or nInf, which is more problematic to test for in code.

There is no material difference in using lbn rather than loading values on a pin, but it can complicate the maintenance and readability of the code unless you leave comments detailing what the hashes represent. This problem is easily rectified by leaving comments in your code.

Leave comments in your code.

If you have many devices you are addressing in this manner, it is a timesaver to maintain a spreadsheet or list of their namehashes for reference.
Gathering Data
In order to make precise modifications to the furnace it is necessary to know certain pieces of information about the furnace contents and the various gas inputs. Here are the primary pieces of information and how to obtain or calculate them:

  • Primary Gas Attributes - You are able to read out the Temperature, Pressure and TotalMoles logic types directly from your advanced furnace and any connected pipe analyzers. This satisfies all but one variable (Volume) in the ideal gas equation.
  • Specific Heat - For any single-gas feeds, the specific heat for that gas may be referenced from the Stationpedia. For multi-gas feeds, or for your furnace contents, it will be necessary to assess the ratio of the various gases present and determine the total mixed specific heat. This calculation is very simple, as it is simply the ratio of the gas (from the Ratio___ logic types, like RatioOxygen, RatioNitrogen, etc) multiplied by the specific heat value for that gas. Phrased another way, the total specific heat is the average specific heat of all gas moles in that volume.

    As an example...
    Fuel is 2 parts volatiles, 1 part oxygen. The resulting ratios are 0.667 Volatiles and 0.333 oxygen. Volatiles have a specific heat of 20.4 J/K while oxygen has a specific heat of 21.1 J/K. When combined in the proper ratio, the resulting fuel has a specific heat of:
    (0.667 * 20.4) + (0.333 * 21.1) = 20.633 J/K

    When combusted, however, that same gas turns into a mix of 2 parts CO2 and one part pollutant. CO2's specific heat value is 28.2 J/K, while pollutant's is 24.8. Combined, this gas has a heat value of:
    (0.667 * 28.2) + (0.333 * 24.8) = 27.067 J/K

    This means that the combusted gas has more energy per degree of temperature than the input fuel.

    Why is this important?

    Simply put, the specific heat value of input gases impacts the final temperature of the mixed output. If you were to mix together 100mol each of volatiles (20.4 J/K) at 273.15K (0C) with an equal amount of CO2 (28.2 J/K) at 373.15K (100C), the resulting gas would have a temperature of:

    0C = 273.15K (O2 Temperature) 100C = 373.15K (CO2 Temperature) (0.5 * 28.2 J/K) + (0.5 * 20.4 J/K) = 24.3 J/K (Specific heat of the mixed gas) (273.15K * 20.4 J/K * 100mol) = 557,226 J (Energy in O2) (373.15K * 28.2 J/K * 100mol) = 1,052,283 J (Energy in CO2) 557,226 J + 1,052,283 J = 1,609,509 J (Energy in mixed gas) 1,609,509 J / 24.3 J/K / 200mol = 331.17K (Final temperature of mixed gas) 331.17K = 58.02C

    But mixing those same gases with the temperature reversed results in the following:

    100C = 373.15K (O2 Temperature) 0C = 273.15K (CO2 Temperature) (0.5 * 28.2 J/K) + (0.5 * 20.4 J/K) = 24.3 J/K (Mixed specific heat remains the same) (373.15K * 20.4 J/K * 100mol) = 761,226 J (Energy in O2) (273.15K * 28.2 J/K * 100mol) = 770,283 J (Energy in CO2) 761,226 J + 770,283 J = 1,531,509 J (Energy in mixed gas) 1,531,509 J / 24.3 J/K / 200mol = 315.13K (Final temperature of mixed gas) 315.13K = 41.98C

    You can see how the gas with the higher specific heat is smuggling more energy with it, and therefore has a higher impact on the final mixed temperature than the gas with a lower specific heat.

    Calculations for Specific Heat

    For gas feeds that are pure or have a fixed composition, you can define the specific heat value in your code without calculating it. For dynamic values like your furnace contents, however, you will need to perform the calculation. This involves iterating through the various gas ratios and totaling their contribution to the final specific heat. Your script will look something like this:

    alias adfurn d0 # Advanced Furnace alias frspht r0 # Furnace Specific Heat alias result r1 # Utility Variable l result adfurn RatioVolatiles # Ratio of Volatiles in furnace mul frspht result 20.4 # Volatiles Specific Heat from Stationpedia l result adfurn RatioPollutant # Then do the same for Pollutant mul result result 24.8 add frspht frspht result # Total the numbers together l result adfurn RatioCarbonDioxide mul result result 28.2 add frspht frspht result

    Etc, repeated for all gases in the volume. Since this is a relatively bulky script in terms of lines, you may wish to do all of your specific heat calculations on a separate IC and write them out to logic memory chips or the IC board's own Setting variable so that your other scripts can reference them easily.
The Furnace Process
Now that we have all of the required physical infrastructure and information to smelt, it's time to consider how we want to make use of it. Our furnace is the central piece of equipment in its process, and we must define what we want it to be doing at any given point in time. The states that it can be in are, in order:
  1. Idle
  2. Ore processing
  3. Smelting
  4. Ejection
  5. Venting and cooldown
  6. Inactive
We are primarily going to focus on Ore Processing and Smelting here, since those are the subject of the guide. Let's define the necessary operations while the furnace is in either state, as well as the triggers that cause those states to start and end.
Ore Processing
During ore processing you are getting your reagents into the furnace. This stage begins when you insert the first reagents into the input, and ends when the last of them has been successfully processed as reagents into the furnace. Our requirements for this stage are simple - just that the furnace has some gas in it, and that gas is over 100C so that the intake process can continue.

The challenges faced during this segment are primarily related to ore offgassing. Raw ores will release gas into the furnace volume and continually lower the temperature while raising the pressure. Additionally, some of these ores may release oxygen or nitrous oxide, which can combust and rapidly raise both temperature and pressure. Depending on your goal, this may or may not be desirable.

Gas smelting affords an opportunity here that is harder to accomplish with fuel smelting, which is that we can create a continuous metered flow through the furnace. Using our PV=nRT equation from before, we can calculate the volume setting for our utility gas that will dispense a consistent number of gas mols into the intake pipe:

For a 25mol target from a 48MPa, 900K source: V = nRt / P V = 25mol * 8.3144626 * 900K / 48000kPa V = 3.8974L

Or, in IC script:

l gastmp gassrc Temperature # Load source temperature l gasprs gassrc Pressure # Load source pressure mul result gastmp rgas # rgas is a special constant set to 8.3144626 mul result result 25 # you can combine these and just do T * 207.86 div result result gasprs min result result 10 # Clamping to 10L s volpmp Setting result # Pump is set to 3.8974

The advanced furnace has a relatively large volume of 1000L, of which the internal pump can empty 100L each tick. This means that at most the furnace can eject 10% of the gas in its internal volume each tick. Consequently, if you inject 25mol/tick into the furnace and turn the outflow on high, the furnace will stabilize at 250mols of gas - of which 25 (10%) are removed each tick, bringing it into precise balance with the inflow.

If ore adds extra mols to the furnace, the outflow pump will suddenly be able to draw well in excess of the inflow and the pressure will rapidly drop back to the equilibrium setpoint. This works for temperature as well, as the contents will converge with equal speed on the temperature of the source gas. There is no extra code or logic needed for this effect, it's just a natural consequence of the furnace parameters.

The setpoint can be adjusted by changing the mols of gas injected by the volume pump; the furnace will always contain ten times the per-tick injected gas. If you want to select this based on a target pressure, we can dredge up the same equation in the format n = PV/RT. We can do better than the base form, though:

PV/RT = n (2000 kPa * 100L) / (8.3144626 * 900K) = 26.727 mols For the source gas volume, from above we know that: V = 26.727mol * 8.3144626 * 900K / 48000MPa V = 4.167 L However, since the nRT term is the same, and PV = nRT, the ratio P1/P2 gets us there faster: V2 * P2 = nRT = V1 * P1 V2 * P2 = V1 * P1 V2 = V1 * P1 / P2 V2 = 100 * (2000 kPa/48000 kPa) V2 = 4.167 L Consequently, to determine the vol pump setting that will provide pressure P, you just need: move target 2000 l gspres gassrc Pressure mul result target 100 # P1 * V1 div result result gasprs # / P2 min result result 10 # Clamping to 10L s volpmp Setting result # Volume pump is set appropriately.

Adjusting the setpoint is actually a very effective way to smelt things at the temperature of your source gas. Theoretically, this is all you need to run a basic single-source gas furnace as long as that source is superhot gas; if you want to keep a tank of combusted 2200 K exhaust around then you can take that code snippet, hook up the tank to your furnace and you can smelt anything without a max temperature.

However, this method is somewhat wasteful of the source gas. Inserted items are converted to reagents at a rate of 10 per second, or 5 per tick; assuming everything is chute-fed and the rate is 25mol, we will expend our source gas at a rate of 25mol/tick, 5mol per ore. Smelting 400g of steel this way will burn through 2 kmol of gas, which is the product of 666.67 mol of fuel; you could achieve this for less than a tenth of the fuel cost by just burning the fuel directly in the furnace. This method is most suitable for low-value gases sourced from the atmosphere or a waste feed (e.g. H2 Combustor).

In short, if you have an infinite supply of hot gas (Vulcan atmosphere, etc) this is the simplest and most robust method I know to utilize it in smelting.

It is possible to tune the rate of gas expenditure down somewhat by reducing the furnace outflow volume. This will be much more gas-efficient, but commensurately slower at self-balancing to its equilibrium point. More efficient and deliberate methods of balancing will be discussed in the section about smelting, next.
Smelting
This stage of the process occurs when you have processed all ingots and can now look to hit the correct temperature and pressure to get your end product. For basic ores and some alloys this can be instantaneous; if your source gas is hot enough and you have it at equilibrium per the prior section, your ingot will be available one tick after you finish reagent processing.

For other ingots, adjustments will be necessary. The adjustment to pressure is the easiest, so I'll cover it first.

Adjusting Pressure

We know from before that the furnace interior pump can remove up to 10% of the volume of the furnace in one tick. Therefore, to adjust the pressure downward towards a target:

P = Pressure on the current tick. T = Pressure target. V = ((P - T) / P) * 1000 1000 is the factor relating the pump volume setting to the ratio of the furnace volume it represents. If P = 16 MPa and T = 15 MPa, then the equation is: V = (16,000 kPa - 15,000 kPa) / 16,000 kPa * 1000) V = 62.5 Setting the outflow pump to 62.5 will remove 6.25% of the furnace volume, or 1/16th.

For variances above 10% you just turn it on full and try again next tick. Eventually, you'll get in range where the pump can begin taking precise nibbles of gas to keep you balanced.

So, reducing pressure is easy.

Adding pressure is also "easy", in that the solution is simple. Just add gas! You don't even have to worry about overshooting, because your overpressure solution above will compensate for any excess.

The trouble is ensuring that this extra gas is at the correct temperature. Therefore:

Adjusting Temperature

"What temperature gas do I need to add to my furnace?" is the central question in this guide. Specifically, the information we need is the temperature a fixed unit of gas would have to be at in order to change the total furnace temperature to the target. This is the planned temperature for the batch of gas we'll mix in our feed pipe.

In terms of our setup, we then ask a second question - what mixture of our available gases will get us closest to that ideal temperature? Often the calculated temperature will be well beyond the hottest or coldest gases available, which means we feed pure superhot or cold gas into the furnace steadily until we get closer to the ideal temperature and a proper mix for this batch temperature goal is available.

Once we have achieved the ideal temperature, we can continue to inject a slow feed of gas at a temperature that corrects any radiant heat loss your furnace may experience. Since our overpressure solution is still chugging away, this gets us right back to the mechanism we covered in the prior section about a constant gas flow providing a stabilizing effect towards the temperature of the source gas.

The big difference here is that we're composing the source gas on the fly with our volume pumps to be the temperature we need. This gets somewhat involved.

Oh look, math.

This is just an elaboration of the stuff you already read back in the definition of specific heat, so it's not that horrible in the end. There are just a few steps to get from point A to point B.

We find the specific heat of our furnace contents from the average of the various specific heats present within - there are examples in the Gathering Data section. Calculate this value constantly and make it available to your IC. We also need the specific heat of each input gas. If these are static feeds, you can calculate it once and just give the script the static value; varying feeds will have to be calculated just like the furnace.

From the furnace, we need the total moles inside. This gives us:

TT = Target temperature TF = Furnace temperature FN = Moles in Furnace AN = Moles we intend to add FC = Specific heat of furnace AC = Specific heat of added gas X = TT + ((FN * FC) / (AN * AC) * (TT - TF)) X = Temperature in K our added gas must be at to change TF to TT. You may notice that you have no way to know AC yet, but we'll cover that. Some sample values: X = 950 K + ((100 mol * 26 J/K) / (25 mol * 24 J/K) * (950 K - 800K)) X = 1600 K Adding 25 mol of a 1600 K gas @ 24 J/K will raise our furnace contents to the target temperature of 950 K.

As mentioned previously, if this exceeds your hottest or coldest gas you can just feed the furnace whatever volume you like of that gas until the values are more reasonable. If you have to make large adjustments it may be worth temporarily dropping the pressure to clear out old gas. It might also be desirable to pop a small quantity of fuel in if you need to raise the temp and pressure a lot.

If X falls within our range of available gas temperatures, however, we can do something a bit more interesting. We will calculate the "energy differential" D of two gases that are on either side of our goal temperature. We will use our utility gas (u) and an additive gas (a), either hot or cold depending on our needs. The utility gas is going to be our middle ground, and we will see how much additive gas we need to inject in order to skew the temperature to our batch goal.

C = Gas Specific Heat T = Gas Temperature G = Temperature Goal Du = Cu * (G - Tu) Da = Ca * (Ta - G) Note the reversed order - this is because Tu is our "origin" and Ta is towards our "destination". If we are trying to reach our 1600 K gas from the prior example and have a 900 K utility gas (u) plus a 2200 K superhot gas (a): Mix Ratio = Du / (Du + Da) Du = 23.203 J/K * (1600 K - 900 K) Da = 27.067 J/K * (2200 K - 1600 K) Du = 16242 J (per mol) Da = 16240 J (per mol) R = 16242 / (16242 + 16240) R = 0.5

The temperature we want is a midpoint between the two source gases, in terms of energy, so a 50/50 mix will get us our target temperature. However, there is a complication.

Batch Specific Heat

The target batch temperature used a presumed value of 24 J/K for the specific heat of the added gas. However, our 50/50 blend of Vulcan atmosphere and combustion waste has a specific heat of:

(23.203 * 0.5) + (27.067 * 0.5) = 25.13 J/K

If we plug this number into our batch temperature calculation, we get a revised necessary temperature of 1570.65 - that is, our prior mix is too hot because the specific heat is higher than we had assumed, therefore our actual target is 30 degrees cooler. Running the mix calculations above, we get a revised ratio of 0.489.

But wait! The observant among you will have spotted that a 0.489 mix will have a different specific heat value again, and sure enough - the value is now:

(23.203 * 0.511) + (27.067 * 0.489) = 25.09 J/K

You can see how this process could go on for a while, but we're also pretty darn close even after one iteration. Furthermore, you can start from a better spot by retaining your prior specific heat value from one loop to the next, as your gas mix last tick will be a pretty good starting point for your calculation.

In fact, it is a decent solution to just carry forward the specific heat from last tick and not bother with the iteration at all. You will experience some oscillation as a result, because your gas mix will lack precision, but your furnace temperature will still be fairly stable.

If you choose to iterate, you can mitigate much of the impact on your script size by simply rerunning the lines of code with a single-use loop:

main: yield move loopct 0 # reset your counter at the start of each tick beq opmode 2 smelt # the loop begins with a counter at 0 ... smelt: # Perform your calculations # and set your sp. heat variable add loopct loopct 1 # increment your counter beq loopct 1 smelt # if this is the first loop, do it again. # in subsequent loops you proceed to set your pumps

However, remember that ICs only execute 128 lines/tick, and we want to run the whole loop each tick. If iterating would put you over this total, don't do it.
Modifications and Fuel Smelting
Did you know that Steam has a length limit on these sections? I didn't.

Anyway, once you know the proper ratio to mix the gases at, you simply multiply your desired mole count by that value and solve for how each gas pump should be set to insert that many moles of gas.

And that pretty much solves the entire thing! So now that we've covered the basics, let's talk about some variant cases.

It may be that you don't have a utility gas feed, or that your most-abundant gas is in a temperature range that makes it too cold for ore processing - you are on Mars, let's say, and want to use pressurized daytime air as an input.

The above setup is easily adaptable to a two-gas arrangement, where your lower bound is your cold gas and your upper is your superhot gas. For anything requiring a "utility gas" feed, like ore processing, you can use the gas mixing calculations from the prior section to compose a mixture of cold and superhot gas that uses the minimum superhot input to achieve your target temperature.

In this scenario your smelt stage is actually simpler, since you don't have to determine which combination of gases to use; every smelt will be some combination of your cold and superhot gas. You can also further conserve your superhot gas by adding some fuel injection capabilities to your furnace.

Fuel Injection

While this is a guide about gas-driven smelting, certain targets can be pretty hard on your superhot gas supply - smelting stellite or astroloy, for example, require quite a lot of hot gas in the furnace. You may find it more convenient to begin your smelting batch with a load of fuel, and then revert to the fine control loop from the smelting section in order to reach your exact target.

If you are injecting a load of fuel to achieve a particular temperature and pressure, we can start by calculating the theoretical yield of fuel combustion. I will be using Vol/O2 fuel for these calculations, but the same principles apply to superfuel if you'd like to use that.

1mol O2 + 2mol Volatiles = 3mol Pollutant + 6mol CO2 + 572,000 J 3mol Fuel @ 293 K combusts to 9mol Exhaust @ ? K ? = (Initial Energy + Combustion Energy) / Exhaust Specific Heat / Exhaust Mols Sp. Heat O2: 21.1 J/K Sp. Heat Vol: 20.4 J/K Sp. Heat Fuel: 21.1 J/K * 0.333 + 20.4 J/K * 0.667 = 20.633 J/K 20.633 J/K * 3 mol * 293 K = 18,136 J Sp. Heat Pol: 24.8 J/K Sp. Heat CO2: 28.2 J/K Sp. Heat Exhaust = 24.8 J/K * 0.333 + 28.2 J/K * 0.667 = 27.067 J/K (18,136 J + 572,000 J) / 9mol / 27.067 J/K = 2423 K

Now, this sounds great in principle, but if you try to do combustion you will notice that you don't immediately get a load of piping hot 2.4kK gas. Instead, what happens is that the gas combusts slowly, at a diminishing rate as the amount of unburnt fuel decreases.

I haven't had any luck finding the precise math for how much fuel combusts each tick, but I did some experiments and found that 16% of the fuel combusts on the first tick, a rate which falls precipitously thereafter.


This is 50 ticks of combustion, or 25 seconds, after which 80% of the fuel was combusted. Since we had less energy and fewer mols present than the calculation would indicate, the pressure was less as well - at 50 ticks I saw 77% of the pressure and 89% of the temperature.


The temperature keeps pace better because while the pressure is kept lower by the lower mole count, the energy from the combustion that did occur is being fed into fewer moles of gas with a lower specific heat. The uncombusted fuel therefore rises in temperature quite readily compared to its combusted exhaust.

Incidentally, this is why superfuel is so super. N2O combustion produces the same 572kJ as regular fuel, but the equation is:

1mol Vol + 1mol N2O = 2mol Nitrogen + 2mol CO2

Where fuel has a mol ratio of 1:3, inputs to outputs, superfuel has a ratio of 1:2 and produces 44% of the output mols relative to energy produced - and at a lower specific heat, so each degree absorbs less of that energy!

Anyway, all this is to say that if you use fuel as a tool to get your temperature and pressure up at the start of a burn, you should treat it less like the exact math we did prior and more like a rough initial attempt to get the furnace conditions closer to your targets. Once your combustion rate has slowed and you're not seeing much additional change in temperature/pressure, you can flip back over to the more granular furnace control script and nudge those values where they need to be.
Considerations and Conclusions
This has been far from a comprehensive overview of every problem you will encounter during your construction of a gas-smelting setup, so I will leave a few more things for you to consider as part of your design process.

  • For each source gas, particularly the superhot gas, the moles available per tick of a volume pump may be more limited than you're expecting. It is worth considering how your calculations will adjust if the volume pump is unable to provide enough gas to satisfy what the equation demands.
  • How will you terminate the process if it gets stuck in a state where it will never complete the smelt - say, due to incorrect reagents being inserted?
  • The technique of using a small input pipe to feed the furnace works great, but you will eventually want to turn the furnace off - this means turning the input off. It is worth ensuring that you have monitoring and failsafes to prevent that pipe from receiving any input gas if the furnace is not prepared to intake that gas, or you will find that it overpressurizes in fairly short order.
  • More generally, it is a good idea to examine all the cases where you are stopping gas from flowing through the furnace, and making sure that you have some logic to detect if this action is about to cause an explosion.
  • Gas obtained from ores can be valuable, as is the case with N2O from silver and lead. Consider how to best make use of this tool when you want the extra furnace T/P, and how you might safely dispose of or capture the gas when you don't.
  • The gas mixing logic covered in the smelt section can be extended to an arbitrary number of gases of varying temperatures and compositions. If you have multiple utility gas feeds that would otherwise be wasted or vented, consider how they might be integrated into your smelting process to provide more flexibility and prevent drain on your more valuable gas stocks.

That's it.

I hope that some of this has been useful, as it is a collection of the information I wish I'd had in a centralized form when I was building my own furnace. If there is something I've neglected to address or you have a point of clarification, please feel free to drop a comment below.

Happy Stationeering!
4 Comments
[BGG]ClockYze 23 hours ago 
This is super helpful. I'm going to look back at this page quite a lot of times, thank you !
TMarkos  [author] 13 Oct @ 6:06am 
Fixed the unit discrepancies, everything should be correctly noted and all the temperatures in C are now primarily stated in K. Thanks for pointing those out, both of you!
Jaryd 13 Oct @ 2:21am 
Just a small correction, in the "Ore Processing" section on the first math block, you write
V = 25mol * 8.3144626 * 900K / 48000MPa
The unit for the Pressure is wrong, I think you meant 48000KPa
acibi 12 Oct @ 5:59pm 
Great guide! Would be nice to see some example setups in piping and the arrangements.