Closed mlangsdorf closed 5 years ago
This would definitely be an improvement. Vehicle power and electric motors are way out right now.
Changing vehicle power to use an appropriate standard unit would make it easier to set good values for vehicle components. Watt hours would work fine for anything inside the scope of the vehicle system.
I may be newish to the community and this game, but, I wholeheartedly agree with the @mlangsdorf logic. Exact numbers will probably need testing and such for balance, but, this seems like a good idea
Solar panels being upped as well or no? Also the alternators and generator might be affected?
No change to solar panels, alternators, generators, or the combustion engines. Those numbers are good enough. Standard automotive batteries may be a small boost.
It's the future Everything's more efficient
There are physical limits on the efficiency of combustion engines etc, but I agree that (real-life) solar panels still have plenty of space for efficiency improvement, so they could be buffed a bit if they aren't already.
Solar panels already have two upgrades that improve their efficiency, and I will reintroduce rotating solar panels from blazemod at some point. But quantum solar panels, iirc, are already close to 99% efficient, which is pretty much the upper bounds of reasonable.
https://en.m.wikipedia.org/wiki/Shockley%E2%80%93Queisser_limit
Tl;dr conventional solar cells at around 33%, advanced panels at around 40%, theoretical advanced panels at about 75%, quantum panels theoretically at 100%.
Basically, if anything, everything but quantum panels would drop in output, quantum would probably stay where it is.
The current ratio of quantum to upgraded to standard is 6:2:1 (300 epower, 100 epower, 50 epower). It could be 4:2:1 (300 epower, 150 epower, 75 epower) if that 24% efficiency number is correct.
But this isn't a discussion about solar panels: I'm not changing them for this issue. This proposal is solely about electric motor efficiency and storage battery capacity.
According to the item browser, a storage battery is 22.86 kg, whereas the 85 kWh tesla battery pack is 540 kg. (6,85 kg/kWh) The Prius battery pack seems to be around 80 kg. (~12 kg/kWh) (Which brings into question why we currently need a crane to install a 22kg battery pack, but that's another debate).
So if our storage battery was Tesla-efficient, it'd store 3.57 kWh. If right now it stores 4.14, it's about right.
I think upping the electric engines' power consumption is fair, but then we should either bump up the wiehgt of a storage battery a lot, or add a new "Large Storage Battery" and add it to the various electric vehicles. (And maybe remove the lift requirement from the current storage battery)
According to the item browser, a storage battery is 22.86 kg
I don't know where from item browser takes info, but according to the data\json\items\vehicle\battery.json
storage battery weights a whooping 150 kg, that's why it requires crane to install.
Uh, I think I was looking at the stable, not the development for the item browser, my bad. 30 kWh for a 150 kg pack is perfectly reasonable.
I don't like the idea of my batteries draining even faster, but it seems like a good change to me. As long as solar panels don't get nerfed without also reducing the whole raining 80% of the time, it seems fair to me. I have always been annoyed at how rapidly batteries discharge even without driving nonstop.
I had never looked into the numbers, but it did always seem like electric engines were a bit too strong.
Hang on.
A vehicle power unit is 373 watts over 6 seconds.
This is well documented in the code.
The conversion comes from 0.5hp ≈ 373W One vehicle power unit is 0.5hp over 1 tick One vehicle epower unit is 1W over 1 tick = 6J = 1/600 Wh
vehicle epower generation/consumption is straightforward:
A 7.5kW generator has "epower" : 7500
and produces 45 kJ per tick
A floodlight has "epower": -1500
and consumes 9 kJ per tick
A small electric motor has "epower": -1000
and consumes 6 kJ per tick
Batteries, however...
A storage battery contains 40,000 vehicle power units.
This struck me as rather strange, so I checked -- vehicle battery charge is indeed given in vehicle power units.
Why are they not simply in epower?
This means that one charge of vehicle battery is equivalent to 2238J or 0.621667 Wh, how odd.
Side note: lead acid batteries changed in #17183 (a6d817aeed9abb17dd62909278aefcfaf5f09444) probably have incorrect values as a result of misunderstanding the units.
That works out to 4.14 kW-hrs.
Don't we need to multiply by (1 tick = 6s)?
I think it should be:
40,000 vehicle power = 14920 kW over 1 tick
= 89520 kJ
= 24.8667 kWh
I'm not exactly sure why vehicle power units are used for storage battery charges, and it does cause problems.
Power is generated and consumed in 6 second chunks. A minifridge (which draws 250 W, which is reasonably for conventional minifridges) drains a storage battery in 4 days, but if you work out the math, it should drain it in about 30 days. That was the discussion that original prompted the "storage batteries are too small" revelation.
I'm not exactly sure why vehicle power units are used for storage battery charges, and it does cause problems.
Can we change this while we're at it, or are there compelling reasons not to? It would be far more intuitive when reading/editing the json for each charge to correspond to X joules (or some other well-understood unit of stored energy). "3 horsepower-seconds" seems a rather weird way to think about battery charge.
Power is generated and consumed in 6 second chunks.
I'm aware of this, my point is that we should not confuse power and energy.
In the json, epower is easily interpreted as power rating, in watts.
The fridge has "epower": -249
, i.e. it consumes 249W.
However, in the code, when power is applied (produced or consumed), we need to remember that we are integrating over time. epower
of 1W applied over a duration of one tick (6s) corresponds to 6 joules.
So, when the electrical consumption of a fridge is calculated here it imposes a load of 249W (power) over 6s (time) which corresponds to 1494J (energy).
Supposing that nothing else on the vehicle is producing or consuming electricity, then over here that 1494J load is converted to (249/373) vehicle power units (albeit with some fudging using probability in order to handle fractional values).
So, on average, in each 6-second tick, 0.667560322 vehicle power units is discharged from the battery due to the electrical load from the fridge.
One vehicle power unit corresponds to
1494J / (249/373) = 2238J
That means that the storage battery contains
40,000 * 2238J
= 89520 kJ
= 24.8667 kWh
Thus, by stepping through the code to convert a concrete example from appliance consumption into battery discharge, I have validated my calculations in the earlier post..
The correct interpretation of battery charge, in the current state of affairs, is 1 vpu = 3 horsepower-seconds
It is not 1 vpu = 0.5 horsepower-seconds
which is how you arrived at 4.14 kWh.
A minifridge (which draws 250 W, which is reasonably for conventional minifridges) drains a storage battery in 4 days, but if you work out the math, it should drain it in about 30 days
24.8667 kWh / 250W = 4.14445 days
The behavior is perfectly consistent with my math.
If using the incorrect 1 vpu = 0.5 horsepower-seconds
you get 24.8667 days.
Not sure how to arrive at "about 30 days"
That was the discussion that original prompted the "storage batteries are too small" revelation.
If the complaint is that "running the fridge drains batteries too quickly", another factor to consider is duty cycle.
Currently, vehicle fridge and minifreezer operate on a simple model. They are in an "always-on" state, and simply maintain a constant internal temperature; they do not absorb heat from the surrounding environment or react to opening/closing the fridge door, nor do they care about what their contents are or what temperature those are at.
Real world fridges generally aren't running all the time, so we can compensate by doing something like:
"name": "minifridge",
"epower": -125, "//": "125W = 250W at 50% duty cycle",
~(I pulled that number for duty cycle out of nowhere, needs researched further.)~
Edit: I went and looked at a few refrigerators while window shopping and found one that was 71L capacity advertised as 250+kWh per annum -- so 260kWh / 1 year ≈ 30W
on average would be reasonable.
So that's another method we can employ to better model fridge power consumption.
I'm not outright opposed to increasing battery capacity; the point I'm trying to make is if we're going to do rebalancing based on real world values then let's make sure to do it correctly.
Yes, I want to move vehicle power calculations to watts and energy calculations to joules.
Okay, you've convinced me I did the math wrong. So now we're just going to increase electric motor power consumption by a factor of 3x to 7x without a corresponding increase in battery capacity, and people are going to howl.
Yes, I want to move vehicle power calculations to watts and energy calculations to joules.
Yeah, we're going to need that, because I found inconsistent behavior when I dug further into the code. :sweat: It'll need fixed, more on that in a bit. First, re: proposed motor changes:
Enhanced motor at 215 kW (same as Tesla Roadster) looks to be a sensible choice for highest powered motor.
As for efficiency, from wikipedia
electric vehicles have on-board efficiency of over 90%, when counted against stored chemical energy, or around 80%, when counted against required energy to recharge.
80% is measured against mains electricity consumed, and includes losses from charging system, such as converting mains AC to DC for the battery, etc.
In-game power generation using solar panels and ICE-powered alternators/generator are lossy; jumper cables also cause power loss. So, perhaps we could consider letting electric motors be closer to 90% efficiency so as not to double-penalize the player for charging costs.
And the nitty-gritty:
A standard electric motor consumes 5 kW of electric power to produce 37.3 kW of motor power.
Well, only if we're sure that "power": 100
indeed translates to 50 horsepower in the code that calculates acceleration, moves the vehicle, etc. Could you please verify? (I haven't looked at the movement code in-depth yet.)
The reason I don't take that for granted is the inconsistency I uncovered when looking at the code that handles fuel consumption:
here is the function call that should consume fuel proportionate to acceleration when thrust is applied
fuel consumption accounts for fractional charges here: https://github.com/CleverRaven/Cataclysm-DDA/blob/02e0a7f6c196f4fa4f701aec315a5ad0473e0f78/src/vehicle.cpp#L2631-L2641
fuel_remainder[ ft ] = drain_energy( ft, amnt_precise ) - amnt_precise ;
this is where energy consumption is ultimately translated into charges of fuel consumed
JSON_INFO.md
states:
"fuel" : {
energy": 34.2, // battery charges per mL of fuel. batteries have energy 1
// is also MJ/L from https://en.wikipedia.org/wiki/Energy_density
// assumes stacksize 250 per volume 1 (250mL). Multiply
// by 250 / stacksize * volume for other stack sizes and volumes
which suggests that batteries are intended to have energy 1 (= 1MJ/L) Energy content of all other fuels is specified in terms of this benchmark.
Now, IF batteries had stack_size
250, then the above would be true, and also agree with vehicle.cpp#L2631
that one battery charge is 1kJ. However, batteries are implicitly defined with stack_size
100 due to count
100. And just to muddy things further, thanks to fractional volumes for AMMO types being rounded (#22028) the actual behavior in game is that 100 charges are 200mL i.e. stack_size
125 :dizzy_face:
If 1 charge = 1kJ then 40,000 vpu = 11.11kWh -- certainly on the lower side of things
Anyhow, bottom line is: it's a bit of a mess, all of that will need to be made consistent.
Considering that the item definition for battery is used not only for vehicle batteries but also dry cells and other stored charge in various tools, it needs to be appropriate for lower-power items as well. AFAICT those specify turns_per_charge
and are handled in item::process_tool()
. As a point of reference, currently a flashlight lasts 2 min per charge of battery. Assuming a 2-cell (3V) flashlight with a 0.5W bulb: 60J in 2 min -- nowhere near 1kJ as per the markdown docs or 3 horsepower-seconds as per epower code.
now we're just going to increase electric motor power consumption by a factor of 3x to 7x without a corresponding increase in battery capacity, and people are going to howl.
Well, two factors from the code discussed so far:
Both can be fixed.
But something else that plays into this is the perception that electric vehicles are underpowered compared to combustion (#20411). And I think I've found the cause for that:
Gasoline engines effectively use only 15% of the fuel energy content to move the vehicle or to power accessories, and diesel engines can reach on-board efficiency of 20%
This here looks like combustion engines are converting fuel to energy at 100% efficiency. That means ICE is overpowered, having fuel efficiency at 500%~670% what it ought to be. Electric motors being at 300%~700% efficiency just happened to slightly compensate.
Likewise, while alternators are lossy, the combustion engine used to power them are overpowered, thus making solar seem much weaker by comparison.
[make] hybrid electric vehicles [...] more attractive.
Here's a related idea: currently engines are binary on/off. On a hybrid EV, turning both motor and engine on leads to both of them contributing motive power, but with a further penalty in efficiency -- not exactly ideal, so I personally tend to switch between pure electric and pure combustion in such situations.
What we could do is have an additional mode available to combustion engines on hybrid EVs, where they only power the alternator and not the wheels -- i.e. the range extender role. With careful balance tweaks, this could be made into an attractive choice for fuel economy.
Sorry about massive wall of text, one thing led to another, etc. Would appreciate my findings being double checked.
Glancing through your logic, I think you're correct in your assumptions, and yes, the vehicle code is a mess and 100 nominal HP does not produce the acceleration or velocity that 100 HP should.
I'm now thinking a better approach is to hold off on this - if both combustion engines and motors are stupidly efficient, they're stupidly efficient in the same ways. Instead, I (or other people who want to work on this crud) need to first figure out, and then update, the vehicle movement code so that the numbers look about right.
Basically, we need to decide on a bunch of reference vehicles and get performance data on them, then model similar vehicles in CDDA and tune things until the results are sensible:
Real World Vehicle | Curb Weight (lbs) | Engine | Engine HP | Max Speed (mph) |
---|---|---|---|---|
Porsche 911 GT3 Sports car | 3150 | 4.0L i6 | ~500 | 195 |
Mazda6 Sedan | 3600 | 2.5L i4 | 184 | 105? |
Ford Fiesta Subcompact | 2340 | 1.6 i4 | 180 | 136 |
Yamama VX1900A Motorcylce | 725 | 1.8L v2 | 81 | 90? |
We could probably use better sample vehicles than this.
100 nominal HP does not produce the acceleration or velocity that 100 HP should.
Hm, this should impact both combustion and EVs equally, right? In which case I think it should be fine if we take start taking steps to alleviate some of the found problems now, as well as lay a bit of groundwork for later.
Stuff like:
figure out, and then update, the vehicle movement code so that the numbers look about right.
sgtm. :+1: Will assist as able.
model similar vehicles in CDDA and tune things until the results are sensible
One concern: are vehicle parts stats sane enough that we can expect CDDA models of reference vehicles to behave "sensibly"? I've just increased sheet metal by 6× as part of review of steel resources #25210, don't know about the status of other vehicle parts.
Electric scooter has very little energy capacity (or bad engine efficiency) - I could only drive for ~30 minutes which seems rather low.
Right, I've been doing some tests with the stock (spawned using debug menu) scooter vs electric scooter. Here's my data. For reference, "map tiles" are overmap tiles, whereas "tiles" are in-game tiles meant to represent 1 meter.
Going at 10 mph (assuming a fully charged battery, straight road course, and nude driver) with cruise control, an electric scooter has 10 minutes of drive time, or 7.5 overmap tiles. Incidentally, the stock scooter has no method of recharging its batteries. Going to 20 mph, however, has 8 minutes of drive time but nearly 12 tiles of distance traveled due to coasting. I will define "coasting" as un-powered travelling that still achieves a velocity of greater than or equal to 10 mph. The trend continues as you start with higher speeds with cruise control, ending with nearly 35 map tiles at 80 mph.
Without cruise control, you can achieve much greater distances. To make a long story short, the most efficient way to use the electric scooter is manually going at ~60 mph. You will travel nearly 55 map tiles.
Incidentally, the regular, gasoline powered scooter, has a max safe speed of 22 mph... but can travel the same max distance, 55~ map tiles, with only 12% fuel spent. Also, the nude + wrist driver traveled the same distance as the 90 kg heavy power armor + anvil driver. Will update based on vehicle weight vs smaller electric motors later.
A custom scooter, designed to be as light as possible, with only two extra-light frames, saddle, controls, two bicycle wheels, motorbike battery (the same as electric scooter) with a small electric motor swapped in and all excess weight dropped, is 22 kg, compared to the electric scooters 33kg. It only travels 8 (normal) tiles farther than stock, going at 10mph. A small electric motor powered wheelchair at 17 kg only gets 1 more tile than the custom scooter. The small electric motor provides only marginal gains at 10 mph while losing the the high speed coasting feature of the regular sized variant.
The same custom scooter, with larger variants of electric motors, under performed when compared to the stock electric motor. Though they, in the case of the large electric motor, quadrupled the weight, they still out preformed the small electric motor. Lastly, in a test to see how much vehicle weight truly mattered, the same custom scooter outfitted with roller wheels clocked in at nearly 1600 kg. This is nearly eighty (80) times the normal weight! Yet in the 10mph cruise test, it was only 30~ tiles behind the stock electric scooter.
TL;DR - The motorbike battery is only meant to start motorbikes, not to supply an electric vehicle.
Finally, some screenshots of the 10mph "graveyard:
Apologies for the size, but I had to compromise based on detail and length of the straight away. The "custom" vehicles, except the saddle of one, are cut off tiles away.
And this is the overmap. The blinking tile is the 10mph graveyard. The test straightaway began at the map tile NW of the evac center. The red LMOE shelter is the distance reached by 40 mph coasting, and slightly off screen is the max distance traveled.
Closing this issue for now. There needs to be a general rework of vehicle speed mechanics (more on the line of this http://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html). When a 100 HP motor is providing sensible speeds for a small car or motorcycle, I will look into a general rebalance of consumption rates,
Background: Weak storage batteries
A vehicle power unit is 373 watts over 6 seconds. A storage battery contains 40,000 vehicle power units. That works out to 4.14 kW-hrs.
Current real-world storage batteries range from 6.5 kW-hrs (2019 Toyota Prius) to 60+ kW-hrs for a Tesla roadster.
So our storage batteries are somewhere between 1/5th and 1/12th the size they should be.
Background: Impossibly efficient electric motors
A standard electric motor consumes 5 kW of electric power to produce 37.3 kW of motor power. A large electric motor consumes 40 kW of electric power to produce 149 kW of motor power. An enhanced electric motor consumes 60 kW of electric power to produce 186.5 kW of motor power. (by way of comparison, a truck alternator consumes 2.2 kW of motor power to produce 1.3 kW of electric power.)
So our electric motors are 7 to 3x as efficient as it is physically possible to be.
Two problems, one solution
Make the electric motors 80% efficient (possibly 85% for the enhanced), so their numbers look like:
Increase storage battery size to 300,000 vehicle power units (roughly 30 kW-hrs).
Net effect is that electric vehicles drain their batteries roughly 3x or 4x as fast, but the battery is 7.5x as large, so the effective range is doubled. But since the recharge rate isn't increased, it takes 7x as long to recharge a full discharged battery (via solar power or whatever), and the range from one day's charge is reduced by a factor of 3 or 4.
It will be a substantial nerf to pure solar vehicles. Hybrid electric vehicles become much more attractive.
On the plus side, stationary craft rigs get a slight boost, because a fully charged battery takes 7x as long to discharge. A single mini-fridge should take roughly 30 days to discharge a single fully charged storage battery, so powering a survivor's house through the winter should be much easier.
Additional Changes
Add hydraulic lifts as furniture to gas stations and garages, so that there's another path to swapping out storage batteries.
Possibly add furniture/terrain rechargers to labs, the refugee center, and other locations that are established as having independent power supplies.
Alternate Solutions
This would be a substantial change to the game. It's not strictly required, but the fact that electric motors are 300+% efficient is deeply weird.