Anyone know how to use the new Fluid Energy type?

Place to get help with not working mods / modding interface.
kasandraen
Long Handed Inserter
Long Handed Inserter
Posts: 51
Joined: Wed May 27, 2015 11:00 pm
Contact:

Anyone know how to use the new Fluid Energy type?

Post by kasandraen »

Looking through the patch notes

Code: Select all

Added "fluid" energy_source type can be used for both fuel-value based fluids, and heat capacity based fluids configured the same was as the generator entity.
How do I use this? I cant seem to find anything using it
kasandraen
Long Handed Inserter
Long Handed Inserter
Posts: 51
Joined: Wed May 27, 2015 11:00 pm
Contact:

Re: Anyone know how to use the new Fluid Energy type?

Post by kasandraen »

I have gotten this far
Image
but the machine doesnt run. As the image show it does recoginize the recipe (iron-ore -> liquid iron)
But I dont know how to configure the Consumption. It says 0.0/s but I dont know what option to change to increase it
Bilka
Factorio Staff
Factorio Staff
Posts: 3310
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Anyone know how to use the new Fluid Energy type?

Post by Bilka »

For future readers: The issue was that the fluid was at the default temperature which the minimum temperature. The fluid has to have a higher temperature than the minimum temperature to be able to extract energy from it.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
kasandraen
Long Handed Inserter
Long Handed Inserter
Posts: 51
Joined: Wed May 27, 2015 11:00 pm
Contact:

Re: Anyone know how to use the new Fluid Energy type?

Post by kasandraen »

Bilka wrote: Sat Mar 02, 2019 6:01 pm For future readers: The issue was that the fluid was at the default temperature which the minimum temperature. The fluid has to have a higher temperature than the minimum temperature to be able to extract energy from it.
Yeah, thank you soo much for your help on discord

For anyone else that is looking for the same, heres the code behind my furnace;

Code: Select all

local obj = util.table.deepcopy(data.raw["furnace"]["electric-furnace"])
obj.name = "smeltery"
obj.crafting_categories = {"metal_smelting"}
obj.minable = {mining_time = 0.1, result = "smeltery"}
obj.fluid_boxes =
    {
      {
        production_type = "output",
        pipe_picture = assembler2pipepictures(),
        pipe_covers = pipecoverspictures(),
        base_area = 10,
        base_level = 1,
        pipe_connections = {{ type="output", position = {2,0} }},
        secondary_draw_orders = { north = -1 }
      },
      off_when_no_fluid_recipe = false
    }
obj.energy_source =
    {
      type = "fluid",
      max_temperature = 10000,
      specific_heat = "10KJ",
      max_transfer = "2GW",
      min_working_temperature = 1500,
	  maximum_temperature = 10000.0,
	  fluid_usage_per_tick = 0.5,
	  fluid_consumption = 0.5,
      fluid_box =
		{
		  base_area = 1,
		  height = 2,
		  base_level = -1,
		  pipe_covers = pipecoverspictures(),
		  pipe_connections =
		  {
			{ type = "input-output", position = {0, 2} },
			{ type = "input-output", position = {0, -2} }
		  },
		  production_type = "input-output",
		  filter = "lava",
		  minimum_temperature = 1500.0,
		  maximum_temperature = 10000.0
		}
	}

data:extend({ obj })	
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Anyone know how to use the new Fluid Energy type?

Post by darkfrei »

I've made another mod with fluid energy power source. Steamed

It adds covers to entities with this code:

Code: Select all

local x = prot.collision_box[1][1] -- -1.4
local y = prot.collision_box[1][2] -- -1.4
x = math.floor (x*2)/2 - 0.5 
y = math.floor (y*2)/2 + 2 -0.5
local position = {x=x, y=y}
local position_2 = {x=-x, y=y}
prot.energy_source.pipe_connections = {{position = position}, {position = position_2}}
But all entities take too much fluids without respect to power consumption and energy in the fluid.
Last edited by darkfrei on Mon Mar 04, 2019 12:03 pm, edited 1 time in total.
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3197
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Anyone know how to use the new Fluid Energy type?

Post by BlueTemplar »

How much compared to what they should take ?
BobDiggity (mod-scenario-pack)
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Anyone know how to use the new Fluid Energy type?

Post by bobingabout »

I pretty much designed the thing. It's all based on how the steam engine works.
There's 2 modes: Fuel value mode or Temperature mode.
The amount of fuel consumed (Like burner) is determined by the power consumption of the entity.

Lets start with an example:

Code: Select all

    energy_source =
    {
      type = "fluid",
      emissions = 0.1 / 6.5,
      fluid_box =
      {
        base_area = 1,
        height = 2,
        base_level = -1,
        pipe_connections =
        {
          {type = "input", position = {0, 1.5}}
        },
        pipe_covers = pipecoverspictures(),
        pipe_picture = assembler2pipepictures(),
        production_type = "input",
      },
      burns_fluid = true,
      scale_fluid_usage = true,
      smoke =
      {
        {
          name = "smoke",
          north_position = util.by_pixel(-38, -47.5),
          south_position = util.by_pixel(38.5, -32),
          east_position = util.by_pixel(20, -70),
          west_position = util.by_pixel(-19, -8.5),
          frequency = 15,
          starting_vertical_speed = 0.0,
          starting_frame_deviation = 60
        }
      }
    }
Lets run through this line by line.

Code: Select all

smoke
is optional, that's basically just to make smoke come out of the chimney of the boiler I borrowed this code from.

Code: Select all

emissions
is pollution, same as burner.

Code: Select all

effectivity
is the standard fuel usage multiplier for efficiency.

Code: Select all

fluid_box
needs to be defined, because that's how the fluid gets in. You can define it either as an input, or input-output if you want the fluid to flow through like on the steam engine. production_type and pipe_connections.type should match, but I've not done full testing what happens when they don't. Otherwise it's pretty much defined how else you'd do it on other entities.

Code: Select all

burns_fluid
set it to true to set fuel_value mode, false if you want steam mode.

Code: Select all

scale_fluid_usage
... situational, if you define fluid_usage_per_tick to a value, and the fuel value of the fluid would result in more power than the entity demands, it uses less fluid. this also works with steam power in the same way but is also dependant on maximum_temperature

Code: Select all

fluid_usage_per_tick
sets the maximum fluid usage per tick. if scale_fluid_usage is false, it always consumes this amount if needed or not.

Code: Select all

maximum_temperature
must be present if burns_fluid = false, and just like on a steam engine, this is the temperature of steam the entity is designed to consume. if using colder steam, it will run at a slower speed, if using hotter steam and scale_fluid_usage = true, it will use less steam.
So a steam usage example would be...

Code: Select all

    energy_source =
    {
      type = "fluid",
      emissions = 0,
      fluid_box =
      {
        base_area = 1,
        height = 2,
        base_level = -1,
        pipe_connections =
        {
          {type = "input", position = {0, 1.5}}
        },
        pipe_covers = pipecoverspictures(),
        pipe_picture = assembler2pipepictures(),
        production_type = "input",
        filter = "steam",
        minimum_temperature = 100.0,
      },
      burns_fluid = false,
      scale_fluid_usage = true,
      maximum_temperature = 165,
      smoke =
      {
        {
          name = "light-smoke",
          north_position = util.by_pixel(-38, -47.5),
          south_position = util.by_pixel(38.5, -32),
          east_position = util.by_pixel(20, -70),
          west_position = util.by_pixel(-19, -8.5),
          frequency = 10 / 32,
          starting_vertical_speed = 0.08,
          slow_down_factor = 1,
          starting_frame_deviation = 60
        }
      },
    }
The 2 unmentioned tags on the fluid_box as follows
filter = "steam",
minimum_temperature = 100.0
are taken basically just standard fluid box tags that you can use on any fluid box. in this case they're taken from the steam engine's input, and work fine on the energy source fluid box too.
For smoke, I've included steam as defined on the steam engine, but with the offsets of a boiler, so this would be suitable for the laughably silly steam powered boiler.

Hopefully these 2 examples explain everything you need to know.

Basically, the energy source needs a fluid box with an input, can use effectivity and emissions, defaults to burns_fluid = false, can use scale_fluid_usage which defaults to false and fluid_usage_per_tick that defaults to unlimited and needs maximum_temperature if burns_fluid is false.

Yeah, scale_fluid_usage which defaults to false and fluid_usage_per_tick that defaults to unlimited, so if you don't set either of them, it will destroy fluids. Personally, I set scale_fluid_usage to true, but if you want it to function like a steam engine and consume the right amount of steam for the job, you'd need to manually set fluid_usage_per_tick to give the amount of power required for the expected fuel source. for steam you have 200W per degree, so, 165 degree steam is (165 - 15) * 200 to give 30kW per unit of steam. if for example you're powering a 90kW machine, you want to use 3 units of steam PER SECOND, so it's fluid_usage_per_tick = 3/60, because the tag wants per tick, not per second. or you could define it as fluid_usage_per_tick = 0.05 (3/60 = 0.05)
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3197
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Anyone know how to use the new Fluid Energy type?

Post by BlueTemplar »

Oh, so you can't use both Fuel Value AND Temperature mode ?
(I guess that would be asking too much... :P)

If I'm not mistaken, pre-0.15.10(?),
Boilers and Steam Engines could take any fluid,
(was there a temperature limit?)
and internally Steam was just Water hotter than 100°C,
so the new Temperature mode is, in a way, re-enabling that for any(?) power producer/consumer ?
(When was the Fuel Value mode added? It looks like your Oil Burner used something like it in 0.16.51 ?)

----
Physics detour :

I guess that on one hand the water/steam distinction makes sense,
but on the other hand, IRL it takes a LOT of energy to transform 100°C water to 100°C ("dry") steam :
http://hyperphysics.phy-astr.gsu.edu/hb ... phase.html
phase_changed_fixed_transparency_issue.png
phase_changed_fixed_transparency_issue.png (59.67 KiB) Viewed 3623 times
More than 5 times than to heat the same amount of water from 0°C to 100°C !
While in Factorio, that's 0...

(Also, all Factorio fluids pretty much behave like liquids...)

----
Back to Factorio modding:

Is it possible for the Temperature mode to not consume the fluid - to better differentiate the two modes ?
(I guess that you could just re-create the (now colder) fluid on the output, but will it work with all situations/settings/flags, especially with scale_fluid_usage = false ?)

----
Physics again :

A steam-"powered" boiler is not necessarily laughably silly if you can reuse colder "waste steam" from steam engine output, and use it to pre-heat the boiler !
You might have thought that you want input water to be as cold as possible, because the steam engine efficiency depends on the "difference" between the temperature of the water, and that of the steam..., but real steam engines are more complicated than that, so you can be more efficient by diverting part of the energy from the turbine to pre-heat water !
(Py already does something a loop like that in 0.16, but IIRC his (<100°C) steam is just waste, and designed to be so... (you can spend energy to turn it back into water.))

----
Back

Code: Select all

maximum_temperature
if using colder steam, it will run at a slower speed, if using hotter steam and scale_fluid_usage = true, it will use less steam.
Wait, so you would be able to use steam hotter than maximum_temperature ?
What is the point of maximum_temperature in the scale_fluid_usage = true case then ?
BobDiggity (mod-scenario-pack)
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Anyone know how to use the new Fluid Energy type?

Post by bobingabout »

This is all just based on existing steam engine logic. fuel value was a hack to steam logic to allow fluids to have a fuel value just like item fuel does.
It basically just removed the formula and writes the value on the fluid directly, so instead of having to calculate 200(energy per degree) * (165(current temp) - 15(default temp) = 30kJ per unit, you just define 30kJ on the fluid, then everything else functions as it did before.

But yeah, this is basically just a "Burner" power source, except instead of an item, you have a fluid. there is no conversion from 1 fluid to another programmed in.

As for the steam engine stuff. in theory it can still work like it did pre-0.15, heating any fluid, as long as the current temperature is higher than default temperature. the reason why it's limited to steam right now is because of that filter.

And You'd have to ask Klonan when fuel value was added to fluids, probably in 0.15 or 0.16, but I personally started using it in 0.16.
Last edited by bobingabout on Wed Mar 06, 2019 9:01 am, edited 1 time in total.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3197
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Anyone know how to use the new Fluid Energy type?

Post by BlueTemplar »

Oh, right, my bad, Klonan is likely the first that made a mod doing that :
https://mods.factorio.com/mod/KS_Power
Image
Seems to go all the way back to 0.12 ?
(Perhaps not for the fluid burner though?)
BobDiggity (mod-scenario-pack)
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Anyone know how to use the new Fluid Energy type?

Post by bobingabout »

BlueTemplar wrote: Tue Mar 05, 2019 5:33 pm Oh, right, my bad, Klonan is likely the first that made a mod doing that :
https://mods.factorio.com/mod/KS_Power
Seems to go all the way back to 0.12 ?
(Perhaps not for the fluid burner though?)
Yeah, that's the mod Klonan made. He occasionally edits the mod to make use of features as they're added to the game engine, so fluid burner was the previous new addition, and in the latest he makes use of fluid energy sources (not that I've seen the code of the latest version, he just thanked me for working on the code and told me he was going to use it.)

The mod portal will only list mods as far back as when it was created, and it was created for 0.12. it's possible Klonan has been playing with this even longer.

As for the first mod to make use of this fluid energy source, that would be mine. I wrote the feature, I wrote a testing mod to create entities making use of this feature, and then I wrote oil boilers into bobpower. So, who made use of it first? depends how you look at it. Who first used it? me, as I was writing it, testing it to make sure it worked. Who wrote the first mod making use of it? Me, I added oil (powered) boilers to bobpower making use of it. Who first published a mod using it? Klonan, because he posted it 3 days before 0.17 release where I waited until 0.17 had been released, tested my mods with it (which some were actually broken by 0.17.0 release) and then released the mod, almost 4 days after Klonan.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
Post Reply

Return to “Modding help”