Mass measures an object's inertia and its contribution to gravitational interactions. In a rocket model, it is the quantity that determines how much the vehicle accelerates under engine thrust. section 8.5
Rocket modeling starts with a mass budget: estimate propellant needs, payload capacity, and travel distance before adding details about instruments, batteries, or solar cells. section 8.5
A useful rocket mass model separates:
- Dry mass: the mass of an empty propellant tank. section 8.1
- Propellant mass: the propellant currently remaining. section 8.1
- Total mass: the tank's dry mass plus its remaining propellant. section 8.1
- Rocket mass: the combined mass of payload, tank, engine, and other modeled components. section 8.5 section 8.1
Updating mass as propellant is consumed
A SmallTank initialized with 50 units of propellant returns 40 after consuming 10, then 30 after consuming another 10. Refilling restores its propellant to 370 units, so its mass changes with tank state. section 8.1
Listing 8.5 Adding propellant tank abilities and behavior
# Accessors (setters and getters)
propellant(tank::Tank) = tank.propellant #1
function propellant!(tank::Tank, amount::Real) #1
tank.propellant = amount
end
isempty(tank::Tank) = tank.propellant <= 0 #2
mass(tank::Tank) = drymass(tank) + propellant(tank) #3
# Actions
function refill!(tank::Tank) #4
propellant!(tank, totalmass(tank) - drymass(tank))
tank #5
end
function consume!(tank::Tank, amount::Real) #6
remaining = max(propellant(tank) - amount, 0)
propellant!(tank, remaining)
remaining
end
Inspect the Julia implementation that computes tank mass from drymass(tank) + propellant(tank), alongside refill and consume behavior. section 8.1
