Skip to content

Commit

Permalink
pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
luca7084 committed Jul 24, 2023
1 parent 1d4285b commit 7338a97
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions rocket_twin/systems/rocket/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,38 @@

from rocket_twin.systems import ControllerCoSApp, Engine, Tank


class Stage(System):
"""Model of a rocket stage.
Inputs
------
Outputs
------
force [N]: float,
thrust force
weight [kg]: float,
weight
cg [m]: float,
center of gravity
"""

def setup(self):

self.add_child(ControllerCoSApp("controller"))
self.add_child(Tank("tank"), pulling=["w_in", "weight_max", "weight_p"])
self.add_child(Engine("engine"))

self.connect(self.controller.outwards, self.tank.inwards, {"w": "w_command"})
self.connect(self.tank.outwards, self.engine.inwards, {"w_out": "w_out"})

self.add_outward("weight", 1., desc="Weight", unit='kg')
self.add_outward("cg", 1., desc="Center of gravity", unit='m')
self.add_outward("weight", 1.0, desc="Weight", unit="kg")
self.add_outward("cg", 1.0, desc="Center of gravity", unit="m")

def compute(self):

self.weight = self.tank.weight + self.engine.weight
self.cg = (self.tank.cg*self.tank.weight + self.engine.cg*self.engine.weight)/(self.weight)
self.cg = (self.tank.cg * self.tank.weight + self.engine.cg * self.engine.weight) / (
self.weight
)

0 comments on commit 7338a97

Please sign in to comment.