Skip to content
Snippets Groups Projects
Commit bb2928b1 authored by Duc Bui Tien's avatar Duc Bui Tien
Browse files

remove last traces of old convergenceLoop

add comments
parent a6bf7e5f
Branches
Tags
2 merge requests!2UnicadoGuiBackend,!1New UnicadoGUI Branch
......@@ -4,9 +4,13 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="ade4f2dd-968a-4099-9236-831254f6eb55" name="Changes" comment="add config for available modules and a small script to generate&#10;add exampale settings of modules">
<change beforePath="$PROJECT_DIR$/.idea/fastApiUnicado.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/fastApiUnicado.iml" afterDir="false" />
<list default="true" id="ade4f2dd-968a-4099-9236-831254f6eb55" name="Changes" comment="refactoring test file to tmp/modules">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/tmp/modules" beforeDir="false" afterPath="$PROJECT_DIR$/tmp/modules" afterDir="false" />
<change beforePath="$PROJECT_DIR$/xml_configs/config.ini" beforeDir="false" afterPath="$PROJECT_DIR$/xml_configs/config.ini" afterDir="false" />
<change beforePath="$PROJECT_DIR$/xml_configs/propulsionIntegration_conf.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/xml_configs/propulsionIntegration_conf_default.xml" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -58,7 +62,7 @@
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;codeWithMe.voiceChat.enabledByDefault&quot;: &quot;false&quot;,
&quot;git-widget-placeholder&quot;: &quot;master&quot;,
&quot;last_opened_file_path&quot;: &quot;C:/Users/d_bui/PycharmProjects/fastApiUnicado/xml_configs&quot;,
&quot;last_opened_file_path&quot;: &quot;C:/Users/d_bui/PycharmProjects/fastApiUnicado/tmp&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
......@@ -70,6 +74,7 @@
}</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\d_bui\PycharmProjects\fastApiUnicado\tmp" />
<recent name="C:\Users\d_bui\PycharmProjects\fastApiUnicado\xml_configs" />
<recent name="C:\Users\d_bui\PycharmProjects\fastApiUnicado\output_files" />
<recent name="C:\Users\d_bui\PycharmProjects\fastApiUnicado" />
......@@ -79,7 +84,7 @@
<recent name="C:\Users\d_bui\PycharmProjects\fastApiUnicado" />
</key>
</component>
<component name="RunManager" selected="FastAPI.fastApiUnicado">
<component name="RunManager" selected="Python.configWriter">
<configuration name="test_main | #6" type="HttpClient.HttpRequestRunConfigurationType" factoryName="HTTP Request" temporary="true" nameIsGenerated="true" path="$PROJECT_DIR$/test_main.http" index="6" requestIdentifier="#6" runType="Run single request">
<method v="2" />
</configuration>
......@@ -295,7 +300,9 @@
<workItem from="1725608860034" duration="12274000" />
<workItem from="1725871510924" duration="595000" />
<workItem from="1725956023581" duration="4552000" />
<workItem from="1725970370723" duration="1430000" />
<workItem from="1725970370723" duration="6389000" />
<workItem from="1726038817770" duration="36000" />
<workItem from="1726046411914" duration="4116000" />
</task>
<task id="LOCAL-00001" summary="add update_Modules">
<option name="closed" value="true" />
......@@ -377,7 +384,15 @@
<option name="project" value="LOCAL" />
<updated>1725971455637</updated>
</task>
<option name="localTasksCounter" value="11" />
<task id="LOCAL-00011" summary="refactoring test file to tmp/modules">
<option name="closed" value="true" />
<created>1725972109933</created>
<option name="number" value="00011" />
<option name="presentableId" value="LOCAL-00011" />
<option name="project" value="LOCAL" />
<updated>1725972109933</updated>
</task>
<option name="localTasksCounter" value="12" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
......@@ -417,12 +432,13 @@
<MESSAGE value="add reset to default" />
<MESSAGE value="bugfix utf-8 special char writing" />
<MESSAGE value="add config for available modules and a small script to generate&#10;add exampale settings of modules" />
<option name="LAST_COMMIT_MESSAGE" value="add config for available modules and a small script to generate&#10;add exampale settings of modules" />
<MESSAGE value="refactoring test file to tmp/modules" />
<option name="LAST_COMMIT_MESSAGE" value="refactoring test file to tmp/modules" />
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/fastApiUnicado$fastApiUnicado.coverage" NAME="fastApiUnicado Coverage Results" MODIFIED="1725971234697" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" />
<SUITE FILE_PATH="coverage/fastApiUnicado$fastApiUnicado.coverage" NAME="fastApiUnicado Coverage Results" MODIFIED="1726049164040" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" />
<SUITE FILE_PATH="coverage/fastApiUnicado$xmlConfigReader.coverage" NAME="xmlConfigReader Coverage Results" MODIFIED="1720078308255" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/fastApiUnicado$test.coverage" NAME="test Coverage Results" MODIFIED="1711008069985" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/fastApiUnicado$configWriter.coverage" NAME="configWriter Coverage Results" MODIFIED="1725970890207" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/fastApiUnicado$configWriter.coverage" NAME="configWriter Coverage Results" MODIFIED="1726053313909" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component>
</project>
\ No newline at end of file
......@@ -2,12 +2,12 @@ import configparser
import json
from fastapi import FastAPI
from fastapi.responses import FileResponse
import xml.etree.ElementTree as ET
from fastapi.middleware.cors import CORSMiddleware
from pydantic import BaseModel
import xmltodict
from fastapi.encoders import jsonable_encoder
#FastAPI Backend for UNICADO Gui
app = FastAPI()
origins = [
......@@ -23,26 +23,15 @@ app.add_middleware(
allow_headers=["*"],
)
class Convergence(BaseModel):
SetupSteps: list = []
StudyMission: list = []
SizingLoop: list = []
PostprocessingSteps: list = []
#Models for requests
class Modules(BaseModel):
groups: list = []
class Conf(BaseModel):
module_configuration_file: dict = {}
def search_modules(dict, name, root):
list = []
for i in range(len(root.findall(f"ProgramSettings/{name}/Program/Name"))):
list.append(root.find(f"ProgramSettings/{name}/Program[@ID='{i + 1}']/Name").text)
dict[name] = list
#Endpoints
@app.get("/start/{module}")
async def start_module(module: str):
#dummy-function
......@@ -50,22 +39,19 @@ async def start_module(module: str):
return {"message": f"running {module} without problems"}
@app.get("/convergence")
async def get_conv_modules():
tree = ET.parse('xml_configs/convergenceLoop_conf.xml')
root = tree.getroot()
#endpoint which returns a list of available modules
@app.get("/modules/selection")
async def get_avail_modules():
dict = {}
config = configparser.ConfigParser()
config.read('xml_configs/config.ini')
search_modules(dict, "SetupSteps", root)
search_modules(dict, "SizingLoop", root)
search_modules(dict, "StudyMission", root)
search_modules(dict, "PostprocessingSteps", root)
dict['availableModules']=config['available_Modules']['modules'].split(',')
return dict
#TO-DO: following endpoints are for the case of a single project, need to add solution for more projects
#endpoint which returns the last saved project
@app.get("/modules")
async def get_modules():
with open("tmp/modules", "r") as fp:
......@@ -73,7 +59,7 @@ async def get_modules():
return modules
#endpoint to save the current project on the server
@app.put("/modules/update")
async def update_modules(item:Modules):
print(jsonable_encoder(item))
......@@ -82,13 +68,14 @@ async def update_modules(item:Modules):
return item
#endpoint to get the settings of selected module
@app.get("/modules/{module}/config")
async def get_module_config(module: str):
with open("xml_configs/"+module+"_conf.xml", encoding='utf-8') as fd:
config = json.dumps(xmltodict.parse(fd.read()))
return config
#endpoint to save the setting of selected module
@app.put("/modules/config/update")
async def update_module_config(config: Conf):
dict = {"module_configuration_file": config.module_configuration_file}
......@@ -97,6 +84,7 @@ async def update_module_config(config: Conf):
fd.write(xml)
return
#endpoint reset settings of selected module to default
@app.get("/modules/{module}/config/reset")
async def reset_module_config(module:str):
with open("xml_configs/"+module+"_conf_default.xml", encoding='utf-8') as fd:
......@@ -106,6 +94,7 @@ async def reset_module_config(module:str):
fd.write(xml)
return
#dummy endpoints
@app.get("/graph/")
async def get_plotData():
#dummy-Function
......
{"groups": [{"name": "models from branches", "loop": "true", "loopsize": 1, "modules": ["initialSizing", "wingDesign", "createMissionXML", "systemsDesign", "calculatePolar", "calculatePerformance", "propulsionIntegration", "missionAnalysis", "weightAndBalanceAnalysis", "propulsionDesign"]}, {"name": "test1", "loop": "true", "loopsize": 1, "modules": ["landingGearDesign", "estimateDOC", "initialSizing", "cpacsInterface", "calculatePerformance"]}, {"name": "copy of test1", "loop": "true", "loopsize": 1, "modules": ["estimateDOC", "landingGearDesign", "initialSizing", "cpacsInterface", "calculatePerformance"]}]}
\ No newline at end of file
{"groups": [{"name": "models from modularization branches", "loop": "true", "loopsize": 1, "modules": ["initialSizing", "wingDesign", "createMissionXML", "systemsDesign", "calculatePolar", "calculatePerformance", "missionAnalysis", "weightAndBalanceAnalysis", "propulsionDesign"]}]}
\ No newline at end of file
[available_Modules]
modules = calculatePerformance,calculatePolar,createMissionXML,initialSizing,missionAnalysis,propulsionDesign,propulsionIntegration,systemsDesign,weightAndBalanceAnalysis,wingDesign
modules = calculatePerformance,calculatePolar,createMissionXML,initialSizing,missionAnalysis,propulsionDesign,systemsDesign,weightAndBalanceAnalysis,wingDesign
<?xml version="1.0" encoding="utf-8" ?>
<ConfigFile Name="propulsionIntegration_conf.xml">
<ControlSettings Desc="General control settings">
<IOFileName>CSR-02.xml</IOFileName>
<IODir>../../../../rUnicado/aircraftReferences/CSR/CSR-02/cleanSheetDesign/</IODir>
<OwnToolLevel>1</OwnToolLevel>
<ConsoleOutputOn Desc="0: Off, 1: only out/err/warn, 2: 1 + info, 3: 2 + debug">1</ConsoleOutputOn>
<LogfileOutputOn Desc="0: Off, 1: only out/err/warn, 2: 1 + info, 3: 2 + debug">1</LogfileOutputOn>
<PlotOutputOn CopyPlottingFiles="1" DeletePlottingFilesFromToolFolder="1">1</PlotOutputOn>
<ReportOutputOn>1</ReportOutputOn>
<TexReportOn>1</TexReportOn>
<WriteInfoFiles>0</WriteInfoFiles>
<GnuplotScript>propulsionIntegration_plot.plt</GnuplotScript>
<LogFile>propulsionIntegration.log</LogFile>
<InkscapePath>DEFAULT</InkscapePath>
<GnuplotPath>DEFAULT</GnuplotPath>
</ControlSettings>
<ProgramSettings Desc="Program settings">
<SizingMode Unit="-" Desc="0: Nacelles will not be altered, 1:Nacelle Sizing, 2: Nacelle Scaling" Default="1">1</SizingMode>
<PylonParameters Desc="Parameters for the design and scaling of the Pylons">
<PylonMode Unit="-" Desc="0:Pylons will not be altered, 1:Pylon Sizing, 2: Pylon repositioning" Default="1">1</PylonMode>
<PylonSizing Desc="Parameters for the sizing of a 2 segment pylon, 1. seg. in nacelle, 2. seg to connected body">
<rel_x_ref_Point Unit="-" Desc="Distance in x direction from nacelle ref point to plyon ref point relative to nacelle length" Default="0.1">0.1</rel_x_ref_Point>
<rel_y_ref_Point Unit="-" Desc="Distance in y direction from nacelle ref point to plyon ref point relative to nacelle width" Default="0.0">0.0</rel_y_ref_Point>
<rel_z_ref_Point Unit="-" Desc="Distance in z direction from nacelle ref point to plyon ref point relative to nacelle height" Default="0.0">0.0</rel_z_ref_Point>
<Pylon1stSegment>
<InnerProfile_Segment Desc="Inner airfoil segment. Geometry is stored in IoDir/geometry/airfoilData in a seperate file (*.dat)" ToolLevel="1">geometryData/airfoilData/n0012.dat</InnerProfile_Segment>
<OuterProfile_Segment Desc="Outer airfoil segment. Geometry is stored in IoDir/geometry/airfoilData in a seperate file (*.dat)" ToolLevel="1">geometryData/airfoilData/n0012.dat</OuterProfile_Segment>
<l_i_rel_segment Unit="-" Desc="Inner chord length of pylon relative to nacelle length" Default="0.9">1.2</l_i_rel_segment>
<l_o_rel_segment Unit="-" Desc="Inner chord length of pylon relative to nacelle length" Default="0.9">1.5</l_o_rel_segment>
<s_rel_Segment Unit="-" Desc="Span of pylon segment relative to nacelle heigth" ToolLevel="0.5">0.42</s_rel_Segment>
<phi_Segment Unit="deg" Desc="Leading edge sweep angle of pylon segment" Default="0.">0</phi_Segment>
</Pylon1stSegment>
<Pylon2ndSegment>
<InnerProfile_Segment Desc="Inner airfoil segment. Geometry is stored in IoDir/geometry/airfoilData in a seperate file (*.dat)" ToolLevel="1">geometryData/airfoilData/n0012.dat</InnerProfile_Segment>
<OuterProfile_Segment Desc="Outer airfoil segment. Geometry is stored in IoDir/geometry/airfoilData in a seperate file (*.dat)" ToolLevel="1">geometryData/airfoilData/n0012.dat</OuterProfile_Segment>
<l_i_rel_segment Unit="-" Desc="Inner chord length of pylon relative to nacelle length" Default="0.9">1.5</l_i_rel_segment>
</Pylon2ndSegment>
</PylonSizing>
</PylonParameters>
</ProgramSettings>
</ConfigFile>
<?xml version="1.0" encoding="utf-8" ?>
<ConfigFile Name="propulsionIntegration_conf.xml">
<ControlSettings Desc="General control settings">
<IOFileName>CSR-02.xml</IOFileName>
<IODir>../../../../rUnicado/aircraftReferences/CSR/CSR-02/cleanSheetDesign/</IODir>
<OwnToolLevel>1</OwnToolLevel>
<ConsoleOutputOn Desc="0: Off, 1: only out/err/warn, 2: 1 + info, 3: 2 + debug">1</ConsoleOutputOn>
<LogfileOutputOn Desc="0: Off, 1: only out/err/warn, 2: 1 + info, 3: 2 + debug">1</LogfileOutputOn>
<PlotOutputOn CopyPlottingFiles="1" DeletePlottingFilesFromToolFolder="1">1</PlotOutputOn>
<ReportOutputOn>1</ReportOutputOn>
<TexReportOn>1</TexReportOn>
<WriteInfoFiles>0</WriteInfoFiles>
<GnuplotScript>propulsionIntegration_plot.plt</GnuplotScript>
<LogFile>propulsionIntegration.log</LogFile>
<InkscapePath>DEFAULT</InkscapePath>
<GnuplotPath>DEFAULT</GnuplotPath>
</ControlSettings>
<ProgramSettings Desc="Program settings">
<SizingMode Unit="-" Desc="0: Nacelles will not be altered, 1:Nacelle Sizing, 2: Nacelle Scaling" Default="1">1</SizingMode>
<PylonParameters Desc="Parameters for the design and scaling of the Pylons">
<PylonMode Unit="-" Desc="0:Pylons will not be altered, 1:Pylon Sizing, 2: Pylon repositioning" Default="1">1</PylonMode>
<PylonSizing Desc="Parameters for the sizing of a 2 segment pylon, 1. seg. in nacelle, 2. seg to connected body">
<rel_x_ref_Point Unit="-" Desc="Distance in x direction from nacelle ref point to plyon ref point relative to nacelle length" Default="0.1">0.1</rel_x_ref_Point>
<rel_y_ref_Point Unit="-" Desc="Distance in y direction from nacelle ref point to plyon ref point relative to nacelle width" Default="0.0">0.0</rel_y_ref_Point>
<rel_z_ref_Point Unit="-" Desc="Distance in z direction from nacelle ref point to plyon ref point relative to nacelle height" Default="0.0">0.0</rel_z_ref_Point>
<Pylon1stSegment>
<InnerProfile_Segment Desc="Inner airfoil segment. Geometry is stored in IoDir/geometry/airfoilData in a seperate file (*.dat)" ToolLevel="1">geometryData/airfoilData/n0012.dat</InnerProfile_Segment>
<OuterProfile_Segment Desc="Outer airfoil segment. Geometry is stored in IoDir/geometry/airfoilData in a seperate file (*.dat)" ToolLevel="1">geometryData/airfoilData/n0012.dat</OuterProfile_Segment>
<l_i_rel_segment Unit="-" Desc="Inner chord length of pylon relative to nacelle length" Default="0.9">1.2</l_i_rel_segment>
<l_o_rel_segment Unit="-" Desc="Inner chord length of pylon relative to nacelle length" Default="0.9">1.5</l_o_rel_segment>
<s_rel_Segment Unit="-" Desc="Span of pylon segment relative to nacelle heigth" ToolLevel="0.5">0.42</s_rel_Segment>
<phi_Segment Unit="deg" Desc="Leading edge sweep angle of pylon segment" Default="0.">0</phi_Segment>
</Pylon1stSegment>
<Pylon2ndSegment>
<InnerProfile_Segment Desc="Inner airfoil segment. Geometry is stored in IoDir/geometry/airfoilData in a seperate file (*.dat)" ToolLevel="1">geometryData/airfoilData/n0012.dat</InnerProfile_Segment>
<OuterProfile_Segment Desc="Outer airfoil segment. Geometry is stored in IoDir/geometry/airfoilData in a seperate file (*.dat)" ToolLevel="1">geometryData/airfoilData/n0012.dat</OuterProfile_Segment>
<l_i_rel_segment Unit="-" Desc="Inner chord length of pylon relative to nacelle length" Default="0.9">1.5</l_i_rel_segment>
</Pylon2ndSegment>
</PylonSizing>
</PylonParameters>
</ProgramSettings>
</ConfigFile>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment