UBC Solar's physics and environment models for simulating our groundbreaking solar cars.
The API is currently unstable, and backwards compatibility may not be maintained.
Versions indicated are recommended
First, clone this repository.
git clone https://github.com/UBC-Solar/physics.git
Then, create and activate a virtual environment. Next, install dependencies in editable mode.
pip3 install -e .
Example of calculating solar arrays produced energy
from physics.models.arrays import BasicArray
import numpy as np
efficiency = 0.25 # 25.0% efficient
panel_size = 4.0 # 4.0m^2 of panels
tick = 1.0 # 1.0s interval
arrays = BasicArray(panel_efficiency=efficiency, panel_size=panel_size)
irradiance = np.full([5], 400.0) # 10 seconds of 400.0W/m^2 irradiance
solar_power_produced = arrays.calculate_produced_energy(solar_irradiance=irradiance, tick=tick)
assert np.array_equal(solar_power_produced, np.array([400.0, 400.0, 400.0, 400.0, 400.0]))