Coder Social home page Coder Social logo

cpacs2to3's Introduction

cpacs2to3

Build Status

A tool to convert CPACS files from version 2 to CPACS 3.1.

Quickstart

The simplest way to install cpacs2to3 is to use the conda package manager. The dependencies should be installed automatically and you should be ready to go:

$ conda create -n cpacs2to3 python=3.7 cpacs2to3 -c dlr-sc 

Enter the virtual environment

$ activate cpacs2to3

To convert a cpacs file, just call cpacs2to3 with the file to convert.

$ cpacs2to3 myaircraft.xml -o myaircraftv3.xml

If the output file is not specified, no file will be written, but the cpacs file will be printed to the standard out.

What is converted at the moment?

  • Adds uIDs, that are required by the new CPACS 3 definition.
  • Conversion of the guide curve geometry. CPACS 3 uses a different definition of the guide curves, where we have to convert the geometry.
  • Conversion of the wing structure, including recomputation of eta/xsi coordinates to the new definition.
  • Conversion of material stiffness properties
  • Updates the CPACS version number of the file

How does does it work?

We are using TiXI to transform the xml. This is the easy part. The hard part is the geometry conversion. To support this process, we use both the TiGL 2 and the TiGL 3 library that are able to compute the geometries for both cpacs standards.

Development

cpacs2to3 requires tigl 2 and 3 in order to perform geometry conversions. The easiest way is to create a virtual conda environment

$ conda create -n cpacs2to3_devel python=3.5 tigl3 tigl tixi3 tixi -c dlr-sc

To enter this environment, enter

$ activate cpacs2to3_devel

cpacs2to3 can then be installed into this environment using the standard python setup.py install command.

Legal stuff

Copyright © 2020, German Aerospace Center (DLR e.V.)

This software is licensed under the Apache Public License 2.0. See LICENSE for details.

cpacs2to3's People

Contributors

bernhardmgruber avatar joergbrech avatar rainman110 avatar sfreund-dlr avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cpacs2to3's Issues

Illegal referenceUID in eta isoline after conversion from CPACS 2 to 3.0

The following lines will add a trailing edge uid to a CPACSEtaIsoLine:

elif uid in tedUids:
# TODO has this even changed?
pass

But according to CPACS (and also the TiGL implementation) the referenceUID must be a reference to either a wing segment or a wing component segment.

I suppose we should add the uid of the trailing edge device's component segment here?

Installation of cpacs2to3 via anaconda fails with UnsatisfiableError

When trying to install cpacs2to3 via conda create -n cpacs2to3 python=3.5 cpacs2to3 -c dlr-sc on Windows the operation fails with following error message:

UnsatisfiableError: The following specifications were found to be in conflict:

  • cpacs2to3

Also setting up the devel environment via conda create -n cpacs2to3_devel python=3.5 tigl3 tigl tixi3 tixi -c dlr-sc fails with following error message:

UnsatisfiableError: The following specifications were found to be in conflict:

  • tigl -> pythonocc-core==0.17
  • tigl3 -> pythonocc-core==0.17.3

Fix errors without converting

Currently, some common CPACS issues can be fixed during conversion, but this fix is only applied if we update from CPACS 2 to CPACS 3. It would be convenient if we could apply the fixes without conversion, e.g. fix a CPACS 3.1 file.

def upgrade_2_to_3(cpacs_handle, args):
filename = args.input_file
if args.fix_errors:
file_has_changed = uid_manager.fix_invalid_uids(cpacs_handle)
file_has_changed = fix_empty_elements(cpacs_handle) or file_has_changed
file_has_changed = fix_guide_curve_profile_element_names(cpacs_handle) or file_has_changed

linux installation issue with miniconda3

On Ubuntu conda create -n cpacs2to3 python=3.5 cpacs2to3 -c dlr-sc does not work properly: Running cpacs2to3 gives the following error:

Traceback (most recent call last):
  File "/home/jan/tools/miniconda3/envs/cpacs2to3/bin/cpacs2to3", line 6, in <module>
    from cpacs2to3.cpacs_converter import main
  File "/home/jan/tools/miniconda3/envs/cpacs2to3/lib/python3.5/site-packages/cpacs2to3-0.2-py3.5.egg/cpacs2to3/cpacs_converter.py", line 27, in <module>
ImportError: No module named 'tixi'

Apparently tixi gets installed into the wrong directory (python3.6 rather than python3.5):

(cpacs2to3) jan@jan-notebook:~/tools/miniconda3/envs/cpacs2to3/lib$ find -name tixi
./python3.6/site-packages/tixi
./tixi

Problems with Guide Curve Conversion

There are a few issues with guide curve conversion:

  • cpacs2to3 checks, wether a guideCurveProfile is used by a guideCurve in a wing or a fuselage, without checking wether a wing or fuselage exists at all. This causes a crash for aircrafts that don't have a fuselage
  • TiGL 2 uses a slightly different CPACS definition for guide curve profiles:
    • The xpath cpacs/vehicles/profiles/guideCurves should be cpacs/vehicles/profiles/guideCurveProfiles
    • The xpath cpacs/vehicles/profiles/guideCurves/guieCurveProfile[i]/pointList/rX should be cpacs/vehicles/profiles/guideCurveProfiles/guieCurveProfile[i]/pointList/x. The same holds for rY and rZ.
      These element names should be converted when using the option '--fix-errors'. The user should be notified to use this option, if guide curve parsing fails with TIGL 2
  • The tool catia2cpacs creates CPACS 2 files, with a CPACS 3 interpretation of the guide curve points. In this case, the user should be able to specify NOT to convert the guide curve points. This could be achieved either
    • by requiring the user to add a node to the CPACS 2 file, that states that the guide curves use the CPACS 3 standard
    • by adding yet another command line flag to cpacs2to3

Convert old Nacelles

Even though, the old nacelle is just a cylinder, we have to convert it to CPACS 3 mainly to the following reasons:

  • TiGL will make an error, if the nacelle node is wrong / illformatted
  • Consistent geometry

Improve fix for duplicate UIDs

The current mechanism scans for duplicate uIDs and replaces them with a newly generated one.

The replacement however does not work correct:

  • It simply performs text replacement
  • E.g. if uID="1", all ones ("1") in the text will be replaced with a new uID, even at thos positions that don't refer to a uID
  • This will obviously break TiGL!

Add CI

In the CI, we should do the following:

  • Build cpacs2to3
  • Test the converter:
    • At least the converted file should be valid to cpacs 3 schema.
  • Create conda packages
  • Upload packages to anaconda / dlr-sc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.