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

Simple car electric circuits - Give option so that consuming devices not touch the dedicated engine battery. #24871

Open
Androwski3000 opened this issue Aug 16, 2018 · 8 comments

Comments

Projects
None yet
8 participants
@Androwski3000
Copy link

commented Aug 16, 2018

Have you ever jumped out of the car with the headlights still on without noticing?

In the game Factorio you can create simple logic circuits for your factory needs. When you have full accumulators from solar power you want to use that first. Only if the accu´s are empty the coal power shall kick in. The player can craft a circuit to make that happen.

What would be great in CDAA would be an option on cars to make all power consumtion on a car not touch the battery dedicated to the engine. So that you always have a vehicle being capable of starting.

So that fridge, lights, etc only operate from the storage battery.

@mlangsdorf

This comment has been minimized.

Copy link
Contributor

commented Aug 16, 2018

Looking at the code, I think this is pretty simple.

I would probably implement it as a "Isolate engine batteries" menu option in the electronics control battery. That option would only appear if a vehicle has 2+ batteries and 1 or more of them is located on an engine and 1 or more of them is not.

I'd want to add fields to vehicle_part to let an engine track the batteries and alternators associated with it.
When isolate engine batteries is on, vehicle::power_parts() would need only draw/store battery power needed by an engine and produced by its alternator from the associated battery.

It's low priority but I'll note it.

@sfsworms

This comment has been minimized.

Copy link

commented Aug 16, 2018

Is the requirement that the dedicated "engine battery" only get power from the alternator of the engine needed?

@lucasmr

This comment has been minimized.

Copy link
Contributor

commented Aug 16, 2018

It would prioritize recharging of the main battery, also a good addition.

@alanbrady

This comment has been minimized.

Copy link
Contributor

commented Aug 16, 2018

Having a way to specify/change charging priority would be nice too. If I wanted to put in a battery into my swappable case have it charge it up real quick so I can put it back in my scooter type of situation.

Alternatively, and I'm not sure how difficult this is, I think the charging system needs to be reworked a bit. Real world it should charge all the batteries simultaneously, not one at a time.

@mlangsdorf

This comment has been minimized.

Copy link
Contributor

commented Aug 16, 2018

If you isolate the engine circuit, excess alternator generation is going to go to the engine battery first, and only when that battery is fully charged will excess generation be fed back into the main system. That's probably the easiest way to handle it.

A battery priority scheme runs into the issue that (aside from a battery mounted on the same tile as a specific engine), it's a hassle to know, game turn from game turn, where that battery actually is. Equal distribution among all batteries is doable (I think), and greedy engine batteries is doable, but I'd dubious about my ability to keep track of the 4th storage battery after the vehicle has been in a collision and had some parts destroyed.

@CoroNaut

This comment has been minimized.

Copy link

commented Aug 17, 2018

Instead of having to set a specific battery to store charge for the engine, could we implement a "starter battery" object or something similar that doesn't (or does) show up in the battery list? This way, you can rely on your car even if all batteries are 0%, the starter battery will come through for a couple attempts to start it up. This will automatically make it separate from regular batteries and the code would simply allow it to not discharge for anything but the vehicle engine.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Aug 17, 2018

I feel like this is going to lead to more trouble than it's worth.

Charging priority is a non-starter, it would be a hassle to manage, and generally speaking circuits dont work like that, at a minimum you need some device to manage it.

Say you isolate some of your vehicle appliances, are you specifying the whole circuit? Because if the appliance is isolated it means its drawing from a seperate battery, and that battery is either discharging and will run out (and then become useless), or has a dedicated alternator, so now you have two independent circuits. Can you make more than two circuits? Is there a menu listing your circuits and what is as reached to each one? Are the circuits set up at installation time or are you switching them while the car is already assembled?

This ends up sounding like a lot of work to make cars act a lot less like they do IRL and solve a pretty trivial problem.

@mlangsdorf

This comment has been minimized.

Copy link
Contributor

commented Aug 17, 2018

I gave the proposed implementation I did because I have been poking through the vehicle code a bit recently, and the engine + alternator + battery on an isolated circuit is something I am reasonably sure that can be implemented:

  1. its easy to check a single tile for an engine, alternator, and battery (or at least it will be when batteries get a VPFLAG_ which they're going to as part of mullti fuel support).
  2. Also easy to check that a vehicle that has an engine, alternator, and battery on a single tile also has a battery not on an engine tile.
  3. Power_parts currently loops through engines and then alternators and sums epower for each set and then pass power to batteries but having it loop through engines, check their alternators, sum epower for each tile, and pass excess epower to a battery in the same tile is pretty straightforward.

Electrical engineering wise, feeding all the current from an alternator to a specific battery until it's full and only then opening a way feed current to the rest of the vehicle requires some clever use of diodes but certainly doable in the age of semi-conductors.

This implementation would not support multiple circuits. It wouldn't isolate subsets of vehicle appliances, which would be a huge design hassle, if it's even possible. It wouldn't let you have some engines that are isolated and others that aren't: the toggle would be vehicle wide. It wouldn't even let you put a fridge on an engine with a battery and an alternator, isolate the engine battery, and power the fridge off a dedicated generator. It would solely be a solution to the specific desire to not have secondary appliances steal from the starter battery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.