mirror of
https://github.com/RichieCahill/dotfiles.git
synced 2026-04-17 04:58:19 -04:00
added random
This commit is contained in:
35
python/random/capasitor.py
Normal file
35
python/random/capasitor.py
Normal file
@@ -0,0 +1,35 @@
|
||||
def calculate_capacitor_capacity(voltage, farads):
|
||||
joules = (farads * voltage**2) // 2
|
||||
return joules // 3600
|
||||
|
||||
|
||||
def calculate_pack_capacity(cells, cell_voltage, farads):
|
||||
return calculate_capacitor_capacity(cells * cell_voltage, farads / cells)
|
||||
|
||||
|
||||
def calculate_pack_capacity2(cells, cell_voltage, farads, cell_cost):
|
||||
capacitor_capacity = calculate_capacitor_capacity(
|
||||
cells * cell_voltage, farads / cells
|
||||
)
|
||||
return capacitor_capacity, cell_cost * cells
|
||||
|
||||
|
||||
def main():
|
||||
watt_hours = calculate_pack_capacity(cells=10, cell_voltage=2.7, farads=500)
|
||||
print(f"{watt_hours=}")
|
||||
print(f"{watt_hours*16=}")
|
||||
watt_hours = calculate_pack_capacity(cells=1, cell_voltage=2.7, farads=5000)
|
||||
print(f"{watt_hours=}")
|
||||
|
||||
watt_hours, cost = calculate_pack_capacity2(
|
||||
cells=10,
|
||||
cell_voltage=2.7,
|
||||
farads=3000,
|
||||
cell_cost=11.60,
|
||||
)
|
||||
print(f"{watt_hours=}")
|
||||
print(f"{cost=}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user