sharpie7 / circuitjs1

Electronic Circuit Simulator in the Browser
GNU General Public License v2.0
2.32k stars 637 forks source link

[Feature Request] Battery Component #295

Open CytrusGallium opened 5 years ago

CytrusGallium commented 5 years ago

Can you please add a battery component so that we can simulate charging and discharging of li-ion batteries, thanks.

E3V3A commented 5 years ago

I guess you're asking for a Battery item? If that is it , I guess it can be modeled as just a "constant" voltage source with fancy icon. If you wan't a more complicated model, you need to provide some info, that can be coded.

E3V3A commented 5 years ago

@kamyflex Not sure what exactly you're looking for, but modelling (e.g. LiPo) battery is almost impossible and depend on the charge/discharge history of it. To read all about it, look here:

https://batteryuniversity.com/index.php/learn/article/how_to_prolong_lithium_based_batteries

Then you can start educating yourself, and us from here: BU-501: Basics about Discharging

CytrusGallium commented 5 years ago

Thanks for your response, let me precise that it does not need to be necessarly a LiPo Battery, what i would like to have is component that can be charged but also can be moved around i.e manually moving the battery in the circuit using mouse drag while it holds the charge that was received from its previous charger. The most important thing i want to simulate is an LED powered with battery while the battery is being charged, and when the battery is being charged the LED is powered by the same source as the battery.

E3V3A commented 5 years ago

Why don't you use a capacitor with some outrageous capacitance?

but also can be moved around i.e manually moving the battery in the circuit using mouse drag while it holds the charge

That is an entirely different feature!

CytrusGallium commented 5 years ago

I am a hobbiest, can you please provide me an example file on how to use a capacitor as a battery ? Thanks for your time.

E3V3A commented 5 years ago

http://tinyurl.com/y26c3v2p

kubark42 commented 1 year ago

I love Falstad/CircuitJS1. The one thing which would really improve my life is a battery item. The crucial difference between a battery item and a capacitor item is the way battery voltage decays with current, temperature, and SoC.

Screen Shot 2021-11-08 at 13 04 57

This model is highly empirical, and so is not representable by a clean formal model. Instead, users would need to upload the battery's parameters, likely via some kind of CSV file. This empirical model would then be interpolated to find the current battery voltage and internal resistance.

Having true battery models would be invaluable in simulating power electronics, such as motors and chargers.