Feat: Add ClusterMotor class and inertia tools
Pull request type
- [x] Code changes (bugfix, features)
- [x] Code maintenance (refactoring, formatting, tests)
- [ ] ReadMe, Docs and GitHub updates
- [ ] Other (please describe):
Checklist
- [ ] Tests for the changes have been added (if needed)
- [x] Docs have been reviewed and added / updated
- [x] Lint (
black rocketpy/ tests/) has passed locally - [ ] All tests (
pytest tests -m slow --runslow) have passed locally - [ ]
CHANGELOG.mdhas been updated (if relevant)
Current behavior
Currently, RocketPy only supports attaching a single Motor object to a Rocket. Users wishing to simulate a cluster configuration must manually aggregate thrust curves and mass properties externally before creating a generic motor instance, which is cumbersome and less accurate regarding geometry.
New behavior
This PR introduces the ClusterMotor class in rocketpy/motors/cluster_motor.py.
Key features:
- Aggregation: The class accepts a list of
Motorobjects, their positions, and optional orientations. - Mass & Thrust: It automatically computes the total propellant mass, dry mass, and total thrust vector (scalar sum for now) as functions of time.
- Geometry: It computes the global Center of Mass (CoM) and Center of Propellant Mass (CoPM) of the cluster.
- Tools: I have added the necessary mathematical helper functions (Parallel Axis Theorem for moments and products of inertia) in
rocketpy/tools.pyto support future advanced inertia calculations.
Breaking change
- [ ] Yes
- [x] No
Additional information
Note to reviewers regarding Inertia:
I have already implemented the necessary Parallel Axis Theorem functions in rocketpy/tools.py within this PR. The full integration of these tools into ClusterMotor (to calculate the full inertia tensor dynamically) is planned for a dedicated follow-up PR immediately after this one is merged.
This incremental approach ensures the basic structure is validated before adding mathematical complexity.