ubc-solar-physics 1.3.0__cp39-cp39-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- core.cp39-win_amd64.pyd +0 -0
- physics/__init__.py +14 -0
- physics/_version.py +16 -0
- physics/environment/__init__.py +15 -0
- physics/environment/environment.rs +2 -0
- physics/environment/gis/__init__.py +7 -0
- physics/environment/gis/base_gis.py +24 -0
- physics/environment/gis/gis.py +337 -0
- physics/environment/gis/gis.rs +25 -0
- physics/environment/gis.rs +1 -0
- physics/environment/meteorology/__init__.py +3 -0
- physics/environment/meteorology/base_meteorology.py +69 -0
- physics/environment/meteorology/clouded_meteorology.py +600 -0
- physics/environment/meteorology/irradiant_meteorology.py +107 -0
- physics/environment/meteorology/meteorology.rs +138 -0
- physics/environment/meteorology.rs +1 -0
- physics/environment.rs +2 -0
- physics/lib.rs +132 -0
- physics/models/__init__.py +13 -0
- physics/models/arrays/__init__.py +7 -0
- physics/models/arrays/arrays.rs +0 -0
- physics/models/arrays/base_array.py +6 -0
- physics/models/arrays/basic_array.py +39 -0
- physics/models/arrays.rs +1 -0
- physics/models/battery/__init__.py +14 -0
- physics/models/battery/base_battery.py +29 -0
- physics/models/battery/basic_battery.py +140 -0
- physics/models/battery/battery.rs +78 -0
- physics/models/battery/battery_config.py +22 -0
- physics/models/battery/battery_config.toml +8 -0
- physics/models/battery/battery_model.py +135 -0
- physics/models/battery/kalman_filter.py +341 -0
- physics/models/battery.rs +1 -0
- physics/models/constants.py +23 -0
- physics/models/lvs/__init__.py +7 -0
- physics/models/lvs/base_lvs.py +6 -0
- physics/models/lvs/basic_lvs.py +18 -0
- physics/models/lvs/lvs.rs +0 -0
- physics/models/lvs.rs +1 -0
- physics/models/motor/__init__.py +7 -0
- physics/models/motor/base_motor.py +6 -0
- physics/models/motor/basic_motor.py +174 -0
- physics/models/motor/motor.rs +0 -0
- physics/models/motor.rs +1 -0
- physics/models/regen/__init__.py +7 -0
- physics/models/regen/base_regen.py +6 -0
- physics/models/regen/basic_regen.py +39 -0
- physics/models/regen/regen.rs +0 -0
- physics/models/regen.rs +1 -0
- physics/models.rs +5 -0
- ubc_solar_physics-1.3.0.dist-info/LICENSE +21 -0
- ubc_solar_physics-1.3.0.dist-info/METADATA +141 -0
- ubc_solar_physics-1.3.0.dist-info/RECORD +55 -0
- ubc_solar_physics-1.3.0.dist-info/WHEEL +5 -0
- ubc_solar_physics-1.3.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,174 @@
|
|
1
|
+
import math
|
2
|
+
import numpy as np
|
3
|
+
|
4
|
+
from physics.models.motor.base_motor import BaseMotor
|
5
|
+
from physics.models.constants import ACCELERATION_G, AIR_DENSITY
|
6
|
+
|
7
|
+
|
8
|
+
class BasicMotor(BaseMotor):
|
9
|
+
def __init__(self, vehicle_mass, road_friction, tire_radius, vehicle_frontal_area, drag_coefficient):
|
10
|
+
super().__init__()
|
11
|
+
|
12
|
+
# Instantaneous voltage supplied by the battery to the motor controller
|
13
|
+
self.dc_v = 0
|
14
|
+
|
15
|
+
# Instantaneous current supplied by the battery to the motor controller
|
16
|
+
self.dc_i = 0
|
17
|
+
|
18
|
+
self.input_power = 0
|
19
|
+
self.vehicle_mass = vehicle_mass
|
20
|
+
self.acceleration_g = ACCELERATION_G
|
21
|
+
self.road_friction = road_friction
|
22
|
+
self.tire_radius = tire_radius
|
23
|
+
|
24
|
+
self.air_density = AIR_DENSITY
|
25
|
+
self.vehicle_frontal_area = vehicle_frontal_area
|
26
|
+
self.drag_coefficient = drag_coefficient
|
27
|
+
|
28
|
+
self.friction_force = (self.vehicle_mass * self.acceleration_g * self.road_friction)
|
29
|
+
|
30
|
+
self.e_mc = 0.98 # motor controller efficiency, subject to change
|
31
|
+
self.e_m = 0.9 # motor efficiency, subject to change
|
32
|
+
|
33
|
+
# print("torque experienced by motor: {} Nm".format(self.constant_torque))
|
34
|
+
|
35
|
+
@staticmethod
|
36
|
+
def calculate_motor_efficiency(motor_angular_speed, motor_output_energy, tick):
|
37
|
+
"""
|
38
|
+
|
39
|
+
Calculates a NumPy array of motor efficiency from NumPy array of operating angular speeds and NumPy array
|
40
|
+
of output power. Based on data obtained from NGM SC-M150 Datasheet and modelling done in MATLAB
|
41
|
+
|
42
|
+
r squared value: 0.873
|
43
|
+
|
44
|
+
:param np.ndarray motor_angular_speed: (float[N]) angular speed motor operates in rad/s
|
45
|
+
:param np.ndarray motor_output_energy: (float[N]) energy motor outputs to the wheel in J
|
46
|
+
:param float tick: length of 1 update cycle in seconds
|
47
|
+
:returns e_m: (float[N]) efficiency of the motor
|
48
|
+
:rtype: np.ndarray
|
49
|
+
|
50
|
+
"""
|
51
|
+
|
52
|
+
# Power = Energy / Time
|
53
|
+
motor_output_power = motor_output_energy * tick
|
54
|
+
rads_rpm_conversion_factor = 30 / math.pi
|
55
|
+
|
56
|
+
revolutions_per_minute = motor_angular_speed * rads_rpm_conversion_factor
|
57
|
+
|
58
|
+
e_m = calculate_motor_efficiency(motor_output_power, revolutions_per_minute)
|
59
|
+
|
60
|
+
e_m[e_m < 0.7382] = 0.7382
|
61
|
+
e_m[e_m > 1] = 1
|
62
|
+
|
63
|
+
return e_m
|
64
|
+
|
65
|
+
@staticmethod
|
66
|
+
def calculate_motor_controller_efficiency(motor_angular_speed, motor_output_energy, tick):
|
67
|
+
"""
|
68
|
+
|
69
|
+
Calculates a NumPy array of motor controller efficiency from NumPy array of operating angular speeds and
|
70
|
+
NumPy array of output power. Based on data obtained from the WaveSculptor Motor Controller Datasheet efficiency
|
71
|
+
curve for a 90 V DC Bus and modelling done in MATLAB.
|
72
|
+
|
73
|
+
r squared value: 0.7431
|
74
|
+
|
75
|
+
:param np.ndarray motor_angular_speed: (float[N]) angular speed motor operates in rad/s
|
76
|
+
:param np.ndarray motor_output_energy: (float[N]) energy motor outputs to the wheel in J
|
77
|
+
:param float tick: length of 1 update cycle in seconds
|
78
|
+
:returns e_mc (float[N]) efficiency of the motor controller
|
79
|
+
:rtype: np.ndarray
|
80
|
+
|
81
|
+
"""
|
82
|
+
|
83
|
+
# Ignore nan warning. Set nan value to 0
|
84
|
+
np.seterr(divide='ignore', invalid='ignore')
|
85
|
+
|
86
|
+
# Power = Energy / Time
|
87
|
+
motor_output_power = motor_output_energy / tick
|
88
|
+
|
89
|
+
# Torque = Power / Angular Speed
|
90
|
+
motor_torque_array = np.nan_to_num(motor_output_power / motor_angular_speed)
|
91
|
+
|
92
|
+
np.seterr(divide='warn', invalid='warn')
|
93
|
+
|
94
|
+
e_mc = calculate_motor_controller_efficiency(motor_angular_speed, motor_torque_array)
|
95
|
+
|
96
|
+
e_mc[e_mc < 0.9] = 0.9
|
97
|
+
e_mc[e_mc > 1] = 1
|
98
|
+
|
99
|
+
return e_mc
|
100
|
+
|
101
|
+
def calculate_energy_in(self, required_speed_kmh, gradients, wind_speeds, tick):
|
102
|
+
"""
|
103
|
+
|
104
|
+
Create a function which takes in array of elevation, array of wind speed, required
|
105
|
+
speed, returns the consumed energy.
|
106
|
+
|
107
|
+
:param np.ndarray required_speed_kmh: (float[N]) required speed array in km/h
|
108
|
+
:param np.ndarray gradients: (float[N]) gradient at parts of the road
|
109
|
+
:param np.ndarray wind_speeds: (float[N]) speeds of wind in m/s, where > 0 means against the direction of the vehicle
|
110
|
+
:param float tick: length of 1 update cycle in seconds
|
111
|
+
:returns: (float[N]) energy expended by the motor at every tick
|
112
|
+
:rtype: np.ndarray
|
113
|
+
|
114
|
+
"""
|
115
|
+
required_speed_ms = required_speed_kmh / 3.6
|
116
|
+
|
117
|
+
acceleration_ms2 = np.clip(np.gradient(required_speed_ms), a_min=0, a_max=None)
|
118
|
+
acceleration_force = acceleration_ms2 * self.vehicle_mass
|
119
|
+
|
120
|
+
required_angular_speed_rads = required_speed_ms / self.tire_radius
|
121
|
+
|
122
|
+
drag_forces = 0.5 * self.air_density * (
|
123
|
+
(required_speed_ms + wind_speeds) ** 2) * self.drag_coefficient * self.vehicle_frontal_area
|
124
|
+
|
125
|
+
angles = np.arctan(gradients)
|
126
|
+
g_forces = self.vehicle_mass * self.acceleration_g * np.sin(angles)
|
127
|
+
|
128
|
+
road_friction_array = self.road_friction * self.vehicle_mass * self.acceleration_g * np.cos(angles)
|
129
|
+
|
130
|
+
net_force = road_friction_array + drag_forces + g_forces + acceleration_force
|
131
|
+
|
132
|
+
motor_output_energies = required_angular_speed_rads * net_force * self.tire_radius * tick
|
133
|
+
motor_output_energies = np.clip(motor_output_energies, a_min=0, a_max=None)
|
134
|
+
|
135
|
+
e_m = self.calculate_motor_efficiency(required_angular_speed_rads, motor_output_energies, tick)
|
136
|
+
e_mc = self.calculate_motor_controller_efficiency(required_angular_speed_rads, motor_output_energies, tick)
|
137
|
+
|
138
|
+
motor_controller_input_energies = motor_output_energies / (e_m * e_mc)
|
139
|
+
|
140
|
+
# Filter out and replace negative energy consumption as 0
|
141
|
+
motor_controller_input_energies = np.where(motor_controller_input_energies > 0,
|
142
|
+
motor_controller_input_energies, 0)
|
143
|
+
|
144
|
+
return motor_controller_input_energies
|
145
|
+
|
146
|
+
def __str__(self):
|
147
|
+
return (f"Tire radius: {self.tire_radius}m\n"
|
148
|
+
f"Rolling resistance coefficient: {self.road_friction}\n"
|
149
|
+
f"Vehicle mass: {self.vehicle_mass}kg\n"
|
150
|
+
f"Acceleration of gravity: {self.acceleration_g}m/s^2\n"
|
151
|
+
f"Motor controller efficiency: {self.e_mc}%\n"
|
152
|
+
f"Motor efficiency: {self.e_m}%\n")
|
153
|
+
|
154
|
+
|
155
|
+
def calculate_motor_efficiency(motor_output_power, revolutions_per_minute):
|
156
|
+
return 0.7382 - (6.281e-5 * motor_output_power) + (6.708e-4 * revolutions_per_minute) \
|
157
|
+
- (2.89e-8 * motor_output_power ** 2) + (2.416e-7 * motor_output_power * revolutions_per_minute) \
|
158
|
+
- (8.672e-7 * revolutions_per_minute ** 2) + (5.653e-12 * motor_output_power ** 3) \
|
159
|
+
- (1.74e-11 * motor_output_power ** 2 * revolutions_per_minute) \
|
160
|
+
- (7.322e-11 * motor_output_power * revolutions_per_minute ** 2) \
|
161
|
+
+ (3.263e-10 * revolutions_per_minute ** 3)
|
162
|
+
|
163
|
+
|
164
|
+
def calculate_motor_controller_efficiency(motor_angular_speed, motor_torque_array):
|
165
|
+
return 0.7694 + (0.007818 * motor_angular_speed) + (0.007043 * motor_torque_array) \
|
166
|
+
- (1.658e-4 * motor_angular_speed ** 2) - (1.806e-5 * motor_torque_array * motor_angular_speed) \
|
167
|
+
- (1.909e-4 * motor_torque_array ** 2) + (1.602e-6 * motor_angular_speed ** 3) \
|
168
|
+
+ (4.236e-7 * motor_angular_speed ** 2 * motor_torque_array) \
|
169
|
+
- (2.306e-7 * motor_angular_speed * motor_torque_array ** 2) \
|
170
|
+
+ (2.122e-06 * motor_torque_array ** 3) - (5.701e-09 * motor_angular_speed ** 4) \
|
171
|
+
- (2.054e-9 * motor_angular_speed ** 3 * motor_torque_array) \
|
172
|
+
- (3.126e-10 * motor_angular_speed ** 2 * motor_torque_array ** 2) \
|
173
|
+
+ (1.708e-09 * motor_angular_speed * motor_torque_array ** 3) \
|
174
|
+
- (8.094e-09 * motor_torque_array ** 4)
|
File without changes
|
physics/models/motor.rs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
mod motor;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
from physics.models.regen import BaseRegen
|
2
|
+
import numpy as np
|
3
|
+
|
4
|
+
|
5
|
+
class BasicRegen(BaseRegen):
|
6
|
+
GRAVITY = 9.81
|
7
|
+
EFFICIENCY = 0.5 # currently set to 50% but best case scenario is 60-70%
|
8
|
+
|
9
|
+
def __init__(self, vehicle_mass):
|
10
|
+
super().__init__()
|
11
|
+
self.min_decel_mag = 0
|
12
|
+
self.vehicle_mass = vehicle_mass
|
13
|
+
self.kmh_to_mps = 0.278
|
14
|
+
|
15
|
+
def calculate_produced_energy(self, speed_kmh, gis_route_elevations, min_regen_speed, max_power):
|
16
|
+
"""
|
17
|
+
Returns a numpy array containing the energy produced by regen
|
18
|
+
during each tick of the race based on the change in energy in that tick
|
19
|
+
:param speed_kmh: an array containing the speeds at each tick
|
20
|
+
:param gis_route_elevations: an array containing elevations on the route at each tick
|
21
|
+
"""
|
22
|
+
# get the changes of energy from tick i to tick i + 1
|
23
|
+
speed_ms = speed_kmh / 3.6 # Convert to m/s from km/h
|
24
|
+
delta_kinetic_energy = np.diff((1 / 2) * self.vehicle_mass * pow(speed_ms, 2), append=[0])
|
25
|
+
delta_potential_energy = np.diff(self.vehicle_mass * self.GRAVITY * gis_route_elevations, append=[0])
|
26
|
+
|
27
|
+
# get the total change in energy at each tick
|
28
|
+
delta_energy = delta_kinetic_energy + delta_potential_energy
|
29
|
+
|
30
|
+
# create regen energy produced array
|
31
|
+
# if delta_energy is negative, we regen that energy back at the set efficiency rate; else 0 energy regen
|
32
|
+
produced_energy = np.where(delta_energy < 0, abs(delta_energy) * self.EFFICIENCY, 0)
|
33
|
+
|
34
|
+
# Regen does not occur below a certain speed
|
35
|
+
produced_energy = np.where(speed_ms >= min_regen_speed, produced_energy, 0)
|
36
|
+
|
37
|
+
# Regen power is capped by current limitations
|
38
|
+
|
39
|
+
return np.clip(produced_energy, a_min=0, a_max=max_power)
|
File without changes
|
physics/models/regen.rs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
mod regen;
|
physics/models.rs
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 UBC Solar
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,141 @@
|
|
1
|
+
Metadata-Version: 2.2
|
2
|
+
Name: ubc-solar-physics
|
3
|
+
Version: 1.3.0
|
4
|
+
Summary: UBC Solar's Simulation Environment
|
5
|
+
Author: Fisher Xue, Mihir Nimgade, Chris Chang, David Widjaja, Justin Hua, Ilya Veksler, Renu Rajamagesh, Ritchie Xia, Erik Langille, Chris Aung, Nicolas Ric, Ishaan Trivedi, Jason Liang, Felix Toft, Mack Wilson, Jonah Lee, Tamzeed Quazi, Joshua Riefman
|
6
|
+
Author-email: UBC Solar <strategy@ubcsolar.com>
|
7
|
+
Maintainer: Renu Rajamagmesh, Felix Toft, Mack Wilson, Jonah Lee, Tamzeed Quazi
|
8
|
+
Maintainer-email: UBC Solar <strategy@ubcsolar.com>, Joshua Riefman <joshuariefman@gmail.com>
|
9
|
+
License: MIT License
|
10
|
+
|
11
|
+
Copyright (c) 2024 UBC Solar
|
12
|
+
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
15
|
+
in the Software without restriction, including without limitation the rights
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
18
|
+
furnished to do so, subject to the following conditions:
|
19
|
+
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
21
|
+
copies or substantial portions of the Software.
|
22
|
+
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
29
|
+
SOFTWARE.
|
30
|
+
|
31
|
+
Project-URL: Homepage, https://ubcsolar.com
|
32
|
+
Project-URL: Repository, https://github.com/UBC-Solar/physics
|
33
|
+
Project-URL: Documentation, https://ubc-solar-physics.readthedocs.io/en/latest/
|
34
|
+
Keywords: car,simulation,solar
|
35
|
+
Classifier: Programming Language :: Python :: 3
|
36
|
+
Classifier: Programming Language :: Rust
|
37
|
+
Classifier: Natural Language :: English
|
38
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
39
|
+
Requires-Python: >=3.9
|
40
|
+
Description-Content-Type: text/markdown
|
41
|
+
License-File: LICENSE
|
42
|
+
Requires-Dist: backports.tarfile==1.2.0
|
43
|
+
Requires-Dist: certifi==2024.7.4
|
44
|
+
Requires-Dist: charset-normalizer==3.3.2
|
45
|
+
Requires-Dist: dill==0.3.8
|
46
|
+
Requires-Dist: haversine==2.8.1
|
47
|
+
Requires-Dist: idna==3.7
|
48
|
+
Requires-Dist: importlib_metadata==8.2.0
|
49
|
+
Requires-Dist: jaraco.classes==3.4.0
|
50
|
+
Requires-Dist: jaraco.context==5.3.0
|
51
|
+
Requires-Dist: jaraco.functools==4.0.2
|
52
|
+
Requires-Dist: keyring==25.3.0
|
53
|
+
Requires-Dist: llvmlite==0.43.0
|
54
|
+
Requires-Dist: markdown-it-py==3.0.0
|
55
|
+
Requires-Dist: mdurl==0.1.2
|
56
|
+
Requires-Dist: more-itertools==10.4.0
|
57
|
+
Requires-Dist: nh3==0.2.18
|
58
|
+
Requires-Dist: numba==0.60.0
|
59
|
+
Requires-Dist: numpy==2.0.1
|
60
|
+
Requires-Dist: pkginfo==1.10.0
|
61
|
+
Requires-Dist: Pygments==2.18.0
|
62
|
+
Requires-Dist: readme_renderer==44.0
|
63
|
+
Requires-Dist: requests==2.32.3
|
64
|
+
Requires-Dist: requests-toolbelt==1.0.0
|
65
|
+
Requires-Dist: rfc3986==2.0.0
|
66
|
+
Requires-Dist: rich==13.7.1
|
67
|
+
Requires-Dist: tqdm==4.66.5
|
68
|
+
Requires-Dist: urllib3==2.2.2
|
69
|
+
Requires-Dist: zipp==3.20.0
|
70
|
+
Requires-Dist: filterpy==1.4.5
|
71
|
+
Requires-Dist: toml==0.10.2
|
72
|
+
Requires-Dist: pandas
|
73
|
+
Requires-Dist: pydantic==2.9.2
|
74
|
+
Requires-Dist: scipy
|
75
|
+
Requires-Dist: tomli
|
76
|
+
|
77
|
+
# UBC Solar Physics
|
78
|
+
|
79
|
+
<!-- marker-index-start -->
|
80
|
+
|
81
|
+
[](https://ubc-solar-physics.readthedocs.io/en/latest/?badge=latest)
|
82
|
+
|
83
|
+
UBC Solar's physics and environment models for simulating our groundbreaking solar cars.
|
84
|
+
|
85
|
+
The API is currently unstable, and backwards compatibility may not be maintained.
|
86
|
+
|
87
|
+
## Requirements
|
88
|
+
|
89
|
+
Versions indicated are recommended
|
90
|
+
|
91
|
+
* Git [^1]
|
92
|
+
* Python >=3.9 [^2]
|
93
|
+
* Rustc >=1.79.0 [^3]
|
94
|
+
* Cargo >=1.79.0 [^4]
|
95
|
+
|
96
|
+
## Installation
|
97
|
+
|
98
|
+
First, clone this repository.
|
99
|
+
|
100
|
+
```bash
|
101
|
+
git clone https://github.com/UBC-Solar/physics.git
|
102
|
+
```
|
103
|
+
Then, create and activate a virtual environment.
|
104
|
+
Next, install dependencies in editable mode.
|
105
|
+
|
106
|
+
```bash
|
107
|
+
pip3 install -e .
|
108
|
+
```
|
109
|
+
|
110
|
+
## Getting Started
|
111
|
+
|
112
|
+
Example of calculating solar arrays produced energy
|
113
|
+
|
114
|
+
```python
|
115
|
+
from physics.models.arrays import BasicArray
|
116
|
+
import numpy as np
|
117
|
+
|
118
|
+
efficiency = 0.25 # 25.0% efficient
|
119
|
+
panel_size = 4.0 # 4.0m^2 of panels
|
120
|
+
tick = 1.0 # 1.0s interval
|
121
|
+
|
122
|
+
arrays = BasicArray(panel_efficiency=efficiency, panel_size=panel_size)
|
123
|
+
|
124
|
+
irradiance = np.full([5], 400.0) # 10 seconds of 400.0W/m^2 irradiance
|
125
|
+
|
126
|
+
solar_power_produced = arrays.calculate_produced_energy(solar_irradiance=irradiance, tick=tick)
|
127
|
+
|
128
|
+
assert np.array_equal(solar_power_produced, np.array([400.0, 400.0, 400.0, 400.0, 400.0]))
|
129
|
+
```
|
130
|
+
|
131
|
+
## Appendix
|
132
|
+
|
133
|
+
[^1]: use `git --version` to verify version
|
134
|
+
|
135
|
+
[^2]: use `python3 --version` to verify version
|
136
|
+
|
137
|
+
[^3]: use `rustc --version` to verify version
|
138
|
+
|
139
|
+
[^4]: use `cargo --version` to verify version
|
140
|
+
|
141
|
+
<!-- marker-index-end -->
|
@@ -0,0 +1,55 @@
|
|
1
|
+
core.cp39-win_amd64.pyd,sha256=T4gMSl3bCuEEaZeMaRloW0nrGrUFYtqNWgchckSOEK8,382976
|
2
|
+
physics/__init__.py,sha256=jRV9J_eGh0vNXEfFrILqcM6xxVjyqm3XwKAg1B1IPBs,183
|
3
|
+
physics/_version.py,sha256=rrk6ompAx9vyxehfMb_vjY6qx7K6uH7dlf-VhKnKUoI,427
|
4
|
+
physics/environment.rs,sha256=OghmBkvHLZvzzuVsXUmV2lR3X_tEwuB9sT2TGZLQC6E,36
|
5
|
+
physics/lib.rs,sha256=FqnhKkotYKJCu8v1vbov2QW9s0apay7-BnEcUgxOakU,5798
|
6
|
+
physics/models.rs,sha256=747ABP-D1XKxA6X_MNh1PbmST0zsxpxhP_pEWjbR46c,63
|
7
|
+
physics/environment/__init__.py,sha256=se_LVo4aWZKcZgbbK1KwwhHG8SH2zS1g6TEPw0GOZSs,225
|
8
|
+
physics/environment/environment.rs,sha256=-VztdV2_GSlRbyIV_Pt6gKPVxpuNXpjLgAmoervonLg,34
|
9
|
+
physics/environment/gis.rs,sha256=9R7G0cjf5PxQAz-CSryA6-KGfrh1eSwRhJ6qF8KfjDE,12
|
10
|
+
physics/environment/meteorology.rs,sha256=naWb7qYrtMkCE_tLAkM474fmxaufhCkyhy3TTUQ4Yw4,20
|
11
|
+
physics/environment/gis/__init__.py,sha256=SjqhVjuDbZln636zOFROq1tWPfadghkuYz8aheflyxA,96
|
12
|
+
physics/environment/gis/base_gis.py,sha256=WJMwpuxjmHuV-dS5HwWvLxARNd7JRQyd3IBptuxNAI0,656
|
13
|
+
physics/environment/gis/gis.py,sha256=I04ABXsNOmeikCajBtl9a5oW6NzMBPc8nG53oiIicqw,11737
|
14
|
+
physics/environment/gis/gis.rs,sha256=jMkVmlUNl5cz7GF1QVkMNoRb58YUOe4D95EdhBJ4anM,876
|
15
|
+
physics/environment/meteorology/__init__.py,sha256=mvjJw_0nNLIdh80F_yTaRC3Sw3oI-z1L0J5cOK_ei0k,157
|
16
|
+
physics/environment/meteorology/base_meteorology.py,sha256=n0JsEXQLuciEatQp_S0QBXd_HQzCY5LeIQeVKgl5O-8,2487
|
17
|
+
physics/environment/meteorology/clouded_meteorology.py,sha256=H4jqQmaf1UiARQ4T5HmWE0ChS6IJhlvumj0lfoe52cw,28241
|
18
|
+
physics/environment/meteorology/irradiant_meteorology.py,sha256=BNuINbPfNQO5dB9AE9bMMdN4IUWK5HpRmEXONSykpVc,5646
|
19
|
+
physics/environment/meteorology/meteorology.rs,sha256=a5XlYhb34xvPKuGp1etTQZlSqm9qTd7UXuN6H0-jXfY,5142
|
20
|
+
physics/models/__init__.py,sha256=YgSvt4iBbcoH55XskiK9uE3VXxqCh-ZoIbAWogNUK7U,268
|
21
|
+
physics/models/arrays.rs,sha256=rtthXq7PDjL30lIt8y9L2xFAPJE5o_ltmCbOGzzOxrc,11
|
22
|
+
physics/models/battery.rs,sha256=fTL9O20fQarT_CFsmMSqVEZNe_sTejWMaAR8Fc-z_ak,16
|
23
|
+
physics/models/constants.py,sha256=GMD4hYO1FKoni3MNPvcyYg2EKGrgKxvOnxVKlEapUEc,839
|
24
|
+
physics/models/lvs.rs,sha256=uyJ1ZZ1Phq8cWCzr2aevCWzt8MlhCw9DO5ObUvEs8ds,8
|
25
|
+
physics/models/motor.rs,sha256=Iya1C_YF09KMy-9N-Mt-rBf1EIAs2Bf3Q4eDvyFuAoc,10
|
26
|
+
physics/models/regen.rs,sha256=WXwtzB72akG6L17wg-9Pz9kUe-57lqh4-PcSv1cKrGU,10
|
27
|
+
physics/models/arrays/__init__.py,sha256=Ds36SXwtCBnoq1xDOVlqA4kMBcOqS1wa9gLTn7TyB6Q,126
|
28
|
+
physics/models/arrays/arrays.rs,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
|
+
physics/models/arrays/base_array.py,sha256=KjTX_0MCvWSEf4irXd3P1ITsgjhFUqK1Cf0MbSQwLuk,101
|
30
|
+
physics/models/arrays/basic_array.py,sha256=-6yj85XkuySrjnLVmLnU35A4EOatiw4QpkLcC7n1WXU,1371
|
31
|
+
physics/models/battery/__init__.py,sha256=huRYMnfw035kqHyWeApAvdCaSf9yAQZMcQMnPutIXLE,376
|
32
|
+
physics/models/battery/base_battery.py,sha256=yU-QopEEQ83kw4CUvJ2MEhYyj3AM3LYY_hvdZ2wwW7c,1232
|
33
|
+
physics/models/battery/basic_battery.py,sha256=5o-7g5xflhNLKuJyeqOY-1rLIOSIy_CJ0U4GEqeQO1E,5894
|
34
|
+
physics/models/battery/battery.rs,sha256=0wIQVli7UOWgKXT96cQLWisLQKo5UE08X4B9dl09USI,3649
|
35
|
+
physics/models/battery/battery_config.py,sha256=Dsi7cXR8SL0v7aSTuihhB6il9-8h1a2P8qrGbdvlf8Q,617
|
36
|
+
physics/models/battery/battery_config.toml,sha256=J8jzmhg1mdfFqiHreiRfbbb_5byJklgVBEXKsn3sSUI,393
|
37
|
+
physics/models/battery/battery_model.py,sha256=kHn-xOyFBzWycpd-9Wn75fzHYZ512wXOi1dUrlt3a5M,6313
|
38
|
+
physics/models/battery/kalman_filter.py,sha256=axDzXTpAmJVE_AcOv3nk8nhJJSztyaAwXQ6qC2Y0hj4,14231
|
39
|
+
physics/models/lvs/__init__.py,sha256=ZBips6zW4Lot7SkQZMZt_OGRNUqgOfUlDtBA5lfUkM4,114
|
40
|
+
physics/models/lvs/base_lvs.py,sha256=kVLfGd9Qwql4-6u86uwHbJoFCgYpG07r0cAR2Ngsq38,116
|
41
|
+
physics/models/lvs/basic_lvs.py,sha256=xNXeN6RGSZkJLhtcW0n2xZU6YIOT4bKUIbOFdmh4zc0,621
|
42
|
+
physics/models/lvs/lvs.rs,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
43
|
+
physics/models/motor/__init__.py,sha256=zhEnTiYZUGBYGwksfUp0cznnVeeETTH0pWuZn0aFAfY,126
|
44
|
+
physics/models/motor/base_motor.py,sha256=tcJ9C9-TX9oRCbz8nqQ1U9g-JbuUiOMRMsVGmmBjYXo,101
|
45
|
+
physics/models/motor/basic_motor.py,sha256=hHGngG5lvZNzw7qgU3-c_3KFMKQ9siZCm471RvtjcLo,7902
|
46
|
+
physics/models/motor/motor.rs,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
47
|
+
physics/models/regen/__init__.py,sha256=JzyRYKwT89FQ6_p9ofCqusl2fnWGHulyiK4P4f8Lakc,126
|
48
|
+
physics/models/regen/base_regen.py,sha256=lY44jrTSHEo8Xv7hKCjo4C3Jx0PUgilyITHwQchT2bM,101
|
49
|
+
physics/models/regen/basic_regen.py,sha256=RY730lQLJ_gKkm2wJ68t1OPTmcz9xxGmu0yBLwHCGoQ,1811
|
50
|
+
physics/models/regen/regen.rs,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
51
|
+
ubc_solar_physics-1.3.0.dist-info/LICENSE,sha256=1Vq7OikLHh7N0xsmTPHCmPkOxk1AXrMK9k1a1icQFlk,1087
|
52
|
+
ubc_solar_physics-1.3.0.dist-info/METADATA,sha256=15ISzzdiPxotM7oZC1_y5gFcmYr7-uXEIxgm0qUTL74,5107
|
53
|
+
ubc_solar_physics-1.3.0.dist-info/WHEEL,sha256=agy-BJge3afXwWznUXANATmKFW4eqelqRR0uf608A_0,99
|
54
|
+
ubc_solar_physics-1.3.0.dist-info/top_level.txt,sha256=aws060Zz-1h0Kx76JzcE1gLA_AfS1lrRtTCsyUYwDvM,8
|
55
|
+
ubc_solar_physics-1.3.0.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
physics
|