setuav-pythrust 0.1.0__tar.gz

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.
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if distributed along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,56 @@
1
+ Metadata-Version: 2.4
2
+ Name: setuav-pythrust
3
+ Version: 0.1.0
4
+ Summary: Electric propulsion system co-design, analysis, and optimization framework for UAVs.
5
+ Author: Hüseyin Karakaya
6
+ License: Apache-2.0
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Science/Research
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Topic :: Scientific/Engineering
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: numpy>=1.20
18
+ Requires-Dist: scipy>=1.7
19
+ Provides-Extra: plot
20
+ Requires-Dist: matplotlib>=3.4; extra == "plot"
21
+ Provides-Extra: pybamm
22
+ Requires-Dist: pybamm>=25.0; extra == "pybamm"
23
+ Provides-Extra: openmdao
24
+ Requires-Dist: openmdao>=3.20.0; extra == "openmdao"
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0; extra == "dev"
27
+ Dynamic: license-file
28
+
29
+ ![PyThrust Banner](docs/images/PyThrust_banner.png)
30
+
31
+ # PyThrust
32
+
33
+ PyThrust is an open-source framework for electric propulsion system analysis, co-design, and parameter optimization in UAV applications. It can be used for multidisciplinary design optimization (MDO) within OpenMDAO. It includes steady-state performance solvers, auto-tuning calibration tools to fit manufacturer test data, and database search tools to map theoretical designs onto real-world brushless motor and propeller catalogs.
34
+
35
+ ## Design and Analysis Visualization
36
+
37
+ | 1. Propulsion Co-Design Optimization | 2. Propulsion Calibration & Auto-Tuning |
38
+ | :---: | :---: |
39
+ | ![Propulsion Co-Design Optimization](docs/images/optimize_and_plot_results.png) | ![Propulsion Calibration & Auto-Tuning Results](docs/images/calibration_results.png) |
40
+ | **3. Propeller Aerodynamic Coefficients** | **4. Hover Efficiency Heatmap** |
41
+ | ![Propeller Aerodynamic Coefficients](docs/images/propeller_coefficients.png) | ![Hover Efficiency Heatmap](docs/images/efficiency_heatmap.png) |
42
+
43
+ ### 5. PyBaMM Electrochemical Battery Simulation (Dynamic Load)
44
+ ![PyBaMM Electrochemical Battery Simulation](docs/images/pybamm_mission_results.png)
45
+
46
+ ## Documentation
47
+
48
+ Please see the [docs/](docs/) folder for design specifications, core mathematical model descriptions, and database details.
49
+
50
+ ## License
51
+
52
+ PyThrust is licensed under the Apache License, Version 2.0 (the "License"). See [LICENSE](LICENSE) for the full license.
53
+
54
+ ## Copyright
55
+
56
+ Copyright (c) 2026 Hüseyin Karakaya. All rights reserved.
@@ -0,0 +1,28 @@
1
+ ![PyThrust Banner](docs/images/PyThrust_banner.png)
2
+
3
+ # PyThrust
4
+
5
+ PyThrust is an open-source framework for electric propulsion system analysis, co-design, and parameter optimization in UAV applications. It can be used for multidisciplinary design optimization (MDO) within OpenMDAO. It includes steady-state performance solvers, auto-tuning calibration tools to fit manufacturer test data, and database search tools to map theoretical designs onto real-world brushless motor and propeller catalogs.
6
+
7
+ ## Design and Analysis Visualization
8
+
9
+ | 1. Propulsion Co-Design Optimization | 2. Propulsion Calibration & Auto-Tuning |
10
+ | :---: | :---: |
11
+ | ![Propulsion Co-Design Optimization](docs/images/optimize_and_plot_results.png) | ![Propulsion Calibration & Auto-Tuning Results](docs/images/calibration_results.png) |
12
+ | **3. Propeller Aerodynamic Coefficients** | **4. Hover Efficiency Heatmap** |
13
+ | ![Propeller Aerodynamic Coefficients](docs/images/propeller_coefficients.png) | ![Hover Efficiency Heatmap](docs/images/efficiency_heatmap.png) |
14
+
15
+ ### 5. PyBaMM Electrochemical Battery Simulation (Dynamic Load)
16
+ ![PyBaMM Electrochemical Battery Simulation](docs/images/pybamm_mission_results.png)
17
+
18
+ ## Documentation
19
+
20
+ Please see the [docs/](docs/) folder for design specifications, core mathematical model descriptions, and database details.
21
+
22
+ ## License
23
+
24
+ PyThrust is licensed under the Apache License, Version 2.0 (the "License"). See [LICENSE](LICENSE) for the full license.
25
+
26
+ ## Copyright
27
+
28
+ Copyright (c) 2026 Hüseyin Karakaya. All rights reserved.
@@ -0,0 +1,48 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "setuav-pythrust"
7
+ dynamic = ["version"]
8
+ description = "Electric propulsion system co-design, analysis, and optimization framework for UAVs."
9
+ readme = "README.md"
10
+ authors = [
11
+ { name = "Hüseyin Karakaya" }
12
+ ]
13
+ license = { text = "Apache-2.0" }
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Science/Research",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Topic :: Scientific/Engineering",
22
+ ]
23
+ requires-python = ">=3.10"
24
+ dependencies = [
25
+ "numpy>=1.20",
26
+ "scipy>=1.7",
27
+ ]
28
+
29
+ [project.optional-dependencies]
30
+ plot = [
31
+ "matplotlib>=3.4",
32
+ ]
33
+ pybamm = [
34
+ "pybamm>=25.0",
35
+ ]
36
+ openmdao = [
37
+ "openmdao>=3.20.0",
38
+ ]
39
+ dev = [
40
+ "pytest>=7.0",
41
+ ]
42
+
43
+ [tool.setuptools.dynamic]
44
+ version = {attr = "pythrust.__version__"}
45
+
46
+ [tool.setuptools.packages.find]
47
+ where = ["."]
48
+ include = ["pythrust*"]
@@ -0,0 +1,4 @@
1
+ """PyThrust package."""
2
+
3
+ __version__ = "0.1.0"
4
+
@@ -0,0 +1,6 @@
1
+ """Motor database and lookup utilities."""
2
+
3
+ from .database import ( # noqa: F401
4
+ MotorEntry,
5
+ MotorDatabase,
6
+ )
@@ -0,0 +1,130 @@
1
+ """Brushless motor database loader and query interface."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass
6
+ from pathlib import Path
7
+ import json
8
+ from typing import Dict, List, Optional
9
+ from pythrust.propulsion.models import MotorSpec
10
+
11
+
12
+ @dataclass(frozen=True)
13
+ class MotorEntry:
14
+ """A database entry for a single brushless motor."""
15
+ id: str
16
+ name: str
17
+ manufacturer: str
18
+ kv: float
19
+ resistance: float
20
+ io: float
21
+ max_current: float
22
+ weight_g: float
23
+ max_power: float
24
+ io_voltage: float
25
+
26
+ def to_spec(self) -> MotorSpec:
27
+ """Convert the database entry to a PyThrust MotorSpec object."""
28
+ return MotorSpec(
29
+ kv_rpm_per_v=self.kv,
30
+ resistance_ohm=self.resistance,
31
+ no_load_current_a=self.io,
32
+ current_max_a=self.max_current,
33
+ no_load_voltage_v=self.io_voltage,
34
+ )
35
+
36
+
37
+ class MotorDatabase:
38
+ """Load and query brushless motor database from JSON files."""
39
+
40
+ def __init__(self) -> None:
41
+ """Create an empty motor database."""
42
+ self._entries: Dict[str, MotorEntry] = {}
43
+ self._loaded = False
44
+
45
+ @property
46
+ def is_loaded(self) -> bool:
47
+ """Return True if a database has been successfully loaded."""
48
+ return self._loaded
49
+
50
+ @property
51
+ def motor_count(self) -> int:
52
+ """Return the number of motors in the database."""
53
+ return len(self._entries)
54
+
55
+ def list_motors(self) -> List[str]:
56
+ """Return sorted unique motor IDs in the database."""
57
+ return sorted(self._entries.keys())
58
+
59
+ def get(self, motor_id: str) -> Optional[MotorEntry]:
60
+ """Get a motor entry by its unique ID."""
61
+ return self._entries.get(motor_id)
62
+
63
+ def load(self, data_dir: Path) -> bool:
64
+ """Load all motor JSON entries from a dataset directory."""
65
+ data_dir = Path(data_dir)
66
+ if not data_dir.exists():
67
+ self._loaded = False
68
+ return False
69
+
70
+ self._entries.clear()
71
+
72
+ # Recursively search for and load all .json files under the directory
73
+ for json_path in sorted(data_dir.glob("**/*.json")):
74
+ self.load_entry(json_path)
75
+
76
+ self._loaded = bool(self._entries)
77
+ return self._loaded
78
+
79
+ def load_entry(self, json_path: Path) -> Optional[MotorEntry]:
80
+ """Load a single motor JSON file and store its entry."""
81
+ json_path = Path(json_path)
82
+ if not json_path.exists():
83
+ return None
84
+ try:
85
+ with open(json_path, "r", encoding="utf-8") as f:
86
+ m = json.load(f)
87
+
88
+ entry = MotorEntry(
89
+ id=m.get("id", ""),
90
+ name=m.get("name", "Unknown"),
91
+ manufacturer=m.get("manufacturer", "Unknown"),
92
+ kv=float(m.get("kv", 0.0)),
93
+ resistance=float(m.get("resistance", 0.0)),
94
+ io=float(m.get("io", 0.0)),
95
+ max_current=float(m.get("max_current", 0.0)),
96
+ weight_g=float(m.get("weight_g", 0.0)),
97
+ max_power=float(m.get("max_power", 0.0)),
98
+ io_voltage=float(m.get("io_voltage", 10.0)),
99
+ )
100
+ if entry.id:
101
+ self._entries[entry.id] = entry
102
+ self._loaded = True
103
+ return entry
104
+ except Exception:
105
+ pass
106
+ return None
107
+
108
+ def search(
109
+ self,
110
+ min_kv: Optional[float] = None,
111
+ max_kv: Optional[float] = None,
112
+ min_max_current: Optional[float] = None,
113
+ min_weight: Optional[float] = None,
114
+ max_weight: Optional[float] = None,
115
+ ) -> List[MotorEntry]:
116
+ """Search and filter motors in the database matching specified criteria."""
117
+ results = []
118
+ for entry in self._entries.values():
119
+ if min_kv is not None and entry.kv < min_kv:
120
+ continue
121
+ if max_kv is not None and entry.kv > max_kv:
122
+ continue
123
+ if min_max_current is not None and entry.max_current < min_max_current:
124
+ continue
125
+ if min_weight is not None and entry.weight_g < min_weight:
126
+ continue
127
+ if max_weight is not None and entry.weight_g > max_weight:
128
+ continue
129
+ results.append(entry)
130
+ return results
@@ -0,0 +1,3 @@
1
+ """OpenMDAO integration components for PyThrust."""
2
+
3
+ from .components import PropulsionComponent # noqa: F401
@@ -0,0 +1,103 @@
1
+ """OpenMDAO wrapper component for PyThrust propulsion solver."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import math
6
+ import openmdao.api as om
7
+
8
+ from pythrust.propellers.database import PropellerEntry
9
+ from pythrust.propulsion import (
10
+ BatterySpec,
11
+ MotorSpec,
12
+ PropellerSpec,
13
+ PropulsionSolver,
14
+ SystemSpec,
15
+ )
16
+
17
+
18
+ class PropulsionComponent(om.ExplicitComponent):
19
+ """OpenMDAO ExplicitComponent wrapping the PyThrust propulsion solver."""
20
+
21
+ def initialize(self) -> None:
22
+ self.options.declare(
23
+ 'prop_entry',
24
+ types=PropellerEntry,
25
+ desc='PropellerEntry database object',
26
+ )
27
+
28
+ def setup(self) -> None:
29
+ # Inputs
30
+ self.add_input('kv_rpm_per_v', val=860.0, desc='Motor Kv [RPM/V]')
31
+ self.add_input('resistance_ohm', val=0.0258, desc='Motor winding resistance [ohm]')
32
+ self.add_input('no_load_current_a', val=1.3, desc='Motor no-load current [A]')
33
+ self.add_input('current_max_a', val=65.0, desc='Motor maximum current [A]')
34
+
35
+ self.add_input('voltage_v', val=14.8, desc='Battery pack voltage [V]')
36
+ self.add_input('discharge_efficiency', val=1.0, desc='Battery discharge efficiency')
37
+
38
+ self.add_input('resistance_system_ohm', val=0.095, desc='Lumped system transmission resistance [ohm]')
39
+ self.add_input('diameter_m', val=0.3302, desc='Propeller diameter [m]')
40
+ self.add_input('throttle', val=0.7, desc='Throttle fraction [0, 1]')
41
+
42
+ self.add_input('rho', val=1.225, desc='Air density [kg/m^3]')
43
+ self.add_input('airspeed_mps', val=0.0, desc='Flight airspeed [m/s]')
44
+
45
+ # Outputs
46
+ self.add_output('rpm', val=5000.0, desc='Equilibrium shaft speed [RPM]')
47
+ self.add_output('thrust_n', val=10.0, desc='Generated static/dynamic thrust [N]')
48
+ self.add_output('torque_nm', val=0.2, desc='Propeller shaft torque [N-m]')
49
+ self.add_output('battery_current_a', val=15.0, desc='Battery DC current draw [A]')
50
+ self.add_output('battery_power_w', val=220.0, desc='Battery power consumption [W]')
51
+ self.add_output('motor_current_a', val=15.0, desc='Motor winding current [A]')
52
+ self.add_output('motor_voltage_v', val=12.0, desc='Motor terminal voltage [V]')
53
+ self.add_output('is_feasible', val=1.0, desc='1.0 if feasible, 0.0 otherwise')
54
+
55
+ # Declare derivatives using finite-difference
56
+ self.declare_partials(of='*', wrt='*', method='fd')
57
+
58
+ def _get_specs(self, inputs: om.Vector) -> tuple[MotorSpec, BatterySpec, SystemSpec, PropellerSpec]:
59
+ motor = MotorSpec(
60
+ kv_rpm_per_v=float(inputs['kv_rpm_per_v'][0]),
61
+ resistance_ohm=float(inputs['resistance_ohm'][0]),
62
+ no_load_current_a=float(inputs['no_load_current_a'][0]),
63
+ current_max_a=float(inputs['current_max_a'][0]),
64
+ )
65
+ battery = BatterySpec(
66
+ voltage_v=float(inputs['voltage_v'][0]),
67
+ discharge_efficiency=float(inputs['discharge_efficiency'][0]),
68
+ )
69
+ system = SystemSpec(
70
+ resistance_ohm=float(inputs['resistance_system_ohm'][0]),
71
+ )
72
+ propeller = PropellerSpec(
73
+ diameter_m=float(inputs['diameter_m'][0]),
74
+ )
75
+ return motor, battery, system, propeller
76
+
77
+ def compute(self, inputs: om.Vector, outputs: om.Vector) -> None:
78
+ motor, battery, system, propeller = self._get_specs(inputs)
79
+ prop_entry = self.options['prop_entry']
80
+ throttle = float(inputs['throttle'][0])
81
+ rho = float(inputs['rho'][0])
82
+ airspeed_mps = float(inputs['airspeed_mps'][0])
83
+
84
+ solver = PropulsionSolver()
85
+ op = solver.solve_operating_point(
86
+ motor=motor,
87
+ battery=battery,
88
+ system=system,
89
+ propeller=propeller,
90
+ prop_entry=prop_entry,
91
+ rho=rho,
92
+ airspeed_mps=airspeed_mps,
93
+ throttle=throttle,
94
+ )
95
+
96
+ outputs['rpm'] = op.rpm
97
+ outputs['thrust_n'] = op.thrust_n
98
+ outputs['torque_nm'] = op.torque_nm
99
+ outputs['battery_current_a'] = op.battery_power_w / max(1e-6, battery.voltage_v)
100
+ outputs['battery_power_w'] = op.battery_power_w
101
+ outputs['motor_current_a'] = op.motor_current_a
102
+ outputs['motor_voltage_v'] = op.motor_voltage_v
103
+ outputs['is_feasible'] = 1.0 if op.is_feasible else 0.0
@@ -0,0 +1,8 @@
1
+ """Propeller database and lookup utilities."""
2
+
3
+ from .database import ( # noqa: F401
4
+ PropellerDataPoint,
5
+ PropellerEntry,
6
+ PropellerMetadata,
7
+ PropellerDatabase,
8
+ )