Thermal Solar Power (Shadow Fix) deprecated


Fork of Thermal Solar Power by MarximusMaximus. Adds missing shadows to thermal solar panels. This mod will be removed if merged into the original version.

Content
1 year, 12 days ago
1.1
282
Power

b [Mod Compat] Krastorio 2 issue

1 year, 14 days ago

Krastorio 2 changes the energy value of both water and steam to 0.5 KJ, from the default 1KJ. K2 then also modifies Steam Engines to consume 1 / 6 fluid per tick (so 10 per second).

What this means when you have both K2 and TSP installed (I chuckle a bit with the abbreviation of Thermal Solar Panel sharing my nickname), is that the first steam engine works as K2 wants it (10/s) and Steam Engine MK2 immediately bumps the consumption up to 39/s, and it further increases from there. This is a big issue considering K2 changes heat exchangers' fluid consumption to 24/s, so you need several of the highest tier exchangers to power just one Steam Engine MK4.

I did a quick fix of this for someone on the K2 Discord. Quick and dirty entities.lua:

engine2.fluid_usage_per_tick = 1.3 / 6
engine3.fluid_usage_per_tick = 1.6 / 6
engine4.fluid_usage_per_tick = 1.75 / 6

This'll reduce fluid usage per tick back in line with Krastorio2 while keeping the same "increased demand" from the original TSP.

So to fix this nicely, you'd have to add an optional dependency for K2 and adjust the code for it. The same it was done for bob's.

1 year, 14 days ago
(updated 1 year, 14 days ago)

in entities.lua
add near end:

if settings.startup["steam-turbines-enabled"].value and mods["Krastorio2"] and not mods["bobpower"] then

    local engine2 = table.deepcopy(data.raw.generator["steam-engine"])
    engine2.name = "tsp-steam-engine-2"
    engine2.minable.result = "tsp-steam-engine-2"
    engine2.fluid_usage_per_tick = 1.3 / 6
    engine2.maximum_temperature = 315

    local engine3 = table.deepcopy(data.raw.generator["steam-engine"])
    engine3.name = "tsp-steam-engine-3"
    engine3.minable.result = "tsp-steam-engine-3"
    engine3.fluid_usage_per_tick = 1.6 / 6
    engine3.maximum_temperature = 465

    local engine4 = table.deepcopy(data.raw.generator["steam-engine"])
    engine4.name = "tsp-steam-engine-4"
    engine4.minable.result = "tsp-steam-engine-4"
    engine4.fluid_usage_per_tick = 1.75 / 6
    engine4.maximum_temperature = 615

    data:extend({engine2,engine3,engine4})
end

in info.json
change file to:

{
    "name": "thermal-solar-power-fix",
    "version": "1.1.2",
    "title": "Thermal Solar Power (Shadow Fix)",
    "author": "MarximusMaximus, CyberWizard2261, Caxx, ZarSasha",
    "description": "Fork of Thermal Solar Power by MarximusMaximus and others. Adds missing shadows to thermal solar panels. Will be removed if merged into the original version.",
    "homepage": "",
    "factorio_version": "1.1",
    "dependencies": [
        "base >= 1.1.0",

        "? Krastorio2",
        "? bobpower"
    ]
}

This will work.

1 year, 14 days ago

Hi TSP. Sure thing, I'll look into it soon! Also, thanks for providing the necessary code, so I don't have to figure it out, it's been a while since I last worked on any of my mods for Factorio. :-)

1 year, 14 days ago
(updated 1 year, 14 days ago)

Hi again, I have tested the new code and noticed that Krastorio 2 actually increases water consumption for the vanilla Heat Exchanger from 103/s to 250/s with TSP installed, but at the same time it reduces the rate from 60/s to 24/s for the Heat Exchangers 1-4 added by this mod. I suppose the vanilla exchanger should be fixed as well?

Not sure what is going on and can't really think right now. I will have to look into this tomorrow.

1 year, 13 days ago

Okay, looked at it again, and the updated mod seems to work fine. It is just that Krastorio 2 changes the vanilla Heat Exchanger to have a way higher capacity that doesn't match up with the heat exchanger tiers added by the Thermal Solar Power mod. Do you think anything else should change on the part of this mod? Otherwise, I am ready to upload the new version.

1 year, 13 days ago
(updated 1 year, 13 days ago)

Okay, looked at it again, and the updated mod seems to work fine. It is just that Krastorio 2 changes the vanilla Heat Exchanger to have a way higher capacity that doesn't match up with the heat exchanger tiers added by the Thermal Solar Power mod. Do you think anything else should change on the part of this mod? Otherwise, I am ready to upload the new version.

I have a small question
I don't know if this would be so easy to realise
When I read your answer in this thread I had an idea
Would it be possible to add an option in Factorio in the mod settings menu when K2 is detected to double the output of the thermal solar panels if you wanted to, which you could simply activate with one click?
Since K2 has reduced the steam output of the heat exchanger and the energy output of the steam engine, you would need twice as many thermal solar panels to get the same energy output as without K2 because you need more heat exchangers and steam engines so you don't have to pave your world with thermal solar panels which can be especially useful if you don't have a lot of space because you can then use the same number of thermal solar panels as without K2.

There is just one small problem
In the translation it is written how many kw a thermal solar panel produces, but if you were to activate this setting and double the kw of the thermal solar panels then the kw in the translation would no longer be correct and would be wrong.

Written with Deepl

1 year, 13 days ago
(updated 1 year, 13 days ago)

Hi DarkNova. Yes, that is possible!

There are various ways of going about it, but to ensure some user control, I could for example add a Startup Setting called "Fix Thermal Solar Output for Krastorio 2" along with the description "Doubles heat generation and heat capacity for the Thermal Solar Panels, if Krastorio 2 is also detected". I would then add a check for both this setting and the presence of Krastorio 2, and if conditions are fulfilled the specific heat capacity of all Thermal Solar Panels will be doubled. Since the solar panels are actually heated through a script that specifically increases temperature depending on the current amount of daylight, this means that not only the heat capacity, but also the heat energy generated pr. tick is doubled, thereby fixing all parts of the problem. No need to change any description of the power output, it will match it as it was supposed to.

There are some limitations in regards to entity prototypes, but there are more sophisticated solutions which allow user configuration of the output, display of that output in the tool-tip, as well as a make-shift sunlight indicator. These are things I have tinkered with in a personal fork of this mod (currently taking a long break from it), and it works pretty great! Maybe I will incorporate some of that code into this version as well.

I will look into it again tomorrow.

1 year, 13 days ago
(updated 1 year, 13 days ago)

Hi again DarkNova, I actually did some testing this time around (not familiar with Krastorio 2), and the mod already works as intended! Each 100kw thermal solar panel generates 100kw, whether or not Krastorio 2 is installed. This is because, even though the energy density of steam has been halved by Krastorio 2, the amount of heat energy generated by the solar panels is not changed. They simply generate twice the amount of steam in the heat exchangers!

So the issue is not the solar panels taking up space, it is the heat exchangers and steam engines taking up space due to their greatly lowered steam capacity and slightly lowered max electricity output. I will have to think for a while about what exactly needs fixing.

1 year, 12 days ago
(updated 1 year, 12 days ago)

I looked it up again ingame so that I can explain it better
The numbers I give here are just examples for explanation

Assuming T4 Thermal Solar Panels generate 250kw of heat and
1 T4 heat exchanger would have a maximum heat consumption of 1MW (which would correspond exactly to 4 T4 panels) and 1 steam engine T4 would generate 6MW energy but because of K2 the generated energy would only be 3MW instead of 6MW you would need 2 T4 steam engines 2 heat exchangers and 8 Thermal Solar panels to get to 6MW output, because 4 T4 Thermal Solar panels could not cover the maximum heat consumption of 2 heat exchangers which would then correspond to 2MW.
That was what I meant by that
I'm not so good at explaining things ^^

Edit:I just thought of something, actually what I wrote at the top of my first message is complete nonsense because it is also much easier to do

If the maximum heat consumption works as I had written above this message then a setting that is only there when K2 is detected that would reduce the maximum heat consumption of the heat exchangers by half would be much easier to implement than changing anything on the Thermal Solar Panels themselves

I even have the finished code for it here, because I tried out how it works
Since I'm not very familiar with Factorio Modding and Lua I had to test something there

Or am I understanding something wrong??
If I have misunderstood anything, please feel free to correct me

1 year, 12 days ago
(updated 1 year, 12 days ago)

Hi DarkNova, I am getting confused by this Krastorio 2 mod as well, so I did some more testing and calculation. The numbers you provide don't seem correct at all, by the way (could they be changed by another mod?), and I am not sure what problem exactly you are describing. This is my take on it:

It would seem that the energy density of steam has effectively been multiplied by a factor of 2.5x. Normally, the vanilla (tier 1) Steam Engine produces 900kW electricity from 30 units/s of steam. With Krastorio 2 installed it instead produces 750kW from 10 units/s of steam. This is because, in prototypes/vanilla-changes/mandatory/vanilla-energy-changes.lua line 17+, energy capacity for water/steam was changed from 1.0kJ to 0.5kJ, while the Steam Engine's fluid usage pr. tick was changed from 0.5 to 1/6! The result is 2.5 times higher energy density for steam in relation to power production.

It is this factor of 2.5x that Krastorio 2 applies to all the Heat Exchangers, so their steam production rate of 60 units/s is reduced to 24 units/s of steam. Their energy conversion rate still remains at 1.8MW. This was done to Steam Engines as well, reducing steam consumption rate from 30 units/s to 12 units/s for the same power output. However, the max power output has also been reduced by 16.67% from 900kw to 750kw. So with Krastorio 2 a basic solar thermal setup still requires the same number of Tier 1 Thermal Solar Panels and Tier 1 Heat Exchangers, but needs 20% more Tier 1 Steam Engines to produce a given amount of electricity. Which is annoying, but it doesn't seem overwhelmingly important for me to try and correct either (since I would have to change entities outside of this mod too).

Things get weird at the higher tiers though, since Krastorio 2 doesn't actually change the steam consumption rate of tier 2-4 of Steam Engines added by this mod, even if it adjusts tier 1-4 of the Heat Exchangers. This leads to a steep jump from the vanilla Steam Engine to the following tiers. So the higher tier Steam Engines are overpowered relatively to the Heat Exchangers. TSP's code corrects this problem.

When corrected, the ratios should then be 18x T1 Thermal Solar Panels : 1x T1 Heat Exchanger : 2.4x T1 Steam Engines, producing 1800kW during the day. At the highest tier, that would be 28.8x T4 Thermal Solar Panels : 1x T4 Heat Exchanger : 1.37x T4 Steam Engines, producing 7200kW during the day. So even when corrected, the higher tiers leads to all around more compact setups and even relatively fewer Steam Engines pr. Heat Exchangers/Thermal Solar Panels.

In conclusion: I am just going to implements the changes suggested by TSP for now. Let me know if the new release works as expected.

1 year, 12 days ago

Version 1.1.2 has been uploaded!

1 year, 12 days ago

The numbers in my last message regarding kw and maximum heat consumption were just examples to make it easier to explain
As I said, I'm not very good at explaining, plus I use a translator which makes it much more difficult as my English is not very good as I'm from Germany

It can also be that I have completely misunderstood something with the values of the mod can also happen sometimes

But I'll just take a look at the new version and I think it's good that there is still someone who continues the mod and it is not dead

So anyway thanks for your work

1 year, 12 days ago
(updated 1 year, 12 days ago)

Ah, I see. Anyway, it's fine, and I am happy to help. :-)

If the above seems confusing, it may partly have to do with the fact that Krastorio 2 changes parameters for the Steam Engine in a way that it shouldn't. If energy capacity for steam has been halved, you would expect the game to scale the Steam Engine's consumption up from 30 units/s to 60 units/s of steam to output the same amount of electricity. However, Krastorio 2 has simultaneously set a max power production of 750kW AND a fluid consumption rate only a third of the normal level. This means that the Steam Engine effectively harnesses 2 * 3 * (750kW / 900kW) = 5 times the amount of energy that the steam actually contains! (Or 2.5 times the normal amount.) Krastorio 2 should only have set one of these parameters, not both, and let the other scale accordingly. (And in some way I don't quite understand yet, the consumption/production rate of the Heat Exchangers was divided by 2.5 as well).

1 year, 12 days ago

In case there are any problems with K2 compatibility, K2 also has a Discord

1 year, 12 days ago

Appreciate the info! Depending on what I find out, I may write them about it as well.

1 year, 11 days ago

Just wanted to put it out there, if any of you are interested: I have just uploaded that new fork I had been working on! It is called Thermal Solar Power (Lite).

1 year, 10 days ago

I apologize for the very late response here. You marked the thread as fixed; but if there's anything you have questions on after figuring this all out, I can take a look at things as well. I did not realize that the water intake for the heat exchanger was changed for example. I don't know if that matters too much though considering how easy it is to add more pipes and better pumps, but if it was Thermal Solar Power's doing somehow, it may be worth looking into. Then again you marked it as fixed so perhaps it's sorted anyway.

Again, sorry for the late reply.

1 year, 10 days ago
(updated 1 year, 10 days ago)

Hi again TSP. No problem! Thinking about it, I was actually too quick to mark it as fixed, when I had yet to receive any feedback from you, so sorry about that too!

(Taking the new version 1.1.2 as starting point:)

I am not entirely sure why Krastorio 2 reduces the water intake of the Heat Exchangers by 2.5x from 60/s to 24/s, and I would actually like to look more into that. Several values cancel out, so the balance of the TSP mod is largely preserved (rather, only the energy output of the Steam Engines are nerfed by 16.67%). On the other hand, K2 does not similarly lower vanilla Heat Exchanger intake from 103/s to ~41/s, but instead buffs it to a whopping 250/s (whether TSP is installed or not). That is an enormous difference, and I don't really like that, but I am also not sure what to do about it. It seems overall a choice between keeping this mod balanced as intended, or greatly buffing the tiered Heat Exchangers to make the TSP and K2 feel more balanced in relation to each other.

I am guessing the intake was increased to allow much more compact, scaled nuclear setups, which is a choice I can understand, even if I don't prefer it. On the other hand, there doesn't seem to be a similar need for the tiered Heat Exchangers from this mod to be buffed as well.

What do you think? Maybe I could add an option of buff/no buff when K2 is installed or something. (Although ideally, in my opinion, K2 should have added a higher tier Heat Exchanger rather than only modify the existing one - or just not buff it like that at all.)

11 months ago

I asked Raiguard (current maintainer of K2) a few times but have had no response over the last few days. I assume it's because he's also a dev of Factorio for a while now, so he's probably busy working on the expansion.

I've been giving it a thought and I think K2 (Original devs, Krastor & Linver) wanted to keep things simple in terms of ratio's for the nuclear power plant while also reducing UPS cost a lot (fewer machines, less liquid demands etc). And there are other issues with K2 as well (Lack of lategame oil cracking buildings, copper demand (At least solved easy with matter) of LDS etcetera.

It looks like we won't get an exact answer to the question for a while. Perhaps Raiguard will go back to default liquid rebalance and just adjust fuel efficiency, that way K2 would keep things a lot more compatible with other mods.

11 months ago

Hi TSP, thanks for the info.

I haven't looked into these issues lately, but at least it seems to me that this mod works largely as intended now, even if K2 changes values in strange ways. I haven't figured out everything, but K2 seems to potentially mess up mod balancing by setting power output and fluid input/tick (for e.g. steam engines) simultaneously in the code, rather than only one of them and letting the other scale accordingly (mentioned in the conversation with DarkNova above).

I haven't contacted them about it myself. I just don't have the energy to test and make sure that I know what I write.

New response