Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thermal electric gear power draw reduction #78834

Merged
merged 12 commits into from
Jan 5, 2025

Conversation

mark-ik
Copy link
Contributor

@mark-ik mark-ik commented Dec 29, 2024

Summary

Balance "Thermal electric gear power draw reduction + medium battery for TE suit"

Purpose of change

Currently, the thermal electric (TE) outfit eats through a medium battery in seven minutes. This PR reduces the power draw of all TE gear to a total of 5 W for the TE outfit. It also changes the TE suit to use a medium battery instead of a light one, along with changing the battery flags for that item. See IdleSol's comment in Issue #78798

Describe the solution

Applied values from here to TE gear. Also changed TE suit magazine flag restriction to BATTERY_MEDIUM and default magazine to medium_battery_cell

Changed:

  • TE socks (200 mW)
  • TE suit (4400 mW), battery pocket flag to medium, and default battery to medium
  • TE gloves (150 mW)
  • TE mask (250 mW)
  • TE outfit (5 W)

Describe alternatives you've considered

Considered letting the TE suit also reload with light batteries, but the outfit doesn't take light batteries so I stuck with what IdleSol said. Also considered lowering the power draw to a total of 4 or even 2 W, but 5 W is manageable.

Testing

Applied changes to local copy
Reloaded thermal electric outfit with medium battery
Turned it on, lasted from 2:20PM to 5:20PM. Success!

Additional context

Previous time on was around seven minutes, and 5 W is manageable (though it could be lower) for mutant cyborg psychics in a way that 130 W was not.

Applied values from 

CleverRaven#78798 (comment) 

Changed:
thermal socks power draw
thermal suit power draw, battery flag, and default battery
thermal gloves power draw
thermal mask power draw
thermal outfit power draw
@github-actions github-actions bot added [JSON] Changes (can be) made in JSON Items: Armor / Clothing Armor and clothing Game: Balance Balancing of (existing) in-game features. new contributor astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Dec 29, 2024
@mark-ik mark-ik marked this pull request as ready for review December 29, 2024 12:19
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Dec 29, 2024
@moxian
Copy link
Contributor

moxian commented Dec 29, 2024

Turned it on, lasted from 2:20PM to 5:20PM. Success!

3 hours is not enough to last a night sleep, so I don't think it counts as success. The character will freeze, and hurt themselves.

So, I decided to re-do the math. From the #78798 (comment)

For most ORORO products powered by the Mini 5K Battery (4800mAh):

5Ah * 4 V ~ 20 Wh = 72 kJ. Slightly more than our medium battery of 56 kJ.

This is underestimation. The product page for ORORO Mini 5K battery (link) shows that the bank contains two 18650 cells internally, and the Q&A says:

What is the output voltage of the battery? What size DC port is used for the vest to connect to the battery?

Hi, Matt! The battery supplies 7.4 volts of direct current to power the heating elements. The DC prot model is DC 4017 (4.0mm*1.7mm). Feel free to contact us if you need more information!

If we use 7.4V number we get 4.8Ah * 7.4 V * 3600 sec/h ~128 kJ
That's a bit over twice as much as we have in our medium battery. Which tracks, since our medium battery is modelled after a 18650 cell and ORORO Mini 5K has two of those.
If we could load the suit with two medium batteries then we'd have 6 hours of in-game runtime, and it would be almost enough. But I don't think we support this on the technical level.

So the options we have [that would make the suit usable in practice] are either half the consumption, or up the battery size to small tool battery (heavy_battery_cell). Personally, I would much rather prefer the latter approach.

Doing market research on these kinds of suits is surprisingly unpleasant, but here are two models that either include or suggest 10000mAh battery, which looks reasonably like a "small tool battery". So we can use them as a real-world reference. (even though it's technically can't fit into power tools. But I would think that's not a deal breaker).
(for the record the "unpleasant" part is due to the fact that the most of the models I'm finding come with no power bank at all, and suggest that the user figures it out themselves. Which is really disingeneous.. The ads also look very ugly and copy-pasted from one another, which does not lend much credibility...)

TL;DR: I believe the suit (and the full outfit) needs to use heavy_battery_cell, not medium_battery_cell. (And i'm too lazy to do the math on the other pieces, but medium_battery_cell should be enough for those).

@moxian
Copy link
Contributor

moxian commented Dec 29, 2024

p.s.: sorry, I'm very tired, and missed the part where 5W draw was calculated on the assumption of the total battery capacity being 56kJ in the first place. So if total capacity is increased 2-4x then the draw would be increased 2-4x to accomodate.

I did not double-check that math. But if the math is right, then it's surprising that we get only 3h of suit runtime in game when it has been calculated to last 8.

Either way, my overall point is that the suit should last 8h+, and if the battery needs to be bigger to ensure that's the case - then we can use bigger batteries. But 8h should be the goal.

@mark-ik
Copy link
Contributor Author

mark-ik commented Dec 29, 2024

I will make that change and move each piece up a battery tier!

Moved all thermal electric gear up one battery tier (ultralight/small -> medium, medium -> heavy)
@mark-ik
Copy link
Contributor Author

mark-ik commented Dec 29, 2024

With the change to the tool batteries, the TE outfit lasts 28 hours with the big tool battery, and with a small tool battery it ran for about 14 hours and ~30 minutes. Is that too long?

@IdleSol
Copy link
Contributor

IdleSol commented Dec 29, 2024

Several alternatives:

  1. You can reduce the suit's consumption from 5 watts to 2 watts (just enough for 8 hours).
  2. You could add the ability to plug the suit into an electrical grid. Just like any other tool. And then, if you go to bed, you use the connection. And when you go out for loot, you use batteries. ~3 hours on a single battery is more than enough.
  3. The second point can be realized, through a modification that will add the ability to connect to the network grid.
  4. Or use a modification for UPS power and thus use large batteries.

@mark-ik
Copy link
Contributor Author

mark-ik commented Dec 30, 2024

The small tool battery appears to be have a bit more capacity than two of the 10000mAh power banks used to power the outfit moxian linked, much like how one of those power banks is a bit more than two medium rechargeable batteries. You're supposed to use two in the outfit, so that small tool battery seems right.

Since the IRL outfit uses two of those batteries (pls check my math)

(2 * 128 kJ) / 8 hr / 3600 sec/hr = ~8.9 W

So I'll round to 9 W and see if I get an ~8 hr runtime with a small tool battery.

Do I need to add the ability to plug the suit into power grids in a separate PR? That linked outfit seems to connect to its two power banks with two USB ports, suggesting the item in game could be powered by other means like a power grid.

One question I have is, will the outfit and constituent parts of it spawn as loot with tool batteries, or will that need to be addressed in a separate loot table pr?

thermal electric outfit
100% x 9 W

thermal electric balaclava
5% x 9 W = 450 mW

thermal electric suit
88% x 9 W = 7920 mW

pair of thermal electric gloves
3% x 9 W = 270 mW

pair of thermal electric socks
4% x 9 W = 360 mW

@mark-ik
Copy link
Contributor Author

mark-ik commented Dec 30, 2024

Currently:

small tool battery: a couple minutes under 8 hours
big tool battery: 15 hours, 30 minutes

@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Dec 30, 2024
@moxian
Copy link
Contributor

moxian commented Dec 30, 2024

@IdleSol

Several alternatives:
You can reduce the suit's consumption from 5 watts to 2 watts (just enough for 8 hours).

Possible, but would likely be shot down on the grounds of realism and lack of IRL sources supporting the number.

You could add the ability to plug the suit into an electrical grid. Just like any other tool. And then, if you go to bed, you use the connection. And when you go out for loot, you use batteries. ~3 hours on a single battery is more than enough.
The second point can be realized, through a modification that will add the ability to connect to the network grid.

I would not expect any commercial TE wear to require you be plugged into AC grid. It would be extremely awkward to use in most any real life situation. You'd be tripping over the cable constantly.

Or use a modification for UPS power and thus use large batteries.

Last I heard, we are trying to move away from UPS for technical reasons, so please don't make it UPS.

@mark-ik

You're supposed to use two in the outfit, so that small tool battery seems right.

I haven't found any mention of using two of those. I assumed it's a single 10000mAh power bank for the entire suit. Which is two times smaller than our small tool battery (and 2x larger than our medium battery), but still only one of them.

Since the IRL outfit uses two of those batteries (pls check my math)
(2 * 128 kJ) / 8 hr / 3600 sec/hr = ~8.9 W

math checks out, and is consistent with your testing - our small tool battery gets a bit under 8h of runtime if given a bit higher power draw. And I would want to note once again that this is with our 2x bigger bateries, so IRL power draw would be smaller.

Currently:
small tool battery: a couple minutes under 8 hours

I still maintain that it should be over 8 hours. Especially given that our batteries are 2x bigger than the suggested IRL counterparts.
This should be achievable if you round the consumption down to 8.5W (or 8W even) instead of up to 9W.

Additionally, reading this closer, I'm not sure where the specific small percents (3%, 4%, 5%) for the power consumption of individual pieces are coming from (#78798 (comment)). The current experimental has balaclava/gloves/socks all have the same (ridiculous, admittedly) power draw of 7.5W. I think it's worth preserving the uniformity both from maintenance standpoint (it's easy to have things uniform) and from realism standpoint (really, they have the exact same amount of heating elements, so no reason for them to differ in consumption).

So - assuming you would touch the total power draw anyway - I would suggest redistributing it as 5%/5%/5%/85% instead of 3%/4%/5%/88%. For the numbers:

item percent draw with 8W total draw with 8.5W total draw with 9W total
(please don't v_v)
outfit 100% 8W 8.5W 9W
suit 85% 6.8W 7225 mW 7650 mW
balaclava/gloves/socks 5% 400mW 425mW 450mW

(and of course you don't need to follow the split exactly. Picking random "round" numbers from roughly that range would work perfectly fine too, say 3x 450mW + 7250mW = 8600mW or some such)

Alternatively

If you are tired of fiddling with the numbers and want to be done with it, then you can also just say "hey, the suit portion of the outfit lasts 8h! If you want the full outfit to last 8h+ - then either power the accessories separately, or get a bigger battery, ez!", and that's a fine answer too.

One question I have is, will the outfit and constituent parts of it spawn as loot with tool batteries, or will that need to be addressed in a separate loot table pr?

They should spawn with the new batteries. That's what default_magazine means. You can test it by debug spawning them from the debug menu.

There will be migration errors (#78530) , when people with saves from before this PR try to load their game after the PR , since the batteries are different, and the existing thermal suits would be soft-bricked (until people find new batteries for them), but that's fine. Many other items have suffered this fate already, and if we're bothered about it, we'd have to devise a new migration anyway, and that would cover your change too. So, tl;dr: there's nothing for you to worry about here.

Although, having said that, I think it's fine to allow using BATTERY_MEDIUM in these? As in, instead of "flag_restriction": ["BATTERY_HEAVY"] on the outfit make it "flag_restriction": [ "BATTERY_MEDIUM", "BATTERY_HEAVY" ]. Using medium batteries would not last you a night, but they are probably usable there, so it's fine?..

And also also, looking at the code, you did change the battery for the outfit but not for the suit (unless i'm misreading this), which is almost as power-hungry, and should use the same power storage.

@mark-ik
Copy link
Contributor Author

mark-ik commented Dec 30, 2024

In this (edit: wrong link, here's the right link) example, there's one power bank on the top half's left side and a second on the lower half's right side. The video was really clarifying in that regard; the top and bottom halves of the outfit are separate and so need their own individual batteries.

I don't mind making the power draw 8, 8.8, 8.9, or 9 W; 8.8 W should get it to be just barely over 8 hours, but 8 W is satisfyingly round and gives a little buffer past 8 hours runtime so I'll use that.

I assumed the percentage breakdowns were derived from total body coverage of the gear, but it makes sense for the power draw to be the same for the gloves, socks, and probably the mask (I could see an argument for the mask being bigger but meh). I'll make it 5% x 3 and 85% for the suit.

Lastly, I'll update the flags to allow medium batteries on the suit and outfit too. I don't think I missed the suit for the flag and default battery, but I'll double check.

Thank you all for your help, will push and test in a sec!

Changed thermal electric gear power draws to a total of 8 W with a different ratio equalizing power draw between the balaclava, gloves, and socks. Added MEDIUM_BATTERY flags to the TE suit and outfit.
@mark-ik
Copy link
Contributor Author

mark-ik commented Dec 30, 2024

At 8 W,
big tool battery: 17 hours, 26 minutes
small tool battery: 8 hours, 58 minutes

@mark-ik
Copy link
Contributor Author

mark-ik commented Dec 30, 2024

Oh, last thing: I am happy to add the ability to connect any/all thermal gear to a grid. Although it would be awkward to be limited by a cable, it is plausible enough that someone would connect to a grid to stay warm, particularly if they don't have a recharging station to charge their batteries with. I just need a little info on what to do there.

@moxian
Copy link
Contributor

moxian commented Dec 30, 2024

LGTM

Oh, last thing: I am happy to add the ability to connect any/all thermal gear to a grid. Although it would be awkward to be limited by a cable, it is plausible enough that someone would connect to a grid to stay warm, particularly if they don't have a recharging station to charge their batteries with. I just need a little info on what to do there.

Personally I don't think that's necceessary, but I also wouldn't mind it at all. On a technical level, adding grid support would mean changing the use_action to something like

"use_action": [ {
      "type": "transform",
      "msg": "You activate your %s.",
       ....
  }, 
  { "type": "link_up", "cable_length": 2, "charge_rate": "5 W" } 
],

Adjust cable_length and charge_rate as appropriate (these specific values above I just copied from mp3 player)
Make sure to add the link_up to both inactive and active items, else the game would yell at you.

@IdleSol
Copy link
Contributor

IdleSol commented Dec 30, 2024

@moxian

Possible, but would likely be shot down on the grounds of realism and lack of IRL sources supporting the number.

As far as I understand it, if you make an argument for why this is so, it will be accepted. Something like, in reality it runs on N battery, but we don't have such batteries. So the consumption is reduced to ... to get a commensurate run time.

Hi, Matt! The battery supplies 7.4 volts of direct current to power the heating elements.

What confuses me is that the charger is 5V. How do they charge a ~8V battery? So I'm assuming that's not true. But in principle it doesn't matter.

@mark-ik

There are no comments on my part. I'm happy with any outcome.

And yes, you're right. When I calculated the %, I took the coverage of body parts. It's not perfect (and doesn't match reality), but in the game it is.

Without going into details, the higher the area, the stronger the cooling. Which means you have to heat harder. (Or longer, but that can't be implemented in the game).

By the way, do you have a desire to make two modes of operation for the suit?

UPD. Regarding the power from the cable. I would suggest doing a separate PR so as not to deviate from the stated topic.

@PatrikLundell
Copy link
Contributor

I can't see a real world case where a cable hookup would make sense. I would expect this gear to be used outside, where there aren't any connection points available (and there are few cases where you'd use the gear without moving more than a few meters from the connection point anyway). If you're sleeping in it, I would expect that's because you don't have means to heat your environment (which may well be a tent out in the wilderness).

That doesn't mean it is impossible to hook a suit up, especially since there aren't any consumer protection enforcement to stop you from frying or cooking yourself, but any such capability should be a modded functionality, not a standard one.

@mark-ik
Copy link
Contributor Author

mark-ik commented Dec 30, 2024

The use cases:

  • No batteries
  • No way to charge batteries
  • Use when in base
  • Use when in vehicle

The cable length can be extended with extension cords. When connecting other tools to the power grid, the main benefit is that I don't have to micromanage batteries.

@moxian

So I need to add the "link up" bit to the use action. I'll do it for the suit and outfit. I'll make cable length 3 and the power draw equivalent to the default.

@IdleSol

I'm interested in doing two power modes for the suit and the outfit (could do the gloves, socks, and mask too, what do you think?)! Where do I start?

@moxian
Copy link
Contributor

moxian commented Dec 31, 2024

I'm interested in doing two power modes for the suit and the outfit (could do the gloves, socks, and mask too, what do you think?)! Where do I start?

There's no easy way, our codebase does not really support that. I see three potential options:

  • create a new item for each power mode. This is somewhat straightforward to do, but also kinda ugly.
  • perhaps you can do something via EoC, but I am not familiar with EoC magic at all, so I don't know if this even makes sense. Check the docs perhaps.
  • Adding the functionality to C++ is also an option. The support for multiple power modes [for all items] has further reaching implications of not even needing to define separate _on items at all, which would be very neat. But that's C++ code, which is more tricky to work with, and requires more careful approach and planning. And I'm not sure if there's any specific good place to start at, it's a pretty broad question.

Either way, I would suggest limiting the scope of this PR to roughly what you have right now so as not to get lost in this. You can always make more PRs expanding on your work!

@IdleSol
Copy link
Contributor

IdleSol commented Dec 31, 2024

I agree that cable and multiple modes are better done as separate PRs. Just in case the boss says “we don't need it”.

So I'll put it under a spoiler. Here's the code for the suit:

Details
 {
--    "id": "thermal_outfit",
++    "id": "test_thermal_outfit",
    "type": "TOOL_ARMOR",
    "category": "clothing",
    "symbol": "[",
    "color": "light_gray",
++    "name": { "str": "TEST thermal electric outfit" },
    "description": "A suit of thin thermal underwear that covers you from head to toe and is equipped with internal battery-powered heating elements.  Use it to turn it on.",
    "flags": [ "VARSIZE", "SKINTIGHT", "WATER_BREAK" ],
    "price": "300 USD",
    "price_postapoc": "7 USD 50 cent",
    "material": [ "cotton" ],
    "weight": "5748 g",
    "volume": "4500 ml",
    "ammo": "battery",
--    "use_action": {
--      "type": "transform",
--      "msg": "You activate your %s.",
--      "target": "thermal_outfit_on",
--      "active": true,
--      "need_charges": 1,
--      "need_charges_msg": "The %s's batteries are dead."
--    },
++    "use_action": [
++      {
++        "type": "transform",
++        "menu_text": "Turn on: normal mod",
++        "target": "test_thermal_outfit_on",
++        "active": true,
++        "msg": "You activate your %s.",
++        "moves": 100,
++        "need_charges": 1,
++        "need_charges_msg": "The %s's batteries are dead."
++      },
++      {
++        "type": "delayed_transform",
++        "menu_text": "Turn on: light mod",
++        "target": "test_thermal_outfit_light_mod_on",
++        "transform_age": 0,
++        "not_ready_msg": "debug msg",
++        "active": true,
++        "msg": "You activate your %s.",
++        "moves": 100,
++        "need_charges": 1,
++        "need_charges_msg": "The %s's batteries are dead."
++      },
++      { "type": "link_up", "cable_length": 1, "charge_rate": "0 W" }
++    ],
    "warmth": 10,
    "material_thickness": 0.1,
    "pocket_data": [
      {
        "pocket_type": "MAGAZINE_WELL",
        "rigid": true,
        "flag_restriction": [ "BATTERY_MEDIUM", "BATTERY_HEAVY" ],
        "default_magazine": "heavy_battery_cell"
      }
    ],
    "armor": [
      {
        "coverage": 100,
        "covers": [ "head", "mouth", "torso", "arm_l", "arm_r", "leg_l", "leg_r", "hand_l", "hand_r", "foot_l", "foot_r" ]
      }
    ]
  },
  {
--    "id": "thermal_outfit_on",
--    "copy-from": "thermal_outfit",
++    "id": "test_thermal_outfit_on",
++    "copy-from": "test_thermal_outfit",
    "type": "TOOL_ARMOR",
--    "name": { "str": "thermal electric outfit (on)", "str_pl": "thermal electric outfits (on)" },
++    "name": { "str": "TEST thermal electric outfit (on)", "str_pl": "TEST thermal electric outfits (on)" },
    "description": "A suit of thin thermal underwear that covers you from head to toe and is equipped with internal battery-powered heating elements.  It is currently on, and continually draining batteries.  Use it to turn it off.",
    "flags": [ "VARSIZE", "SKINTIGHT", "TRADER_AVOID" ],
--    "power_draw": "130 W",
--    "revert_to": "thermal_outfit",
++    "power_draw": "8 W",
++    "revert_to": "test_thermal_outfit",
--    "use_action": {
--      "ammo_scale": 0,
--      "type": "transform",
--      "menu_text": "Turn off",
--      "msg": "Your %s deactivates.",
--      "target": "thermal_outfit"
--    },
++    "use_action": [
++       {
++        "type": "transform",
++        "menu_text": "Turn off",
++        "target": "test_thermal_outfit",
++        "ammo_scale": 0,
++        "msg": "Your %s deactivates.",
++        "moves": 100
++      },
++      {
++        "type": "delayed_transform",
++        "menu_text": "Turn on: light mod",
++        "target": "test_thermal_outfit_light_mod_on",
++        "transform_age": 0,
++        "not_ready_msg": "debug msg",
++        "active": true,
++        "msg": "You activate your %s.",
++        "moves": 100,
++        "need_charges": 1,
++        "need_charges_msg": "The %s's batteries are dead."
++      },
++      { "type": "link_up", "cable_length": 1, "charge_rate": "0 W" }
++    ],
    "warmth": 60
  },
++  {
++    "id": "test_thermal_outfit_light_mod_on",
++    "copy-from": "test_thermal_outfit",
++    "type": "TOOL_ARMOR",
++    "name": { "str": "TEST thermal electric outfit (light mod on)", "str_pl": "TEST thermal electric outfits (light mod on)" },
++    "description": "A suit of thin thermal underwear that covers you from head to toe and is equipped with internal battery-powered heating elements.  It is currently on, and continually draining batteries.  Use it to turn it off.",
++    "flags": [ "VARSIZE", "SKINTIGHT", "TRADER_AVOID" ],
++    "power_draw": "4 W",
++    "revert_to": "test_thermal_outfit",
++    "use_action": [
++       {
++        "type": "transform",
++        "menu_text": "Turn off",
++        "target": "test_thermal_outfit",
++        "ammo_scale": 0,
++        "msg": "Your %s deactivates.",
++        "moves": 100
++      },
++      {
++        "type": "delayed_transform",
++        "menu_text": "Turn on: normal mod",
++        "target": "test_thermal_outfit_on",
++        "transform_age": 0,
++        "not_ready_msg": "debug msg",
++        "active": true,
++        "msg": "You activate your %s.",
++        "moves": 100,
++        "need_charges": 1,
++        "need_charges_msg": "The %s's batteries are dead."
++      },
++      { "type": "link_up", "cable_length": 1, "charge_rate": "0 W" }
++    ],
++    "warmth": 35
++  }

Some of the changes are due to me testing things by adding copies through my mod. That's why the id and names have been changed.
test_thermal_outfit.json

P.S. For a more classic version, you can look at an example:

"name": { "str": "Hub 01 modular recon headgear" },

"name": { "str_sp": "Hub 01 modular recon headgear (NV)" },

"name": { "str_sp": "Hub 01 modular recon headgear (IR)" },

@mark-ik
Copy link
Contributor Author

mark-ik commented Jan 1, 2025

I'll open another PR for cables, then multi mode! I'll wait until this one's merged. Happy New Year, y'all!

@Maleclypse Maleclypse merged commit 337b4d4 into CleverRaven:master Jan 5, 2025
26 checks passed
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions Game: Balance Balancing of (existing) in-game features. Items: Armor / Clothing Armor and clothing [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions new contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants