Пример #1
0
    def get_user_inputs(self, cpacs_path):
        """Get user input from the CPACS file

        The function 'get_user_inputs' extracts from the CPACS file the required
        input data, the code will use the default value when they are missing.

        Args:
            cpacs_path (str): Path to CPACS file

        """

        tixi = open_tixi(cpacs_path)

        description = "User geometry input"
        get_value_or_default(tixi, GEOM_XPATH + "/description", description)

        self.IS_DOUBLE_FLOOR = get_value_or_default(
            tixi, GEOM_XPATH + "/isDoubleFloor", 0)
        self.PILOT_NB = get_value_or_default(tixi, PILOTS_XPATH + "/pilotNb",
                                             2)
        self.MASS_PILOT = get_value_or_default(tixi,
                                               PILOTS_XPATH + "/pilotMass",
                                               102)
        self.MASS_CABIN_CREW = get_value_or_default(
            tixi, CAB_CREW_XPATH + "/cabinCrewMemberMass", 68)
        self.MASS_PASS = get_value_or_default(tixi, PASS_XPATH + "/passMass",
                                              105)
        self.PASS_PER_TOILET = get_value_or_default(
            tixi, PASS_XPATH + "/passPerToilet", 50)

        description = "Desired max fuel volume [m^3] and payload mass [kg]"
        get_value_or_default(tixi, ML_XPATH + "/description", description)

        self.MAX_PAYLOAD = get_value_or_default(tixi, ML_XPATH + "/maxPayload",
                                                0)
        self.MAX_FUEL_VOL = get_value_or_default(tixi,
                                                 ML_XPATH + "/maxFuelVol", 0)
        self.MASS_CARGO = get_value_or_default(
            tixi, MASSBREAKDOWN_XPATH + "/payload/mCargo/massDescription/mass",
            0.0)
        self.FUEL_DENSITY = get_value_or_default(tixi, F_XPATH + "/density",
                                                 800)
        add_uid(tixi, F_XPATH, "kerosene")

        self.TURBOPROP = get_value_or_default(tixi, PROP_XPATH + "/turboprop",
                                              False)
        self.RES_FUEL_PERC = get_value_or_default(tixi,
                                                  FUEL_XPATH + "/resFuelPerc",
                                                  0.06)

        tixi.save(cpacs_path)
Пример #2
0
def cpacs_engine_update(ui, ed, mw, cpacs_out_path):
    """ The function that update the cpacs file after the Weight_unc_main
        program.

    Args:
        mw (class): MassesWeihts class.
        ui (class): UserInputs class.
        ed (class): EngineData class.
        cpacs_out_path (str): Path of the CPACS output file.

    """

    tixi = open_tixi(cpacs_out_path)

    EN_XPATH = "/cpacs/vehicles/engines"

    if tixi.checkElement(EN_XPATH):
        tixi.removeElement(EN_XPATH)
    for e in range(0, ed.NE):

        EN_XPATH = "/cpacs/vehicles/engines/engine" + str(e + 1)
        create_branch(tixi, EN_XPATH, True)

        EN_UID = "EngineuID_" + str(e + 1)
        add_uid(tixi, EN_XPATH, EN_UID)
        tixi.createElement(EN_XPATH, "name")

        if not ed.EN_NAME[e]:
            EN_NAME = "Engine_" + str(e + 1)
            tixi.updateTextElement(EN_XPATH + "/name", EN_NAME)
        else:
            tixi.updateTextElement(EN_XPATH + "/name", ed.EN_NAME[e])

        ENA_XPATH = EN_XPATH + "/analysis/mass"
        create_branch(tixi, ENA_XPATH, False)
        add_uid(tixi, EN_XPATH, EN_UID + "_mass")
        tixi.createElement(ENA_XPATH, "mass")
        tixi.updateDoubleElement(ENA_XPATH + "/mass", ed.en_mass, "%g")

        ENT_XPATH = EN_XPATH + "/analysis"
        tixi.createElement(ENT_XPATH, "thrust00")
        tixi.updateDoubleElement(ENT_XPATH + "/thrust00", ed.max_thrust, "%g")

    tixi.save(cpacs_out_path)

    return ()
Пример #3
0
def get_data(mw, ri, cpacs_in):
    """ The function extracts from the xml file the required input data,
        the code will use the default value when they are missing.

        INPUT
        (class) mw       --Arg.: MassesWeight class updated
        (class) ri       --Arg.: RangeInput class updated
        ##======= Classes are defined in the Input_classes folder =======##

        (char) opt       --Arg.: Cpacs or input option
        (char) cpacs_in  --Arg.: Relative location of the xml file in the
                                 ToolInput folder (cpacs option) or
                                 relative location of the temp. xml file in
                                 the ToolOutput folder (input option).

        OUTPUT
        (class) mw       --Out.: MassesWeight class updated.
        (class) ri       --Out.: RangeInput class updated.
        (file) cpacs_in  --Out.: Updated cpasc file.
    """
    log.info("CPACS file path check")

    # path definition ========================================================
    # Opening CPACS file
    tixi = open_tixi(cpacs_in)

    TSPEC_PATH = "/cpacs/toolspecific/CEASIOMpy"
    W_PATH = TSPEC_PATH + "/weight"
    C_PATH = W_PATH + "/crew"
    P_PATH = C_PATH + "/pilots"
    CC_PATH = C_PATH + "/cabinCrewMembers"
    PASS_PATH = W_PATH + "/passengers"
    FMP_PATH = PASS_PATH + "/fuelMassMaxpass/mass"
    PROP_PATH = TSPEC_PATH + "/propulsion"
    RANGE_PATH = TSPEC_PATH + "/ranges"

    MASS_PATH = "/cpacs/vehicles/aircraft/model/analyses/massBreakdown"
    DM_PATH = MASS_PATH + "/designMasses"
    MTOM_PATH = DM_PATH + "/mTOM/mass"
    F_PATH = MASS_PATH + "/fuel/massDescription/mass"
    OEM_PATH = MASS_PATH + "/mOEM/massDescription/mass"
    PAY_PATH = MASS_PATH + "/payload/massDescription/mass"

    F1_PATH = "/cpacs/vehicles/fuels/fuel"
    F2_PATH = TSPEC_PATH + "/fuels"

    TSFC_PATH = PROP_PATH + "/tSFC"
    create_branch(tixi, TSFC_PATH, False)
    create_branch(tixi, RANGE_PATH, False)
    create_branch(tixi, P_PATH, False)
    create_branch(tixi, F1_PATH, False)
    create_branch(tixi, F2_PATH, False)
    add_uid(tixi, F1_PATH, "kerosene")

    # Compulsory path checks =================================================

    if not tixi.checkElement(TSPEC_PATH):
        raise Exception("Missing required toolspecific path.")
    elif not tixi.checkElement(CC_PATH + "/cabinCrewMemberNb"):
        raise Exception("Missing required cabinCrewMemberNb path.")
    elif not tixi.checkElement(MASS_PATH):
        raise Exception("Missing required massBreakdown path.")
    elif not tixi.checkElement(DM_PATH):
        raise Exception("Missing required designMasses path.")
    elif not tixi.checkElement(MTOM_PATH):
        raise Exception("Missing required mTOM/mass path.")
    elif not tixi.checkElement(F_PATH):
        raise Exception("Missing required fuel/massDescription/mass path.")
    elif not tixi.checkElement(FMP_PATH):
        raise Exception("Missing required fuelMassMaxpass/mass path.")
    elif not tixi.checkElement(OEM_PATH):
        raise Exception("Missing required mOEM/massDescription/mass path.")
    elif not tixi.checkElement(PAY_PATH):
        raise Exception("Missing required payload/massDescription/mass path.")
    else:
        log.info("All path correctly defined in the toolinput.xml file, " +
                 "beginning data extracction.")

    # Gathering data =========================================================
    #  TOOLSPECIFIC ----------------------------------------------------------
    if not tixi.checkElement(RANGE_PATH + "/lDRatio"):
        tixi.createElement(RANGE_PATH, "lDRatio")
        tixi.updateDoubleElement(RANGE_PATH + "/lDRatio", ri.LD, "%g")
    else:
        temp = tixi.getIntegerElement(RANGE_PATH + "/lDRatio")
        if temp != ri.LD and temp > 0:
            ri.LD = temp

    if not tixi.checkElement(RANGE_PATH + "/cruiseSpeed"):
        tixi.createElement(RANGE_PATH, "cruiseSpeed")
        tixi.updateDoubleElement(RANGE_PATH + "/cruiseSpeed", ri.CRUISE_SPEED,
                                 "%g")
    else:
        temp = tixi.getIntegerElement(RANGE_PATH + "/cruiseSpeed")
        if temp != ri.CRUISE_SPEED and temp > 0:
            ri.CRUISE_SPEED = temp

    if not tixi.checkElement(RANGE_PATH + "/loiterTime"):
        tixi.createElement(RANGE_PATH, "loiterTime")
        tixi.updateDoubleElement(RANGE_PATH + "/loiterTime", ri.LOITER_TIME,
                                 "%g")
    else:
        temp = tixi.getIntegerElement(RANGE_PATH + "/loiterTime")
        if temp != ri.LOITER_TIME and temp > 0:
            ri.LOITER_TIME = temp

    if not tixi.checkElement(TSPEC_PATH + "/geometry/winglet"):
        tixi.createElement(TSPEC_PATH + "/geometry", "winglet")
        tixi.updateIntegerElement(TSPEC_PATH + "/geometry/winglet", ri.WINGLET,
                                  "%i")
    else:
        temp = tixi.getIntegerElement(TSPEC_PATH + "/geometry/winglet")
        if temp != ri.WINGLET:
            ri.WINGLET = temp

    if not tixi.checkElement(P_PATH + "/pilotNb"):
        tixi.createElement(P_PATH, "pilotNb")
        tixi.updateIntegerElement(P_PATH + "/pilotNb", ri.pilot_nb, "%i")
    else:
        temp = tixi.getIntegerElement(P_PATH + "/pilotNb")
        if temp != ri.pilot_nb and temp > 0:
            ri.pilot_nb = temp

    # Pilots user input data
    if not tixi.checkElement(P_PATH + "/pilotMass"):
        tixi.createElement(P_PATH, "pilotMass")
        tixi.updateDoubleElement(P_PATH + "/pilotMass", ri.MASS_PILOT, "%g")
    else:
        temp = tixi.getDoubleElement(P_PATH + "/pilotMass")
        if temp != ri.MASS_PILOT and temp > 0:
            ri.MASS_PILOT = temp

    # Cabin crew user input data
    if not tixi.checkElement(CC_PATH + "/cabinCrewMemberMass"):
        tixi.createElement(CC_PATH, "cabinCrewMemberMass")
        tixi.updateDoubleElement(CC_PATH + "/cabinCrewMemberMass",
                                 ri.MASS_CABIN_CREW, "%g")
    else:
        temp = tixi.getDoubleElement(CC_PATH + "/cabinCrewMemberMass")
        if temp != ri.MASS_CABIN_CREW and temp > 0:
            ri.MASS_CABIN_CREW = temp

    # Passengers input
    if not tixi.checkElement(PASS_PATH + "/passMass"):
        tixi.createElement(PASS_PATH, "passMass")
        tixi.updateDoubleElement(PASS_PATH + "/passMass", ri.MASS_PASS, "%g")
    else:
        temp = tixi.getDoubleElement(PASS_PATH + "/passMass")
        if temp != ri.MASS_PASS and temp > 0:
            ri.MASS_PASS = temp

    # Propulsion and Fuel

    if not tixi.checkElement(PROP_PATH + "/turboprop"):
        create_branch(tixi, PROP_PATH, False)
        tixi.createElement(PROP_PATH, "turboprop")
        if ri.TURBOPROP:
            tixi.updateTextElement(PROP_PATH + "/turboprop", "True")
        else:
            tixi.updateTextElement(PROP_PATH + "/turboprop", "False")
    else:
        temp = tixi.getTextElement(PROP_PATH + "/turboprop")
        if temp == "False":
            ri.TURBOPROP = False
        else:
            ri.TURBOPROP = True

    if not tixi.checkElement(F2_PATH + "/resFuelPerc"):
        tixi.createElement(F2_PATH, "resFuelPerc")
        tixi.updateDoubleElement(F2_PATH + "/resFuelPerc", ri.RES_FUEL_PERC,
                                 "%g")
    else:
        temp = tixi.getDoubleElement(F2_PATH + "/resFuelPerc")
        if temp != ri.RES_FUEL_PERC and temp > 0:
            ri.RES_FUEL_PERC = temp

    if not tixi.checkElement(TSFC_PATH + "/tsfcCruise"):
        tixi.createElement(TSFC_PATH, "tsfcCruise")
        tixi.updateDoubleElement(TSFC_PATH + "/tsfcCruise", ri.TSFC_CRUISE,
                                 "%g")
    else:
        temp = tixi.getDoubleElement(TSFC_PATH + "/tsfcCruise")
        if temp != ri.TSFC_CRUISE and temp > 0:
            ri.TSFC_CRUISE = temp

    if not tixi.checkElement(TSFC_PATH + "/tsfcLoiter"):
        tixi.createElement(TSFC_PATH, "tsfcLoiter")
        tixi.updateDoubleElement(TSFC_PATH + "/tsfcLoiter", ri.TSFC_LOITER,
                                 "%g")
    else:
        temp = tixi.getDoubleElement(TSFC_PATH + "/tsfcLoiter")
        if temp != ri.TSFC_LOITER and temp > 0:
            ri.TSFC_LOITER = temp

    #  REQUIRED DATA =========================================================
    # Cabin Crew
    ri.cabin_crew_nb = tixi.getIntegerElement(CC_PATH + "/cabinCrewMemberNb")

    # Fuel
    mw.mass_fuel_maxpass = tixi.getDoubleElement(FMP_PATH)

    #  REQUIRED MASSBREAKDOWN DATA ===========================================
    mw.maximum_take_off_mass = tixi.getDoubleElement(MTOM_PATH)
    mw.operating_empty_mass = tixi.getDoubleElement(OEM_PATH)
    mw.mass_payload = tixi.getDoubleElement(PAY_PATH)
    mw.mass_fuel_max = tixi.getDoubleElement(F_PATH)

    log.info("Data from CPACS file succesfully extracted")

    # Saving and closing the cpacs file ======================================
    tixi.save(cpacs_in)

    return (mw, ri)
Пример #4
0
def get_user_inputs(ed, ui, adui, cpacs_in):
    """Function to extract from the xml file the required input data,
        the code will use the default value when they are missing.

    Function 'get_user_inputs' ...

    Args:
        ed (int): EngineData class.
        ui (class): UserInputs class
        adui (str): AdvancedInputs class.
        cpacs_in (str): Path to the CPACS file

    Returns:
        ed (int): Updated ngineData class.
        ui (class): Updated UserInputs class
        adui (str): Updated AdvancedInputs class.

    """

    log.info("Starting data extraction from CPACS file")

    tixi = open_tixi(cpacs_in)

    create_branch(tixi, FUEL_XPATH, False)
    create_branch(tixi, GEOM_XPATH, False)
    create_branch(tixi, RANGE_XPATH, False)
    create_branch(tixi, PILOTS_XPATH, False)
    create_branch(tixi, CAB_CREW_XPATH, False)
    create_branch(tixi, PASS_XPATH, False)
    create_branch(tixi, ML_XPATH, False)
    create_branch(tixi, PROP_XPATH, False)

    # cpacs/vehicles
    MC_XPATH = MASSBREAKDOWN_XPATH + "/payload/mCargo/massDescription"

    create_branch(tixi, MC_XPATH, False)
    create_branch(tixi, F_XPATH, False)
    add_uid(tixi, F_XPATH, "kerosene")

    # Gathering data =========================================================
    # Geometry ===============================================================
    if not tixi.checkElement(GEOM_XPATH + "/description"):
        tixi.createElement(GEOM_XPATH, "description")
        tixi.updateTextElement(GEOM_XPATH + "/description",
                               "User " + "geometry input")

    ui.FLOORS_NB = get_value_or_default(tixi, GEOM_XPATH + "/floorsNb",
                                        ui.FLOORS_NB)
    adui.VRT_THICK = get_value_or_default(tixi, GEOM_XPATH + "/virtualThick",
                                          0.00014263)
    adui.VRT_STR_DENSITY = get_value_or_default(tixi,
                                                GEOM_XPATH + "/virtualDensity",
                                                2700.0)
    ui.H_LIM_CABIN = get_value_or_default(tixi, GEOM_XPATH + "/cabinHeight",
                                          2.3)

    # People =================================================================
    # Pilots user input data

    adui.PILOT_NB = get_value_or_default(tixi, PILOTS_XPATH + "/pilotNb", 2)
    adui.MASS_PILOT = get_value_or_default(tixi, PILOTS_XPATH + "/pilotMass",
                                           102.0)
    adui.MASS_CABIN_CREW = get_value_or_default(
        tixi, CAB_CREW_XPATH + "/cabinCrewMemberMass", 68.0)
    adui.MASS_PASS = get_value_or_default(tixi, PASS_XPATH + "/passMass",
                                          105.0)
    adui.PASS_BASE_DENSITY = get_value_or_default(tixi,
                                                  PASS_XPATH + "/passDensity",
                                                  1.66)
    adui.PASS_PER_TOILET = get_value_or_default(tixi,
                                                PASS_XPATH + "/passPerToilet",
                                                50)

    # what to to with this input
    if tixi.checkElement(PASS_XPATH + "/passNb"):
        temp = tixi.getIntegerElement(PASS_XPATH + "/passNb")
        if temp != ui.MAX_PASS and temp > 0:
            ui.MAX_PASS = temp

    # Fuel ===================================================================
    adui.FUEL_DENSITY = get_value_or_default(tixi, F_XPATH + "/density", 800)
    adui.RES_FUEL_PERC = get_value_or_default(tixi, F_XPATH + "/resFuelPerc",
                                              0.06)

    # Weight =================================================================
    # Mass limits data
    if not tixi.checkElement(ML_XPATH + "/description"):
        tixi.createElement(ML_XPATH, "description")
        tixi.updateTextElement(
            ML_XPATH + "/description",
            "Desired max fuel " + "volume [m^3] and payload mass [kg]")

    ui.MAX_PAYLOAD = get_value_or_default(tixi, ML_XPATH + "/maxPayload", 0.0)
    ui.MAX_FUEL_VOL = get_value_or_default(tixi, ML_XPATH + "/maxFuelVol", 0.0)
    ui.MASS_CARGO = get_value_or_default(tixi, MC_XPATH + "/massCargo", 0.0)
    # If the cargo mass is defined in the UserInputs class will be added
    # in the CPACS file after the analysis.

    # Flight =================================================================

    ed.TSFC_CRUISE = get_value_or_default(tixi, PROP_XPATH + "/tSFC", 0.5)

    # TODO: These data should be taken from aeroMaps...
    if not tixi.checkElement(RANGE_XPATH + "/lDRatio"):
        tixi.createElement(RANGE_XPATH, "lDRatio")
        tixi.updateDoubleElement(RANGE_XPATH + "/lDRatio", ui.LD, "%g")
    else:
        temp = tixi.getIntegerElement(RANGE_XPATH + "/lDRatio")
        if temp != ui.LD and temp > 0:
            ui.LD = temp

    if not tixi.checkElement(RANGE_XPATH + "/cruiseSpeed"):
        tixi.createElement(RANGE_XPATH, "cruiseSpeed")
        tixi.updateDoubleElement(RANGE_XPATH + "/cruiseSpeed", ui.CRUISE_SPEED,
                                 "%g")
    else:
        temp = tixi.getIntegerElement(RANGE_XPATH + "/cruiseSpeed")
        if temp != ui.CRUISE_SPEED and temp > 0:
            ui.CRUISE_SPEED = temp

    # TODO: see how to enter input for Engines
    if not tixi.checkElement(PROP_XPATH + "/userEngineOption"):
        tixi.createElement(PROP_XPATH, "userEngineOption")
        if ui.USER_ENGINES:
            tixi.updateTextElement(PROP_XPATH + "/userEngineOption", "True")
        else:
            tixi.updateTextElement(PROP_XPATH + "/userEngineOption", "False")
    else:
        temp = tixi.getTextElement(PROP_XPATH + "/userEngineOption")
        if temp == "False":
            ui.USER_ENGINES = False
        else:
            ui.USER_ENGINES = True

    if not tixi.checkElement(PROP_XPATH + "/singleHydraulics"):
        tixi.createElement(PROP_XPATH, "singleHydraulics")
        if adui.SINGLE_HYDRAULICS:
            tixi.updateTextElement(PROP_XPATH + "/singleHydraulics", "True")
        else:
            tixi.updateTextElement(PROP_XPATH + "/singleHydraulics", "False")
    else:
        temp = tixi.getTextElement(PROP_XPATH + "/singleHydraulics")
        if temp == "False":
            adui.SINGLE_HYDRAULICS = False
        else:
            adui.SINGLE_HYDRAULICS = True

    log.info("Data from CPACS file succesfully extracted")

    tixi.save(cpacs_in)

    return (ed, ui, adui)
Пример #5
0
def cpacs_weight_update(out, mw, ui, cpacs_out_path):
    """ The function that update the cpacs file after the Weight_unc_main
        program.

    Args:
        out (class): Output class.
        mw (class): Mass and weight class.
        ui (class): UserInputs class.
        cpacs_out_path (str): Path of the output file.

    """

    tixi = open_tixi(cpacs_out_path)

    # Path definition
    MB_PATH = "/cpacs/vehicles/aircraft/model/analyses/massBreakdown"

    if tixi.checkElement(MB_PATH):
        tixi.removeElement(MB_PATH)

    MD_PATH = MB_PATH + "/designMasses"
    MTOM_PATH = MD_PATH + "/mTOM"
    MZFM_PATH = MD_PATH + "/mZFM"
    MF_PATH = MB_PATH + "/fuel/massDescription"
    OEM_PATH = MB_PATH + "/mOEM/massDescription"
    PAY_PATH = MB_PATH + "/payload/massDescription"
    MC_PATH = MB_PATH + "/payload/mCargo"
    EM_PATH = MB_PATH + "/mOEM/mEM"
    OIM_PATH = MB_PATH + "/mOEM/mOperatorItems/mCrewMembers/massDescription"
    MSYS_PATH = EM_PATH + "/mSystems/massDescription/mass"
    MSTR_PATH = EM_PATH + "/mStructure/massDescription/mass"
    MEN_PATH = EM_PATH + "/mPowerUnits/massDescription/mass"

    create_branch(tixi, MTOM_PATH + "/mass", False)
    create_branch(tixi, MZFM_PATH + "/mass", False)
    create_branch(tixi, MF_PATH + "/mass", False)
    create_branch(tixi, OEM_PATH + "/mass", False)
    create_branch(tixi, PAY_PATH + "/mass", False)
    create_branch(tixi, MC_PATH, False)
    create_branch(tixi, OIM_PATH + "/mass", False)
    create_branch(tixi, EM_PATH, False)
    create_branch(tixi, MSYS_PATH, False)
    create_branch(tixi, MSTR_PATH, False)
    create_branch(tixi, MEN_PATH, False)

    # DESIGN MASSES
    add_uid(tixi, MTOM_PATH, "MTOM")
    tixi.createElement(MTOM_PATH, "name")
    tixi.updateTextElement(MTOM_PATH + "/name", "Maximum take-off mass")
    tixi.createElement(MTOM_PATH, "description")
    tixi.updateTextElement(
        MTOM_PATH + "/description",
        "Maximum " + "take off mass [kg], CoG coordinate [m] and " +
        "moment of inertia.",
    )
    tixi.updateDoubleElement(MTOM_PATH + "/mass", mw.maximum_take_off_mass,
                             "%g")

    # MZFM
    add_uid(tixi, MZFM_PATH, "MZFM")
    tixi.createElement(MZFM_PATH, "name")
    tixi.updateTextElement(MZFM_PATH + "/name", "Maximum zero fuel mass")
    tixi.createElement(MZFM_PATH, "description")
    tixi.updateTextElement(
        MZFM_PATH + "/description",
        "Maximum " + "zero fuel mass [kg] and corresponding CoG " +
        "coordinate [m], moment of inertia.",
    )
    tixi.updateDoubleElement(MZFM_PATH + "/mass", mw.zero_fuel_mass, "%g")

    # FUEL MASS
    add_uid(tixi, MF_PATH, "MFM")
    tixi.createElement(MF_PATH, "name")
    tixi.updateTextElement(MF_PATH + "/name", "Max fuel mass")
    tixi.createElement(MF_PATH, "description")
    tixi.updateTextElement(MF_PATH + "/description", "Maximum fuel mass [kg].")
    tixi.updateDoubleElement(MF_PATH + "/mass", mw.mass_fuel_max, "%g")

    # OEM
    add_uid(tixi, OEM_PATH, "OEM")
    tixi.createElement(OEM_PATH, "name")
    tixi.updateTextElement(OEM_PATH + "/name", "Operating empty mass")
    tixi.createElement(OEM_PATH, "description")
    tixi.updateTextElement(
        OEM_PATH + "/description",
        "Operating empty" + " mass [kg] and related inertia [kgm^2].")
    tixi.updateDoubleElement(OEM_PATH + "/mass", mw.operating_empty_mass, "%g")

    tixi.updateDoubleElement(OIM_PATH + "/mass", mw.mass_crew, "%g")
    add_uid(tixi, OIM_PATH, "massCrew")
    tixi.updateDoubleElement(MSYS_PATH, mw.mass_systems, "%g")
    add_uid(tixi, EM_PATH + "/mSystems/massDescription", "mSys")
    tixi.updateDoubleElement(MSTR_PATH, mw.mass_structure, "%g")
    add_uid(tixi, EM_PATH + "/mStructure/massDescription", "mStrt")
    tixi.updateDoubleElement(MEN_PATH, mw.mass_engines, "%g")
    add_uid(tixi, EM_PATH + "/mPowerUnits/massDescription", "mEng")

    # PAYLOAD MASS AND FUEL CARGO MASS =======================================
    add_uid(tixi, PAY_PATH, "MPM")
    tixi.createElement(PAY_PATH, "name")
    tixi.updateTextElement(PAY_PATH + "/name", "Max payload mass")
    tixi.createElement(PAY_PATH, "description")
    tixi.updateTextElement(PAY_PATH + "/description",
                           "Maximum payload mass [kg].")
    tixi.updateDoubleElement(PAY_PATH + "/mass", mw.mass_payload, "%g")
    tixi.createElement(MC_PATH, "massCargo")
    tixi.updateDoubleElement(MC_PATH + "/massCargo", ui.MASS_CARGO, "%g")

    tixi.save(cpacs_out_path)

    return ()
def cpacs_mbd_update(out, mw, bi, ms_zpm, out_xml):
    """ The function updates the cpacs file after the Weight_and_Balance
        program.

        INPUT
        (float) mass_pass   --Arg.: Passenger mass, countig also the
                                          extra mass.
        (class) out         --Arg.: BalanceOutput class.
        (class) mw          --Arg.: MassesWeights class.
        (class) bi          --Arg.: BalanceInput class.
        ##======= Classes are defined in the InputClasses folder =======##
        (cahr) out_xml      --Arg.: Path of the output file.

        OUTPUT
        (file) cpacs.xml --Out.: Updated cpacs file.
    """

    tixi = open_tixi(out_xml)

    # CREATING PATH ==========================================================
    MB_PATH = "/cpacs/vehicles/aircraft/" + "model/analyses/massBreakdown"

    MD_PATH = MB_PATH + "/designMasses"
    MTOM_PATH = MD_PATH + "/mTOM"

    MZFM_PATH = MD_PATH + "/mZFM"

    OEM_PATH = MB_PATH + "/mOEM/massDescription"
    J_PATH = OEM_PATH + "/massInertia/J"
    CG_PATH = OEM_PATH + "/location/"

    create_branch(tixi, MTOM_PATH + "/location/x", False)
    create_branch(tixi, MTOM_PATH + "/location/y", False)
    create_branch(tixi, MTOM_PATH + "/location/z", False)
    create_branch(tixi, MTOM_PATH + "/massInertia/Jxx", False)
    create_branch(tixi, MTOM_PATH + "/massInertia/Jyy", False)
    create_branch(tixi, MTOM_PATH + "/massInertia/Jzz", False)
    create_branch(tixi, MTOM_PATH + "/massInertia/Jxy", False)
    create_branch(tixi, MTOM_PATH + "/massInertia/Jyz", False)
    create_branch(tixi, MTOM_PATH + "/massInertia/Jxz", False)

    create_branch(tixi, MZFM_PATH + "/location/x", False)
    create_branch(tixi, MZFM_PATH + "/location/y", False)
    create_branch(tixi, MZFM_PATH + "/location/z", False)
    create_branch(tixi, MZFM_PATH + "/massInertia/Jxx", False)
    create_branch(tixi, MZFM_PATH + "/massInertia/Jyy", False)
    create_branch(tixi, MZFM_PATH + "/massInertia/Jzz", False)
    create_branch(tixi, MZFM_PATH + "/massInertia/Jxy", False)
    create_branch(tixi, MZFM_PATH + "/massInertia/Jyz", False)
    create_branch(tixi, MZFM_PATH + "/massInertia/Jxz", False)

    create_branch(tixi, OEM_PATH + "/location/x", False)
    create_branch(tixi, OEM_PATH + "/location/y", False)
    create_branch(tixi, OEM_PATH + "/location/z", False)
    create_branch(tixi, OEM_PATH + "/massInertia/Jxx", False)
    create_branch(tixi, OEM_PATH + "/massInertia/Jyy", False)
    create_branch(tixi, OEM_PATH + "/massInertia/Jzz", False)
    create_branch(tixi, OEM_PATH + "/massInertia/Jxy", False)
    create_branch(tixi, OEM_PATH + "/massInertia/Jyz", False)
    create_branch(tixi, OEM_PATH + "/massInertia/Jxz", False)

    # DESIGN MASSES ==========================================================
    # MTOM -------------------------------------------------------------------
    tixi.uIDSetToXPath(MTOM_PATH + "/location", "MTOMloc")

    tixi.updateDoubleElement(MTOM_PATH + "/location" + "/x",
                             out.center_of_gravity[0], "%g")
    tixi.updateDoubleElement(MTOM_PATH + "/location" + "/y",
                             out.center_of_gravity[1], "%g")
    tixi.updateDoubleElement(MTOM_PATH + "/location" + "/z",
                             out.center_of_gravity[2], "%g")

    tixi.updateDoubleElement(MTOM_PATH + "/massInertia" + "/Jxx", out.Ixx_lump,
                             "%g")
    tixi.updateDoubleElement(MTOM_PATH + "/massInertia" + "/Jyy", out.Iyy_lump,
                             "%g")
    tixi.updateDoubleElement(MTOM_PATH + "/massInertia" + "/Jzz", out.Izz_lump,
                             "%g")
    tixi.updateDoubleElement(MTOM_PATH + "/massInertia" + "/Jxy", out.Ixy_lump,
                             "%g")
    tixi.updateDoubleElement(MTOM_PATH + "/massInertia" + "/Jyz", out.Iyz_lump,
                             "%g")
    tixi.updateDoubleElement(MTOM_PATH + "/massInertia" + "/Jxz", out.Ixz_lump,
                             "%g")

    # MZFM -------------------------------------------------------------------
    add_uid(tixi, MZFM_PATH + "/location", "MZFMloc")

    # updating path
    tixi.updateDoubleElement(MZFM_PATH + "/location" + "/x", out.cg_zpm[0],
                             "%g")
    tixi.updateDoubleElement(MZFM_PATH + "/location" + "/y", out.cg_zpm[1],
                             "%g")
    tixi.updateDoubleElement(MZFM_PATH + "/location" + "/z", out.cg_zpm[2],
                             "%g")

    tixi.updateDoubleElement(MZFM_PATH + "/massInertia" + "/Jxx",
                             out.Ixx_lump_zfm, "%g")
    tixi.updateDoubleElement(MZFM_PATH + "/massInertia" + "/Jyy",
                             out.Iyy_lump_zfm, "%g")
    tixi.updateDoubleElement(MZFM_PATH + "/massInertia" + "/Jzz",
                             out.Izz_lump_zfm, "%g")
    tixi.updateDoubleElement(MZFM_PATH + "/massInertia" + "/Jxy",
                             out.Ixy_lump_zfm, "%g")
    tixi.updateDoubleElement(MZFM_PATH + "/massInertia" + "/Jyz",
                             out.Iyz_lump_zfm, "%g")
    tixi.updateDoubleElement(MZFM_PATH + "/massInertia" + "/Jxz",
                             out.Ixz_lump_zfm, "%g")

    # OEM ====================================================================
    add_uid(tixi, OEM_PATH + "/location", "OEMloc")

    tixi.updateDoubleElement((CG_PATH + "x"), out.cg_oem[0], "%g")
    tixi.updateDoubleElement((CG_PATH + "y"), out.cg_oem[1], "%g")
    tixi.updateDoubleElement((CG_PATH + "z"), out.cg_oem[2], "%g")
    tixi.updateDoubleElement((J_PATH + "xx"), out.Ixx_lump_oem, "%g")
    tixi.updateDoubleElement((J_PATH + "yy"), out.Iyy_lump_oem, "%g")
    tixi.updateDoubleElement((J_PATH + "zz"), out.Izz_lump_oem, "%g")
    tixi.updateDoubleElement((J_PATH + "xy"), out.Ixy_lump_oem, "%g")
    tixi.updateDoubleElement((J_PATH + "yz"), out.Iyz_lump_oem, "%g")
    tixi.updateDoubleElement((J_PATH + "xz"), out.Ixz_lump_oem, "%g")

    # ZPM INERTIA ============================================================
    B_PATH = "/cpacs/toolspecific/CEASIOMpy/balance"
    ZPM_PATH = B_PATH + "/mZPM"
    create_branch(tixi, ZPM_PATH + "/name", False)
    tixi.updateTextElement(ZPM_PATH + "/name", "Maximum no payload mass")
    create_branch(tixi, ZPM_PATH + "/description", False)
    tixi.updateTextElement(
        ZPM_PATH + "/description",
        "Maximum " + "no payload mass [kg], CoG coordinate [m] and " +
        "moment of inertia.",
    )
    create_branch(tixi, ZPM_PATH + "/mass", False)
    tixi.updateDoubleElement(ZPM_PATH + "/mass", ms_zpm, "%g")

    create_branch(tixi, ZPM_PATH + "/location/x", False)
    create_branch(tixi, ZPM_PATH + "/location/y", False)
    create_branch(tixi, ZPM_PATH + "/location/z", False)
    create_branch(tixi, ZPM_PATH + "/massInertia/Jxx", False)
    create_branch(tixi, ZPM_PATH + "/massInertia/Jyy", False)
    create_branch(tixi, ZPM_PATH + "/massInertia/Jzz", False)
    create_branch(tixi, ZPM_PATH + "/massInertia/Jxy", False)
    create_branch(tixi, ZPM_PATH + "/massInertia/Jyz", False)
    create_branch(tixi, ZPM_PATH + "/massInertia/Jxz", False)

    LOC_PATH = ZPM_PATH + "/location"
    MOI_PATH = ZPM_PATH + "/massInertia"

    add_uid(tixi, ZPM_PATH, "MZPM")
    add_uid(tixi, LOC_PATH, "MZPMloc")
    tixi.updateDoubleElement((LOC_PATH + "/x"), out.cg_zpm[0], "%g")
    tixi.updateDoubleElement((LOC_PATH + "/y"), out.cg_zpm[1], "%g")
    tixi.updateDoubleElement((LOC_PATH + "/z"), out.cg_zpm[2], "%g")
    tixi.updateDoubleElement((MOI_PATH + "/Jxx"), out.Ixx_lump_zpm, "%g")
    tixi.updateDoubleElement((MOI_PATH + "/Jyy"), out.Iyy_lump_zpm, "%g")
    tixi.updateDoubleElement((MOI_PATH + "/Jzz"), out.Izz_lump_zpm, "%g")
    tixi.updateDoubleElement((MOI_PATH + "/Jxy"), out.Ixy_lump_zpm, "%g")
    tixi.updateDoubleElement((MOI_PATH + "/Jyz"), out.Iyz_lump_zpm, "%g")
    tixi.updateDoubleElement((MOI_PATH + "/Jxz"), out.Ixz_lump_zpm, "%g")

    # USER CASE ==============================================================
    if bi.USER_CASE:
        UC_PATH = "/cpacs/toolspecific/CEASIOMpy/balance/userBalance"
        LOC_PATH = UC_PATH + "/location"
        MOI_PATH = UC_PATH + "/massInertia"

        create_branch(tixi, LOC_PATH + "/x", False)
        create_branch(tixi, LOC_PATH + "/y", False)
        create_branch(tixi, LOC_PATH + "/z", False)
        create_branch(tixi, MOI_PATH + "/Jxx", False)
        create_branch(tixi, MOI_PATH + "/Jyy", False)
        create_branch(tixi, MOI_PATH + "/Jzz", False)
        create_branch(tixi, MOI_PATH + "/Jxy", False)
        create_branch(tixi, MOI_PATH + "/Jyz", False)
        create_branch(tixi, MOI_PATH + "/Jxz", False)

        add_uid(tixi, LOC_PATH, "USERCase")
        tixi.updateDoubleElement((LOC_PATH + "/x"), out.cg_user[0], "%g")
        tixi.updateDoubleElement((LOC_PATH + "/y"), out.cg_user[1], "%g")
        tixi.updateDoubleElement((LOC_PATH + "/z"), out.cg_user[2], "%g")
        tixi.updateDoubleElement((MOI_PATH + "/Jxx"), out.Ixx_lump_user, "%g")
        tixi.updateDoubleElement((MOI_PATH + "/Jyy"), out.Iyy_lump_user, "%g")
        tixi.updateDoubleElement((MOI_PATH + "/Jzz"), out.Izz_lump_user, "%g")
        tixi.updateDoubleElement((MOI_PATH + "/Jxy"), out.Ixy_lump_user, "%g")
        tixi.updateDoubleElement((MOI_PATH + "/Jyz"), out.Iyz_lump_user, "%g")
        tixi.updateDoubleElement((MOI_PATH + "/Jxz"), out.Ixz_lump_user, "%g")

    # Saving and closing the new cpacs file inside the ToolOutput folder -----
    tixi.save(out_xml)

    return ()
Пример #7
0
def cpacs_update(mass_pass, out, mw, out_xml):
    """ The function updates the cpacs file after the range analysis.

        INPUT
        (float) mass_pass         --Arg.: Passenger mass, countig also the
                                          extra mass.
        (class) out               --Arg.: RangeOutput class.
        ##======== Class is defined in the InputClasses folder =======##

        (class) mw                --Arg.: MassesWeights class.
        ##======= Class is defined in the InputClasses folder =======##
        (char) out_xml             --Arg.: Path of the output file.


        OUTPUT
        (file) cpacs.xml --Out.: Updated cpacs file.
    """
    tixi = open_tixi(out_xml)

    # PATH CHECKS ==========================================================

    CEASIOM_PATH = "/cpacs/toolspecific/CEASIOMpy"
    # Ranges
    RANGE_PATH = CEASIOM_PATH + "/ranges"
    R_DES_MAXP_PATH = RANGE_PATH + "/rangeMaxP/rangeDescription"
    R_DES_MAXF_PATH = RANGE_PATH + "/rangeMaxF/rangeDescription"
    R_DES_MAXIMUM_PATH = RANGE_PATH + "/rangeMaximum/rangeDescription"

    create_branch(tixi, R_DES_MAXP_PATH + "/range", False)
    create_branch(tixi, R_DES_MAXP_PATH + "/payload", False)
    create_branch(tixi, R_DES_MAXF_PATH + "/range", False)
    create_branch(tixi, R_DES_MAXF_PATH + "/payload", False)
    create_branch(tixi, R_DES_MAXIMUM_PATH + "/range", False)
    create_branch(tixi, R_DES_MAXIMUM_PATH + "/payload", False)

    # Fuel consumption
    FCONS_PATH = "/cpacs/toolspecific/CEASIOMpy/fuelConsumption"
    FDES_PATH = FCONS_PATH + "/description"
    FTO_PATH = FCONS_PATH + "/fuelForTakeOff"
    FC_PATH = FCONS_PATH + "/fuelForClimb"
    FCR_PATH = FCONS_PATH + "/fuelForCruise"
    FL_PATH = FCONS_PATH + "/fuelForLoiter"
    FLD_PATH = FCONS_PATH + "/fuelForLanding"
    FAL_PATH = FCONS_PATH + "/fuelRemained"

    create_branch(tixi, FDES_PATH, False)
    create_branch(tixi, FTO_PATH, False)
    create_branch(tixi, FC_PATH, False)
    create_branch(tixi, FCR_PATH, False)
    create_branch(tixi, FL_PATH, False)
    create_branch(tixi, FLD_PATH, False)
    create_branch(tixi, FAL_PATH, False)

    #  RANGES ===============================================================
    #  Max payload max range ------------------------------------------------
    add_uid(tixi, R_DES_MAXP_PATH,
            "Maximum_range_[km]" + "_with_maximum_payload_[kg]")
    tixi.updateDoubleElement(R_DES_MAXP_PATH + "/range", out.ranges[1], "%g")
    tixi.updateDoubleElement(R_DES_MAXP_PATH + "/payload", out.payloads[1],
                             "%g")

    #  Max fuel range with some payload -------------------------------------
    add_uid(tixi, R_DES_MAXF_PATH,
            "Range_[km]_with_" + "maximum_fuel_and_some_payload_[kg]")
    tixi.updateDoubleElement(R_DES_MAXF_PATH + "/range", out.ranges[2], "%g")
    tixi.updateDoubleElement(R_DES_MAXF_PATH + "/payload", out.payloads[2],
                             "%g")

    #  Maximum range, no payload and max fuel -------------------------------
    add_uid(tixi, R_DES_MAXIMUM_PATH,
            "Maximum_range_[km]_with_" + "max_fuel_and_no_payload_[kg]")
    tixi.updateDoubleElement(R_DES_MAXIMUM_PATH + "/range", out.ranges[3],
                             "%g")
    tixi.updateDoubleElement(R_DES_MAXIMUM_PATH + "/payload", out.payloads[3],
                             "%g")

    #  FUEL CONSUMPTION =====================================================
    add_uid(
        tixi, FDES_PATH,
        "Fuel required for each flight phase " + "[kg], with maximum payload.")

    tixi.updateDoubleElement(FTO_PATH, mw.mf_for_to, "%g")
    tixi.updateDoubleElement(FC_PATH, mw.mf_for_climb, "%g")
    tixi.updateDoubleElement(FCR_PATH, mw.mf_for_cruise, "%g")
    tixi.updateDoubleElement(FL_PATH, mw.mf_for_loiter, "%g")
    tixi.updateDoubleElement(FLD_PATH, mw.mf_for_landing, "%g")
    tixi.updateDoubleElement(FAL_PATH, mw.mf_after_land, "%g")

    #  Saving and closing the new cpacs file inside the ToolOutput folder ---
    tixi.save(out_xml)

    return out_xml
Пример #8
0
def cpacs_update(mw, out, cpacs_path, cpacs_out_path):
    """ The function updates the cpacs file after the Weight analysis.

    Args:
        mw (class) : MassesWeights class
        out (class) : WeightOutput class
        cpacs_path (str) : Path to the CPACS file
        cpacs_out_path (str) : Path to the output CPACS file

    """

    tixi = open_tixi(
        cpacs_out_path
    )  # (because it has been modifed somewre else, TODO: change that)

    # Path update
    if not tixi.checkElement(CREW_XPATH + "/cabinCrewMembers/cabinCrewMemberNb"):
        create_branch(tixi, CREW_XPATH + "/cabinCrewMembers/cabinCrewMemberNb")
    tixi.updateDoubleElement(
        CREW_XPATH + "/cabinCrewMembers/cabinCrewMemberNb", out.cabin_crew_nb, "%g"
    )

    if not tixi.checkElement(PASS_XPATH + "/passNb"):
        tixi.createElement(PASS_XPATH, "passNb")
    tixi.updateIntegerElement(PASS_XPATH + "/passNb", out.pass_nb, "%i")
    if not tixi.checkElement(PASS_XPATH + "/rowNb"):
        tixi.createElement(PASS_XPATH, "rowNb")
    tixi.updateIntegerElement(PASS_XPATH + "/rowNb", out.row_nb, "%i")
    if not tixi.checkElement(PASS_XPATH + "/aisleNb"):
        tixi.createElement(PASS_XPATH, "aisleNb")
    tixi.updateIntegerElement(PASS_XPATH + "/aisleNb", out.aisle_nb, "%i")
    if not tixi.checkElement(PASS_XPATH + "/toiletNb"):
        tixi.createElement(PASS_XPATH, "toiletNb")
    tixi.updateIntegerElement(PASS_XPATH + "/toiletNb", out.toilet_nb, "%i")
    if not tixi.checkElement(PASS_XPATH + "/abreastNb"):
        tixi.createElement(PASS_XPATH, "abreastNb")
    tixi.updateIntegerElement(PASS_XPATH + "/abreastNb", out.abreast_nb, "%i")

    if not tixi.checkElement(PASS_XPATH + "/fuelMassMaxpass"):
        tixi.createElement(PASS_XPATH, "fuelMassMaxpass")
    FMP_XPATH = PASS_XPATH + "/fuelMassMaxpass"
    if not tixi.checkElement(FMP_XPATH + "/description"):
        tixi.createElement(FMP_XPATH, "description")
    tixi.updateTextElement(
        FMP_XPATH + "/description", "Maximum amount of " + "fuel with maximum payload [kg]"
    )
    if not tixi.checkElement(FMP_XPATH + "/mass"):
        tixi.createElement(FMP_XPATH, "mass")
    tixi.updateDoubleElement(FMP_XPATH + "/mass", mw.mass_fuel_maxpass, "%g")

    # CPACS MASS BREAKDOWN UPDATE

    # Path creation
    if tixi.checkElement(MASSBREAKDOWN_XPATH):
        tixi.removeElement(MASSBREAKDOWN_XPATH)

    MD_XPATH = MASSBREAKDOWN_XPATH + "/designMasses"
    MTOM_XPATH = MD_XPATH + "/mTOM"
    MZFM_XPATH = MD_XPATH + "/mZFM"
    MF_XPATH = MASSBREAKDOWN_XPATH + "/fuel/massDescription"
    OEM_XPATH = MASSBREAKDOWN_XPATH + "/mOEM/massDescription"
    PAY_XPATH = MASSBREAKDOWN_XPATH + "/payload/massDescription"
    MC_XPATH = MASSBREAKDOWN_XPATH + "/payload/mCargo"
    OIM_XPATH = MASSBREAKDOWN_XPATH + "/mOEM/mOperatorItems/mCrewMembers/massDescription"

    create_branch(tixi, MTOM_XPATH + "/mass", False)
    create_branch(tixi, MZFM_XPATH + "/mass", False)
    create_branch(tixi, MF_XPATH + "/mass", False)
    create_branch(tixi, OEM_XPATH + "/mass", False)
    create_branch(tixi, PAY_XPATH + "/mass", False)
    create_branch(tixi, MC_XPATH, False)
    create_branch(tixi, OIM_XPATH + "/mass", False)

    # DESIGN MASSES
    add_uid(tixi, MTOM_XPATH, "MTOM")
    tixi.createElement(MTOM_XPATH, "name")
    tixi.updateTextElement(MTOM_XPATH + "/name", "Maximum take-off mass")
    tixi.createElement(MTOM_XPATH, "description")
    tixi.updateTextElement(
        MTOM_XPATH + "/description",
        "Maximum " + "take off mass [kg], CoG coordinate [m] and " + "moment of inertia.",
    )
    tixi.updateDoubleElement(MTOM_XPATH + "/mass", mw.maximum_take_off_mass, "%g")

    # MZFM
    add_uid(tixi, MZFM_XPATH, "MZFM")
    tixi.createElement(MZFM_XPATH, "name")
    tixi.updateTextElement(MZFM_XPATH + "/name", "Maximum zero fuel mass")
    tixi.createElement(MZFM_XPATH, "description")
    tixi.updateTextElement(
        MZFM_XPATH + "/description",
        "Maximum "
        + "zero fuel mass [kg] and corresponding CoG "
        + "coordinate [m], moment of inertia.",
    )
    tixi.updateDoubleElement(MZFM_XPATH + "/mass", mw.zero_fuel_mass, "%g")

    # FUEL MASS
    add_uid(tixi, MF_XPATH, "MFM")
    tixi.createElement(MF_XPATH, "name")
    tixi.updateTextElement(MF_XPATH + "/name", "Max fuel mass")
    tixi.createElement(MF_XPATH, "description")
    tixi.updateTextElement(MF_XPATH + "/description", "Maximum fuel mass [kg]")
    tixi.updateDoubleElement(MF_XPATH + "/mass", mw.mass_fuel_max, "%g")

    # OEM
    add_uid(tixi, OEM_XPATH, "OEM")
    tixi.createElement(OEM_XPATH, "name")
    tixi.updateTextElement(OEM_XPATH + "/name", "Operating empty mass")
    tixi.createElement(OEM_XPATH, "description")
    tixi.updateTextElement(
        OEM_XPATH + "/description", "Operating empty" + " mass [kg] and related inertia [kgm^2]."
    )
    tixi.updateDoubleElement(OEM_XPATH + "/mass", mw.operating_empty_mass, "%g")
    tixi.updateDoubleElement(OIM_XPATH + "/mass", mw.mass_crew, "%g")
    add_uid(tixi, OIM_XPATH, "massCrew")

    # PAYLOAD MASS AND FUEL WITH MAX PAYLOAD
    add_uid(tixi, PAY_XPATH, "MPM")
    tixi.createElement(PAY_XPATH, "name")
    tixi.updateTextElement(PAY_XPATH + "/name", "Max payload mass")
    tixi.createElement(PAY_XPATH, "description")
    tixi.updateTextElement(PAY_XPATH + "/description", "Maximum " + "payload mass [kg].")
    tixi.updateDoubleElement(PAY_XPATH + "/mass", mw.mass_payload, "%g")

    if mw.mass_cargo:
        tixi.createElement(MC_XPATH, "massCargo")
        tixi.updateDoubleElement(MC_XPATH + "/massCargo", mw.mass_cargo, "%g")

    tixi.save(cpacs_out_path)