Skip to content

Commit

Permalink
Modular ground class, pre-commit, typos
Browse files Browse the repository at this point in the history
  • Loading branch information
luca7084 committed Jun 28, 2023
1 parent bf547e7 commit 1270e47
Show file tree
Hide file tree
Showing 37 changed files with 294 additions and 276 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
max-line-length=100
extend-ignore=E203,D104,D100,I004
exclude=*/tests/*,docs/source/tools/*
exclude=*/tests/*,docs/source/tools/*
2 changes: 1 addition & 1 deletion .github/workflows/commit-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
- name: Test with pytest
run: |
pytest
pytest
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,4 @@ $RECYCLE.BIN/
# Cosapp Systems representations
**.html

# End of https://www.gitignore.io/api/git,linux,macos,python,windows,pycharm,jupyternotebook
# End of https://www.gitignore.io/api/git,linux,macos,python,windows,pycharm,jupyternotebook
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ known_third_party=pybind11,conda,conda_env
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
use_parentheses=True
2 changes: 1 addition & 1 deletion AUTHORS.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Luca Rodrigues Miguel
Luca Rodrigues Miguel
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Copyright (c) 2022, twiinIT - All Rights Reserved
Unauthorized copying and/or distribution of this source-code, via any medium
is strictly prohibited without the express permission of twiinIT.

Proprietary and confidential.
Proprietary and confidential.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ include README.md

recursive-exclude tests *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
recursive-exclude * *.py[co]
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ This library was built with CoSApp, an open source framework allowing complex sy

## Getting Started

After cloning the repository thanks to
After cloning the repository thanks to
```bash
git clone https://github.com/twiinIT/rocket-twin.git
```

install the dependencies via
install the dependencies via

```bash
pip install -r requirements.txt
```

## How to use

In order to use the graphic interface, move to the UI directory
In order to use the graphic interface, move to the UI directory
and browse the jupyter notebook `user_interface.ipynb`.

## Overview
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ profile = "black"
[tool.pytest.ini_options]
pythonpath = [
"."
]
]
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ pytest
flake8
isort
black
pre-commit
pre-commit
4 changes: 2 additions & 2 deletions rocket_twin/drivers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from rocket_twin.drivers.fuelling_rocket import FuellingRocket
from rocket_twin.drivers.fueling_rocket import FuelingRocket
from rocket_twin.drivers.mission import Mission
from rocket_twin.drivers.vertical_flying_rocket import VerticalFlyingRocket

__all__ = ["FuellingRocket", "VerticalFlyingRocket", "Mission"]
__all__ = ["FuelingRocket", "VerticalFlyingRocket", "Mission"]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,23 @@
from cosapp.systems import System


class FuellingRocket(Driver):
class FuelingRocket(Driver):
"""Driver that simulates the fueling of a rocket.
Inputs
------
name: string,
the name of the driver
w_out [kg/s]: float,
mass flow of fuel exiting the ground tank
dt [s]: float,
integration time step
owner: System,
the system that owns the driver
Outputs
------
"""
def __init__(self, name: str, w_out, dt, owner: Optional["System"] = None, **kwargs):
super().__init__(name, owner, **kwargs)

Expand All @@ -26,7 +42,9 @@ def __init__(self, name: str, w_out, dt, owner: Optional["System"] = None, **kwa

self.rk.set_scenario(init=init, stop=stop)
self.rk.add_recorder(
DataFrameRecorder(includes=["rocket.dyn.a", "g_tank.weight", "rocket.tank.weight_p"], hold=True),
DataFrameRecorder(
includes=["rocket.dyn.a", "g_tank.weight", "rocket.tank.weight_p"], hold=True
),
period=dt,
)
self.data = None
Expand Down
27 changes: 22 additions & 5 deletions rocket_twin/drivers/mission.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,35 @@
from cosapp.drivers import Driver
from cosapp.systems import System

from rocket_twin.drivers.fuelling_rocket import FuellingRocket
from rocket_twin.drivers.fueling_rocket import FuelingRocket
from rocket_twin.drivers.vertical_flying_rocket import VerticalFlyingRocket


class Mission(Driver):
def __init__(
self, name: str, w_in, w_out, dt, owner: Optional["System"] = None, **kwargs
):
"""Driver that simulates the fueling and the vertical flight of a rocket.
Inputs
------
name: string,
the name of the driver
w_in [kg/s]: float,
mass flow of fuel entering the rocket tank during refueling
w_out [kg/s]: float,
mass flow of fuel exiting the rocket tank during flight
dt [s]: float,
integration time step
owner: System,
the system that owns the driver
Outputs
------
"""

def __init__(self, name: str, w_in, w_out, dt, owner: Optional["System"] = None, **kwargs):
super().__init__(name, owner, **kwargs)

# Fuelling
self.add_child(FuellingRocket("fuelling", w_out=w_in, dt=dt, owner=owner))
self.add_child(FuelingRocket("fuelling", w_out=w_in, dt=dt, owner=owner))

# Flying
self.add_child(VerticalFlyingRocket("flying", w_out=w_out, dt=dt, owner=owner))
Expand Down
21 changes: 20 additions & 1 deletion rocket_twin/drivers/vertical_flying_rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@


class VerticalFlyingRocket(Driver):
"""Driver that simulates the vertical flight of a rocket.
Inputs
------
name: string,
the name of the driver
w_out [kg/s]: float,
mass flow of fuel exiting the rocket tank
dt [s]: float,
integration time step
owner: System,
the system that owns the driver
Outputs
------
"""

def __init__(self, name: str, w_out, dt, owner: Optional["System"] = None, **kwargs):
super().__init__(name, owner, **kwargs)

Expand All @@ -26,7 +43,9 @@ def __init__(self, name: str, w_out, dt, owner: Optional["System"] = None, **kwa

self.rk.set_scenario(init=init, stop=stop)
self.rk.add_recorder(
DataFrameRecorder(includes=["rocket.dyn.a", "g_tank.weight", "rocket.tank.weight_p"], hold=True),
DataFrameRecorder(
includes=["rocket.dyn.a", "g_tank.weight", "rocket.tank.weight_p"], hold=True
),
period=dt,
)
self.data = None
Expand Down
163 changes: 0 additions & 163 deletions rocket_twin/notebooks/test_design_method.ipynb

This file was deleted.

6 changes: 3 additions & 3 deletions rocket_twin/notebooks/test_sequences.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"metadata": {},
"outputs": [],
"source": [
"from rocket_twin.systems import Ground\n",
"from rocket_twin.systems import Station\n",
"from rocket_twin.utils import run_sequences"
]
},
Expand All @@ -20,7 +20,7 @@
"source": [
"#System creation\n",
"\n",
"sys = Ground('sys')"
"sys = Station('sys')"
]
},
{
Expand Down Expand Up @@ -180,7 +180,7 @@
"source": [
"#Creates a second system to check behaviour when all sequences are executed together\n",
"\n",
"sys2 = Ground('sys2')"
"sys2 = Station('sys2')"
]
},
{
Expand Down
Loading

0 comments on commit 1270e47

Please sign in to comment.