diff --git a/.gitignore b/.gitignore index f7acbbb..2eb6b5d 100644 --- a/.gitignore +++ b/.gitignore @@ -251,6 +251,6 @@ $RECYCLE.BIN/ **.html # Command sequences -*.fmu +#*.fmu # End of https://www.gitignore.io/api/git,linux,macos,python,windows,pycharm,jupyternotebook diff --git a/rocket_twin/systems/__init__.py b/rocket_twin/systems/__init__.py index b793440..e65d754 100644 --- a/rocket_twin/systems/__init__.py +++ b/rocket_twin/systems/__init__.py @@ -4,7 +4,7 @@ StageControllerCoSApp, StageControllerFMU, StationControllerCoSApp, - StationControllerFMU + StationControllerFMU, ) from rocket_twin.systems.engine import Engine, EngineGeom, EnginePerfo from rocket_twin.systems.ground import Ground diff --git a/rocket_twin/systems/control/rocket_controller/rocket_controller.fmu b/rocket_twin/systems/control/rocket_controller/rocket_controller.fmu index 6473c43..383e5ee 100644 Binary files a/rocket_twin/systems/control/rocket_controller/rocket_controller.fmu and b/rocket_twin/systems/control/rocket_controller/rocket_controller.fmu differ diff --git a/rocket_twin/systems/control/stage_controller.mo b/rocket_twin/systems/control/stage_controller.mo index ded3008..4e1fa1b 100644 --- a/rocket_twin/systems/control/stage_controller.mo +++ b/rocket_twin/systems/control/stage_controller.mo @@ -7,4 +7,4 @@ equation else w = 0.; end if; -end stage_controller; \ No newline at end of file +end stage_controller; diff --git a/rocket_twin/systems/control/stage_controller/stage_controller.fmu b/rocket_twin/systems/control/stage_controller/stage_controller.fmu new file mode 100644 index 0000000..c21fc06 Binary files /dev/null and b/rocket_twin/systems/control/stage_controller/stage_controller.fmu differ diff --git a/rocket_twin/systems/control/stage_controller_fmu.py b/rocket_twin/systems/control/stage_controller_fmu.py index e6f523b..73d783c 100644 --- a/rocket_twin/systems/control/stage_controller_fmu.py +++ b/rocket_twin/systems/control/stage_controller_fmu.py @@ -38,7 +38,7 @@ def setup(self, model_path, model_name): fmu_path = self.create_fmu(model_path, model_name) self.add_child( FMUSystem("fmu_controller", fmu_path=fmu_path), - pulling=['is_on', 'w'], + pulling=["is_on", "w"], ) self.add_event("full", trigger="weight_prop == weight_max") @@ -74,4 +74,4 @@ def create_fmu(self, model_path, model_name): if filename != (model_name + ".fmu"): os.remove(filename) - return fmu \ No newline at end of file + return fmu diff --git a/rocket_twin/systems/control/station_controller.mo b/rocket_twin/systems/control/station_controller.mo index 3033412..05f7cbe 100644 --- a/rocket_twin/systems/control/station_controller.mo +++ b/rocket_twin/systems/control/station_controller.mo @@ -7,4 +7,4 @@ equation else w = 0.; end if; -end station_controller; \ No newline at end of file +end station_controller; diff --git a/rocket_twin/systems/control/station_controller/station_controller.fmu b/rocket_twin/systems/control/station_controller/station_controller.fmu new file mode 100644 index 0000000..e11d187 Binary files /dev/null and b/rocket_twin/systems/control/station_controller/station_controller.fmu differ diff --git a/rocket_twin/systems/control/station_controller_fmu.py b/rocket_twin/systems/control/station_controller_fmu.py index 0423da6..096a029 100644 --- a/rocket_twin/systems/control/station_controller_fmu.py +++ b/rocket_twin/systems/control/station_controller_fmu.py @@ -30,7 +30,7 @@ def setup(self, model_path, model_name): fmu_path = self.create_fmu(model_path, model_name) self.add_child( FMUSystem("fmu_controller", fmu_path=fmu_path), - pulling=['fueling', 'w'], + pulling=["fueling", "w"], ) def create_fmu(self, model_path, model_name): @@ -64,4 +64,4 @@ def create_fmu(self, model_path, model_name): if filename != (model_name + ".fmu"): os.remove(filename) - return fmu \ No newline at end of file + return fmu diff --git a/rocket_twin/systems/rocket/rocket.py b/rocket_twin/systems/rocket/rocket.py index 9ef152a..dc5c585 100644 --- a/rocket_twin/systems/rocket/rocket.py +++ b/rocket_twin/systems/rocket/rocket.py @@ -60,7 +60,7 @@ def setup(self, n_stages=1): self.add_child( RocketControllerCoSApp("controller", n_stages=n_stages), execution_index=0, - pulling=["flying"] + pulling=["flying"], ) self.add_child(OCCGeometry("geom", shapes=shapes, properties=properties)) self.add_child(Dynamics("dyn", forces=forces, weights=["weight_rocket"]), pulling=["a"]) diff --git a/rocket_twin/tests/test_controller_cosapp.py b/rocket_twin/tests/test_controller_cosapp.py index 697b46d..1920ec6 100644 --- a/rocket_twin/tests/test_controller_cosapp.py +++ b/rocket_twin/tests/test_controller_cosapp.py @@ -7,6 +7,7 @@ class TestControllerCosapp: """Tests for the cosapp controller.""" + def test_run_once(self): sys = Station("sys", n_stages=3) diff --git a/rocket_twin/tests/test_controller_fmu.py b/rocket_twin/tests/test_controller_fmu.py index 8d018c2..68ea07c 100644 --- a/rocket_twin/tests/test_controller_fmu.py +++ b/rocket_twin/tests/test_controller_fmu.py @@ -3,11 +3,17 @@ from cosapp.recorders import DataFrameRecorder from cosapp.utils import swap_system -from rocket_twin.systems import StageControllerFMU, StationControllerFMU, RocketControllerFMU, Station +from rocket_twin.systems import ( + RocketControllerFMU, + StageControllerFMU, + Station, + StationControllerFMU, +) class TestControllerFMU: """Tests for the FMU controller.""" + def test_controller_fmu(self): n_stages = 3 @@ -38,7 +44,7 @@ def test_controller_fmu(self): StageControllerFMU("controller", model_path=model_path_s, model_name=model_name_s), ) - driver = sys.add_driver(RungeKutta(order=4, time_interval=[0, 35], dt=1.)) + driver = sys.add_driver(RungeKutta(order=4, time_interval=[0, 35], dt=1.0)) driver.add_child(NonLinearSolver("solver")) init = { "g_tank.fuel.weight_p": 20.0, diff --git a/rocket_twin/tests/test_drivers.py b/rocket_twin/tests/test_drivers.py index f6a5f84..af98b18 100644 --- a/rocket_twin/tests/test_drivers.py +++ b/rocket_twin/tests/test_drivers.py @@ -11,7 +11,7 @@ class TestDrivers: sys = Station("sys") def test_fuel(self): - dt = 1. + dt = 1.0 init = { "rocket.stage_1.tank.fuel.weight_p": 0.0, diff --git a/rocket_twin/tests/test_engine.py b/rocket_twin/tests/test_engine.py index 21df550..e4350da 100644 --- a/rocket_twin/tests/test_engine.py +++ b/rocket_twin/tests/test_engine.py @@ -6,6 +6,7 @@ class TestEngine: """Tests for the engine model.""" + def test_run_once(self): sys = Engine("sys") diff --git a/rocket_twin/tests/test_geometry.py b/rocket_twin/tests/test_geometry.py index 4544fcb..c745ec9 100644 --- a/rocket_twin/tests/test_geometry.py +++ b/rocket_twin/tests/test_geometry.py @@ -9,6 +9,7 @@ class TestGeometry: """Tests for the geometry model.""" + def test_structure(self): sys = OCCGeometry("sys", shapes=["cylinder_s", "cone_s"], properties=["cylinder", "cone"]) diff --git a/rocket_twin/tests/test_mission.py b/rocket_twin/tests/test_mission.py index b069217..f6b7323 100644 --- a/rocket_twin/tests/test_mission.py +++ b/rocket_twin/tests/test_mission.py @@ -9,7 +9,7 @@ class TestMission: def test_run_once(self): sys = Station("sys") - dt = 1. + dt = 1.0 init = { "rocket.stage_1.tank.fuel.weight_p": 0.0, diff --git a/rocket_twin/tests/test_station.py b/rocket_twin/tests/test_station.py index 4c80e56..ab65482 100644 --- a/rocket_twin/tests/test_station.py +++ b/rocket_twin/tests/test_station.py @@ -6,6 +6,7 @@ class TestStation: """Tests for the station model.""" + def test_run_once(self): sys = Station("sys")