Code owners
Assign users and groups as approvers for specific file changes. Learn more.
check_design_logic.py 35.13 KiB
# imports for python
import os
import sys
import shutil
from inspect import currentframe, getframeinfo
from datetime import datetime
from sub_function.read_xml_file import read_xml_file
from sub_function.check_for_existing_geometry import check_for_existing_geometry
from sub_function.prepare_single_mission_analysis import prepare_single_mission_analysis
from sub_function.write_to_log_file import write_to_log_file
from parameter_study.initialize_parameter_study import initialize_parameter_study
def check_design_logic(paths_and_names, parameter_for_design_case, control_settings, global_loop_counter,
outer_loop_counter):
""" check_design_logic checks the switches in aircraft exchange- and config files of selected design mode
-> if check fails -> switches will set to correct value.
The input list of lists "paths_and_names" contains the following values:
* [0][0] string: 'path_to_python_scripts', [0][1] string: 'the system path to python scripts'
* [1][0] string: 'path_of_working_directory', [1][1] string: 'the system path of working directory'
* [2][0] string: 'path_of_working_directory_rce', [2][1] string: 'the system path of working directory for rce'
* [3][0] string: 'path_of_origin_tool_directory', [3][1] string: 'the system path to the root directory of UNICADO repositories'
* [4][0] string: 'current_workflow_name', [4][1] string: 'workflow name of the current workflow execution'
* [5][0] string: 'path_to_aircraft_projects', [5][1] string: 'the system path to the repository of aircraft design projects'
* [6][0] string: 'path_to_aircraft_design_tools', [6][1] string: 'the system path to the repository of aircraft design tools'
* [7][0] string: 'path_to_software_tools', [7][1] string: 'the system path to the repository of software tools'
* [8][0] string: 'path_to_json_files', [8][1] string: 'the path to module json files in .rce system folder'
* [9][0] string: 'aircraft_exchange_directory', [9][1] string: 'name of the directory, witch contains the current aircraft project'
* [10][0] string: 'aircraft_exchange_file', [10][1] string: 'name of the current used aircraft exchange file'
* [11][0] string: 'aircraft_project', [11][1] string: 'name of the aircraft project, which ist currently designed'
* [12][0] string: 'path_to_project', [12][1] string: 'the system path to current project folder'
* [13][0] string: 'aircraft_type', [13][1] string: 'name of aircraft type'
The input list of lists "parameter_for_design_case" contains the following values:
* [0][0] string: 'design_mode', [0][1] int: 'value to check which design mode is selected'
* [1][0] string: 'automatic_trim', [1][1] int: 'value to switch off and on the automatic trim function of the workflow'
* [2][0] string: 'convergence_criteria', [2][1] float: 'value of convergence criteria of ome and mtom iteration'
* [3][0] string: 'number_of_max_iteration', [3][1] int: 'value to set maximum number of design sizing iteration steps'
* [4][0] string: 'damp_mtom_iteration' [4][1] bool: 'switch to activate damping of mtom iteration loop'
* [5][0] String: 'damp_ome_iteration' [5][1] bool: 'switch to activate damping of ome iteration loop'
* [6][0] string: 'parallel_execution' [6][1] int: 'switch to activate the parallel execution mode'
* [7][0] string: 'count_of_iteration', [7][1] int: 'current number of iteration of design sizing loop'
* [8][0] string: 'count_of_mission_study_loop', [8][1] int: 'current number of iteration of mission study loop'
The input list of lists "control_settings" contains the following values:
* [0][0] string: 'delete_plots_before_run', [0][1] int: 'switch to delete old plots before running'
* [1][0] string: 'delete_engines_before_run', [1][1] int: 'switch to delete old engine data before running'
* [2][0] string: 'clear_old_log_files_at_start', [2][1] int: 'switch to delete old log-files before running'
* [3][0] string: 'plot_output_on', [3][1] int: 'switch to enable or disable plot generation'
* [4][0] string: 'switch_off_plots', [4][1] int: 'switch to enable generation of plots of each iteration step'
* [5][0] string: 'report_output_on' [5][1] int: 'switch to enable or disable report generation'
* [6][0] string: 'switch_off_reports', [6][1] int: 'switch to enable generation of reports of each iteration step'
* [7][0] string: 'tex_report_on' [7][1] int: 'switch to enable or disable tex-report generation'
* [8][0] string: 'switch_off_tex', [8][1] int: 'switch to enable generation of tex-reports of each iteration step'
* [9][0] string: 'status_flag_to_skip_design_sizing' [9][1] int: 'status flag for plot generation of design sizing loop - iniitalized with 0'
* [10][0] string: 'status_flag_to_skip_study_mission', [10][1] int: 'status flag for plot generation of study mission loop - iniitalized with 0'
* [11][0] string: 'check_settings_for_design_logic', [11][1] int: 'value to switch off and on the checks of the design logic'
* [12][0] string: 'use_control_settings_for_sub_programs', [12][1] int: 'value for switching off and on the override control settings of subroutines'
* [13][0] string: 'use_range_type_specific_factors', [13][1] int: 'value for switch of range scenario to set range dependent parameters'
* [14][0] string: 'use_configs_from_existing_project', [14][1] int: 'value to activate copy of configuration files from existing project before running'
* [15][0] string: 'use_engine_from_existing_project', [15][1] int: 'value to activate copy of engine data from existing project before running'
* [16][0] string: 'save_configs_to_result_folder', [16][1] int: 'value to switch off and on the saving of configuration files in the result folder'
* [17][0] string: 'save_log_files_to_result_folder', [17][1] int: 'value to switch off and on the saving of log files in the result folder'
* [18][0] string: 'save_acft_xml_to_result_folder', [18][1] int: 'value to switch off and on the saving of aircraft exchange file in the result folder'
* [19][0] string: 'save_acft_xml_after_each_iteration', [19][1] int: 'value to switch off and on the saving of aircraft exchange file in the result folder after each step of iteration'
* [20][0] string: 'write_info_files', [20][1] int: 'switch to activate the writing of info files after each tool execution'
* [21][0] string: 'write_info_files_only_at_last_step_of_iteration', [21][1] int: 'switch to activate the writing of info files only after last step of sizing loop'
* [22][0] string: 'program_mode', [22][1] string: 'Value of program execution mode - either standard_aircraft_design, or parameter_study, or optimization'
The input integer 'global_loop_counter' contains the current outer loop number.
The input integer 'outer_loop_counter' contains the maximum number of parameter study loops to perform.
The output list of lists "parameter_for_design_case" contains the following values:
* [0][0] string: 'design_mode', [0][1] int: 'value to check which design mode is selected'
* [1][0] string: 'automatic_trim', [1][1] int: 'value to switch off and on the automatic trim function of the workflow'
* [2][0] string: 'convergence_criteria', [2][1] float: 'value of convergence criteria of ome and mtom iteration'
* [3][0] string: 'number_of_max_iteration', [3][1] int: 'value to set maximum number of design sizing iteration steps'
* [4][0] string: 'damp_mtom_iteration' [4][1] bool: 'switch to activate damping of mtom iteration loop'
* [5][0] String: 'damp_ome_iteration' [5][1] bool: 'switch to activate damping of ome iteration loop'
* [6][0] string: 'parallel_execution' [6][1] int: 'switch to activate the parallel execution mode'
* [7][0] string: 'count_of_iteration', [7][1] int: 'current number of iteration of design sizing loop'
* [8][0] string: 'count_of_mission_study_loop', [8][1] int: 'current number of iteration of mission study loop'
The output integer 'outer_loop_counter' contains the maximum number of parameter study loops to perform.
:param: paths_and_names: input list of lists
:param: parameter_for_design_case: input list of lists
:param: control_settings: input list of lists
:param: global_loop_counter: input integer
:param: outer_loop_counter: input integer
:return: parameter_for_design_case: output list of list, outer_loop_counter: output integer
"""
''' create list for log-file string '''
log_file_list = ['',
'************************************************ check design logic '
'************************************************']
''' read data for script execution '''
aircraft_exchange_file = ([item for item in paths_and_names if 'aircraft_exchange_file' in item])[-1][-1]
aircraft_project = ([item for item in paths_and_names if 'aircraft_project' in item])[-1][-1]
aircraft_type = ([item for item in paths_and_names if 'aircraft_type' in item])[-1][-1]
current_workflow_name = ([item for item in paths_and_names if 'current_workflow_name' in item])[-1][-1]
path_of_working_directory = ([item for item in paths_and_names if 'path_of_working_directory' in item])[-1][-1]
path_of_working_directory_rce = \
([item for item in paths_and_names if 'path_of_working_directory_rce' in item])[-1][-1]
path_to_aircraft_projects = ([item for item in paths_and_names if 'path_to_aircraft_projects' in item])[-1][-1]
path_to_aircraft_design_tools = \
([item for item in paths_and_names if 'path_to_aircraft_design_tools' in item])[-1][-1]
path_to_software_tools = ([item for item in paths_and_names if 'path_to_software_tools' in item])[-1][-1]
path_to_project = ([item for item in paths_and_names if 'path_to_project' in item])[-1][-1]
design_mode = ([item for item in parameter_for_design_case if 'design_mode' in item])[-1][-1]
parameter_study_mode = (([item for item in control_settings if 'program_mode' in item])[-1][-1]
== "parameter_study")
optimization_mode = (([item for item in control_settings if 'program_mode' in item])[-1][-1]
== "optimization")
''' initialize local parameter '''
function_name = getframeinfo(currentframe()).function
file_name = str()
program_switch = str()
design_type = str()
path_to_repository = str()
path_to_repository_file = str()
overwrite_fuselage_geometry = int()
check_flag_for_start_file = bool()
''' create list of files in working directory to check if all tools exist '''
files_in_origin_tool_directory = os.listdir(path_to_aircraft_design_tools + 'UNICADOworkflow/jsonFiles')
# loop for all elements in list of files
for file_name in files_in_origin_tool_directory:
if not file_name == '.git':
# check if file_name a directory
check_for_origin_tool_directory = os.path.isdir(path_to_aircraft_design_tools + file_name)
check_for_origin_software_tool_directory = os.path.isdir(path_to_software_tools + file_name)
check_for_working_tool_directory = os.path.isdir(path_of_working_directory + file_name)
# check if working copy of each module exist -> otherwise copy to working directory
if check_for_origin_tool_directory and not check_for_working_tool_directory:
shutil.copytree(path_to_aircraft_design_tools + file_name, path_of_working_directory + file_name)
print('Working copy of ' + file_name + ' has been successfully created!')
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
'Working copy of ' + file_name + ' has been successfully created!')
# check if working copy of software tool exist -> otherwise copy to working directory
if check_for_origin_software_tool_directory and not check_for_working_tool_directory:
shutil.copytree(path_to_software_tools + file_name, path_of_working_directory + file_name)
print('Working copy of ' + file_name + ' has been successfully created!')
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
'Working copy of ' + file_name + ' has been successfully created!')
# check if the parameter study mode is selected and the global loop counter is greater than 1
# -> if true: -> perform parameter study loop
if parameter_study_mode == 1 and global_loop_counter > 1:
print('Parameter study is running! Current study loop is: ' + str(global_loop_counter - 1) + ' of '
+ str(outer_loop_counter - 1))
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
'Parameter study is running! Current study loop is: ' + str(global_loop_counter - 1)
+ ' of ' + str(outer_loop_counter - 1))
# check if the parameter study mode is selected and the global loop counter is greater than 1
# -> if true: -> perform parameter study loop
if optimization_mode == 1 and global_loop_counter > 1:
print('Optimization is running! Current optimization loop is: ' + str(global_loop_counter - 1))
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
'Optimization is running! Current optimization loop is: ' + str(global_loop_counter - 1))
# check if the parameter study mode is not selected or reference case should be estimated
# -> if true: -> set design mode settings for single workflow execution
if global_loop_counter == 1:
''' check witch mode is selected'''
# design mode 0 is selected -> standard mode
if design_mode == 0:
print('Standard execution will be performed! '
'No parameter checks will be performed and parameter will be reset!')
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ':'
' Standard execution will be performed! '
'No parameter checks will be performed and no parameter will be reset!')
# design mode 1 is selected -> clean sheet design with mission analysis will be performed
if design_mode == 1:
print('Clean sheet design will be performed!')
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
'Clean sheet design will be performed!')
# design mode 2 is selected -> sizing with an existing geometry will be performed
if design_mode == 2:
print('Design with existing geometry will be performed!')
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
'Design with existing geometry will be performed!')
# mission study analysis without design sizing loop
if design_mode == 3:
print('Mission study analysis without design sizing loop will be performed! '
'Attention, a converged aircraft exchange file and the associated engine '
'and aerodynamic data are required!')
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
'Mission study analysis without design sizing loop will be performed! Attention, '
'a converged aircraft exchange file and the associated engine and aerodynamic '
'data are required!')
# mission study analysis without design sizing loop
if design_mode == 4:
print('Design sizing loop as a clean sheet design without mission analysis loop will be performed!')
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
'Design sizing loop as a clean sheet design without mission analysis loop will be '
'performed! ')
# wrong mode selection -> clean sheet design will be performed
if (design_mode < 0) or (design_mode > 4):
print('WARNING: Wrong design mode selection! Only design mode 0, 1, 2, 3 or 4 is allowed! '
'Execution mode will be set to clean sheet design!')
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
'WARNING: Wrong design mode selection! Only design mode 0, 1, 2, 3 or 4 is allowed! '
'Execution mode will be set to clean sheet design!')
design_mode = 1
([item for item in parameter_for_design_case if 'design_mode' in item])[-1][-1] = design_mode
''' set design mode specific settings and perform initializing steps '''
if design_mode == 1 or design_mode == 2 or design_mode == 4:
''' set design mode specific settings '''
# design mode 1 or 4 is selected -> check existence of _startCSD.xml file
if design_mode == 1 or design_mode == 4:
program_switch = "mode_0"
file_name = aircraft_project + '_startCSD.xml'
check_flag_for_start_file = os.path.isfile(path_of_working_directory_rce + current_workflow_name
+ '/' + aircraft_project + '/' + file_name)
design_type = 'clean_sheet_design'
# design mode 2 is selected -> sizing with an existing
if design_mode == 2:
program_switch = "mode_1"
file_name = aircraft_project + '_startRFD.xml'
check_flag_for_start_file = os.path.isfile(path_of_working_directory_rce + current_workflow_name
+ '/' + aircraft_project + '/' + file_name)
design_type = 'retrofit_design/without_calibration'
''' perform initializing steps '''
# append final file separator to path_to_aircraft_project if not exiting
if not path_to_aircraft_projects[-1] == '/':
path_to_aircraft_projects = path_to_aircraft_projects + '/'
if 'originUnicadoProjects' in path_to_aircraft_projects:
path_to_aircraft_projects = path_to_aircraft_projects + 'projects/'
path_to_repository = path_to_aircraft_projects + aircraft_type + '/' + aircraft_project \
+ '/' + design_type + '/'
path_to_repository_file = path_to_repository + file_name
# Check if the sizing loop starting file exist inside the project folder
# -> if true: -> rename to project file
if check_flag_for_start_file:
shutil.copy(path_of_working_directory_rce + current_workflow_name + '/' + aircraft_project + '/'
+ file_name,
path_of_working_directory_rce + current_workflow_name + '/' + aircraft_project + '/'
+ aircraft_exchange_file)
# Else condition: starting file not exist inside the project folder
# -> copy starting file from repository and rename to project file
else:
if os.path.isfile(path_to_repository_file):
shutil.copy(path_to_repository_file, path_to_project + file_name)
shutil.copy(path_to_project + file_name,
path_of_working_directory_rce + current_workflow_name + '/' + aircraft_project
+ '/' + aircraft_exchange_file)
else:
print('Error: ' + file_name + ' could not be copied, no ' + file_name
+ ' in repository folder found! \n Program aborted!')
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
'Error: ' + file_name + ' could not be copied, no ' + file_name
+ ' in repository folder found! \n Program aborted!')
write_to_log_file(path_of_working_directory_rce, current_workflow_name, log_file_list)
sys.exit(1)
if design_mode == 2:
# check if the necessary geometry data files exist in the current project folder
# -> otherwise try to copy from repository
log_file_list = check_for_existing_geometry(path_of_working_directory_rce, aircraft_project, file_name,
path_to_repository, log_file_list, current_workflow_name)
''' convert switches in config files of modules according to design mode if requested: '''
adapt_module_configs_to_design_case =\
int(([item for item in control_settings if 'check_settings_for_design_logic' in item])[-1][-1])
if adapt_module_configs_to_design_case:
# set switch in wing_design_conf.xml
frame_info = getframeinfo(currentframe())
path = path_of_working_directory_rce + current_workflow_name + '/wing_design_conf.xml'
root_of_wing_design_conf, xml_tree = read_xml_file(path, path_of_working_directory_rce, 'wing_design',
function_name, frame_info.lineno, log_file_list,
current_workflow_name)
# change sizing mode of wing design to initial sizing
path_in_config = './program_settings/modes/design_mode/value'
root_of_wing_design_conf.find(path_in_config).text = program_switch
xml_tree.write(path_of_working_directory_rce + current_workflow_name + '/wing_design_conf.xml',
encoding='utf-8')
print('Sizing mode switch \'' + path_in_config + '\' in the wing_design_conf.xml file is set to '
+ program_switch + '!')
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
'Sizing mode switch \'' + path_in_config + '\' in the wing_design_conf.xml file '
+ 'is set to ' + program_switch + '!')
# set switch in empennage_design_conf.xml
frame_info = getframeinfo(currentframe())
path = path_of_working_directory_rce + current_workflow_name + '/empennage_design_conf.xml'
root_of_empennage_sizing_conf, xml_tree = read_xml_file(path, path_of_working_directory_rce,
'empennage_design', function_name,
frame_info.lineno, log_file_list,
current_workflow_name)
# change sizing mode of empennage sizing to initial sizing
path_in_config = './program_settings/modes/design_mode/value'
root_of_empennage_sizing_conf.find(path_in_config).text = program_switch
xml_tree.write(path_of_working_directory_rce + current_workflow_name + '/empennage_design_conf.xml',
encoding='utf-8')
print('Sizing mode switch \'' + path_in_config + '\' in the empennage_design_conf.xml file '
+ 'is set to ' + program_switch + '!')
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
'Sizing mode switch \'' + path_in_config + '\' in the empennage_design_conf.xml '
+ 'file is set to ' + program_switch + '!')
# set switch in propulsion_design_conf.xml
#frame_info = getframeinfo(currentframe())
#path = path_of_working_directory_rce + current_workflow_name + '/propulsion_design_conf.xml'
#root_of_propulsion_integration_conf, xml_tree = read_xml_file(path, path_of_working_directory_rce,
# 'propulsion_design', function_name,
# frame_info.lineno, log_file_list,
# current_workflow_name)
# change sizing mode of propulsion integration to initial sizing
#path_in_config = './ProgramSettings/SizingMode'
#root_of_propulsion_integration_conf.find(path_in_config).text = str(int(1))
#xml_tree.write(path_of_working_directory_rce + current_workflow_name
# + '/propulsion_design_conf.xml', encoding='utf-8')
#print('Sizing mode switch \'' + path_in_config + '\' in the propulsion_design_conf.xml file '
# + 'is set to mode ' + str(program_switch) + '!')
#log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
# 'Sizing mode switch \'' + path_in_config + '\' in the '
# + 'propulsion_design_conf.xml file is set to mode ' + str(program_switch)
# + '!')
# set switch in fuselage_design_conf.xml
#frame_info = getframeinfo(currentframe())
#path = path_of_working_directory_rce + current_workflow_name + '/fuselage_design_conf.xml'
#root_of_fuselage_design_conf, xml_tree = read_xml_file(path, path_of_working_directory_rce,
# 'fuselage_design', function_name,
# frame_info.lineno, log_file_list,
# current_workflow_name)
# change mode of fuselage design to allow or prohibit overwrite an existing fuselage geometry
#path_in_config = './ControlSettings/ProgramSpecific/OverwriteFuselageGeometry'
#root_of_fuselage_design_conf.find(path_in_config).text = \
# str(int(overwrite_fuselage_geometry))
#xml_tree.write(path_of_working_directory_rce + current_workflow_name + '/fuselage_design_conf.xml',
# encoding='utf-8')
#print('Overwrite fuselage geometry switch \'' + path_in_config + '\' in the fuselage_design_conf.xml '
# + 'file is set to mode ' + str(overwrite_fuselage_geometry) + '!')
#log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
# 'Overwrite fuselage geometry switch \'' + path_in_config + '\' in the '
# + 'fuselage_design_conf.xml file is set to mode ' + str(overwrite_fuselage_geometry)
# + '!')
''' check existance of aircraft project file '''
if not os.path.isfile(path_of_working_directory_rce + current_workflow_name + '/' + aircraft_project
+ '/' + aircraft_exchange_file):
print('Error: ' + aircraft_exchange_file + ' is not existing in working directory '
+ path_of_working_directory_rce + current_workflow_name + '/' + aircraft_project + '/'
+ '\n Program aborted!')
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
'Error: ' + aircraft_exchange_file + ' is not existing in working directory '
+ path_of_working_directory_rce + current_workflow_name + '/' + aircraft_project
+ '/' + '\n Program aborted!')
write_to_log_file(path_of_working_directory_rce, current_workflow_name, log_file_list)
sys.exit(1)
''' Convert switches in config file to design mode '''
if design_mode == 3:
mission_type = "study"
else:
mission_type = "design"
# set switches in create_mission_xml_conf.xml
frame_info = getframeinfo(currentframe())
path = path_of_working_directory_rce + current_workflow_name + '/create_mission_xml_conf.xml'
create_mission_conf_xml_root, xml_tree = read_xml_file(path, path_of_working_directory_rce, 'create_mission_xml',
function_name, frame_info.lineno, log_file_list,
current_workflow_name)
# Change switch to design mission in order to create a design mission
create_mission_conf_xml_root.find('./program_settings/mission_selector/value').text = mission_type + "_mission"
# write settings to configuration xml file
xml_tree.write(path, encoding='utf-8')
#Print change to output
print('Set mode switch in the create_mission_conf.xml to create ' + mission_type + '_mission!')
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
'Set mode switch in the create_mission_conf.xml to create ' + mission_type + '_mission!')
# set switches in systems_design_conf.xml
frame_info = getframeinfo(currentframe())
path = path_of_working_directory_rce + current_workflow_name + '/systems_design_conf.xml'
systems_design_conf_root, xml_tree = read_xml_file(path, path_of_working_directory_rce, 'systems_design',
function_name, frame_info.lineno, log_file_list,
current_workflow_name)
# Change switch from design mission to study mission,
# in order to calculate systems characteristics for a study mission
systems_design_conf_root.find('./program_settings/mission_mode/value').text = mission_type
# write settings to configuration xml file
xml_tree.write(path, encoding='utf-8')
#Print change to output
print('Set mode switch in the systems_design_conf.xml to ' + mission_type + ' systems accordingly!')
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
'Set mode switch in the systems_design_conf.xml to ' + mission_type
+ ' systems accordingly!')
# set switches in mission_analysis_conf.xml
frame_info = getframeinfo(currentframe())
path = path_of_working_directory_rce + current_workflow_name + '/mission_analysis_conf.xml'
mission_analysis_conf_xml_root, xml_tree = read_xml_file(path, path_of_working_directory_rce, 'mission_analysis',
function_name, frame_info.lineno, log_file_list,
current_workflow_name)
# for a study mission - switch off the MTOM estimation
mission_analysis_conf_xml_root.find('./program_settings/mode/mission_methods/mission_type/value').text = \
mission_type + "_mission"
# write settings to configuration xml file
xml_tree.write(path, encoding='utf-8')
#Print change to output
print('Set mode switch in the mission_analysis_conf.xml to fly the ' + mission_type + '_mission!')
log_file_list.append(str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ': '
'Set mode switch in the mission_analysis_conf.xml to fly the ' + mission_type + '_mission!')
if design_mode == 3:
file_name = aircraft_project + '.xml'
prepare_single_mission_analysis(path_of_working_directory_rce, aircraft_project, file_name, log_file_list,
current_workflow_name)
''' initialize parameter study if selected in workflow configuration file '''
if parameter_study_mode == 1 and global_loop_counter == 1:
back_up_outer_loop_counter = outer_loop_counter
print(' * ------ initialize parameter study ------')
log_file_list.append(' * ------ initialize parameter study ------')
# call function to initialize parameter study
abort_parameter_study_flag, outer_loop_counter, log_file_list = initialize_parameter_study(paths_and_names,
log_file_list)
print(' * ------ end initialize parameter study ------')
log_file_list.append(' * ------ end initialize parameter study ------')
# check if the abort_parameter_study_flag is equal to True -> if true: -> set parameter_study_mode switch to 0
if abort_parameter_study_flag:
outer_loop_counter = back_up_outer_loop_counter
([item for item in parameter_for_design_case if 'parameter_study_mode' in item])[-1][-1] = int(0)
''' write log-file to system '''
log_file_list.append('********************************************** end check design logic '
'**********************************************')
write_to_log_file(path_of_working_directory_rce, current_workflow_name, log_file_list)
return parameter_for_design_case, outer_loop_counter