From 90ff8dc7faebff5b8cb72e92cae96eb90bc7da3d Mon Sep 17 00:00:00 2001 From: Karl Walther Date: Sun, 15 Dec 2024 23:56:13 +0100 Subject: [PATCH] correct line endings --- .github/workflows/cxf_check.yml | 2 +- IEC61131-10XML/Add/plc.xml | 216 ++++---- IEC61131-10XML/Custom01/plc.xml | 594 ++++++++++----------- IEC61131-10XML/Custom02/plc.xml | 400 +++++++------- IEC61131-10XML/Custom03/plc.xml | 316 +++++------ IEC61131-10XML/CustomPWithLimiter/plc.xml | 430 +++++++-------- IEC61131-10XML/MultiplyByParameter/plc.xml | 290 +++++----- cdl_plc.py | 7 +- 8 files changed, 1130 insertions(+), 1125 deletions(-) diff --git a/.github/workflows/cxf_check.yml b/.github/workflows/cxf_check.yml index 688d732..653a8a4 100644 --- a/.github/workflows/cxf_check.yml +++ b/.github/workflows/cxf_check.yml @@ -1 +1 @@ -# Workflow for CI tests name: CI-check_modelica-json_translator # Controls when the action will run. on: # Triggers the workflow on push events but only for the master branch push: branches: [ add_CI_workflow ] # Allows you to run this workflow manually from the Actions tab # workflow_dispatch: defaults: run: shell: bash # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: test-modelica-json: # Skip if the commit message contains "ci skip" #if: "!contains(github.event.head_commit.message, 'ci skip')" runs-on: ubuntu-22.04 steps: # Checks-out repository under $GITHUB_WORKSPACE, so job can access it - name: Checkout code uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: python-version: '3.10.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified - name: "Install pip" run: pip3 install --upgrade pip wheel - name: Download modelica-json-1.2.0.zip run: wget https://github.com/lbl-srg/modelica-json/releases/download/v1.2.0/modelica-json-1.2.0.zip -O modelica-json-1.2.0.zip - name: Unzip modelica-json-1.2.0.zip run: unzip modelica-json-1.2.0.zip -d modelica-json - name: Display folder structure run: tree - name: Set MODELICAPATH environment variable run: echo "export MODELICAPATH=\${MODELICAPATH}:/usr/local/Modelica/Library/" >> ~/.bashrc - name: Install Java dependencies run: sudo apt-get update && sudo apt-get install -y default-jdk default-jre - name: Install parser dependencies run: | cd modelica-json/modelica-json-1.2.0 make install - name: Compile Java files run: | cd modelica-json/modelica-json-1.2.0 make compile #- name: Run test cases # run: | # cd modelica-json/modelica-json-1.2.0 # npm test - name: Translate Modelica test cases to jsonld run: | cd modelica-json/modelica-json-1.2.0 node app.js -f ../../ModelicaTestCases/CompositeBlocks/CustomPWithLimiter.mo -o cxf node app.js -f ../../ModelicaTestCases/CompositeBlocks/Custom01.mo -o cxf node app.js -f ../../ModelicaTestCases/CompositeBlocks/Custom02.mo -o cxf node app.js -f ../../ModelicaTestCases/CompositeBlocks/Custom03.mo -o cxf node app.js -f ../../ModelicaTestCases/SingleBlocks/Reals/Add.mo -o cxf node app.js -f ../../ModelicaTestCases/SingleBlocks/Reals/MultiplyByParameter.mo -o cxf - name: Compare changes between existing and new jsonld's run: | diff -r modelica-json/modelica-json-1.2.0/cxf/home/runner/work/cdl-plc/cdl-plc/ModelicaTestCases/ cxf/ModelicaTestCases/ - name: Run translate_test_cases.py run: | pip install Jinja2 cd .CI/tests python translate_test_cases.py - name: Display folder structure run: tree - name: Compare changes between existing and new IEC XML's run: | file IEC61131-10XML/MultiplyByParameter/plc.xml file check_translation_to_IEC_XML/IEC61131-10XML/MultiplyByParameter/plc.xml # diff -r --exclude="README.md" IEC61131-10XML/ check_translation_to_IEC_XML/IEC61131-10XML/ \ No newline at end of file +# Workflow for CI tests name: CI-check_modelica-json_translator # Controls when the action will run. on: # Triggers the workflow on push events but only for the master branch push: branches: [ add_CI_workflow ] # Allows you to run this workflow manually from the Actions tab # workflow_dispatch: defaults: run: shell: bash # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: test-modelica-json: # Skip if the commit message contains "ci skip" #if: "!contains(github.event.head_commit.message, 'ci skip')" runs-on: ubuntu-22.04 steps: # Checks-out repository under $GITHUB_WORKSPACE, so job can access it - name: Checkout code uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: python-version: '3.10.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified - name: "Install pip" run: pip3 install --upgrade pip wheel - name: Download modelica-json-1.2.0.zip run: wget https://github.com/lbl-srg/modelica-json/releases/download/v1.2.0/modelica-json-1.2.0.zip -O modelica-json-1.2.0.zip - name: Unzip modelica-json-1.2.0.zip run: unzip modelica-json-1.2.0.zip -d modelica-json - name: Display folder structure run: tree - name: Set MODELICAPATH environment variable run: echo "export MODELICAPATH=\${MODELICAPATH}:/usr/local/Modelica/Library/" >> ~/.bashrc - name: Install Java dependencies run: sudo apt-get update && sudo apt-get install -y default-jdk default-jre - name: Install parser dependencies run: | cd modelica-json/modelica-json-1.2.0 make install - name: Compile Java files run: | cd modelica-json/modelica-json-1.2.0 make compile #- name: Run test cases # run: | # cd modelica-json/modelica-json-1.2.0 # npm test - name: Translate Modelica test cases to jsonld run: | cd modelica-json/modelica-json-1.2.0 node app.js -f ../../ModelicaTestCases/CompositeBlocks/CustomPWithLimiter.mo -o cxf node app.js -f ../../ModelicaTestCases/CompositeBlocks/Custom01.mo -o cxf node app.js -f ../../ModelicaTestCases/CompositeBlocks/Custom02.mo -o cxf node app.js -f ../../ModelicaTestCases/CompositeBlocks/Custom03.mo -o cxf node app.js -f ../../ModelicaTestCases/SingleBlocks/Reals/Add.mo -o cxf node app.js -f ../../ModelicaTestCases/SingleBlocks/Reals/MultiplyByParameter.mo -o cxf - name: Compare changes between existing and new jsonld's run: | diff -r modelica-json/modelica-json-1.2.0/cxf/home/runner/work/cdl-plc/cdl-plc/ModelicaTestCases/ cxf/ModelicaTestCases/ - name: Run translate_test_cases.py run: | pip install Jinja2 cd .CI/tests python translate_test_cases.py - name: Display folder structure run: tree - name: Compare changes between existing and new IEC XML's run: | file IEC61131-10XML/MultiplyByParameter/plc.xml file check_translation_to_IEC_XML/IEC61131-10XML/MultiplyByParameter/plc.xml diff -r --exclude="README.md" IEC61131-10XML/ check_translation_to_IEC_XML/IEC61131-10XML/ \ No newline at end of file diff --git a/IEC61131-10XML/Add/plc.xml b/IEC61131-10XML/Add/plc.xml index c37cf43..5282402 100644 --- a/IEC61131-10XML/Add/plc.xml +++ b/IEC61131-10XML/Add/plc.xml @@ -1,108 +1,108 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u1 - - - - - - - u2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y1 - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + u1 + + + + + + + u2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + y1 + + + + + + + + + + + + + + + + + + diff --git a/IEC61131-10XML/Custom01/plc.xml b/IEC61131-10XML/Custom01/plc.xml index 5dd096c..0a31ecf 100644 --- a/IEC61131-10XML/Custom01/plc.xml +++ b/IEC61131-10XML/Custom01/plc.xml @@ -1,297 +1,297 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e - - - - - - - uSet - - - - - - - yMax - - - - - - - r3 - - - - - - - k - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + e + + + + + + + uSet + + + + + + + yMax + + + + + + + r3 + + + + + + + k + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + y + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IEC61131-10XML/Custom02/plc.xml b/IEC61131-10XML/Custom02/plc.xml index 0eaf3da..40e4df6 100644 --- a/IEC61131-10XML/Custom02/plc.xml +++ b/IEC61131-10XML/Custom02/plc.xml @@ -1,200 +1,200 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ymax - - - - - - - ymax1 - - - - - - - r1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y - - - - - - - - y1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ymax + + + + + + + ymax1 + + + + + + + r1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + y + + + + + + + + y1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IEC61131-10XML/Custom03/plc.xml b/IEC61131-10XML/Custom03/plc.xml index e4f730b..e44ba98 100644 --- a/IEC61131-10XML/Custom03/plc.xml +++ b/IEC61131-10XML/Custom03/plc.xml @@ -1,158 +1,158 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ymax - - - - - - - r1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y - - - - - - - - y1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ymax + + + + + + + r1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + y + + + + + + + + y1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IEC61131-10XML/CustomPWithLimiter/plc.xml b/IEC61131-10XML/CustomPWithLimiter/plc.xml index 8d4b49e..6653c5c 100644 --- a/IEC61131-10XML/CustomPWithLimiter/plc.xml +++ b/IEC61131-10XML/CustomPWithLimiter/plc.xml @@ -1,215 +1,215 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - e - - - - - - - yMax - - - - - - - k - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + e + + + + + + + yMax + + + + + + + k + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + y + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IEC61131-10XML/MultiplyByParameter/plc.xml b/IEC61131-10XML/MultiplyByParameter/plc.xml index d25fefa..47f30c5 100644 --- a/IEC61131-10XML/MultiplyByParameter/plc.xml +++ b/IEC61131-10XML/MultiplyByParameter/plc.xml @@ -1,145 +1,145 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u2 - - - - - - - r1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + u2 + + + + + + + r1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + y1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cdl_plc.py b/cdl_plc.py index db108cb..359d40b 100644 --- a/cdl_plc.py +++ b/cdl_plc.py @@ -1147,7 +1147,12 @@ def create_iec_xml(self, debug=False): os.makedirs(directory) # Writing to sample.json - with open("{}/plc.xml".format(directory), "w", encoding="utf-8") as outfile: + with open( + "{}/plc.xml".format(directory), + "w", + encoding="utf-8", + newline="\n", + ) as outfile: outfile.write(xml_export) def translate(self):