Skip to content
Snippets Groups Projects
Commit 2bbcc366 authored by imcovangent's avatar imcovangent
Browse files

Finished first version of BLISS-2000 architecture.

Expanded SSBJ database.


Former-commit-id: fbf7c558c75f94e669bef692ed8afb13cb2c06fd
parent b0f5e4dc
No related branches found
No related tags found
No related merge requests found
Showing
with 436 additions and 311 deletions
......@@ -4,22 +4,24 @@
SSBJ test case - http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19980234657.pdf
Original Python implementation for OpenMDAO integration developed by
Sylvain Dubreuil and Remi Lafage of ONERA, the French Aerospace Lab.
Orignal files taken from: https://github.com/OneraHub/SSBJ-OpenMDAO
Original files taken from: https://github.com/OneraHub/SSBJ-OpenMDAO
The files were adjusted for optimal use in KADMOS by Imco van Gent.
"""
from __future__ import absolute_import, division, print_function
import sys
import numpy as np
from lxml import etree
from examples.knowledgebases.ssbj import root_tag, x_tc, x_AR, x_Sref, x_lambda, x_section, x_L, \
x_sigma1, x_sigma2, x_sigma3, x_sigma4, x_sigma5
from examples.knowledgebases.ssbj.common import PolynomialFunction, add_discipline_to_cmdows
from examples.knowledgebases.ssbj import root_tag, x_tc, x_AR, x_Lambda, x_Sref, x_L, x_WT, x_h, x_M, x_ESF, x_Theta, \
x_CDmin, x_D, x_fin, x_dpdx, x_Cf
from examples.knowledgebases.ssbj.common import PolynomialFunction, add_discipline_to_cmdows, run_tool
from openlego.api import AbstractDiscipline
from openlego.utils.xml_utils import xml_safe_create_element
class Cnstrnt_sigmas(AbstractDiscipline):
class Aerodynamics(AbstractDiscipline):
@property
def creator(self):
......@@ -35,22 +37,23 @@ class Cnstrnt_sigmas(AbstractDiscipline):
@property
def description(self):
return u'Structural stress constraint of the SSBJ test case.'
@property
def description(self):
return u'First discipline of the Sellar problem'
return u'Aerodynamic analysis discipline of the SSBJ test case.'
def generate_input_xml(self):
root = etree.Element(root_tag)
doc = etree.ElementTree(root)
xml_safe_create_element(doc, x_tc, 0.05)
xml_safe_create_element(doc, x_h, 45000.0)
xml_safe_create_element(doc, x_M, 1.6)
xml_safe_create_element(doc, x_AR, 5.5)
xml_safe_create_element(doc, x_Lambda, 55.0)
xml_safe_create_element(doc, x_Sref, 1000.0)
xml_safe_create_element(doc, x_lambda, 0.25)
xml_safe_create_element(doc, x_section, 1.0)
xml_safe_create_element(doc, x_L, 49909.58578)
xml_safe_create_element(doc, x_WT, 49909.58578)
xml_safe_create_element(doc, x_ESF, 1.0)
xml_safe_create_element(doc, x_Theta, 0.950978)
xml_safe_create_element(doc, x_CDmin, 0.01375)
xml_safe_create_element(doc, x_Cf, 0.75)
return etree.tostring(doc, encoding='utf-8', pretty_print=True, xml_declaration=True)
......@@ -58,11 +61,10 @@ class Cnstrnt_sigmas(AbstractDiscipline):
root = etree.Element(root_tag)
doc = etree.ElementTree(root)
xml_safe_create_element(doc, x_sigma1, 1.12255)
xml_safe_create_element(doc, x_sigma2, 1.08170213)
xml_safe_create_element(doc, x_sigma3, 1.0612766)
xml_safe_create_element(doc, x_sigma4, 1.04902128)
xml_safe_create_element(doc, x_sigma5, 1.04085106)
xml_safe_create_element(doc, x_L, 49909.58578)
xml_safe_create_element(doc, x_D, 12193.7018)
xml_safe_create_element(doc, x_fin, 4.093062)
xml_safe_create_element(doc, x_dpdx, 1.0)
return etree.tostring(doc, encoding='utf-8', pretty_print=True, xml_declaration=True)
......@@ -78,39 +80,53 @@ class Cnstrnt_sigmas(AbstractDiscipline):
def execute(in_file, out_file):
doc = etree.parse(in_file)
z0 = float(doc.xpath(x_tc)[0].text)
z1 = float(doc.xpath(x_h)[0].text)
z2 = float(doc.xpath(x_M)[0].text)
z3 = float(doc.xpath(x_AR)[0].text)
z4 = float(doc.xpath(x_Lambda)[0].text)
z5 = float(doc.xpath(x_Sref)[0].text)
x0 = float(doc.xpath(x_lambda)[0].text)
x1 = float(doc.xpath(x_section)[0].text)
L = float(doc.xpath(x_L)[0].text)
WT = float(doc.xpath(x_WT)[0].text)
ESF = float(doc.xpath(x_ESF)[0].text)
Theta = float(doc.xpath(x_Theta)[0].text)
CDMIN = float(doc.xpath(x_CDmin)[0].text)
x_aer = float(doc.xpath(x_Cf)[0].text)
pf = PolynomialFunction()
b = np.sqrt(abs(z5 * z3)) / 2.0
R = (1.0 + 2.0 * x0) / (3.0 * (1.0 + x0))
Sigma0 = pf.eval([z0, L, x1, b, R], [4, 1, 4, 1, 1], [0.1] * 5, "sigma[1]")
Sigma1 = pf.eval([z0, L, x1, b, R], [4, 1, 4, 1, 1], [0.15] * 5, "sigma[2]")
Sigma2 = pf.eval([z0, L, x1, b, R], [4, 1, 4, 1, 1], [0.2] * 5, "sigma[3]")
Sigma3 = pf.eval([z0, L, x1, b, R], [4, 1, 4, 1, 1], [0.25] * 5, "sigma[4]")
Sigma4 = pf.eval([z0, L, x1, b, R], [4, 1, 4, 1, 1], [0.30] * 5, "sigma[5]")
if z1 <= 36089.0:
V = 1116.39 * z2 * np.sqrt(abs(1.0 - 6.875E-6 * z1))
rho = 2.377E-3 * (1. - 6.875E-6 * z1) ** 4.2561
else:
V = 968.1 * abs(z2)
rho = 2.377E-3 * 0.2971 * np.exp((36089.0 - z1) / 20806.7)
CL = WT / (0.5 * rho * (V ** 2) * z5)
Fo2 = pf.eval([ESF, abs(x_aer)], [1, 1], [.25] * 2, "Fo2")
CDmin = CDMIN * Fo2 + 3.05 * abs(z0) ** (5.0 / 3.0) \
* abs(np.cos(z4 * np.pi / 180.0)) ** 1.5
if z2 >= 1:
k = abs(z3) * (abs(z2) ** 2 - 1.0) * np.cos(z4 * np.pi / 180.) \
/ (4. * abs(z3) * np.sqrt(abs(z4 ** 2 - 1.) - 2.))
else:
k = (0.8 * np.pi * abs(z3)) ** -1
Fo3 = pf.eval([Theta], [5], [.25], "Fo3")
CD = (CDmin + k * CL ** 2) * Fo3
L = WT
D = CD * 0.5 * rho * V ** 2 * z5
fin = WT / D
dpdx = pf.eval([z0], [1], [.25], "dpdx")
root = etree.Element(root_tag)
doc = etree.ElementTree(root)
xml_safe_create_element(doc, x_sigma1, Sigma0)
xml_safe_create_element(doc, x_sigma2, Sigma1)
xml_safe_create_element(doc, x_sigma3, Sigma2)
xml_safe_create_element(doc, x_sigma4, Sigma3)
xml_safe_create_element(doc, x_sigma5, Sigma4)
xml_safe_create_element(doc, x_L, L)
xml_safe_create_element(doc, x_D, D)
xml_safe_create_element(doc, x_fin, fin)
xml_safe_create_element(doc, x_dpdx, dpdx)
doc.write(out_file, encoding='utf-8', pretty_print=True, xml_declaration=True)
if __name__ == "__main__":
cnstrnt_sigmas_analysis = Cnstrnt_sigmas()
in_file = '__test__cnstrnt_sigmas_input.xml'
out_file = '__test__cnstrnt_sigmas_output.xml'
with open(in_file, 'w') as f:
f.write(cnstrnt_sigmas_analysis.generate_input_xml())
cnstrnt_sigmas_analysis.execute(in_file, out_file)
analysis = Aerodynamics()
run_tool(analysis, sys.argv)
......@@ -4,21 +4,23 @@
SSBJ test case - http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19980234657.pdf
Original Python implementation for OpenMDAO integration developed by
Sylvain Dubreuil and Remi Lafage of ONERA, the French Aerospace Lab.
Orignal files taken from: https://github.com/OneraHub/SSBJ-OpenMDAO
Original files taken from: https://github.com/OneraHub/SSBJ-OpenMDAO
The files were adjusted for optimal use in KADMOS by Imco van Gent.
"""
from __future__ import absolute_import, division, print_function
import sys
import numpy as np
from lxml import etree
from examples.knowledgebases.ssbj import root_tag, x_AR, x_Sref, x_lambda, x_section, x_L, x_Theta
from examples.knowledgebases.ssbj.common import PolynomialFunction, add_discipline_to_cmdows
from examples.knowledgebases.ssbj import root_tag, x_WT, x_h, x_M, x_fin, x_SFC, x_WF, x_R
from examples.knowledgebases.ssbj.common import add_discipline_to_cmdows, run_tool
from openlego.api import AbstractDiscipline
from openlego.utils.xml_utils import xml_safe_create_element
class Cnstrnt_theta(AbstractDiscipline):
class Performance(AbstractDiscipline):
@property
def creator(self):
......@@ -34,17 +36,18 @@ class Cnstrnt_theta(AbstractDiscipline):
@property
def description(self):
return u'Structural constraint of the SSBJ test case.'
return u'Performance analysis discipline of the SSBJ test case.'
def generate_input_xml(self):
root = etree.Element(root_tag)
doc = etree.ElementTree(root)
xml_safe_create_element(doc, x_AR, 5.5)
xml_safe_create_element(doc, x_Sref, 1000.0)
xml_safe_create_element(doc, x_lambda, 0.25)
xml_safe_create_element(doc, x_section, 1.0)
xml_safe_create_element(doc, x_L, 49909.58578)
xml_safe_create_element(doc, x_h, 45000.0)
xml_safe_create_element(doc, x_M, 1.6)
xml_safe_create_element(doc, x_fin, 4.093062)
xml_safe_create_element(doc, x_SFC, 1.12328)
xml_safe_create_element(doc, x_WT, 49909.58578)
xml_safe_create_element(doc, x_WF, 7306.20261)
return etree.tostring(doc, encoding='utf-8', pretty_print=True, xml_declaration=True)
......@@ -52,7 +55,7 @@ class Cnstrnt_theta(AbstractDiscipline):
root = etree.Element(root_tag)
doc = etree.ElementTree(root)
xml_safe_create_element(doc, x_Theta, 0.950978)
xml_safe_create_element(doc, x_R, 528.91363)
return etree.tostring(doc, encoding='utf-8', pretty_print=True, xml_declaration=True)
......@@ -67,30 +70,25 @@ class Cnstrnt_theta(AbstractDiscipline):
@staticmethod
def execute(in_file, out_file):
doc = etree.parse(in_file)
z3 = float(doc.xpath(x_AR)[0].text)
z5 = float(doc.xpath(x_Sref)[0].text)
x0 = float(doc.xpath(x_lambda)[0].text)
x1 = float(doc.xpath(x_section)[0].text)
L = float(doc.xpath(x_L)[0].text)
pf = PolynomialFunction()
b = np.sqrt(abs(z5 * z3)) / 2.0
R = (1.0 + 2.0 * x0) / (3.0 * (1.0 + x0))
Theta = pf.eval([abs(x1), b, R, L], [2, 4, 4, 3], [0.25] * 4, "twist")
z1 = float(doc.xpath(x_h)[0].text)
z2 = float(doc.xpath(x_M)[0].text)
fin = float(doc.xpath(x_fin)[0].text)
SFC = float(doc.xpath(x_SFC)[0].text)
WT = float(doc.xpath(x_WT)[0].text)
WF = float(doc.xpath(x_WF)[0].text)
if z1 <= 36089.:
theta = 1.0 - 6.875E-6 * z1
else:
theta = 0.7519
R = 661.0 * np.sqrt(theta) * z2 * fin / SFC * np.log(abs(WT / (WT - WF)))
root = etree.Element(root_tag)
doc = etree.ElementTree(root)
xml_safe_create_element(doc, x_Theta, Theta)
xml_safe_create_element(doc, x_R, R)
doc.write(out_file, encoding='utf-8', pretty_print=True, xml_declaration=True)
if __name__ == "__main__":
cnstrnt_theta = Cnstrnt_theta()
in_file = '__test__cnstrnt_theta_input.xml'
out_file = '__test__cnstrnt_theta_output.xml'
with open(in_file, 'w') as f:
f.write(cnstrnt_theta.generate_input_xml())
cnstrnt_theta.execute(in_file, out_file)
analysis = Performance()
run_tool(analysis, sys.argv)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
SSBJ test case - http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19980234657.pdf
Original Python implementation for OpenMDAO integration developed by
Sylvain Dubreuil and Remi Lafage of ONERA, the French Aerospace Lab.
Original files taken from: https://github.com/OneraHub/SSBJ-OpenMDAO
The files were adjusted for optimal use in KADMOS by Imco van Gent.
"""
from __future__ import absolute_import, division, print_function
import sys
from lxml import etree
from examples.knowledgebases.ssbj import root_tag, x_h, x_M, x_ESF, x_D, x_Temp, x_SFC, x_WE, x_DT, x_WBE, x_T
from examples.knowledgebases.ssbj.common import PolynomialFunction, add_discipline_to_cmdows, run_tool
from openlego.api import AbstractDiscipline
from openlego.utils.xml_utils import xml_safe_create_element
class Propulsion(AbstractDiscipline):
@property
def creator(self):
return u'S. Dubreuil and R. Lafage'
@property
def owner(self):
return u'J. Sobieszczanski-Sobieski'
@property
def operator(self):
return u'I. van Gent'
@property
def description(self):
return u'Aerodynamic analysis discipline of the SSBJ test case.'
def generate_input_xml(self):
root = etree.Element(root_tag)
doc = etree.ElementTree(root)
xml_safe_create_element(doc, x_h, 45000.0)
xml_safe_create_element(doc, x_M, 1.6)
xml_safe_create_element(doc, x_T, 0.3126)
xml_safe_create_element(doc, x_D, 12193.7018)
xml_safe_create_element(doc, x_WBE, 4360.)
return etree.tostring(doc, encoding='utf-8', pretty_print=True, xml_declaration=True)
def generate_output_xml(self):
root = etree.Element(root_tag)
doc = etree.ElementTree(root)
xml_safe_create_element(doc, x_Temp, 1.0)
xml_safe_create_element(doc, x_ESF, 1.0)
xml_safe_create_element(doc, x_SFC, 1.12328)
xml_safe_create_element(doc, x_WE, 5748.915355)
xml_safe_create_element(doc, x_DT, 0.278366)
return etree.tostring(doc, encoding='utf-8', pretty_print=True, xml_declaration=True)
def deploy(self):
"""Deploy this discipline's template in-/output XML files and its information in the CMDOWS file."""
with open(self.in_file, 'w') as f:
f.write(self.generate_input_xml())
with open(self.out_file, 'w') as f:
f.write(self.generate_output_xml())
add_discipline_to_cmdows(self)
@staticmethod
def execute(in_file, out_file):
doc = etree.parse(in_file)
z1 = float(doc.xpath(x_h)[0].text)
z2 = float(doc.xpath(x_M)[0].text)
Xpro = float(doc.xpath(x_T)[0].text)
D = float(doc.xpath(x_D)[0].text)
WBE = float(doc.xpath(x_WBE)[0].text)
pf = PolynomialFunction()
Tbar = abs(Xpro) * 16168.6
Temp = pf.eval([z2, z1, abs(Xpro)], [2, 4, 2], [.25] * 3, "Temp")
ESF = (D / 3.0) / Tbar
SFC = 1.1324 + 1.5344 * z2 - 3.2956E-05 * z1 - 1.6379E-04 * Tbar \
- 0.31623 * z2 ** 2 + 8.2138E-06 * z2 * z1 - 10.496E-5 * Tbar * z2 \
- 8.574E-11 * z1 ** 2 + 3.8042E-9 * Tbar * z1 + 1.06E-8 * Tbar ** 2
WE = 3.0 * WBE * abs(ESF) ** 1.05
TUAbar = 11484.0 + 10856.0 * z2 - 0.50802 * z1 \
+ 3200.2 * (z2 ** 2) - 0.29326 * z2 * z1 + 6.8572E-6 * z1 ** 2
DT = Tbar / TUAbar - 1.0
root = etree.Element(root_tag)
doc = etree.ElementTree(root)
xml_safe_create_element(doc, x_Temp, Temp)
xml_safe_create_element(doc, x_ESF, ESF)
xml_safe_create_element(doc, x_SFC, SFC)
xml_safe_create_element(doc, x_WE, WE)
xml_safe_create_element(doc, x_DT, DT)
doc.write(out_file, encoding='utf-8', pretty_print=True, xml_declaration=True)
if __name__ == "__main__":
analysis = Propulsion()
run_tool(analysis, sys.argv)
......@@ -4,17 +4,19 @@
SSBJ test case - http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19980234657.pdf
Original Python implementation for OpenMDAO integration developed by
Sylvain Dubreuil and Remi Lafage of ONERA, the French Aerospace Lab.
Orignal files taken from: https://github.com/OneraHub/SSBJ-OpenMDAO
Original files taken from: https://github.com/OneraHub/SSBJ-OpenMDAO
The files were adjusted for optimal use in KADMOS by Imco van Gent.
"""
from __future__ import absolute_import, division, print_function
import sys
import numpy as np
from lxml import etree
from examples.knowledgebases.ssbj import root_tag, x_tc, x_AR, x_Lambda, x_Sref, x_lambda, x_section, x_WO, x_WE, x_WFO, \
x_L, x_Nz, x_WT, x_WF
from examples.knowledgebases.ssbj.common import PolynomialFunction, add_discipline_to_cmdows
x_L, x_Nz, x_WT, x_WF, x_sigma1, x_sigma2, x_sigma3, x_sigma4, x_sigma5, x_Theta
from examples.knowledgebases.ssbj.common import PolynomialFunction, add_discipline_to_cmdows, run_tool
from openlego.api import AbstractDiscipline
from openlego.utils.xml_utils import xml_safe_create_element
......@@ -61,6 +63,12 @@ class Structures(AbstractDiscipline):
xml_safe_create_element(doc, x_WT, 49909.58578)
xml_safe_create_element(doc, x_WF, 7306.20261)
xml_safe_create_element(doc, x_sigma1, 1.12255)
xml_safe_create_element(doc, x_sigma2, 1.08170213)
xml_safe_create_element(doc, x_sigma3, 1.0612766)
xml_safe_create_element(doc, x_sigma4, 1.04902128)
xml_safe_create_element(doc, x_sigma5, 1.04085106)
xml_safe_create_element(doc, x_Theta, 0.950978)
return etree.tostring(doc, encoding='utf-8', pretty_print=True, xml_declaration=True)
......@@ -89,6 +97,9 @@ class Structures(AbstractDiscipline):
pf = PolynomialFunction()
b = np.sqrt(abs(z5 * z3)) / 2.0
R = (1.0 + 2.0 * x0) / (3.0 * (1.0 + x0))
t = z0 * z5 / (np.sqrt(abs(z5 * z3)))
Fo1 = pf.eval([x1], [1], [.008], "Fo1")
......@@ -102,19 +113,30 @@ class Structures(AbstractDiscipline):
WF = WFW + WFO
WT = WO + WW + WF + WE
Sigma0 = pf.eval([z0, L, x1, b, R], [4, 1, 4, 1, 1], [0.1] * 5, "sigma[1]")
Sigma1 = pf.eval([z0, L, x1, b, R], [4, 1, 4, 1, 1], [0.15] * 5, "sigma[2]")
Sigma2 = pf.eval([z0, L, x1, b, R], [4, 1, 4, 1, 1], [0.2] * 5, "sigma[3]")
Sigma3 = pf.eval([z0, L, x1, b, R], [4, 1, 4, 1, 1], [0.25] * 5, "sigma[4]")
Sigma4 = pf.eval([z0, L, x1, b, R], [4, 1, 4, 1, 1], [0.30] * 5, "sigma[5]")
Theta = pf.eval([abs(x1), b, R, L], [2, 4, 4, 3], [0.25] * 4, "twist")
root = etree.Element(root_tag)
doc = etree.ElementTree(root)
xml_safe_create_element(doc, x_WF, WF)
xml_safe_create_element(doc, x_WT, WT)
doc.write(out_file, encoding='utf-8', pretty_print=True, xml_declaration=True)
xml_safe_create_element(doc, x_sigma1, Sigma0)
xml_safe_create_element(doc, x_sigma2, Sigma1)
xml_safe_create_element(doc, x_sigma3, Sigma2)
xml_safe_create_element(doc, x_sigma4, Sigma3)
xml_safe_create_element(doc, x_sigma5, Sigma4)
if __name__ == "__main__":
xml_safe_create_element(doc, x_Theta, Theta)
doc.write(out_file, encoding='utf-8', pretty_print=True, xml_declaration=True)
structural_analysis = Structures()
in_file = '__test__structures_core_input.xml'
out_file = '__test__structures_core_output.xml'
with open(in_file, 'w') as f:
f.write(structural_analysis.generate_input_xml())
structural_analysis.execute(in_file, out_file)
if __name__ == "__main__":
analysis = Structures()
run_tool(analysis, sys.argv)
<?xml version="1.0" encoding="UTF-8"?>
<map:mappings xmlns:map="http://www.rcenvironment.de/2015/mapping"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<map:mapping>
<map:source>/data_schema</map:source>
<map:target>/data_schema</map:target>
</map:mapping>
</map:mappings>
\ No newline at end of file
......@@ -15,7 +15,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This file contains code to clean and deploy the knowledge base of the test Sellar case.
This file contains code to clean and deploy the database of the test SSBJ case.
"""
from __future__ import absolute_import, division, print_function
......@@ -26,13 +26,13 @@ from shutil import copyfile
from openlego.utils.xml_utils import xml_merge
dir_path = os.path.dirname(os.path.realpath(__file__))
base_file_path = os.path.join(dir_path, 'sellar-base.xml')
base_file_path = os.path.join(dir_path, 'SSBJ-base.xml')
root_tag = 'data_schema'
cat1 = 'aircraft/geometry'
cat2 = 'aircraft/weight'
cat3 = 'aircraft/other'
cat4 = 'aircraft/reference'
cat4 = 'reference'
x_root = '/' + root_tag
x_tc = '/'.join([x_root, cat1, 'tc'])
......@@ -72,13 +72,14 @@ x_M = '/'.join([x_root, cat4, 'M'])
x_ESF = '/'.join([x_root, cat4, 'ESF'])
x_Temp = '/'.join([x_root, cat4, 'Temp'])
from examples.knowledgebases.ssbj.Cnstrnt_sigmas import Cnstrnt_sigmas
from examples.knowledgebases.ssbj.Cnstrnt_theta import Cnstrnt_theta
from examples.knowledgebases.ssbj.Structures import Structures
def list_disciplines():
return [Structures(), Cnstrnt_theta(), Cnstrnt_sigmas()]
from examples.knowledgebases.ssbj.Structures import Structures
from examples.knowledgebases.ssbj.Aerodynamics import Aerodynamics
from examples.knowledgebases.ssbj.Propulsion import Propulsion
from examples.knowledgebases.ssbj.Performance import Performance
return [Structures(), Aerodynamics(), Propulsion(), Performance()]
def try_to_remove(file):
try:
......@@ -86,6 +87,7 @@ def try_to_remove(file):
except:
pass
def clean():
for discipline in list_disciplines():
try_to_remove(discipline.in_file)
......@@ -97,6 +99,8 @@ def clean():
for file in os.listdir(dir):
if '__test__' in file:
os.remove(file)
if '__run__' in file and '_output.xml' in file:
os.remove(file)
if '__cmdows__' in file:
os.remove(file)
......
<?xml version='1.0' encoding='utf-8'?>
<data_schema>
<aircraft>
<geometry>
<tc>0.05</tc>
<AR>5.5</AR>
<Lambda>55.0</Lambda>
<Sref>1000.0</Sref>
<Theta>0.950978</Theta>
</geometry>
<weight>
<WT>49909.58578</WT>
</weight>
<other>
<CDmin>0.01375</CDmin>
<Cf>0.75</Cf>
</other>
</aircraft>
<reference>
<h>45000.0</h>
<M>1.6</M>
<ESF>1.0</ESF>
</reference>
</data_schema>
<?xml version='1.0' encoding='utf-8'?>
<data_schema>
<reference>
<h>45000.0</h>
<M>1.6</M>
</reference>
<aircraft>
<other>
<fin>4.093062</fin>
<SFC>1.12328</SFC>
</other>
<weight>
<WT>49909.58578</WT>
<WF>7306.20261</WF>
</weight>
</aircraft>
</data_schema>
<?xml version='1.0' encoding='utf-8'?>
<data_schema>
<reference>
<h>45000.0</h>
<M>1.6</M>
</reference>
<aircraft>
<other>
<T>0.3126</T>
<D>12193.7018</D>
</other>
<weight>
<WBE>4360.0</WBE>
</weight>
</aircraft>
</data_schema>
<?xml version='1.0' encoding='utf-8'?>
<data_schema>
<aircraft>
<geometry>
<tc>0.05</tc>
<AR>5.5</AR>
<Lambda>55.0</Lambda>
<Sref>1000.0</Sref>
<lambda>0.25</lambda>
<section>1.0</section>
</geometry>
<weight>
<WO>25000.0</WO>
<WE>5748.915355</WE>
<WFO>2000.0</WFO>
</weight>
<other>
<L>49909.58578</L>
<Nz>6.0</Nz>
</other>
</aircraft>
</data_schema>
<?xml version="1.0" encoding="UTF-8"?>
<data_schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="data-schema.xsd">
<aircraft>
<geometry>
<tc>0.05</tc>
<AR>5.5</AR>
<Lambda>55.0</Lambda>
<Sref>1000.0</Sref>
<Theta>0.950978</Theta>
</geometry>
<weight>
<WT>49909.58578</WT>
</weight>
<other>
<Cf>1.0</Cf>
</other>
</aircraft>
<reference>
<h>45000.</h>
<M>1.6</M>
<ESF>1.0</ESF>
</reference>
</data_schema>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<data_schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="data-schema.xsd">
<aircraft>
<other>
<L>1.0</L>
<D>1.0</D>
<fin>1.0</fin>
<dpdx>1.0</dpdx>
</other>
</aircraft>
</data_schema>
\ No newline at end of file
......@@ -6,6 +6,8 @@ Sylvain Dubreuil and Remi Lafage of ONERA, the French Aerospace Lab.
import os
import numpy as np
# pylint: disable=C0103
import sys
from kadmos.cmdows import CMDOWS
......@@ -20,7 +22,7 @@ def add_discipline_to_cmdows(Discipline):
else:
cmdows_files = ['__cmdows__SSBJ.xml']
cmdows = CMDOWS()
cmdows.add_header()
cmdows.add_header(Discipline.operator, 'CMDOWS file of the SSBJ database.')
cmdows.add_dc(Discipline.name, Discipline.name, 'main', 1, Discipline.version, Discipline.name)
cmdows.save(cmdows_files[0], pretty_print=True)
......@@ -112,6 +114,38 @@ class PolynomialFunction(object):
return float((Ao + Ai.T * S_shifted.T + 0.5 * S_shifted * Aij * S_shifted.T)[0])
def run_tool(analysis_class, sys_argv):
key_word = analysis_class.__class__.__name__
key_word_lc = key_word.lower()
if len(sys_argv) == 1:
raise SyntaxError('Please provide the required type of run using arguments. Either "test" or "-i infile.xml '
'-o outfile.xml".')
elif sys_argv[1] == 'test':
in_file = '__test__{}_input.xml'.format(key_word_lc)
out_file = '__test__{}_output.xml'.format(key_word_lc)
with open(in_file, 'w') as f:
f.write(analysis_class.generate_input_xml())
analysis_class.execute(in_file, out_file)
sys.stdout.write('Executed test run of {}.py with input file "{}" and output file "{}".'
.format(key_word, in_file, out_file))
elif sys_argv[1] == '-i':
in_file = sys_argv[2]
assert os.path.isfile(in_file), 'Could not find the input file "{}" in the folder.'.format(in_file)
if '-o' in sys_argv:
assert sys_argv[3] == '-o', 'Setting "-o" should be the third argument.'
out_file = sys_argv[4]
else:
out_file = '__run__{}_output.xml'.format(key_word_lc)
analysis_class.execute(in_file, out_file)
sys.stdout.write('Executed run of {}.py with input file "{}" and output file "{}".'.format(key_word, in_file,
out_file))
else:
raise SyntaxError('Please provide the required type of run. Either "test" or "-i infile.xml -o outfile.xml".')
if __name__ == '__main__':
p = PolynomialFunction()
......
<?xml version="1.0" encoding="UTF-8"?>
<data_schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="data-schema.xsd">
<aircraft>
<weight>
<WT>49909.58578</WT>
<WF>7306.20261</WF>
</weight>
<other>
<fin>4.093062</fin>
<SFC>1.12328</SFC>
</other>
</aircraft>
<reference>
<h>45000.</h>
<M>1.6</M>
</reference>
</data_schema>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<data_schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="data-schema.xsd">
<aircraft>
<other>
<R>528.91363</R>
</other>
</aircraft>
</data_schema>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<data_schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="data-schema.xsd">
<aircraft>
<other>
<T>0.5</T>
<D>12193.7018</D>
</other>
</aircraft>
<reference>
<h>45000.</h>
<M>1.6</M>
</reference>
</data_schema>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<data_schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="data-schema.xsd">
<aircraft>
<weight>
<WE>5748.915355</WE>
</weight>
<other>
<SFC>1.12328</SFC>
<DT>0.278366</DT>
</other>
</aircraft>
<reference>
<ESF>1.0</ESF>
<Temp>1.0</Temp>
</reference>
</data_schema>
\ No newline at end of file
<?xml version='1.0' encoding='UTF-8'?>
<cmdows xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://bitbucket.org/imcovangent/cmdows/raw/master/schema/0.7/cmdows.xsd">
<header>
<creator>Lukas Mueller</creator>
<description>RCG CMDOWS file of the super-sonic business jet test case optimization problem</description>
<timestamp>2017-12-04T12:06:18.606991</timestamp>
<fileVersion>0.1</fileVersion>
<cmdowsVersion>0.7</cmdowsVersion>
<updates>
<update>
<modification>KADMOS export of a repository connectivity graph (RCG).</modification>
<creator>Lukas Mueller</creator>
<timestamp>2017-12-04T12:06:18.606991</timestamp>
<fileVersion>0.1</fileVersion>
<cmdowsVersion>0.7</cmdowsVersion>
</update>
</updates>
<organization>
<contacts>
<contact uID="ivangent">
<email>i.vangent@tudelft.nl</email>
<company>TU Delft</company>
<name>Imco van Gent</name>
</contact>
<contact uID="lmuller">
<email>l.muller@student.tudelft.nl</email>
<company>TU Delft</company>
<name>Lukas Muller</name>
</contact>
<contact uID="sylvaindubreuil">
<name>Sylvain Dubreuil</name>
<email>Sylvain.Dubreuil@onera.fr</email>
<company>ONERA Toulouse</company>
<country>France</country>
</contact>
<contact uID="remilafage">
<name>Remi Lafage</name>
<email>Remi.Lafage@onera.fr</email>
<company>ONERA Toulouse</company>
<country>France</country>
</contact>
</contacts>
<organigram>
<integrators>
<integrator>
<contactUID>lmuller</contactUID>
</integrator>
</integrators>
<architects>
<architect>
<contactUID>ivangent</contactUID>
</architect>
<architect>
<contactUID>lmuller</contactUID>
</architect>
</architects>
<toolSpecialists>
<toolSpecialist>
<contactUID>sylvaindubreuil</contactUID>
</toolSpecialist>
<toolSpecialist>
<contactUID>remilafage</contactUID>
</toolSpecialist>
</toolSpecialists>
</organigram>
</organization>
</header>
<executableBlocks>
<designCompetences>
<designCompetence uID="structure[main][1][1.0]">
<ID>structure</ID>
<modeID>main</modeID>
<instanceID>1</instanceID>
<version>1.0</version>
<label>structure</label>
<metadata>
<generalInfo>
<description>Weight estimation of different aircraft parts.</description>
<owner>
<contactUID>remilafage</contactUID>
</owner>
<creator>
<contactUID>sylvaindubreuil</contactUID>
</creator>
</generalInfo>
</metadata>
</designCompetence>
<designCompetence uID="aerodynamics[main][1][1.0]">
<ID>aerodynamics</ID>
<modeID>main</modeID>
<instanceID>1</instanceID>
<version>1.0</version>
<label>aerodynamics</label>
<metadata>
<generalInfo>
<description>Estimation of the aircraft lift and drag during cruise.</description>
<owner>
<contactUID>remilafage</contactUID>
</owner>
<creator>
<contactUID>sylvaindubreuil</contactUID>
</creator>
</generalInfo>
</metadata>
</designCompetence>
<designCompetence uID="propulsion[main][1][1.0]">
<ID>propulsion</ID>
<modeID>main</modeID>
<instanceID>1</instanceID>
<version>1.0</version>
<label>propulsion</label>
<metadata>
<generalInfo>
<description>Engine sizing and estimation of the engine thrust.</description>
<owner>
<contactUID>remilafage</contactUID>
</owner>
<creator>
<contactUID>sylvaindubreuil</contactUID>
</creator>
</generalInfo>
</metadata>
</designCompetence>
<designCompetence uID="performance[main][1][1.0]">
<ID>performance</ID>
<modeID>main</modeID>
<instanceID>1</instanceID>
<version>1.0</version>
<label>performance</label>
<metadata>
<generalInfo>
<description>Estimation of the aircraft range.</description>
<owner>
<contactUID>remilafage</contactUID>
</owner>
<creator>
<contactUID>sylvaindubreuil</contactUID>
</creator>
</generalInfo>
</metadata>
</designCompetence>
</designCompetences>
<mathematicalFunctions>
<mathematicalFunction uID="objective">
<label>objective</label>
<inputs>
<input>
<parameterUID>/data_schema/aircraft/other/R</parameterUID>
<equationLabel>R</equationLabel>
</input>
</inputs>
<outputs>
<output>
<parameterUID>/data_schema/aircraft/other/objective</parameterUID>
<equations uID="objective_equation">
<equation language="Python">-R</equation>
<equation language="LaTeX">-R</equation>
</equations>
</output>
</outputs>
</mathematicalFunction>
</mathematicalFunctions>
</executableBlocks>
<parameters>
<parameter uID="/data_schema/aircraft/other/R">
<label>R</label>
</parameter>
<parameter uID="/data_schema/aircraft/other/objective">
<label>obj</label>
</parameter>
</parameters>
</cmdows>
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment