Skip to content

Commit ed1b0c9

Browse files
Merge branch 'enh/liquid-motors' into enh/liquid_motors_mass_flow_based_tank
2 parents 32664e7 + 542aba2 commit ed1b0c9

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

rocketpy/motors/LiquidMotor.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,24 @@ def __init__(
3131
pass
3232

3333
def evaluateMassFlowRate(self):
34-
pass
34+
massFlowRate = 0
35+
36+
for tank in self.tanks:
37+
massFlowRate += tank.get("tank").netMassFlowRate
38+
39+
return massFlowRate
3540

3641
def evaluateCenterOfMass(self):
37-
pass
42+
totalMass = 0
43+
massBalance = 0
44+
45+
for tankElement in self.tanks:
46+
tank = tankElement.get("tank")
47+
tankPosition = tankElement.get("position")
48+
totalMass += tank.mass
49+
massBalance += tank.mass * (tankPosition + tank.centerOfMass)
50+
51+
return massBalance / totalMass
3852

3953
def evaluateInertiaTensor(self):
4054
pass
@@ -176,7 +190,7 @@ def centerOfMass(self, t):
176190
+ self.cylinder.filled_centroid * cylinderMass
177191
+ self.upperCap.filled_centroid * upperCapMass
178192
) / (bottomCapMass + cylinderMass + upperCapMass)
179-
193+
180194
return centerOfMass
181195

182196
def inertiaTensor(self, t):
@@ -205,7 +219,7 @@ def inertiaTensor(self, t):
205219

206220
# fluids considered inviscid so no shear resistance from torques in z axis
207221
self.inertiaZ = 0
208-
222+
209223
return self.inertiaI, self.inertiaZ
210224

211225

0 commit comments

Comments
 (0)