Electrical-Age / ElectricalAge

Electrical Age (ELN) is a Minecraft Mod offering the ability to perform large-scale in-game electrical simulations.
https://electrical-age.net/
Other
212 stars 96 forks source link

[Feature Request] Voltage Regulator #939

Open setsunafseiei opened 5 years ago

setsunafseiei commented 5 years ago

Issue description

I would like to request a module named LM7805 or voltage regulator especially to export voltage as consistent rate while input voltage is not consistent.

Datasheet

https://www.sparkfun.com/datasheets/Components/LM7805.pdf

Electrical Age version

Future Versions

jrddunbr commented 5 years ago

Heh, seems fun enough. Worth noting that the 78xx and 79xx series of voltage regulators are generally LDO Linear regulators, which behave very similarly to a large rheostats and voltage probe on the output side. It's literally a resistor controlled feedback loop IRL.

LDO Linear regulators require 1.5 to 2 volts more than their typical output voltage (otherwise the output voltage sags), and any voltage drop it creates multiplied by the current through the device immediately becomes heat!

They are typically rated for 1.5A on the TO-220 form factor, but in my experience they tend to melt at that sort of current. There are also smaller versions that are rated for 150mA.

Just to get an idea for the naming convention:

LM7805: 5v regulator LM7812: 12v regulator LM7905: -5v regulator LM7912: -12v regulator

LM317: Variable positive output voltage LDO Regulator LM337: Variable negative output voltage LDO Regulator

AMIDIBOSS commented 5 years ago

We are currently working on voltage regulators. 😄

semplar2007 commented 4 years ago

That would be very good to have a voltage regulator as a single block. Meanwhile, you can create your own linear voltage regulator with use of CPU and rheostat.

 Vcc ---p-L-p-R-p-P----- Rload --- GND
        |   | | | |
        ----c-C-+--
              | |
              ---

GND - Ground Rload - well, your network of machinery that draws current, or battery charge source; P - electrical probe set to measure current, min=0 max=1000; p - electrical probe set to measure voltage, min=0 max=1000; L - an inductor, set it to 100 Henry (19 wires), it's for making current rise slowly; R - a rheostat, set to 2200 Ohm (64 coal dust), it's for dropping of excess voltage to make current match limits; '+' - a hub with its default cross setting; c - helper CPU with formula: B*0.8+C*0.2, B input (the green one) is the one between Vcc and L; C - controller CPU with formula: if(A*1000<0.05,1.0,1.01*(max(B,C)*1000/CURRENT-min(B,C)/(A+pow(max(0,derivate(A))*2,2)))/2200-0.01) Replace CURRENT with 5 if you want to have 5 Amps max.

Explanations on formula (to whoever want to go into technical details).

Current limits you want to have:

Based on cable type (I_cable_max below):

Based on batteries (I_battery_max below, but watch out cable limits!):

So final formula for max amperage is: I_max = min(I_battery_max * N_parallel_batteries, I_cable_max) Better to set it to 90% or 80% limit just to make system surely explosion-proof, because even on allowed currents close to limit, cables still greatly heat up.

Tested myself with 800V batteries. There is little overshoot, but it works fine, both for charging and discharging. Beware of using small passive cooling rheostat, it may explode if overheated. Better use large rheostat. Another way is to use PID controller, but I had hard time to configure it so it works for all currents and all voltages.

Examples of setups:

jrddunbr commented 4 years ago

The development here has halted and been put into new efforts on eln2 which we hope to have completed within two years and will be a complete overhaul with tons of new mechanics and stuff. We're not updating this older version any more because it's too difficult to set up the development environment and you can't use modern versions of Kotlin with it.