Implementing decrease in mass

98 views
Skip to first unread message

adrian....@gmail.com

unread,
May 16, 2016, 6:30:10 AM5/16/16
to SUAVE FORUM
Hi,

SUAVE is a really exciting tool!

Is it possible to implement a constant decrease in mass (e.g. 5kg/s) during one of the mission segments in SUAVE? I need it for experimenting with a 'sprayer' aircraft.

Thanks for your help! I would really appreciate a quick response.


Emilio

unread,
May 16, 2016, 11:11:48 AM5/16/16
to SUAVE FORUM
Hi,
I am glad you think SUAVE is exciting, we do too.

It is possible to implement a constant decrease in mass for one mission segment. The process is actually kind of simple, I'm going to give you all the code you need here. This is just a copy things already in SUAVE, just a modified version for you.

In every mission segment there is a method that integrates the vehicle mass rate. We'll copy that method first and modify it to add the sprayer in:

import numpy as np

def update_weights_sprayer(segment,state):
    
    # unpack
    conditions = state.conditions
    m0        = conditions.weights.total_mass[0,0]
    m_empty   = segment.analyses.weights.mass_properties.operating_empty
    mdot_fuel = conditions.weights.vehicle_mass_rate
    I         = state.numerics.time.integrate
    g         = conditions.freestream.gravity
    
    # Add in the sprayer mass rate
    sprayer   = segment.sprayer_rate
    mdot      = mdot_fuel + sprayer

    # calculate
    m = m0 + np.dot(I, -mdot )

    # weight
    W = m*g

    # pack
    conditions.weights.total_mass[1:,0]                  = m[1:,0] # don't mess with m0
    conditions.frames.inertial.gravity_force_vector[:,2] = W[:,0]

    return

Now to setup the segment you want to add the sprayer in. Here is an example for a cruise segment taken from our B737 tutorial:

    # ------------------------------------------------------------------    
    #   Cruise Segment: constant speed, constant altitude
    # ------------------------------------------------------------------    

    segment = Segments.Cruise.Constant_Speed_Constant_Altitude(base_segment)
    segment.tag = "cruise"

    segment.analyses.extend( analyses.cruise )

    segment.air_speed  = 230.412 * Units['m/s']
    segment.distance   = (3933.65 + 770 - 92.6) * Units.km
    segment.altitude   = 10.668 * Units.km
    
    segment.process.iterate.conditions.weights = update_weights_sprayer
    segment.sprayer_rate = 5. * Units['kg/s']

    # add to mission
    mission.append_segment(segment)

Just make sure to import your sprayer method at the top of the script, or put it in the B737 file.

Let me know if you have trouble. I got this to work on my computer. Haha, although with that mass rate the B737 finishes cruise with negative mass.

-Emilio

adrian....@gmail.com

unread,
May 16, 2016, 11:24:25 AM5/16/16
to SUAVE FORUM
Thanks for your answer! 

Would it be also possible to exclude the sprayed amount from the fuel burned? Or in other words - how to calculate the fuel burned if mdot also includes the ejected mass?

Emilio

unread,
May 16, 2016, 1:42:16 PM5/16/16
to SUAVE FORUM
Alright so as I see it you want to bookkeep the fuel burn and spray separately? Let me know if that's right.

I've modified the method again. One cool thing to notice is that the spray rate needs to be made into a vector before it can be integrated. I think the way we integrate in SUAVE, as done here, is a neat feature.

import numpy as np

def update_weights_sprayer(segment,state):
    
    # unpack
    conditions = state.conditions
    m0        = conditions.weights.total_mass[0,0]
    m_empty   = segment.analyses.weights.mass_properties.operating_empty
    mdot_fuel = conditions.weights.vehicle_mass_rate
    I         = state.numerics.time.integrate
    g         = conditions.freestream.gravity
    
    # Add in the sprayer mass rate
    sprayer   = segment.sprayer_rate * state.ones_row(1)
    
    # Integrate the masses
    fuel  = np.dot(I, mdot_fuel )
    spray = np.dot(I, sprayer )

    # calculate
    m = m0 - fuel - spray

    # weight
    W = m*g

    # pack
    conditions.weights.total_mass[1:,0]                  = m[1:,0] # don't mess with m0
    conditions.frames.inertial.gravity_force_vector[:,2] = W[:,0]
    
    # pack sprayer mass and fuel burn
    conditions.weights.fuel_burn = fuel
    conditions.weights.spray     = spray

    return


The mass of the fuel burn and the spray will be saved to conditions. Just keep in mind this data is only available to this segment.

Lukáš Smilek

unread,
May 23, 2025, 4:53:59 AMMay 23
to SUAVE FORUM
Hi Adrian, Hey Emilio!

I do struggle with a excessive fuel combustion in my analysis with rocket and ramjet engine and I wanted to use this trick to switch off fuel consumption, but I do get and error AttributeError: 'Weights_UAV' object has no attribute 'mass_properties' as this segment is called before weights can be set and analyzed:

def main():
# # Setup a vehicle
# vehicle = vehicle_setup()
#
# # export the vehicle
# write(vehicle, 'UAV_VTOL')

configs, analyses = full_setup() 
# <--- snippet called within here

configs.finalize()
analyses.finalize()  

# weight analysis
weights = analyses.configs.base.weights
breakdown = weights.evaluate()  
# <--- mass distribution estimated only here

# mission analysis
mission = analyses.missions.base
results = mission.evaluate()

plot_mission(results)

plt.show()

return

Or have I understood wrong where to call this?

Thank you!
Dne pondělí 16. května 2016 v 19:42:16 UTC+2 uživatel Emilio napsal:
Reply all
Reply to author
Forward
0 new messages