Skip to content

Commit 18f86ea

Browse files
fixes faulty motor kind association on service layer
1 parent 2dcd980 commit 18f86ea

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

lib/services/flight.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
from rocketpy.simulation.flight import Flight as RocketPyFlight
66
from rocketpy.utilities import get_instance_attributes
77

8-
from lib.models.flight import Flight
98
from lib.services.environment import EnvironmentService
109
from lib.services.rocket import RocketService
11-
from lib.views.flight import FlightSummary
10+
from lib.views.flight import FlightSummary, FlightView
1211

1312

1413
class FlightService:
@@ -18,7 +17,7 @@ def __init__(self, flight: RocketPyFlight = None):
1817
self._flight = flight
1918

2019
@classmethod
21-
def from_flight_model(cls, flight: Flight) -> Self:
20+
def from_flight_model(cls, flight: FlightView) -> Self:
2221
"""
2322
Get the rocketpy flight object.
2423

lib/services/motor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
TankGeometry,
1616
)
1717

18-
from lib.models.motor import Motor, MotorKinds, TankKinds
19-
from lib.views.motor import MotorSummary
18+
from lib.models.motor import MotorKinds, TankKinds
19+
from lib.views.motor import MotorSummary, MotorView
2020

2121

2222
class MotorService:
@@ -26,7 +26,7 @@ def __init__(self, motor: RocketPyMotor = None):
2626
self._motor = motor
2727

2828
@classmethod
29-
def from_motor_model(cls, motor: Motor) -> Self:
29+
def from_motor_model(cls, motor: MotorView) -> Self:
3030
"""
3131
Get the rocketpy motor object.
3232
@@ -46,7 +46,7 @@ def from_motor_model(cls, motor: Motor) -> Self:
4646
"reshape_thrust_curve": False or motor.reshape_thrust_curve,
4747
}
4848

49-
match motor.motor_kind:
49+
match MotorKinds(motor.selected_motor_kind):
5050
case MotorKinds.LIQUID:
5151
rocketpy_motor = LiquidMotor(**motor_core)
5252
case MotorKinds.HYBRID:

lib/services/rocket.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
from rocketpy.utilities import get_instance_attributes
1515

1616
from lib import logger
17-
from lib.models.rocket import Rocket, Parachute
17+
from lib.models.rocket import Parachute
1818
from lib.models.aerosurfaces import NoseCone, Tail, Fins
1919
from lib.services.motor import MotorService
20-
from lib.views.rocket import RocketSummary
20+
from lib.views.rocket import RocketView, RocketSummary
2121

2222

2323
class RocketService:
@@ -27,7 +27,7 @@ def __init__(self, rocket: RocketPyRocket = None):
2727
self._rocket = rocket
2828

2929
@classmethod
30-
def from_rocket_model(cls, rocket: Rocket) -> Self:
30+
def from_rocket_model(cls, rocket: RocketView) -> Self:
3131
"""
3232
Get the rocketpy rocket object.
3333

0 commit comments

Comments
 (0)