def add_segment(tixi_handle, name, fromUID, toUID, num): """ Internal function, add segments to CPACS file Parameters ---------- tixi_handle : tixi handle object A tixi handle to the cpacs file to be created name : str section name, used to generate a UID from_UID : str uid of element at start of section to_UID : str uid of element at end of segment num : int number corresponding to segment index Returns ------- tixi_handle : tixi handle object """ base_path = '/cpacs/vehicles/aircraft/model/fuselages/fuselage/segments' tixi_handle.createElement(base_path, 'segment') base_path += f"/segment[{num}]" segment_name = f"{name}_segment{num}" add_uid(tixi_handle, base_path, segment_name + 'ID') tixi_handle.addTextElement(base_path, 'name', segment_name) tixi_handle.addTextElement(base_path, 'fromElementUID', fromUID) tixi_handle.addTextElement(base_path, 'toElementUID', toUID) return tixi_handle
def save_aeromap_from_df(tixi, aeromap_df, aeromap_uid, description='No decription'): """ Saves AeroMap DataFrame into a CPACS file. Function 'save_aeromap_from_df' will add all the required nodes for a new aeroPerformanceMap, no value will be stored but function like 'create_aeromap' and '???' could be used to fill it then. Args: tixi (handles): TIXI Handle of the CPACS file aeromap_df (str): UID of the aeroPerformanceMap to create aeromap_uid (str): UID of the aeroPerformanceMap to create description (str): description of the aeroPerformanceMap to create """ if tixi.uIDCheckExists(aeromap_uid): log.warning('This UID already exits! The aeromap will be erase!') delete_aeromap(tixi, aeromap_uid) else: log.info(aeromap_uid + ' aeroMap will be created.') # Add the /aeroMap node, or a new child is already exists cpsf.create_branch(tixi, AEROPERFORMANCE_XPATH + '/aeroMap', True) am_count = tixi.getNamedChildrenCount(AEROPERFORMANCE_XPATH, 'aeroMap') aeromap_xpath = AEROPERFORMANCE_XPATH + '/aeroMap[' + str(am_count) + ']' # Add UID and sub nodes cpsf.add_uid(tixi, aeromap_xpath, aeromap_uid) tixi.addTextElement(aeromap_xpath, 'name', aeromap_uid) tixi.addTextElement(aeromap_xpath, 'description', description) apm_bc_xpath = aeromap_xpath + '/boundaryConditions' cpsf.create_branch(tixi, apm_bc_xpath) tixi.addTextElement(apm_bc_xpath, 'atmosphericModel', 'ISA') # Add /AeroPerformanceMap and sub nodes apm_xpath = aeromap_xpath + '/aeroPerformanceMap' cpsf.create_branch(tixi, apm_xpath) # Add states for state, xstate in zip(STATES, XSTATES): if not state in aeromap_df: raise ValueError('Missing {} value in the AeroMap!'.format(state)) state_xpath = apm_xpath + '/' + xstate cpsf.create_branch(tixi, state_xpath) cpsf.add_float_vector(tixi, state_xpath, aeromap_df[state].tolist()) # Add coefficients for coef in COEF_LIST: if coef in aeromap_df: coef_xpath = apm_xpath + '/' + coef cpsf.create_branch(tixi, coef_xpath) cpsf.add_float_vector(tixi, coef_xpath, aeromap_df[coef].tolist()) else: log.info( 'There is no {} coefficient in this AeroMap!'.format(coef))
def cpacs_engine_update(ui, ed, mw, out_xml): """ The function that update the cpacs file after the Weight_unc_main program. INPUT (class) mw --Arg.: MassesWeihts class. (class) ui --Arg.: UserInputs class. (class) ed --Arg.: EngineData class. ##======= Class are defined in the Input_Classes folder =======## (char) out_xml --Arg.: Path of the output file. OUTPUT (file) cpacs.xml --Out.: Updated cpacs file. """ tixi = cpf.open_tixi(out_xml) tigl = cpf.open_tigl(tixi) # Path creation ========================================================== EN_PATH = '/cpacs/vehicles/engines' if tixi.checkElement(EN_PATH): tixi.removeElement(EN_PATH) for e in range(0, ed.NE): EN_PATH = '/cpacs/vehicles/engines/engine' + str(e + 1) tixi = cpf.create_branch(tixi, EN_PATH, True) EN_UID = 'EngineuID_' + str(e + 1) tixi = cpf.add_uid(tixi, EN_PATH, EN_UID) tixi.createElement(EN_PATH, 'name') if not ed.EN_NAME[e]: EN_NAME = 'Engine_' + str(e + 1) tixi.updateTextElement(EN_PATH + '/name', EN_NAME) else: tixi.updateTextElement(EN_PATH + '/name', ed.EN_NAME[e]) ENA_PATH = EN_PATH + '/analysis/mass' tixi = cpf.create_branch(tixi, ENA_PATH, False) tixi = cpf.add_uid(tixi, EN_PATH, EN_UID + '_mass') tixi.createElement(ENA_PATH, 'mass') tixi.updateDoubleElement(ENA_PATH + '/mass', ed.en_mass, '%g') ENT_PATH = EN_PATH + '/analysis' tixi.createElement(ENT_PATH, 'thrust00') tixi.updateDoubleElement(ENT_PATH + '/thrust00', ed.max_thrust, '%g') # Saving and closing the new cpacs file inside the ToolOutput folder ----- tixi.saveDocument(out_xml) cpf.close_tixi(tixi, out_xml) # Openign and closing again the cpacs file, formatting purpose ----------- tixi = cpf.open_tixi(out_xml) tigl = cpf.open_tigl(tixi) tixi.saveDocument(out_xml) cpf.close_tixi(tixi, out_xml) return ()
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, CC_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, MC_XPATH + '/mass', 0.0) self.FUEL_DENSITY = get_value_or_default(tixi, F_XPATH + '/density', 800) 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) add_uid(tixi, F_XPATH, 'kerosene') close_tixi(tixi, cpacs_path)
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 = cpsf.open_tixi(cpacs_out_path) tigl = cpsf.open_tigl(tixi) 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) cpsf.create_branch(tixi, EN_XPATH, True) EN_UID = 'EngineuID_' + str(e+1) cpsf.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' cpsf.create_branch(tixi, ENA_XPATH, False) cpsf.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') cpsf.close_tixi(tixi, cpacs_out_path) return()
def create_empty_aeromap(tixi, aeromap_uid, description = ''): """ Create an empty aeroPerformanceMap Function 'create_empty_apm' will add all the required nodes for a new aeroPerformanceMap, no value will be stored but function like 'create_aeromap' and '???' could be used to fill it then. Args: tixi (handles): TIXI Handle of the CPACS file aeromap_uid (str): UID of the aeroPerformanceMap to create description (str): description of the aeroPerformanceMap to create """ if tixi.uIDCheckExists(aeromap_uid): log.warning('This UID already exits!') aeromap_uid = aeromap_uid + '_bis' log.warning(' The following UID will be used instead: ' + aeromap_uid ) else: log.info(aeromap_uid + ' aeroMap will be created.') # Add the /aeroMap node, or a new child is already exists cpsf.create_branch(tixi,AEROPERFORMANCE_XPATH + '/aeroMap',True) am_count = tixi.getNamedChildrenCount(AEROPERFORMANCE_XPATH, 'aeroMap') aeromap_xpath = AEROPERFORMANCE_XPATH + '/aeroMap[' + str(am_count) + ']' # Add UID and sub nodes cpsf.add_uid(tixi, aeromap_xpath, aeromap_uid) tixi.addTextElement(aeromap_xpath, 'name', aeromap_uid) tixi.addTextElement(aeromap_xpath, 'description', description) apm_bc_xpath = aeromap_xpath + '/boundaryConditions' cpsf.create_branch(tixi, apm_bc_xpath) tixi.addTextElement(apm_bc_xpath,'atmosphericModel','ISA') # Add /AeroPerformanceMap and sub nodes apm_xpath = aeromap_xpath + '/aeroPerformanceMap' cpsf.create_branch(tixi,apm_xpath) cpsf.create_branch(tixi,apm_xpath+'/altitude') cpsf.create_branch(tixi,apm_xpath+'/machNumber') cpsf.create_branch(tixi,apm_xpath+'/angleOfAttack') cpsf.create_branch(tixi,apm_xpath+'/angleOfSideslip') cpsf.create_branch(tixi,apm_xpath+'/cl') cpsf.create_branch(tixi,apm_xpath+'/cd') cpsf.create_branch(tixi,apm_xpath+'/cs') cpsf.create_branch(tixi,apm_xpath+'/cml') cpsf.create_branch(tixi,apm_xpath+'/cmd') cpsf.create_branch(tixi,apm_xpath+'/cms')
def test_add_uid(): """Test the function 'add_uid'""" tixi = cpsf.open_tixi(CPACS_IN_PATH) # Update UID xpath = '/cpacs/vehicles/aircraft/model' new_uid = 'New_aircrat_name' cpsf.add_uid(tixi, xpath, new_uid) updated_uid = tixi.getTextAttribute(xpath, 'uID') assert updated_uid == new_uid # Add UID xpath = '/cpacs/vehicles/aircraft/model/name' new_uid = 'nameUID' cpsf.add_uid(tixi, xpath, new_uid) added_uid = tixi.getTextAttribute(xpath, 'uID') assert added_uid == new_uid # Add existing UID (should add "1" at the end of the UID) xpath = '/cpacs/vehicles/aircraft/model/name' new_uid = 'SimpleFuselage' cpsf.add_uid(tixi, xpath, new_uid) added_uid = tixi.getTextAttribute(xpath, 'uID') assert added_uid == 'SimpleFuselage1'
def add_positioning(tixi_handle, name, length, to_section_uid, from_section_uid, pos_num): """ Internal function, add positionings to CPACS file Parameters ---------- tixi_handle : tixi handle object A tixi handle to the cpacs file to be created name : str section name, used to generate a UID length : float length of segment to_section_uid : str uid of section at end of segment from_section_uid : str uid of section at start of section pos_num : int number corresponding to positioning index Returns ------- tixi_handle : tixi handle object """ base_path = '/cpacs/vehicles/aircraft/model/fuselages/fuselage/positionings' tixi_handle.createElement(base_path, 'positioning') base_path += f"/positioning[{pos_num}]" add_uid(tixi_handle, base_path, f"{name}_positioning{pos_num}ID") tixi_handle.addTextElement(base_path, 'name', f"{name}_positioning{pos_num}") tixi_handle.addDoubleElement(base_path, 'dihedralAngle', 0, '%g') tixi_handle.addDoubleElement(base_path, 'sweepAngle', 90, '%g') tixi_handle.addTextElement(base_path, 'toSectionUID', to_section_uid) tixi_handle.addDoubleElement(base_path, 'length', length, '%g') if from_section_uid: tixi_handle.addTextElement(base_path, 'fromSectionUID', from_section_uid) return tixi_handle
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) tigl = open_tigl(tixi) ### PATH CHECKS ========================================================== CEASIOM_PATH = '/cpacs/toolspecific/CEASIOMpy' # Ranges RANGE_PATH = CEASIOM_PATH + '/ranges' RANGE_MAXP_PATH = RANGE_PATH + '/rangeMaxP' R_DES_MAXP_PATH = RANGE_PATH + '/rangeMaxP/rangeDescription' RANGE_MAXF_PATH = RANGE_PATH + '/rangeMaxF' R_DES_MAXF_PATH = RANGE_PATH + '/rangeMaxF/rangeDescription' RANGE_MAXIMUM_PATH = RANGE_PATH + '/rangeMaximum' 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.saveDocument(out_xml) close_tixi(tixi, out_xml) ### Openign and closing again the cpacs file, formatting purpose --------- tixi = open_tixi(out_xml) tigl = open_tigl(tixi) tixi.saveDocument(out_xml) close_tixi(tixi, out_xml) return (out_xml)
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 = cpsf.open_tixi(cpacs_in) # toolspecific CEASIOM_XPATH = '/cpacs/toolspecific/CEASIOMpy' GEOM_XPATH = CEASIOM_XPATH + '/geometry' RANGE_XPATH = CEASIOM_XPATH + '/ranges' WEIGHT_XPATH = CEASIOM_XPATH + '/weight' CREW_XPATH = WEIGHT_XPATH + '/crew' PILOTS_PATH = CREW_XPATH + '/pilots' CAB_CREW_XPATH = CREW_XPATH + '/cabinCrewMembers' PASS_XPATH = WEIGHT_XPATH + '/passengers' ML_XPATH = WEIGHT_XPATH + '/massLimits' PROP_XPATH = CEASIOM_XPATH + '/propulsion' FUEL_XPATH = '/cpacs/toolspecific/CEASIOMpy/fuels' cpsf.create_branch(tixi, FUEL_XPATH, False) cpsf.create_branch(tixi, GEOM_XPATH, False) cpsf.create_branch(tixi, RANGE_XPATH, False) cpsf.create_branch(tixi, PILOTS_PATH, False) cpsf.create_branch(tixi, CAB_CREW_XPATH, False) cpsf.create_branch(tixi, PASS_XPATH, False) cpsf.create_branch(tixi, ML_XPATH, False) cpsf.create_branch(tixi, PROP_XPATH, False) # cpacs/vehicles MC_XPATH = '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/payload/mCargo/massDescription' F_XPATH = '/cpacs/vehicles/fuels/fuel' cpsf.create_branch(tixi, MC_XPATH, False) cpsf.create_branch(tixi, F_XPATH, False) cpsf.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 = cpsf.get_value_or_default(tixi,GEOM_XPATH + '/floorsNb', ui.FLOORS_NB) adui.VRT_THICK = cpsf.get_value_or_default(tixi,GEOM_XPATH + '/virtualThick', 0.00014263) adui.VRT_STR_DENSITY = cpsf.get_value_or_default(tixi,GEOM_XPATH + '/virtualDensity', 2700.0) ui.H_LIM_CABIN = cpsf.get_value_or_default(tixi,GEOM_XPATH + '/cabinHeight', 2.3) # People ================================================================= # Pilots user input data adui.PILOT_NB = cpsf.get_value_or_default(tixi,PILOTS_PATH + '/pilotNb', 2) adui.MASS_PILOT = cpsf.get_value_or_default(tixi,PILOTS_PATH + '/pilotMass', 102.0) adui.MASS_CABIN_CREW = cpsf.get_value_or_default(tixi,CAB_CREW_XPATH + '/cabinCrewMemberMass', 68.0) adui.MASS_PASS = cpsf.get_value_or_default(tixi,PASS_XPATH + '/passMass', 105.0) adui.PASS_BASE_DENSITY = cpsf.get_value_or_default(tixi,PASS_XPATH + '/passDensity', 1.66) adui.PASS_PER_TOILET = cpsf.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 = cpsf.get_value_or_default(tixi,F_XPATH + '/density', 800) adui.RES_FUEL_PERC = cpsf.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 = cpsf.get_value_or_default(tixi,ML_XPATH + '/maxPayload', 0.0) ui.MAX_FUEL_VOL = cpsf.get_value_or_default(tixi,ML_XPATH + '/maxFuelVol', 0.0) ui.MASS_CARGO = cpsf.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 = cpsf.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') cpsf.close_tixi(tixi, cpacs_in) return(ed, ui, adui)
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. Run '\ + 'Weight_main.py, in the 1Weight_module folder.') elif not tixi.checkElement(CC_PATH + '/cabinCrewMemberNb'): raise Exception('Missing required cabinCrewMemberNb path. Run '\ + 'Weight_main.py, in the 1Weight_module folder.') elif not tixi.checkElement(MASS_PATH): raise Exception('Missing required massBreakdown path. Run '\ + 'Weight_main.py, in the 1Weight_module folder.') elif not tixi.checkElement(DM_PATH): raise Exception('Missing required designMasses path. Run '\ + 'Weight_main.py, in the 1Weight_module folder.') elif not tixi.checkElement(MTOM_PATH): raise Exception('Missing required mTOM/mass path. Run '\ + 'Weight_main.py, in the 1Weight_module folder.') elif not tixi.checkElement(F_PATH): raise Exception('Missing required fuel/massDescription/mass '\ + 'path. Run '\ + 'Weight_main.py, in the 1Weight_module folder.') elif not tixi.checkElement(FMP_PATH): raise Exception('Missing required fuelMassMaxpass/mass path. Run '\ + 'Weight_main.py, in the 1Weight_module folder.') elif not tixi.checkElement(OEM_PATH): raise Exception('Missing required mOEM/massDescription/mass '\ + 'path. Run '\ + 'Weight_main.py, in the 1Weight_module folder.') elif not tixi.checkElement(PAY_PATH): raise Exception('Missing required payload/massDescription/mass '\ + 'path. Run '\ + 'Weight_main.py, in the 1Weight_module folder.') 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.saveDocument(cpacs_in) close_tixi(tixi, cpacs_in) # Openign and closing again the cpacs file =============================== tixi = open_tixi(cpacs_in) tigl = open_tigl(tixi) tixi.saveDocument(cpacs_in) close_tixi(tixi, cpacs_in) return (mw, ri)
def cpacs_mbd_update(out, mw, bi, ms_zpm, out_xml): """ The function updates the cpacs file after the Balance unconventional 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 = cpf.open_tixi(out_xml) tigl = cpf.open_tigl(tixi) # 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/' tixi = cpf.create_branch(tixi, MTOM_PATH + '/location/x', False) tixi = cpf.create_branch(tixi, MTOM_PATH + '/location/y', False) tixi = cpf.create_branch(tixi, MTOM_PATH + '/location/z', False) tixi = cpf.create_branch(tixi, MTOM_PATH + '/massInertia/Jxx', False) tixi = cpf.create_branch(tixi, MTOM_PATH + '/massInertia/Jyy', False) tixi = cpf.create_branch(tixi, MTOM_PATH + '/massInertia/Jzz', False) tixi = cpf.create_branch(tixi, MTOM_PATH + '/massInertia/Jxy', False) tixi = cpf.create_branch(tixi, MTOM_PATH + '/massInertia/Jyz', False) tixi = cpf.create_branch(tixi, MTOM_PATH + '/massInertia/Jxz', False) tixi = cpf.create_branch(tixi, MZFM_PATH + '/location/x', False) tixi = cpf.create_branch(tixi, MZFM_PATH + '/location/y', False) tixi = cpf.create_branch(tixi, MZFM_PATH + '/location/z', False) tixi = cpf.create_branch(tixi, MZFM_PATH + '/massInertia/Jxx', False) tixi = cpf.create_branch(tixi, MZFM_PATH + '/massInertia/Jyy', False) tixi = cpf.create_branch(tixi, MZFM_PATH + '/massInertia/Jzz', False) tixi = cpf.create_branch(tixi, MZFM_PATH + '/massInertia/Jxy', False) tixi = cpf.create_branch(tixi, MZFM_PATH + '/massInertia/Jyz', False) tixi = cpf.create_branch(tixi, MZFM_PATH + '/massInertia/Jxz', False) tixi = cpf.create_branch(tixi, OEM_PATH + '/location/x', False) tixi = cpf.create_branch(tixi, OEM_PATH + '/location/y', False) tixi = cpf.create_branch(tixi, OEM_PATH + '/location/z', False) tixi = cpf.create_branch(tixi, OEM_PATH + '/massInertia/Jxx', False) tixi = cpf.create_branch(tixi, OEM_PATH + '/massInertia/Jyy', False) tixi = cpf.create_branch(tixi, OEM_PATH + '/massInertia/Jzz', False) tixi = cpf.create_branch(tixi, OEM_PATH + '/massInertia/Jxy', False) tixi = cpf.create_branch(tixi, OEM_PATH + '/massInertia/Jyz', False) tixi = cpf.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 ------------------------------------------------------------------- tixi = cpf.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 ==================================================================== tixi = cpf.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' tixi = cpf.create_branch(tixi, ZPM_PATH + '/name', False) tixi.updateTextElement(ZPM_PATH + '/name', 'Maximum zero payload mass') tixi = cpf.create_branch(tixi, ZPM_PATH + '/description', False) tixi.updateTextElement(ZPM_PATH + '/description', 'Maximum '\ + 'zero payload mass [kg], CoG coordinate [m] and '\ + 'moment of inertia.') tixi = cpf.create_branch(tixi, ZPM_PATH + '/mass', False) tixi.updateDoubleElement(ZPM_PATH + '/mass',\ ms_zpm, '%g') tixi = cpf.create_branch(tixi, ZPM_PATH + '/location/x', False) tixi = cpf.create_branch(tixi, ZPM_PATH + '/location/y', False) tixi = cpf.create_branch(tixi, ZPM_PATH + '/location/z', False) tixi = cpf.create_branch(tixi, ZPM_PATH + '/massInertia/Jxx', False) tixi = cpf.create_branch(tixi, ZPM_PATH + '/massInertia/Jyy', False) tixi = cpf.create_branch(tixi, ZPM_PATH + '/massInertia/Jzz', False) tixi = cpf.create_branch(tixi, ZPM_PATH + '/massInertia/Jxy', False) tixi = cpf.create_branch(tixi, ZPM_PATH + '/massInertia/Jyz', False) tixi = cpf.create_branch(tixi, ZPM_PATH + '/massInertia/Jxz', False) LOC_PATH = ZPM_PATH + '/location' MOI_PATH = ZPM_PATH + '/massInertia' tixi = cpf.add_uid(tixi, ZPM_PATH, 'MZPM') tixi = cpf.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' tixi = cpf.create_branch(tixi, LOC_PATH + '/x', False) tixi = cpf.create_branch(tixi, LOC_PATH + '/y', False) tixi = cpf.create_branch(tixi, LOC_PATH + '/z', False) tixi = cpf.create_branch(tixi, MOI_PATH + '/Jxx', False) tixi = cpf.create_branch(tixi, MOI_PATH + '/Jyy', False) tixi = cpf.create_branch(tixi, MOI_PATH + '/Jzz', False) tixi = cpf.create_branch(tixi, MOI_PATH + '/Jxy', False) tixi = cpf.create_branch(tixi, MOI_PATH + '/Jyz', False) tixi = cpf.create_branch(tixi, MOI_PATH + '/Jxz', False) tixi = cpf.add_uid(tixi, LOC_PATH, 'USERloc') 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.saveDocument(out_xml) cpf.close_tixi(tixi, out_xml) # Openign and closing again the cpacs file, formatting purpose ----------- tixi = cpf.open_tixi(out_xml) tigl = cpf.open_tigl(tixi) tixi.saveDocument(out_xml) cpf.close_tixi(tixi, out_xml) return ()
def generate_cpacs_structure(tixi_handle, aircraftname): """Internal function. Generates the basic structure of a CPACS file Parameters ---------- tixi_handle : tixi handle object A tixi handle to the cpacs file to be created aircraftname : str The name of the aircraft and filename of the output CPACS file Outputs ------- tixi_handle : a tixi handle object """ # Define schema and fill in header tixi_handle.declareNamespace("/cpacs", "http://www.w3.org/2001/XMLSchema-instance", "xsi") tixi_handle.registerNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi") tixi_handle.addTextAttribute("/cpacs", "xsi:noNamespaceSchemaLocation", "cpacs_schema.xsd") tixi_handle.addCpacsHeader(name=aircraftname, creator='Noah Sadaka', version='N/A', description='...', cpacsVersion='3.2') # Create XML elements down to sections path_elements = [ 'vehicles', 'aircraft', 'model', 'fuselages', 'fuselage', 'sections' ] base_path = '/cpacs' for i in path_elements: tixi_handle.createElement(base_path, i) if i == 'model': model_path = base_path + '/model' add_uid(tixi_handle, model_path, 'CPACSaircraft') tixi_handle.addTextElement(model_path, 'description', '...') tixi_handle.addTextElement(model_path, 'name', 'Generated Fuselage') ref_path = model_path + '/reference' tixi_handle.createElement(model_path, 'reference') tixi_handle.addDoubleElement(ref_path, 'area', 1, '%f') tixi_handle.addDoubleElement(ref_path, 'length', 1, '%f') tixi_handle.createElement(ref_path, 'point') add_uid(tixi_handle, ref_path + '/point', 'fuse_point1') tixi_handle.addDoubleElement(ref_path + '/point', 'x', 0.0, '%f') tixi_handle.addDoubleElement(ref_path + '/point', 'y', 0.0, '%f') tixi_handle.addDoubleElement(ref_path + '/point', 'z', 0.0, '%f') if i == 'fuselage': fuse_path = base_path + '/fuselage' add_uid(tixi_handle, fuse_path, 'Fuselage_1ID') tixi_handle.addTextElement(fuse_path, 'description', 'Generic Fuselage') tixi_handle.addTextElement(fuse_path, 'name', 'fuselage_1') tixi_handle.createElement(fuse_path, 'transformation') trans_path = fuse_path + '/transformation' add_uid(tixi_handle, trans_path, 'Fuselage_1ID_transformation1') for j in ['rotation', 'scaling', 'translation']: tixi_handle.createElement(trans_path, j) if j == 'translation': tixi_handle.addTextAttribute(f"{trans_path}/{j}", 'refType', 'absLocal') base_uid = 'Fuselage_1ID_transformation1' add_uid(tixi_handle, f"{trans_path}/{j}", f"{base_uid}_{j}1") if j != 'scaling': tixi_handle.addIntegerElement(f"{trans_path}/{j}", 'x', 0, '%d') tixi_handle.addIntegerElement(f"{trans_path}/{j}", 'y', 0, '%d') tixi_handle.addIntegerElement(f"{trans_path}/{j}", 'z', 0, '%d') else: tixi_handle.addIntegerElement(f"{trans_path}/{j}", 'x', 1, '%d') tixi_handle.addIntegerElement(f"{trans_path}/{j}", 'y', 1, '%d') tixi_handle.addIntegerElement(f"{trans_path}/{j}", 'z', 1, '%d') base_path += f"/{i}" # Add segments and positionings tag tixi_handle.createElement( '/cpacs/vehicles/aircraft/model/fuselages/fuselage', 'positionings') tixi_handle.createElement( '/cpacs/vehicles/aircraft/model/fuselages/fuselage', 'segments') return tixi_handle
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 = cpsf.open_tixi( cpacs_out_path ) # (because it has been modifed somewre else, TODO: change that) # Path definition WEIGHT_XPATH = '/cpacs/toolspecific/CEASIOMpy/weight' CREW_XPATH = WEIGHT_XPATH + '/crew' PASS_XPATH = WEIGHT_XPATH + '/passengers' # Path update if not tixi.checkElement(CREW_XPATH + '/cabinCrewMembers/cabinCrewMemberNb'): cpsf.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 MB_XPATH = '/cpacs/vehicles/aircraft/model/analyses/massBreakdown' if tixi.checkElement(MB_XPATH): tixi.removeElement(MB_XPATH) MD_XPATH = MB_XPATH + '/designMasses' MTOM_XPATH = MD_XPATH + '/mTOM' MZFM_XPATH = MD_XPATH + '/mZFM' MF_XPATH = MB_XPATH + '/fuel/massDescription' OEM_XPATH = MB_XPATH + '/mOEM/massDescription' PAY_XPATH = MB_XPATH + '/payload/massDescription' MC_XPATH = MB_XPATH + '/payload/mCargo' OIM_XPATH = MB_XPATH + '/mOEM/mOperatorItems/mCrewMembers/massDescription' cpsf.create_branch(tixi, MTOM_XPATH + '/mass', False) cpsf.create_branch(tixi, MZFM_XPATH + '/mass', False) cpsf.create_branch(tixi, MF_XPATH + '/mass', False) cpsf.create_branch(tixi, OEM_XPATH + '/mass', False) cpsf.create_branch(tixi, PAY_XPATH + '/mass', False) cpsf.create_branch(tixi, MC_XPATH, False) cpsf.create_branch(tixi, OIM_XPATH + '/mass', False) # DESIGN MASSES cpsf.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 cpsf.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 cpsf.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 cpsf.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') cpsf.add_uid(tixi, OIM_XPATH, 'massCrew') # PAYLOAD MASS AND FUEL WITH MAX PAYLOAD cpsf.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') cpsf.close_tixi(tixi, cpacs_out_path)
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 = cpsf.open_tixi(cpacs_out_path) tigl = cpsf.open_tigl(tixi) # 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' cpsf.create_branch(tixi, MTOM_PATH + '/mass', False) cpsf.create_branch(tixi, MZFM_PATH + '/mass', False) cpsf.create_branch(tixi, MF_PATH + '/mass', False) cpsf.create_branch(tixi, OEM_PATH + '/mass', False) cpsf.create_branch(tixi, PAY_PATH + '/mass', False) cpsf.create_branch(tixi, MC_PATH, False) cpsf.create_branch(tixi, OIM_PATH + '/mass', False) cpsf.create_branch(tixi, EM_PATH, False) cpsf.create_branch(tixi, MSYS_PATH, False) cpsf.create_branch(tixi, MSTR_PATH, False) cpsf.create_branch(tixi, MEN_PATH, False) # DESIGN MASSES cpsf.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 cpsf.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 cpsf.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 cpsf.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') cpsf.add_uid(tixi, OIM_PATH, 'massCrew') tixi.updateDoubleElement(MSYS_PATH, mw.mass_systems, '%g') cpsf.add_uid(tixi, EM_PATH + '/mSystems/massDescription', 'mSys') tixi.updateDoubleElement(MSTR_PATH, mw.mass_structure, '%g') cpsf.add_uid(tixi, EM_PATH + '/mStructure/massDescription', 'mStrt') tixi.updateDoubleElement(MEN_PATH, mw.mass_engines, '%g') cpsf.add_uid(tixi, EM_PATH +'/mPowerUnits/massDescription', 'mEng') # PAYLOAD MASS AND FUEL CARGO MASS ======================================= cpsf.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') cpsf.close_tixi(tixi, cpacs_out_path) return()
def get_user_inputs(ind, ui, ag, cpacs_in, cpacs): """ The function to extracts from the XML file the required input data, the code will use the default value when they are missing. INPUT (class) ind --Arg.: InsideDimensions class. (class) ui --Arg.: UserInputs class. ##======= Classes are defined in the InputClasses folder =======## (class) ag --Arg.: AircraftGeometry class ##======= Classes are defined in the InputClasses folder ======## (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). (char) cpacs --Arg.: cpacs True or False option OUTPUT (class) ind --Out.: InsideDimensions class updated (class) ui --Out.: UserInputs class updated. ##====== Classes are defined in the InputClasses folder ======## (file) cpacs_in --Out.: Updated cpasc file """ log.info('Starting data extraction from CPACS file') # Path creation ========================================================== tixi = cpf.open_tixi(cpacs_in) CESAIOM_PATH = '/cpacs/toolspecific/CEASIOMpy' GEOM_PATH = CESAIOM_PATH + '/geometry' FUEL_PATH = CESAIOM_PATH + '/fuels' W_PATH = CESAIOM_PATH + '/weight' C_PATH = W_PATH + '/crew' pilots_path = C_PATH + '/pilots' CC_PATH = C_PATH + '/cabinCrewMembers' PASS_PATH = W_PATH + '/passengers' ML_PATH = W_PATH + '/massLimits' PROP_PATH = CESAIOM_PATH + '/propulsion' F_PATH = '/cpacs/vehicles/fuels/fuel' MC_PATH = '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/'\ + 'payload/mCargo/massDescription' tixi = cpf.create_branch(tixi, MC_PATH, False) tixi = cpf.create_branch(tixi, FUEL_PATH, False) tixi = cpf.create_branch(tixi, GEOM_PATH, False) tixi = cpf.create_branch(tixi, pilots_path, False) tixi = cpf.create_branch(tixi, CC_PATH, False) tixi = cpf.create_branch(tixi, PASS_PATH, False) tixi = cpf.create_branch(tixi, ML_PATH, False) tixi = cpf.create_branch(tixi, PROP_PATH, False) tixi = cpf.create_branch(tixi, F_PATH, False) tixi = cpf.add_uid(tixi, F_PATH, 'kerosene') ### Geometry ============================================================= if not tixi.checkElement(GEOM_PATH + '/description'): tixi.createElement(GEOM_PATH, 'description') tixi.updateTextElement(GEOM_PATH + '/description', 'User '\ + 'geometry input') # Extracting geometry input data (Double Floor) if not tixi.checkElement(GEOM_PATH + '/isDoubleFloor'): tixi.createElement(GEOM_PATH, 'isDoubleFloor') tixi.updateIntegerElement(GEOM_PATH + '/isDoubleFloor',\ ui.IS_DOUBLE_FLOOR, '%i') else: temp = tixi.getIntegerElement(GEOM_PATH + '/isDoubleFloor') if temp != ui.IS_DOUBLE_FLOOR: ui.IS_DOUBLE_FLOOR = temp # Extracting geometry input data (seatWidth) if not tixi.checkElement(GEOM_PATH + '/seatWidth'): tixi.createElement(GEOM_PATH, 'seatWidth') tixi.updateDoubleElement(GEOM_PATH + '/seatWidth',\ ind.seat_width, '%g') else: temp = tixi.getDoubleElement(GEOM_PATH + '/seatWidth') if temp != ind.seat_width and temp > 0: ind.seat_width = temp # Extracting geometry input data (seatLength) if not tixi.checkElement(GEOM_PATH + '/seatLength'): tixi.createElement(GEOM_PATH, 'seatLength') tixi.updateDoubleElement(GEOM_PATH + '/seatLength',\ ind.seat_length, '%g') else: temp = tixi.getDoubleElement(GEOM_PATH + '/seatLength') if temp != ind.seat_length and temp > 0: ind.seat_length = temp # Extracting geometry input data (aisleWidth) if not tixi.checkElement(GEOM_PATH + '/aisleWidth'): tixi.createElement(GEOM_PATH, 'aisleWidth') tixi.updateDoubleElement(GEOM_PATH + '/aisleWidth',\ ind.aisle_width, '%g') else: temp = tixi.getDoubleElement(GEOM_PATH + '/aisleWidth') if temp != ind.aisle_width and temp > 0: ind.aisle_width = temp # Extracting geometry input data (fuseThick) if not tixi.checkElement(GEOM_PATH + '/fuseThick'): tixi.createElement(GEOM_PATH, 'fuseThick') tixi.updateDoubleElement(GEOM_PATH + '/fuseThick',\ ind.fuse_thick, '%g') else: temp = tixi.getDoubleElement(GEOM_PATH + '/fuseThick') if temp != ind.fuse_thick and temp > 0: ind.fuse_thick = temp # Extracting geometry input data (toiletLength) if not tixi.checkElement(GEOM_PATH + '/toiletLength'): tixi.createElement(GEOM_PATH, 'toiletLength') tixi.updateDoubleElement(GEOM_PATH + '/toiletLength',\ ind.toilet_length, '%g') else: temp = tixi.getDoubleElement(GEOM_PATH + '/toiletLength') if temp != ind.toilet_length and temp > 0: ind.toilet_length = temp ### Weight =============================================================== # Pilots user input data if not tixi.checkElement(pilots_path + '/pilotNb'): tixi.createElement(pilots_path, 'pilotNb') tixi.updateIntegerElement(pilots_path + '/pilotNb',\ ui.PILOT_NB, '%i') else: temp = tixi.getIntegerElement(pilots_path + '/pilotNb') if temp != ui.PILOT_NB and temp > 0: ui.PILOT_NB = temp if not tixi.checkElement(pilots_path + '/pilotMass'): tixi.createElement(pilots_path, 'pilotMass') tixi.updateDoubleElement(pilots_path + '/pilotMass',\ ui.MASS_PILOT, '%g') else: temp = tixi.getDoubleElement(pilots_path + '/pilotMass') if temp != ui.MASS_PILOT and temp > 0: ui.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',\ ui.MASS_CABIN_CREW, '%g') else: temp = tixi.getDoubleElement(CC_PATH + '/cabinCrewMemberMass') if temp != ui.MASS_CABIN_CREW and temp > 0: ui.MASS_CABIN_CREW = temp # Passengers user input data if not tixi.checkElement(PASS_PATH + '/passMass'): tixi.createElement(PASS_PATH, 'passMass') tixi.updateDoubleElement(PASS_PATH + '/passMass',\ ui.MASS_PASS, '%g') else: temp = tixi.getDoubleElement(PASS_PATH + '/passMass') if temp != ui.MASS_PASS and temp > 0: ui.MASS_PASS = temp if not tixi.checkElement(PASS_PATH + '/passPerToilet'): tixi.createElement(PASS_PATH, 'passPerToilet') tixi.updateIntegerElement(PASS_PATH + '/passPerToilet',\ ui.PASS_PER_TOILET, '%i') else: temp = tixi.getIntegerElement(PASS_PATH + '/passPerToilet') if temp != ui.PASS_PER_TOILET and temp > 0: ui.PASS_PER_TOILET = temp # Mass limits data if not tixi.checkElement(ML_PATH + '/description'): tixi.createElement(ML_PATH, 'description') tixi.updateTextElement(ML_PATH + '/description', 'Desired max fuel '\ + 'volume [m^3] and payload mass [kg]') if not tixi.checkElement(ML_PATH + '/maxPayload'): tixi.createElement(ML_PATH, 'maxPayload') tixi.updateDoubleElement(ML_PATH + '/maxPayload',\ ui.MAX_PAYLOAD, '%g') else: temp = tixi.getDoubleElement(ML_PATH + '/maxPayload') if temp != ui.MAX_PAYLOAD and temp > 0: ui.MAX_PAYLOAD = temp if not tixi.checkElement(ML_PATH + '/maxFuelVol'): tixi.createElement(ML_PATH, 'maxFuelVol') tixi.updateDoubleElement(ML_PATH + '/maxFuelVol',\ ui.MAX_FUEL_VOL, '%g') else: temp = tixi.getDoubleElement(ML_PATH + '/maxFuelVol') if temp != ui.MAX_FUEL_VOL and temp > 0: ui.MAX_FUEL_VOL = temp if tixi.checkElement(MC_PATH + '/massCargo'): temp = tixi.getDoubleElement(MC_PATH + '/massCargo') if temp != ui.MASS_CARGO and temp != 0: ui.MASS_CARGO = temp # Fuel density =========================================================== if not tixi.checkElement(F_PATH + '/density'): tixi.createElement(F_PATH, 'density') tixi.updateDoubleElement(F_PATH + '/density',\ ui.FUEL_DENSITY, '%g') else: temp = tixi.getDoubleElement(F_PATH + '/density') if temp != ui.FUEL_DENSITY and temp > 0: ui.FUEL_DENSITY = temp # Propulsion ============================================================= if not tixi.checkElement(PROP_PATH + '/turboprop'): tixi = cpf.create_branch(tixi, PROP_PATH, False) tixi.createElement(PROP_PATH, 'turboprop') if ui.TURBOPROP: tixi.updateTextElement(PROP_PATH + '/turboprop', 'True') else: tixi.updateTextElement(PROP_PATH + '/turboprop', 'False') else: temp = tixi.getTextElement(PROP_PATH + '/turboprop') if temp == 'False': ui.TURBOPROP = False else: ui.TURBOPROP = True if not tixi.checkElement(FUEL_PATH + '/resFuelPerc'): tixi.createElement(FUEL_PATH, 'resFuelPerc') tixi.updateDoubleElement(FUEL_PATH + '/resFuelPerc',\ ui.RES_FUEL_PERC, '%g') else: temp = tixi.getDoubleElement(FUEL_PATH + '/resFuelPerc') if temp != ui.RES_FUEL_PERC and temp > 0: ui.RES_FUEL_PERC = temp log.info('Data from CPACS file succesfully extracted') # Saving and closing the cpacs file -------------------------------------- tixi.saveDocument(cpacs_in) cpf.close_tixi(tixi, cpacs_in) # Openign and closing again the cpacs file ------------------------------- tixi = cpf.open_tixi(cpacs_in) tigl = cpf.open_tigl(tixi) tixi.saveDocument(cpacs_in) cpf.close_tixi(tixi, cpacs_in) return (ind, ui)
def cpacs_weight_update(out, mw, out_xml): """ The function updates the cpacs file after the Weight analysis. INPUT (class) out --Arg.: WeightOutput class. (class) mw --Arg.: MassesWeights class. (char) out_xml --Arg.: Path of the output file. ##======= Classes are defined in the classes folder =======## OUTPUT (file) cpacs.xml --Out.: Updated cpacs file. """ tixi = cpf.open_tixi(out_xml) tigl = cpf.open_tigl(tixi) # Path creation ========================================================== 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' OIM_PATH = MB_PATH + '/mOEM/mOperatorItems/mCrewMembers'\ + '/massDescription' tixi = cpf.create_branch(tixi, MTOM_PATH + '/mass', False) tixi = cpf.create_branch(tixi, MZFM_PATH + '/mass', False) tixi = cpf.create_branch(tixi, MF_PATH + '/mass', False) tixi = cpf.create_branch(tixi, OEM_PATH + '/mass', False) tixi = cpf.create_branch(tixi, PAY_PATH + '/mass', False) tixi = cpf.create_branch(tixi, MC_PATH, False) tixi = cpf.create_branch(tixi, OIM_PATH + '/mass', False) # DESIGN MASSES ========================================================== tixi = cpf.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 ------------------------------------------------------------------- tixi = cpf.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 ============================================================== tixi = cpf.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 ==================================================================== tixi = cpf.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') tixi = cpf.add_uid(tixi, OIM_PATH, 'massCrew') # PAYLOAD MASS AND FUEL WITH MAX PAYLOAD ================================= tixi = cpf.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') if mw.mass_cargo: tixi.createElement(MC_PATH, 'massCargo') tixi.updateDoubleElement(MC_PATH + '/massCargo', mw.mass_cargo, '%g') # Saving and closing the new cpacs file inside the ToolOutput folder ----- tixi.saveDocument(out_xml) cpf.close_tixi(tixi, out_xml) # Openign and closing again the cpacs file, formatting purpose ----------- tixi = cpf.open_tixi(out_xml) tigl = cpf.open_tigl(tixi) tixi.saveDocument(out_xml) cpf.close_tixi(tixi, out_xml) return()
def add_end_section(tixi_handle, name, profile_id, section_num): """ Internal function, add nose section to CPACS file Parameters ---------- tixi_handle : tixi handle object A tixi handle to the cpacs file to be created name : str section name, used to generate a UID profile_id : str profile ID used for this section section_num : int number corresponding to which section this is Returns ------- tixi_handle : tixi handle object section_uid : str section UID element_uid : str element UID """ # Create XML infrastructure base_path = '/cpacs/vehicles/aircraft/model/fuselages/fuselage/sections' tixi_handle.createElement(base_path, 'section') base_path += f'/section[{section_num}]' section_uid = f"{name}_section{section_num}ID" add_uid(tixi_handle, base_path, section_uid) tixi_handle.addTextElement(base_path, 'name', name) for j in ['transformation', 'elements']: tixi_handle.createElement(base_path, j) xpath = f"{base_path}/{j}" uid_name = f"{name}section{section_num}ID_{j}1" if j == 'elements': tixi_handle.createElement(xpath, 'element') xpath += '/element' uid_name = f"{name}section{section_num}ID_element1ID" element_uid = uid_name add_uid(tixi_handle, xpath, uid_name) tixi_handle.addTextElement(xpath, 'name', f"{name}section{section_num}element1") tixi_handle.addTextElement(xpath, 'profileUID', profile_id) tixi_handle.createElement(xpath, 'transformation') xpath += '/transformation' uid_name = f"{uid_name}_transformation1" add_uid(tixi_handle, xpath, uid_name) for i in ['rotation', 'scaling', 'translation']: tixi_handle.createElement(xpath, i) if i == 'translation': tixi_handle.addTextAttribute(f"{xpath}/{i}", 'refType', 'absLocal') add_uid(tixi_handle, f"{xpath}/{i}", f"{uid_name}_{i}1") if i != 'scaling': tixi_handle.addIntegerElement(f"{xpath}/{i}", 'x', 0, '%d') tixi_handle.addIntegerElement(f"{xpath}/{i}", 'y', 0, '%d') tixi_handle.addIntegerElement(f"{xpath}/{i}", 'z', 0, '%d') else: if j == 'elements': tixi_handle.addIntegerElement(f"{xpath}/{i}", 'x', 1, '%d') tixi_handle.addIntegerElement(f"{xpath}/{i}", 'y', 0, '%d') tixi_handle.addIntegerElement(f"{xpath}/{i}", 'z', 0, '%d') else: tixi_handle.addIntegerElement(f"{xpath}/{i}", 'x', 1, '%d') tixi_handle.addIntegerElement(f"{xpath}/{i}", 'y', 1, '%d') tixi_handle.addIntegerElement(f"{xpath}/{i}", 'z', 1, '%d') return section_uid, element_uid, tixi_handle
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. INPUT (class) adui --Arg.: AdvancedInputs class. (class) ed --Arg.: EngineData class. (class) ui --Arg.: UserInputs class. ##======= Classes are defined in the InputClasses folder =======## (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) adui --Out.: AdvancedInputs class updated (class) ui --Out.: UserInputs class updated. (class) ed --AOut.:EngineData class updated. (file) cpacs_in --Out.: Updated cpasc file """ log.info('Starting data extraction from CPACS file') # Path creation ========================================================== tixi = cpf.open_tixi(cpacs_in) # toolspecific CEASIOM_PATH = '/cpacs/toolspecific/CEASIOMpy' GEOM_PATH = CEASIOM_PATH + '/geometry' RANGE_PATH = CEASIOM_PATH + '/ranges' W_PATH = CEASIOM_PATH + '/weight' C_PATH = W_PATH + '/crew' PILOTS_PATH = C_PATH + '/pilots' CC_PATH = C_PATH + '/cabinCrewMembers' PASS_PATH = W_PATH + '/passengers' ML_PATH = W_PATH + '/massLimits' PROP_PATH = CEASIOM_PATH + '/propulsion' FUEL_PATH = '/cpacs/toolspecific/CEASIOMpy/fuels' tixi = cpf.create_branch(tixi, FUEL_PATH, False) tixi = cpf.create_branch(tixi, GEOM_PATH, False) tixi = cpf.create_branch(tixi, RANGE_PATH, False) tixi = cpf.create_branch(tixi, PILOTS_PATH, False) tixi = cpf.create_branch(tixi, CC_PATH, False) tixi = cpf.create_branch(tixi, PASS_PATH, False) tixi = cpf.create_branch(tixi, ML_PATH, False) tixi = cpf.create_branch(tixi, PROP_PATH, False) # cpacs/vehicles MC_PATH = '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/'\ + 'payload/mCargo/massDescription' F_PATH = '/cpacs/vehicles/fuels/fuel' tixi = cpf.create_branch(tixi, MC_PATH, False) tixi = cpf.create_branch(tixi, F_PATH, False) tixi = cpf.add_uid(tixi, F_PATH, 'kerosene') # Gathering data ========================================================= # Geometry =============================================================== if not tixi.checkElement(GEOM_PATH + '/description'): tixi.createElement(GEOM_PATH, 'description') tixi.updateTextElement(GEOM_PATH + '/description', 'User '\ + 'geometry input') # Number of floors. if not tixi.checkElement(GEOM_PATH + '/floorsNb'): tixi.createElement(GEOM_PATH, 'floorsNb') tixi.updateDoubleElement(GEOM_PATH + '/floorsNb',\ ui.FLOORS_NB, '%g') else: temp = tixi.getDoubleElement(GEOM_PATH + '/floorsNb') if temp != ui.FLOORS_NB and temp > 0: ui.FLOORS_NB = temp # Extracting fuselage material data. if not tixi.checkElement(GEOM_PATH + '/virtualThick'): tixi.createElement(GEOM_PATH, 'virtualThick') tixi.updateDoubleElement(GEOM_PATH + '/virtualThick',\ adui.VRT_THICK, '%g') else: temp = tixi.getDoubleElement(GEOM_PATH + '/virtualThick') if temp != adui.VRT_THICK and temp > 0: adui.VRT_THICK = temp if not tixi.checkElement(GEOM_PATH + '/virtualDensity'): tixi.createElement(GEOM_PATH, 'virtualDensity') tixi.updateDoubleElement(GEOM_PATH + '/virtualDensity',\ adui.VRT_STR_DENSITY, '%g') else: temp = tixi.getDoubleElement(GEOM_PATH + '/virtualDensity') if temp != adui.VRT_STR_DENSITY and temp > 0: adui.VRT_STR_DENSITY = temp if not tixi.checkElement(GEOM_PATH + '/cabinHeight'): tixi.createElement(GEOM_PATH, 'cabinHeight') tixi.updateDoubleElement(GEOM_PATH + '/cabinHeight',\ ui.H_LIM_CABIN, '%g') else: temp = tixi.getDoubleElement(GEOM_PATH + '/cabinHeight') if temp != ui.H_LIM_CABIN and temp > 0: ui.H_LIM_CABIN = temp # People ================================================================= # Pilots user input data if not tixi.checkElement(PILOTS_PATH + '/pilotNb'): tixi.createElement(PILOTS_PATH, 'pilotNb') tixi.updateIntegerElement(PILOTS_PATH + '/pilotNb',\ adui.PILOT_NB, '%i') else: temp = tixi.getIntegerElement(PILOTS_PATH + '/pilotNb') if temp != adui.PILOT_NB and temp > 0: adui.PILOT_NB = temp if not tixi.checkElement(PILOTS_PATH + '/pilotMass'): tixi.createElement(PILOTS_PATH, 'pilotMass') tixi.updateDoubleElement(PILOTS_PATH + '/pilotMass',\ adui.MASS_PILOT, '%g') else: temp = tixi.getDoubleElement(PILOTS_PATH + '/pilotMass') if temp != adui.MASS_PILOT and temp > 0: adui.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',\ adui.MASS_CABIN_CREW, '%g') else: temp = tixi.getDoubleElement(CC_PATH + '/cabinCrewMemberMass') if temp != adui.MASS_CABIN_CREW and temp > 0: adui.MASS_CABIN_CREW = temp # Passengers user input data if not tixi.checkElement(PASS_PATH + '/passMass'): tixi.createElement(PASS_PATH, 'passMass') tixi.updateDoubleElement(PASS_PATH + '/passMass',\ adui.MASS_PASS, '%g') else: temp = tixi.getDoubleElement(PASS_PATH+ '/passMass') if temp != adui.MASS_PASS and temp > 0: adui.MASS_PASS = temp if tixi.checkElement(PASS_PATH + '/passNb'): temp = tixi.getIntegerElement(PASS_PATH+ '/passNb') if temp != ui.MAX_PASS and temp > 0: ui.MAX_PASS = temp if not tixi.checkElement(PASS_PATH + '/passDensity'): tixi.createElement(PASS_PATH, 'passDensity') tixi.updateDoubleElement(PASS_PATH + '/passDensity',\ ui.PASS_BASE_DENSITY, '%i') else: temp = tixi.getDoubleElement(PASS_PATH + '/passDensity') if temp != ui.PASS_BASE_DENSITY and temp > 0: ui.PASS_BASE_DENSITY = temp if not tixi.checkElement(PASS_PATH + '/passPerToilet'): tixi.createElement(PASS_PATH, 'passPerToilet') tixi.updateIntegerElement(PASS_PATH + '/passPerToilet',\ adui.PASS_PER_TOILET, '%i') else: temp = tixi.getIntegerElement(PASS_PATH + '/passPerToilet') if temp != adui.PASS_PER_TOILET and temp > 0: adui.PASS_PER_TOILET = temp # Fuel =================================================================== if not tixi.checkElement(F_PATH + '/density'): tixi.createElement(F_PATH, 'density') tixi.updateDoubleElement(F_PATH + '/density',\ adui.FUEL_DENSITY, '%g') else: temp = tixi.getDoubleElement(F_PATH + '/density') if temp != adui.FUEL_DENSITY and temp > 0: adui.FUEL_DENSITY = temp if not tixi.checkElement(FUEL_PATH + '/resFuelPerc'): tixi.createElement(FUEL_PATH, 'resFuelPerc') tixi.updateDoubleElement(FUEL_PATH + '/resFuelPerc',\ adui.RES_FUEL_PERC, '%g') else: temp = tixi.getDoubleElement(FUEL_PATH + '/resFuelPerc') if temp != adui.RES_FUEL_PERC and temp > 0: adui.RES_FUEL_PERC = temp # Weight ================================================================= # Mass limits data if not tixi.checkElement(ML_PATH + '/description'): tixi.createElement(ML_PATH, 'description') tixi.updateTextElement(ML_PATH + '/description', 'Desired max fuel '\ + 'volume [m^3] and payload mass [kg]') if not tixi.checkElement(ML_PATH + '/maxPayload'): tixi.createElement(ML_PATH, 'maxPayload') tixi.updateDoubleElement(ML_PATH + '/maxPayload',\ ui.MAX_PAYLOAD, '%g') else: temp = tixi.getDoubleElement(ML_PATH + '/maxPayload') if temp != ui.MAX_PAYLOAD and temp != 0: ui.MAX_PAYLOAD = temp if not tixi.checkElement(ML_PATH + '/maxFuelVol'): tixi.createElement(ML_PATH, 'maxFuelVol') tixi.updateDoubleElement(ML_PATH + '/maxFuelVol',\ ui.MAX_FUEL_VOL, '%g') else: temp = tixi.getDoubleElement(ML_PATH + '/maxFuelVol') if temp != ui.MAX_FUEL_VOL and temp != 0: ui.MAX_FUEL_VOL = temp if tixi.checkElement(MC_PATH + '/massCargo'): temp = tixi.getDoubleElement(MC_PATH + '/massCargo') if temp != ui.MASS_CARGO and temp != 0: ui.MASS_CARGO = temp # If the cargo mass is defined in the UserInputs class will be added # in the CPACS file after the analysis. # Flight ================================================================= if not tixi.checkElement(RANGE_PATH + '/lDRatio'): tixi.createElement(RANGE_PATH, 'lDRatio') tixi.updateDoubleElement(RANGE_PATH + '/lDRatio',\ ui.LD, '%g') else: temp = tixi.getIntegerElement(RANGE_PATH + '/lDRatio') if temp != ui.LD and temp > 0: ui.LD = temp if not tixi.checkElement(RANGE_PATH + '/cruiseSpeed'): tixi.createElement(RANGE_PATH, 'cruiseSpeed') tixi.updateDoubleElement(RANGE_PATH + '/cruiseSpeed',\ ui.CRUISE_SPEED, '%g') else: temp = tixi.getIntegerElement(RANGE_PATH + '/cruiseSpeed') if temp != ui.CRUISE_SPEED and temp > 0: ui.CRUISE_SPEED = temp TSFC_PATH = PROP_PATH + '/tSFC' tixi = cpf.create_branch(tixi, TSFC_PATH, False) if not tixi.checkElement(TSFC_PATH + '/tsfcCruise'): tixi.createElement(TSFC_PATH, 'tsfcCruise') tixi.updateDoubleElement(TSFC_PATH + '/tsfcCruise',\ ed.TSFC_CRUISE, '%g') else: temp = tixi.getDoubleElement(TSFC_PATH + '/tsfcCruise') if temp != ed.TSFC_CRUISE and temp > 0: ed.TSFC_CRUISE = temp if not tixi.checkElement(PROP_PATH + '/userEngineOption'): tixi.createElement(PROP_PATH, 'userEngineOption') if ui.USER_ENGINES: tixi.updateTextElement(PROP_PATH + '/userEngineOption', 'True') else: tixi.updateTextElement(PROP_PATH + '/userEngineOption', 'False') else: temp = tixi.getTextElement(PROP_PATH + '/userEngineOption') if temp == 'False': ui.USER_ENGINES = False else: ui.USER_ENGINES = True if not tixi.checkElement(PROP_PATH + '/singleHydraulics'): tixi.createElement(PROP_PATH, 'singleHydraulics') if adui.SINGLE_HYDRAULICS: tixi.updateTextElement(PROP_PATH + '/singleHydraulics', 'True') else: tixi.updateTextElement(PROP_PATH + '/singleHydraulics', 'False') else: temp = tixi.getTextElement(PROP_PATH + '/singleHydraulics') if temp == 'False': adui.SINGLE_HYDRAULICS = False else: adui.SINGLE_HYDRAULICS = True log.info('Data from CPACS file succesfully extracted') # Saving and closing the cpacs file -------------------------------------- tixi.saveDocument(cpacs_in) cpf.close_tixi(tixi, cpacs_in) # Openign and closing again the cpacs file ------------------------------- tixi = cpf.open_tixi(cpacs_in) tigl = cpf.open_tigl(tixi) tixi.saveDocument(cpacs_in) cpf.close_tixi(tixi, cpacs_in) return(ed, ui, adui)
def add_circular_fuse_profile(tixi_handle): """Internal function. Adds a circular profile to the CPACS file Parameters ---------- tixi_handle : tixi handle object A tixi handle to the cpacs file to be created Returns ------- tixi_handle : tixi handle object profile_id : str uID of the profile, """ base_path = '/cpacs/vehicles' tixi_handle.createElement(base_path, 'profiles') base_path += '/profiles' tixi_handle.createElement(base_path, 'fuselageProfiles') base_path += '/fuselageProfiles' tixi_handle.createElement(base_path, 'fuselageProfile') base_path += '/fuselageProfile' profile_id = 'fuselageCircleProfileID' add_uid(tixi_handle, base_path, profile_id) tixi_handle.addTextElement(base_path, 'name', 'Circle') tixi_handle.addTextElement( base_path, 'description', 'Profile build up from set of points on circle where dimensions are 1 ... -1' ) tixi_handle.createElement(base_path, 'pointList') base_path += '/pointList' # Add points x_vec = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] y_vec = [ 0.0, 0.0774924206719, 0.154518792808, 0.230615870742, 0.305325997695, 0.378199858172, 0.4487991802, 0.516699371152, 0.581492071288, 0.642787609687, 0.700217347767, 0.753435896328, 0.802123192755, 0.84598642592, 0.884761797177, 0.91821610688, 0.946148156876, 0.968389960528, 0.984807753012, 0.995302795793, 0.999811970449, 0.998308158271, 0.990800403365, 0.977333858251, 0.957989512315, 0.932883704732, 0.902167424781, 0.866025403784, 0.824675004109, 0.778364911924, 0.727373641573, 0.672007860556, 0.612600545193, 0.549508978071, 0.483112599297, 0.413810724505, 0.342020143326, 0.268172612761, 0.192712260548, 0.116092914125, 0.0387753712568, -0.0387753712568, -0.116092914125, -0.192712260548, -0.268172612761, -0.342020143326, -0.413810724505, -0.483112599297, -0.549508978071, -0.612600545193, -0.672007860556, -0.727373641573, -0.778364911924, -0.824675004109, -0.866025403784, -0.902167424781, -0.932883704732, -0.957989512315, -0.977333858251, -0.990800403365, -0.998308158271, -0.999811970449, -0.995302795793, -0.984807753012, -0.968389960528, -0.946148156876, -0.91821610688, -0.884761797177, -0.84598642592, -0.802123192755, -0.753435896328, -0.700217347767, -0.642787609687, -0.581492071288, -0.516699371152, -0.4487991802, -0.378199858172, -0.305325997695, -0.230615870742, -0.154518792808, -0.0774924206719, 0.0 ] z_vec = [ 1.0, 0.996992941168, 0.987989849477, 0.97304487058, 0.952247885338, 0.925723969269, 0.893632640323, 0.85616689953, 0.813552070263, 0.766044443119, 0.713929734558, 0.657521368569, 0.597158591703, 0.533204432802, 0.466043519703, 0.396079766039, 0.323733942058, 0.249441144058, 0.173648177667, 0.0968108707032, 0.0193913317718, -0.0581448289105, -0.13533129975, -0.211703872229, -0.286803232711, -0.360177724805, -0.431386065681, -0.5, -0.565606875487, -0.627812124672, -0.686241637869, -0.740544013109, -0.790392669519, -0.835487811413, -0.875558231302, -0.910362940966, -0.939692620786, -0.963370878616, -0.981255310627, -0.993238357742, -0.999247952504, -0.999247952504, -0.993238357742, -0.981255310627, -0.963370878616, -0.939692620786, -0.910362940966, -0.875558231302, -0.835487811413, -0.790392669519, -0.740544013109, -0.686241637869, -0.627812124672, -0.565606875487, -0.5, -0.431386065681, -0.360177724805, -0.286803232711, -0.211703872229, -0.13533129975, -0.0581448289105, 0.0193913317718, 0.0968108707032, 0.173648177667, 0.249441144058, 0.323733942058, 0.396079766039, 0.466043519703, 0.533204432802, 0.597158591703, 0.657521368569, 0.713929734558, 0.766044443119, 0.813552070263, 0.85616689953, 0.893632640323, 0.925723969269, 0.952247885338, 0.97304487058, 0.987989849477, 0.996992941168, 1.0 ] tixi_handle.addFloatVector(base_path, 'x', x_vec, len(x_vec), '%.12f') tixi_handle.addFloatVector(base_path, 'y', y_vec, len(y_vec), '%.12f') tixi_handle.addFloatVector(base_path, 'z', z_vec, len(z_vec), '%.12f') return profile_id, tixi_handle