├── .github
├── CODEOWNERS
└── workflows
│ ├── QA.yml
│ ├── publish-to-pypi.yml
│ └── release_testpypi.yml
├── .gitignore
├── LICENSE
├── MANIFEST.in
├── Makefile
├── README.md
├── dest_path
├── pytest.ini
├── requirements-dev.txt
├── requirements.txt
├── setup.py
├── src
├── conftest.py
└── scl_loader
│ ├── __init__.py
│ ├── resources
│ └── SCL_Schema
│ │ ├── SCL.xsd
│ │ ├── SCL_BaseSimpleTypes.xsd
│ │ ├── SCL_BaseTypes.xsd
│ │ ├── SCL_Communication.xsd
│ │ ├── SCL_DataTypeTemplates.xsd
│ │ ├── SCL_Enums.xsd
│ │ ├── SCL_IED.xsd
│ │ └── SCL_Substation.xsd
│ └── scl_loader.py
└── tests
├── resources
├── IOP_ParserOpenSource_SCD_SITE_20201026_v2.scd
├── SCD_Test.scl
└── SCD_WRONG.scd
└── test_scl_loader.py
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @syllamoh @vermeulenthi
2 |
--------------------------------------------------------------------------------
/.github/workflows/QA.yml:
--------------------------------------------------------------------------------
1 | name: Lint and Test Python 🐍 distribution 📦
2 |
3 | on: [push, workflow_dispatch]
4 |
5 | jobs:
6 | build:
7 |
8 | runs-on: ubuntu-latest
9 |
10 | steps:
11 | - uses: actions/checkout@v3
12 | - name: Set up Python 3.x
13 | uses: actions/setup-python@v4
14 | with:
15 | python-version: '3.x'
16 | architecture: 'x64'
17 | - name: Install dependencies
18 | run: |
19 | python -m pip install --upgrade pip
20 | pip install flake8 pytest
21 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
22 | - name: 🔬Lint with flake8 🔬
23 | run: |
24 | # stop the build if there are Python syntax errors or undefined names
25 | flake8 ./src/scl_loader/scl_loader.py --count --select=E9,F63,F7,F82 --show-source --statistics
26 | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
27 | flake8 ./src/scl_loader/scl_loader.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
28 | - name: ⚗️Test with pytest ⚗️
29 | run: |
30 | pip install pytest
31 | pip install pytest-cov
32 | pytest --doctest-modules --junitxml=junit/test-results.xml --cov=scl_loader --cov-report=xml --cov-report=html
33 |
--------------------------------------------------------------------------------
/.github/workflows/publish-to-pypi.yml:
--------------------------------------------------------------------------------
1 | name: Pypi - Publish Python 🐍 distributions 📦
2 |
3 | on:
4 | release:
5 | types: [created]
6 |
7 | jobs:
8 | deploy:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@v3
12 | - name: Set up Python 🐍
13 | uses: actions/setup-python@v4
14 | with:
15 | python-version: '3.x'
16 | - name: Install dependencies
17 | run: |
18 | python -m pip install --upgrade pip
19 | pip install setuptools wheel twine
20 | - name: Build 🏭 and Publish 🚀 distribution 📦 to PyPI
21 | env:
22 | TWINE_USERNAME: __token__
23 | TWINE_PASSWORD: ${{ secrets.TOKEN_PYPI }}
24 | run: |
25 | python setup.py sdist bdist_wheel
26 | twine upload dist/*
27 |
--------------------------------------------------------------------------------
/.github/workflows/release_testpypi.yml:
--------------------------------------------------------------------------------
1 | name: TESTPypi - Publish Python 🐍 distribution 📦
2 |
3 | on: workflow_dispatch
4 |
5 | jobs:
6 | deploy:
7 | runs-on: ubuntu-latest
8 | steps:
9 | - uses: actions/checkout@v3
10 | - name: Set up Python 🐍
11 | uses: actions/setup-python@v4
12 | with:
13 | python-version: '3.x'
14 | - name: Install dependencies
15 | run: |
16 | python -m pip install --upgrade pip
17 | pip install setuptools wheel twine
18 | - name: Build 🏭 and Publish 🚀 distribution 📦 to TestPyPI
19 | env:
20 | TWINE_USERNAME: __token__
21 | TWINE_PASSWORD: ${{ secrets.TOKEN_TESTPYPI }}
22 | run: |
23 | python setup.py sdist bdist_wheel
24 | twine upload --repository-url https://test.pypi.org/legacy/ dist/*
25 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | *.egg-info/
24 | .installed.cfg
25 | *.egg
26 | MANIFEST
27 |
28 | # PyInstaller
29 | # Usually these files are written by a python script from a template
30 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
31 | *.manifest
32 | *.spec
33 |
34 | # Installer logs
35 | pip-log.txt
36 | pip-delete-this-directory.txt
37 |
38 | # Unit test / coverage reports
39 | htmlcov/
40 | .tox/
41 | .coverage
42 | .coverage.*
43 | .cache
44 | nosetests.xml
45 | coverage.xml
46 | *.cover
47 | .hypothesis/
48 | .pytest_cache/
49 | xunit-reports/
50 | ModeBehavior/
51 | LDATB/
52 | prof/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 |
63 | # Flask stuff:
64 | instance/
65 | .webassets-cache
66 |
67 | # PyBuilder
68 | target/
69 |
70 | # IPython
71 | profile_default/
72 | ipython_config.py
73 |
74 | # pyenv
75 | .python-version
76 |
77 | # Environments
78 | .env
79 | .venv
80 | env/
81 | venv/
82 | ENV/
83 | env.bak/
84 | venv.bak/
85 | my_venv/
86 | venv395-32/
87 |
88 | # IDE - Visual Code
89 | .vscode/
90 |
91 | # IDE - PyCharm
92 | .idea/
93 |
94 | data/
95 | junit/
96 |
97 | IOP_ParserOpenSource_SCD_SITE_20201026_v2-reduced.scd
98 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include requirements.txt LICENSE
2 | include src/scl_loader/resources/SCL_Schema/*.xsd
3 | global-exclude *.py[cod] __pycache__ *.so testss
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | init:
2 | pip install -r requirements-dev.txt
3 |
4 | test:
5 | py.test tests
6 |
7 | .PHONY: init test
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 | # RTE - scl_loader
3 |
4 | ## Installation
5 | ```bash
6 | pip install scl_loader -U --user
7 | ```
8 |
9 | ## Licence
10 |
11 | Apache 2.0
12 |
13 | ## Versionning
14 |
15 | Use [bumpversion](https://pypi.org/project/bumpversion/)
16 |
17 | example :
18 | ```bash
19 | bumpversion --current-version 1.0.0 minor setup.py scl_loader/__init__.py
20 | ```
21 |
22 |
--------------------------------------------------------------------------------
/dest_path:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rte-france/SCL_Loader/7d4e6bba03262033058dd43798c620778b06d08e/dest_path
--------------------------------------------------------------------------------
/pytest.ini:
--------------------------------------------------------------------------------
1 | [pytest]
2 | junit_family=xunit2
3 | log_format = %(asctime)s %(levelname)s %(message)s
4 | log_date_format = %Y-%m-%d %H:%M:%S
5 | log_cli = 1
6 | log_cli_level = INFO
7 | log_cli_format = %(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)
8 | log_cli_date_format=%Y-%m-%d %H:%M:%S
9 | pythonpath=src
10 |
--------------------------------------------------------------------------------
/requirements-dev.txt:
--------------------------------------------------------------------------------
1 | setuptools
2 | bumpversion
3 | flake8
4 | twine
5 | wheel
6 | pycodestyle
7 | pytest
8 | pytest-cov
9 | pytest-dependency
10 | -r requirements.txt
11 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | lxml
2 | pytest
3 | setuptools
4 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | """A setuptools based setup module.
5 |
6 | See:
7 | https://packaging.python.org/guides/distributing-packages-using-setuptools/
8 | https://github.com/pypa/sampleproject
9 | """
10 |
11 | # Always prefer setuptools over distutils
12 | from os import path
13 | from setuptools import setup
14 |
15 | HERE = path.abspath(path.dirname(__file__))
16 |
17 | # Get the long description from the README file
18 | with open(path.join(HERE, 'README.md'), encoding='utf-8') as f:
19 | LONG_DESCRIPTION = f.read()
20 |
21 | with open(path.join(HERE, 'requirements.txt'), encoding='utf-8') as f:
22 | REQUIREMENTS = f.read()
23 |
24 | # Arguments marked as "Required" below must be included for upload to PyPI.
25 | # Fields marked as "Optional" may be commented out.
26 | setup(
27 | name='scl_loader', # Required
28 | version='1.11.7', # Required
29 | description='Outil de manipulation de SCD', # Required
30 | long_description=LONG_DESCRIPTION, # Optional
31 | long_description_content_type='text/markdown', # Optional (see note above)
32 | package_dir={'': 'src'}, # Optional
33 | packages=["scl_loader"], # Required
34 | python_requires='>=3.6, <4',
35 | classifiers=[
36 | "License :: OSI Approved :: Apache Software License",
37 | "Programming Language :: Python :: 3",
38 | "Programming Language :: Python :: 3.6",
39 | ],
40 |
41 | # If there are data files included in your packages that need to be
42 | # installed, specify them here.
43 | #
44 | # If using Python 2.6 or earlier, then these have to be included in
45 | # MANIFEST.in as well.
46 | # package_data={ # Optional
47 | # 'resources': [],
48 | # },
49 | include_package_data=True,
50 | install_requires=REQUIREMENTS,
51 |
52 | entry_points={ # Optional
53 | 'console_scripts': [],
54 | },
55 | )
56 |
--------------------------------------------------------------------------------
/src/conftest.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rte-france/SCL_Loader/7d4e6bba03262033058dd43798c620778b06d08e/src/conftest.py
--------------------------------------------------------------------------------
/src/scl_loader/__init__.py:
--------------------------------------------------------------------------------
1 | from scl_loader.scl_loader import *
2 |
3 |
--------------------------------------------------------------------------------
/src/scl_loader/resources/SCL_Schema/SCL.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | COPYRIGHT (c) IEC, 2018. This version of this XSD is part of IEC 61850-6:2009/AMD1:2018; see the IEC 61850-6:2009/AMD1:2018 for full legal notices. In case of any differences between the here-below code and the IEC published content, the here-below definition supersedes the IEC publication; it may contain updates. See history files. The whole document has to be taken into account to have a full description of this code component.
6 | See www.iec.ch/CCv1 for copyright details.
7 |
8 |
9 | SCL schema version "2007" revision "B" release 4, for IEC 61850-6 Ed. 2.1. 2018-01-22
10 | Supersedes "2007B3".
11 |
12 | Implemented Ed. 2 Tissues (since "2007B"): 948, 1050, 1175, 1189, 1208, 1328, 1359, 1365, 1397, 1434, 1448, 1450, 1458, 1472.
13 | Tissues not relevant for the SCL schema (since "2007B"): 706 (Ed.3), 837, 847, 865, 873, 883, 884, 885, 938, 949, 961, 1048, 1054, 1059, 1118, 1130, 1131, 1147, 1161, 1168, 1170 (Ed.3), 1173, 1185, 1188, 1195, 1200, 1204, 1207, 1221, 1224, 1241 (Ed.3), 1255, 1257 (Ed.3), 1280, 1284, 1327, 1337, 1354, 1395, 1398, 1399, 1400, 1401, 1402, 1415, 1416, 1419, 1421, 1431, 1444, 1445, 1446, 1447, 1451, 1452, 1457, 1461, 1471.
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/src/scl_loader/resources/SCL_Schema/SCL_BaseSimpleTypes.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | COPYRIGHT (c) IEC, 2018. This version of this XSD is part of IEC 61850-6:2009/AMD1:2018; see the IEC 61850-6:2009/AMD1:2018 for full legal notices. In case of any differences between the here-below code and the IEC published content, the here-below definition supersedes the IEC publication; it may contain updates. See history files. The whole document has to be taken into account to have a full description of this code component.
6 | See www.iec.ch/CCv1 for copyright details.
7 |
8 |
9 | SCL schema version "2007" revision "B" release 4, for IEC 61850-6 Ed. 2.1. 2018-01-22
10 | Supersedes "2007B3".
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
--------------------------------------------------------------------------------
/src/scl_loader/resources/SCL_Schema/SCL_BaseTypes.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | COPYRIGHT (c) IEC, 2018. This version of this XSD is part of IEC 61850-6:2009/AMD1:2018; see the IEC 61850-6:2009/AMD1:2018 for full legal notices. In case of any differences between the here-below code and the IEC published content, the here-below definition supersedes the IEC publication; it may contain updates. See history files. The whole document has to be taken into account to have a full description of this code component.
6 | See www.iec.ch/CCv1 for copyright details.
7 |
8 |
9 | SCL schema version "2007" revision "B" release 4, for IEC 61850-6 Ed. 2.1. 2018-01-22
10 | Supersedes "2007B3".
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
--------------------------------------------------------------------------------
/src/scl_loader/resources/SCL_Schema/SCL_Communication.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | COPYRIGHT (c) IEC, 2018. This version of this XSD is part of IEC 61850-6:2009/AMD1:2018; see the IEC 61850-6:2009/AMD1:2018 for full legal notices. In case of any differences between the here-below code and the IEC published content, the here-below definition supersedes the IEC publication; it may contain updates. See history files. The whole document has to be taken into account to have a full description of this code component.
6 | See www.iec.ch/CCv1 for copyright details.
7 |
8 |
9 | SCL schema version "2007" revision "B" release 4, for IEC 61850-6 Ed. 2.1. 2018-01-22
10 | Supersedes "2007B3".
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
--------------------------------------------------------------------------------
/src/scl_loader/resources/SCL_Schema/SCL_DataTypeTemplates.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | COPYRIGHT (c) IEC, 2018. This version of this XSD is part of IEC 61850-6:2009/AMD1:2018; see the IEC 61850-6:2009/AMD1:2018 for full legal notices. In case of any differences between the here-below code and the IEC published content, the here-below definition supersedes the IEC publication; it may contain updates. See history files. The whole document has to be taken into account to have a full description of this code component.
6 | See www.iec.ch/CCv1 for copyright details.
7 |
8 |
9 | SCL schema version "2007" revision "B" release 4, for IEC 61850-6 Ed. 2.1. 2018-01-22
10 | Supersedes "2007B3".
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
--------------------------------------------------------------------------------
/src/scl_loader/resources/SCL_Schema/SCL_Enums.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | COPYRIGHT (c) IEC, 2018. This version of this XSD is part of IEC 61850-6:2009/AMD1:2018; see the IEC 61850-6:2009/AMD1:2018 for full legal notices. In case of any differences between the here-below code and the IEC published content, the here-below definition supersedes the IEC publication; it may contain updates. See history files. The whole document has to be taken into account to have a full description of this code component.
6 | See www.iec.ch/CCv1 for copyright details.
7 |
8 |
9 | SCL schema version "2007" revision "B" release 4, for IEC 61850-6 Ed. 2.1. 2018-01-22
10 | Supersedes "2007B3".
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
--------------------------------------------------------------------------------
/src/scl_loader/resources/SCL_Schema/SCL_IED.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | COPYRIGHT (c) IEC, 2018. This version of this XSD is part of IEC 61850-6:2009/AMD1:2018; see the IEC 61850-6:2009/AMD1:2018 for full legal notices. In case of any differences between the here-below code and the IEC published content, the here-below definition supersedes the IEC publication; it may contain updates. See history files. The whole document has to be taken into account to have a full description of this code component.
6 | See www.iec.ch/CCv1 for copyright details.
7 |
8 |
9 | SCL schema version "2007" revision "B" release 4, for IEC 61850-6 Ed. 2.1. 2018-01-22
10 | Supersedes "2007B3".
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 |
724 |
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 |
733 |
734 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 |
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 |
785 |
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 |
794 |
795 |
796 |
797 |
798 |
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 |
808 |
809 |
810 |
811 |
812 |
813 |
814 |
815 |
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 |
843 |
844 |
845 |
846 |
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 |
858 |
859 |
860 |
861 |
862 |
863 |
864 |
865 |
866 |
867 |
868 |
869 |
870 |
871 |
872 |
873 |
874 |
875 |
876 |
877 |
878 |
879 |
880 |
881 |
882 |
883 |
884 |
885 |
886 |
887 |
888 |
889 |
890 |
891 |
892 |
893 |
894 |
895 |
896 |
897 |
898 |
899 |
900 |
901 |
902 |
903 |
904 |
905 |
906 |
907 |
908 |
909 |
910 |
911 |
912 |
913 |
914 |
915 |
916 |
917 |
918 |
919 |
920 |
921 |
922 |
923 |
924 |
925 |
926 |
927 |
928 |
929 |
--------------------------------------------------------------------------------
/src/scl_loader/resources/SCL_Schema/SCL_Substation.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | COPYRIGHT (c) IEC, 2018. This version of this XSD is part of IEC 61850-6:2009/AMD1:2018; see the IEC 61850-6:2009/AMD1:2018 for full legal notices. In case of any differences between the here-below code and the IEC published content, the here-below definition supersedes the IEC publication; it may contain updates. See history files. The whole document has to be taken into account to have a full description of this code component.
6 | See www.iec.ch/CCv1 for copyright details.
7 |
8 |
9 | SCL schema version "2007" revision "B" release 4, for IEC 61850-6 Ed. 2.1. 2018-01-22
10 | Supersedes "2007B3".
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 |
724 |
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 |
733 |
734 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
--------------------------------------------------------------------------------
/tests/test_scl_loader.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # Copyright RTE - 2020
3 |
4 | """
5 | Module de test du module scd_loader
6 | """
7 | import os
8 | import logging
9 | import pytest
10 | import hashlib
11 | import cProfile
12 | import pstats
13 | import io
14 | from pstats import SortKey
15 | from lxml import etree
16 |
17 | import scl_loader.scl_loader as scdl
18 | from scl_loader import SCD_handler
19 | from scl_loader import IED
20 | from scl_loader import LD
21 | from scl_loader import LN
22 | from scl_loader import LN0
23 | from scl_loader import DO
24 | from scl_loader import DA
25 | from scl_loader import SCDNode
26 | from scl_loader import DataTypeTemplates
27 | from scl_loader import ServiceType
28 |
29 | LOGGER = logging.getLogger(__name__)
30 | HERE = os.path.abspath(os.path.dirname(__file__))
31 | SCD_OPEN_NAME = 'SCD_Test.scl'
32 | SCD_OPEN_IOP_NAME = 'IOP_ParserOpenSource_SCD_SITE_20201026_v2.scd'
33 | SCD_WRONG_NAME = 'SCD_WRONG.scd'
34 | SCD_OPEN_PATH = os.path.join(HERE, 'resources', SCD_OPEN_NAME)
35 | SCD_OPEN_IOP_PATH = os.path.join(HERE, 'resources', SCD_OPEN_IOP_NAME)
36 | SCD_WRONG_PATH = os.path.join(HERE, 'resources', SCD_WRONG_NAME)
37 |
38 |
39 | def hashfile(file):
40 |
41 | # A arbitrary (but fixed) buffer
42 | # size (change accordingly)
43 | # 65536 = 65536 bytes = 64 kilobytes
44 | BUF_SIZE = 65536
45 |
46 | # Initializing the sha256() method
47 | sha256 = hashlib.sha256()
48 |
49 | # Opening the file provided as
50 | # the first commandline arguement
51 | with open(file, 'rb') as f:
52 |
53 | while True:
54 |
55 | # reading data = BUF_SIZE from
56 | # the file and saving it in a
57 | # variable
58 | data = f.read(BUF_SIZE)
59 |
60 | # True if eof = 1
61 | if not data:
62 | break
63 |
64 | # Passing that data to that sh256 hash
65 | # function (updating the function with
66 | # that data)
67 | sha256.update(data)
68 |
69 | # sha256.hexdigest() hashes all the input
70 | # data passed to the sha256() via sha256.update()
71 | # Acts as a finalize method, after which
72 | # all the input data gets hashed hexdigest()
73 | # hashes the data, and returns the output
74 | # in hexadecimal format
75 | return sha256.hexdigest()
76 |
77 |
78 | def _get_node_list_by_tag(scd, tag: str) -> list:
79 | result = []
80 | context = etree.iterparse(scd._scd_path, events=("end",), tag=r'{http://www.iec.ch/61850/2003/SCL}' + tag, remove_comments=True)
81 | for _, ied in context:
82 | result.append(ied)
83 | return result
84 |
85 |
86 | def test_valid_scd():
87 | assert SCD_handler(SCD_OPEN_PATH)
88 | with pytest.raises(AttributeError):
89 | SCD_handler(SCD_WRONG_PATH)
90 |
91 |
92 | def test_datatypes_get_by_id():
93 | """
94 | I should be able to load a Datatype by id
95 | """
96 | datatypes = DataTypeTemplates(SCD_OPEN_PATH)
97 | ln_type = datatypes.get_type_by_id('GAPC')
98 | assert ln_type.get('lnClass') == 'GAPC'
99 | do_type = datatypes.get_type_by_id('ENC')
100 | assert do_type.get('cdc') == 'ENC'
101 |
102 |
103 | class TestSCD_OPEN():
104 |
105 | def setup_method(self):
106 | self.scd = SCD_handler(SCD_OPEN_PATH)
107 | self.tIED = self.scd.get_all_IEDs()
108 |
109 | def teardown_method(self):
110 | del self.scd
111 | del self.tIED
112 |
113 | def _start_perfo_stats(self):
114 | self.pr = cProfile.Profile()
115 | self.pr.enable()
116 |
117 | def _end_perfo_stats(self):
118 | self.pr.disable()
119 | s = io.StringIO()
120 | ps = pstats.Stats(self.pr, stream=s).sort_stats(SortKey.CUMULATIVE)
121 | ps.print_stats()
122 | LOGGER.info(s.getvalue())
123 |
124 | def test_create_scd_object(self):
125 | """
126 | I Should be able to create a SCL object with its children (except IEDs and Datatype)
127 | """
128 | assert self.scd.Header.toolID == 'ggu' # pylint: disable=maybe-no-member
129 | assert self.scd.Communication.Net1.LD_All.GSE[0].Address.P[0].type == 'VLAN-ID' # pylint: disable=maybe-no-member
130 |
131 | def test_create_DA_by_kwargs(self):
132 | """
133 | I should be able to create a DA object with kwargs
134 | """
135 | simple_da = {'fc': 'ST', 'dchg': 'false', 'qchg': 'true', 'dupd': 'false', 'name': 'q', 'bType': 'Quality'}
136 | simple2_da = {'fc': 'DC', 'dchg': 'false', 'qchg': 'false', 'dupd': 'false', 'name': 'd', 'bType': 'VisString255', 'valKind': 'RO', 'valImport': 'false'}
137 | enum_da = {'fc': 'CF', 'dchg': 'true', 'qchg': 'false', 'dupd': 'false', 'name': 'ctlModel', 'bType': 'Enum', 'valKind': 'RO', 'type': 'CtlModelKind', 'valImport': 'false'}
138 |
139 | with pytest.raises(AttributeError):
140 | DA(self.scd.datatypes)
141 | simple_da_inst = DA(self.scd.datatypes, None, None, **simple_da)
142 | assert getattr(simple_da_inst, 'fc') == 'ST'
143 | assert getattr(simple_da_inst, 'dchg') == 'false'
144 | assert getattr(simple_da_inst, 'qchg') == 'true'
145 | assert getattr(simple_da_inst, 'dupd') == 'false'
146 | assert getattr(simple_da_inst, 'name') == 'q'
147 | assert getattr(simple_da_inst, 'bType') == 'Quality'
148 |
149 | simple2_da_inst = DA(self.scd.datatypes, None, None, **simple2_da)
150 | assert getattr(simple2_da_inst, 'fc') == 'DC'
151 | assert getattr(simple2_da_inst, 'dchg') == 'false'
152 | assert getattr(simple2_da_inst, 'qchg') == 'false'
153 | assert getattr(simple2_da_inst, 'dupd') == 'false'
154 | assert getattr(simple2_da_inst, 'name') == 'd'
155 | assert getattr(simple2_da_inst, 'bType') == 'VisString255'
156 | assert getattr(simple2_da_inst, 'valKind') == 'RO'
157 | assert getattr(simple2_da_inst, 'valImport') == 'false'
158 |
159 | enum_da_inst = DA(self.scd.datatypes, None, None, **enum_da)
160 | assert getattr(enum_da_inst, 'fc') == 'CF'
161 | assert getattr(enum_da_inst, 'dchg') == 'true'
162 | assert getattr(enum_da_inst, 'qchg') == 'false'
163 | assert getattr(enum_da_inst, 'dupd') == 'false'
164 | assert getattr(enum_da_inst, 'name') == 'ctlModel'
165 | assert getattr(enum_da_inst, 'bType') == 'Enum'
166 | assert getattr(enum_da_inst, 'valKind') == 'RO'
167 | assert getattr(enum_da_inst, 'type') == 'CtlModelKind'
168 | assert getattr(enum_da_inst, 'valImport') == 'false'
169 |
170 | def test_create_struct_DA_by_kwargs(self):
171 | struct_da = {'name': 'originSrc', 'fc': 'ST', 'bType': 'Struct', 'type': 'Originator'}
172 |
173 | struct_da_inst = DA(self.scd.datatypes, None, **struct_da)
174 | assert getattr(struct_da_inst, 'fc') == 'ST'
175 | assert getattr(struct_da_inst, 'name') == 'originSrc'
176 | assert getattr(struct_da_inst, 'bType') == 'Struct'
177 | assert getattr(struct_da_inst, 'type') == 'Originator'
178 | assert struct_da_inst.orCat.tag == 'BDA' # pylint: disable=maybe-no-member
179 | assert struct_da_inst.orIdent.bType == 'Octet64' # pylint: disable=maybe-no-member
180 |
181 | def test_create_DO_by_dtid(self):
182 | """
183 | I should be able to create a DO object with datatype id
184 | """
185 | input_node = etree.Element('DO')
186 | input_node.attrib['id'] = 'ENC'
187 | simple_do_inst = DO(self.scd.datatypes, input_node, **{'name': 'DO_RTE_1'})
188 | assert getattr(simple_do_inst, 'id') == 'ENC'
189 | assert getattr(simple_do_inst, 'cdc') == 'ENC'
190 | assert getattr(simple_do_inst, 'parent') is None
191 | assert isinstance(getattr(simple_do_inst, 'ctlModel'), DA)
192 | assert simple_do_inst.ctlModel.type == 'CtlModels' # pylint: disable=maybe-no-member
193 | assert isinstance(getattr(simple_do_inst, 'blkEna'), DA)
194 | assert isinstance(getattr(simple_do_inst, 'ctlNum'), DA)
195 | assert isinstance(getattr(simple_do_inst, 'd'), DA)
196 | assert isinstance(getattr(simple_do_inst, 'dU'), DA)
197 | assert isinstance(getattr(simple_do_inst, 'dataNs'), DA)
198 | assert isinstance(getattr(simple_do_inst, 'opOk'), DA)
199 | assert isinstance(getattr(simple_do_inst, 'opRcvd'), DA)
200 | assert isinstance(getattr(simple_do_inst, 'operTimeout'), DA)
201 | assert isinstance(getattr(simple_do_inst, 'origin'), DA)
202 | assert isinstance(getattr(simple_do_inst, 'q'), DA)
203 | assert isinstance(getattr(simple_do_inst, 'stVal'), DA)
204 | assert isinstance(getattr(simple_do_inst, 'subEna'), DA)
205 | assert isinstance(getattr(simple_do_inst, 'subID'), DA)
206 | assert isinstance(getattr(simple_do_inst, 'subQ'), DA)
207 | assert isinstance(getattr(simple_do_inst, 'subVal'), DA)
208 | assert isinstance(getattr(simple_do_inst, 't'), DA)
209 | assert isinstance(getattr(simple_do_inst, 'tOpOk'), DA)
210 |
211 | def test_create_LN_by_dtid(self):
212 | """
213 | I should be able to create a LN object
214 | """
215 | kwargs = {'lnClass': 'GAPC', 'inst': '0', 'lnType': 'GAPC', 'desc': 'This is a GAPC'}
216 | ln_inst = LN(self.scd.datatypes, None, **kwargs)
217 | assert getattr(ln_inst, 'lnType') == 'GAPC'
218 | assert getattr(ln_inst, 'lnClass') == 'GAPC'
219 | assert getattr(ln_inst, 'inst') == '0'
220 | assert getattr(ln_inst, 'name') == 'GAPC0'
221 | assert getattr(ln_inst, 'desc') == 'This is a GAPC'
222 | assert isinstance(getattr(ln_inst, 'Alm1'), DO)
223 | assert isinstance(getattr(ln_inst, 'Auto'), DO)
224 | assert isinstance(getattr(ln_inst, 'DPCSO1'), DO)
225 | assert isinstance(getattr(ln_inst, 'ISCSO1'), DO)
226 | assert isinstance(getattr(ln_inst, 'Ind1'), DO)
227 | assert isinstance(getattr(ln_inst, 'Loc'), DO)
228 | assert isinstance(getattr(ln_inst, 'LocKey'), DO)
229 | assert isinstance(getattr(ln_inst, 'LocSta'), DO)
230 | assert isinstance(getattr(ln_inst, 'Op1'), DO)
231 | assert isinstance(getattr(ln_inst, 'OpCntRs'), DO)
232 | assert isinstance(getattr(ln_inst, 'SPCSO1'), DO)
233 | assert isinstance(getattr(ln_inst, 'Str1'), DO)
234 | assert isinstance(getattr(ln_inst, 'StrVal1'), DO)
235 | assert isinstance(getattr(ln_inst, 'Wrn1'), DO) # pylint: disable=maybe-no-member
236 | assert ln_inst.LocKey.dU.bType == 'Unicode255' # pylint: disable=maybe-no-member
237 | assert ln_inst.DPCSO1.ctlModel.fc == 'CF' # pylint: disable=maybe-no-member
238 |
239 | def test_create_LN0_by_dtid(self):
240 | """
241 | I should be able to create a LN0 object
242 | """
243 | ln0s = _get_node_list_by_tag(self.scd, 'LN0')
244 | assert len(ln0s) > 0
245 | ln0 = LN0(self.scd.datatypes, ln0s[0])
246 | assert getattr(ln0, 'lnClass') == 'LLN0'
247 | assert getattr(ln0, 'name') == 'LLN0'
248 | datasets = ln0.DataSet
249 | assert len(datasets) == 157
250 | assert datasets[0]
251 | assert getattr(datasets[0], 'name') == 'DS_LPHD'
252 | assert isinstance(datasets[0], SCDNode)
253 | assert len(ln0.get_children('ReportControl')) == 157
254 | assert len(ln0.get_children('GSEControl')) == 157
255 | assert len(ln0.get_children('DO')) == 8
256 | assert len(ln0.get_children()) == 479
257 | assert isinstance(getattr(ln0, 'Diag'), DO)
258 |
259 | def test_create_LD(self):
260 | """
261 | I should be able to create a LD object
262 | """
263 | lds = _get_node_list_by_tag(self.scd, 'LDevice')
264 | ld = LD(self.scd.datatypes, lds[0])
265 | assert ld.name == 'LD_all' # pylint: disable=maybe-no-member
266 | assert ld.inst == 'LD_all' # pylint: disable=maybe-no-member
267 | assert ld.LLN0 # pylint: disable=maybe-no-member
268 | assert len(ld.get_children('LN')) == 157
269 |
270 | def test_create_IED(self):
271 | """
272 | I should be able to create a IED object
273 | """
274 | ieds = _get_node_list_by_tag(self.scd, 'IED')
275 | self._start_perfo_stats()
276 | ied = IED(self.scd.datatypes, ieds[0])
277 | assert ied.HVDC_LD_All_1.Server.LD_all.ANCR1.ADetun.blkEna.fc == 'BL' # pylint: disable=maybe-no-member
278 | assert ied.name == 'LD_All' # pylint: disable=maybe-no-member
279 | self._end_perfo_stats()
280 |
281 | def test_get_DA_leaf_nodes(self):
282 | """
283 | I should be able to retrieve all DA leaf nodes from a SCD_Node
284 | """
285 | ieds = _get_node_list_by_tag(self.scd, 'IED')
286 | self._start_perfo_stats()
287 | ied = IED(self.scd.datatypes, ieds[0])
288 | da_list = ied.get_DA_leaf_nodes()
289 | assert len(da_list) == 54166
290 | for da in da_list.values():
291 | assert da.tag == 'DA' or da.tag == 'BDA'
292 | assert da.get_path_from_ld() is not None
293 |
294 | assert da_list['LD_all.LLN0.OpTmh.blkEna'].name == 'blkEna'
295 | self._end_perfo_stats()
296 |
297 | def test_get_ied_names_list(self):
298 | """
299 | I should be able to get the list of the IED names
300 | """
301 | result = self.scd.get_IED_names_list()
302 | assert len(result) == 1
303 | assert result[0] == 'LD_All'
304 |
305 | def test_get_ied_by_name(self):
306 | ied = self.scd.get_IED_by_name('LD_All')
307 | assert isinstance(ied, IED)
308 |
309 | def test_get_all_ied(self):
310 | ieds = self.scd.get_all_IEDs()
311 | assert len(ieds) == 1
312 | assert isinstance(ieds[0], IED)
313 |
314 |
315 | def test_open_iop():
316 | scd = SCD_handler(SCD_OPEN_IOP_PATH)
317 | assert scd
318 | assert scd.Header.toolID == 'PVR GEN TOOL' # pylint: disable=maybe-no-member
319 | assert scd.Communication.RSPACE_PROCESS_NETWORK.AUT1A_SITE_1.GSE[0].Address.P[0].type == 'VLAN-PRIORITY' # pylint: disable=maybe-no-member
320 | assert scd.Substation[0].VoltageLevel[0].name == 'SITEP41' # pylint: disable=maybe-no-member
321 | del scd
322 |
323 |
324 | def test_get_Data_Type_Definition():
325 | scd = SCD_handler(SCD_OPEN_IOP_PATH)
326 | datatype_defs = scd.datatypes.get_Data_Type_Definitions()
327 | assert datatype_defs
328 | assert len(datatype_defs.keys()) == 4
329 | assert len(datatype_defs['LNodeType']) == 145
330 | assert len(datatype_defs['DOType']) == 89
331 | assert len(datatype_defs['DAType']) == 16
332 | assert len(datatype_defs['EnumType']) == 40
333 |
334 |
335 | def test_extract_sub_SCD():
336 | ref_scd2_hash = '4577fb05ea3cc39d637feb699b684cab2a73c216b2bc9bd8f194d3310e66c005'
337 | scd = SCD_handler(SCD_OPEN_IOP_PATH)
338 | ied_list = ['AUT1A_SITE_1', 'IEDTEST_SITE_1']
339 |
340 | dest_path = scd.extract_sub_SCD(ied_list)
341 | assert 'AUT1A_SITE_1' in scd._iter_get_IED_names_list()
342 | assert os.path.exists(dest_path)
343 | assert ref_scd2_hash == hashfile(dest_path)
344 |
345 |
346 | def test_get_IP_Adr():
347 | scd = SCD_handler(SCD_OPEN_IOP_PATH)
348 | (ip1, apName1) = scd.get_IP_Adr('AUT1A_SITE_1')
349 | assert ip1 == '127.0.0.1'
350 | assert apName1 == "PROCESS_AP"
351 |
352 | (ip2, apName2) = scd.get_IP_Adr('IEDTEST_SITE_1')
353 | assert ip2 == '127.0.0.1'
354 | assert apName2 == "PROCESS_AP"
355 |
356 |
357 | class TestSCD_IOP():
358 | '''
359 | !!! SCD_HANDLER set as class attribute because tests are not altering it
360 | Set back SCD_HANDLER in setup/teadown methods if it is altered by any test
361 | '''
362 |
363 | SCD_HANDLER = SCD_handler(SCD_OPEN_IOP_PATH)
364 | def setup_method(self):
365 | pass
366 | # self.SCD_HANDLER = SCD_handler(SCD_OPEN_IOP_PATH)
367 |
368 | def teardown_method(self):
369 | pass
370 | # del self.SCD_HANDLER
371 |
372 | def test_get_all_GSE(self):
373 | all_gse = self.SCD_HANDLER.get_GSEs("AUT1A_SITE_1")
374 | assert (self.SCD_HANDLER.get_GSEs("AUT1A_SITE_1")[0].cbName == "PVR_LLN0_CB_GSE_INT")
375 | assert (self.SCD_HANDLER.get_GSEs("AUT1A_SITE_1")[0].Address.P[0].type == "VLAN-PRIORITY")
376 | assert (self.SCD_HANDLER.get_GSEs("AUT1A_SITE_1")[0].Address.P[0].Val == '4')
377 | assert (len(self.SCD_HANDLER.get_GSEs("AUT1A_SITE_1")) == 11)
378 | assert (self.SCD_HANDLER.get_GSEs("AUT1A_SITE_666") == [])
379 |
380 | def test_extract_sub_SCD(self):
381 | ref_scd2_hash = '4577fb05ea3cc39d637feb699b684cab2a73c216b2bc9bd8f194d3310e66c005'
382 | ied_list = ['AUT1A_SITE_1', 'IEDTEST_SITE_1']
383 |
384 | dest_path = self.SCD_HANDLER.extract_sub_SCD(ied_list)
385 | assert 'AUT1A_SITE_1' in self.SCD_HANDLER._iter_get_IED_names_list()
386 | assert os.path.exists(dest_path)
387 | assert ref_scd2_hash == hashfile(dest_path)
388 |
389 | def test_get_IP_Adr(self):
390 | (ip1, apName1) = self.SCD_HANDLER.get_IP_Adr('AUT1A_SITE_1')
391 | assert ip1 == '127.0.0.1'
392 | assert apName1 == "PROCESS_AP"
393 |
394 | (ip2, apName2) = self.SCD_HANDLER.get_IP_Adr('IEDTEST_SITE_1')
395 | assert ip2 == '127.0.0.1'
396 | assert apName2 == "PROCESS_AP"
397 |
398 | def test_IED_get_extrefs(self):
399 | ied = self.SCD_HANDLER.get_IED_by_name('AUT1A_SITE_1')
400 |
401 | extrefs = ied.get_inputs_extrefs()
402 | assert len(extrefs) == 535
403 | assert extrefs[0] == {'iedName': 'IEDTEST_SITE_1', 'ldInst': 'XX_BCU_4LINE2_1_LDCMDSL_1', 'lnClass': 'CSWI', 'lnInst': '0', 'doName': 'Pos', 'intAddr': 'VDF', 'serviceType': 'GOOSE', 'pLN': 'CSWI', 'pDO': 'Pos', 'pServT': 'GOOSE', 'srcLDInst': 'XX_BCU_4LINE2_1_LDCMDSL_1', 'srcCBName': 'PVR_LLN0_CB_GSE_EXT', 'desc': 'DYN_LDASLD_Position filtree sectionneur_5_Dbpos_1_stVal_3'}
404 | assert extrefs[525] == {'iedName': 'SCU1B_SITE_1', 'ldInst': 'LDITFUA', 'lnClass': 'SBAT', 'lnInst': '2', 'doName': 'BatEF', 'intAddr': 'VDF', 'serviceType': 'GOOSE', 'pLN': 'SBAT', 'pDO': 'BatEF', 'pServT': 'GOOSE', 'srcLDInst': 'LDITFUA', 'srcCBName': 'PVR_LLN0_CB_GSE_INT', 'desc': 'DYN_LDTGSEC_Terre Batterie UA_2_BOOLEAN_1_stVal_2'}
405 |
406 | goose_extrefs = ied.get_inputs_goose_extrefs()
407 | assert goose_extrefs[0] == {'iedName': 'IEDTEST_SITE_1', 'ldInst': 'XX_BCU_4LINE2_1_LDCMDSL_1', 'lnClass': 'CSWI', 'lnInst': '0', 'doName': 'Pos', 'intAddr': 'VDF', 'serviceType': 'GOOSE', 'pLN': 'CSWI', 'pDO': 'Pos', 'pServT': 'GOOSE', 'srcLDInst': 'XX_BCU_4LINE2_1_LDCMDSL_1', 'srcCBName': 'PVR_LLN0_CB_GSE_EXT', 'desc': 'DYN_LDASLD_Position filtree sectionneur_5_Dbpos_1_stVal_3'}
408 | assert len(goose_extrefs) == 526
409 |
410 | assert len(ied.get_inputs_extrefs(ServiceType.SMV)) == 0
411 | assert len(ied.get_inputs_extrefs(ServiceType.Report)) == 0
412 | assert len(ied.get_inputs_extrefs(ServiceType.Poll)) == 0
413 |
414 | def test_IED_get_lds(self):
415 | ied = self.SCD_HANDLER.get_IED_by_name('AUT1A_SITE_1')
416 |
417 | result = ied.get_children_LDs()
418 | assert len(result) == 11
419 | assert isinstance(result[0], LD)
420 |
421 | def test_IED_get_node_by_path(self):
422 | ied = self.SCD_HANDLER.get_IED_by_name('AUT1A_SITE_1')
423 |
424 | assert ied.get_node_by_path('LDASLD').name == 'LDASLD'
425 | assert ied.get_node_by_path('LDASLD.LLN0').name == 'LLN0'
426 | assert ied.get_node_by_path('LDASLD.LLN0.Beh').name == 'Beh'
427 | assert ied.get_node_by_path('LDASLD/LLN0.Beh').name == 'Beh'
428 | assert ied.get_node_by_path('LDASLD.LLN0.Beh.stVal').name == 'stVal'
429 | assert ied.get_node_by_path('LDASLD.PTRC3.Beh.subQ').name == 'subQ'
430 | with pytest.raises(AttributeError):
431 | ied.get_node_by_path('toto')
432 | with pytest.raises(AttributeError):
433 | ied.get_node_by_path('')
434 |
435 |
436 | def test_DataSet_as_tree(self):
437 | ied = self.SCD_HANDLER.get_IED_by_name('AUT1A_SITE_1')
438 | ld = ied.get_children_LDs()[0]
439 |
440 | result = ld.get_dataset_by_name("PVR_LLN0_DS_RPT_DQCHG_EXT").as_tree()
441 | assert(result == ('root', [('LDASLD.LLN0.Beh', [('q', []), ('stVal', []), ('t', [])]), ('LDASLD.LLN0.Beh', [('subEna', []), ('subID', []), ('subQ', []), ('subVal', [])]), ('LDASLD.LLN0.Health', [('q', []), ('stVal', []), ('t', [])]), ('LDASLD.LLN0.Health', [('subEna', []), ('subID', []), ('subQ', []), ('subVal', [])]), ('LDASLD.LLN0.NamPlt', [('paramRev', []), ('valRev', [])]), ('LDASLD.PTRC1.Beh', [('q', []), ('stVal', []), ('t', [])]), ('LDASLD.PTRC1.Beh', [('subEna', []), ('subID', []), ('subQ', []), ('subVal', [])]), ('LDASLD.PTRC1.Tr', [('general', []), ('neut', []), ('phsA', []), ('phsB', []), ('phsC', []), ('q', []), ('t', []), ('originSrc', [('orCat', []), ('orIdent', [])])]), ('LDASLD.PTRC2.Beh', [('q', []), ('stVal', []), ('t', [])]), ('LDASLD.PTRC2.Beh', [('subEna', []), ('subID', []), ('subQ', []), ('subVal', [])]), ('LDASLD.PTRC2.Tr', [('general', []), ('neut', []), ('phsA', []), ('phsB', []), ('phsC', []), ('q', []), ('t', []), ('originSrc', [('orCat', []), ('orIdent', [])])]), ('LDASLD.PTRC3.Beh', [('q', []), ('stVal', []), ('t', [])]), ('LDASLD.PTRC3.Beh', [('subEna', []), ('subID', []), ('subQ', []), ('subVal', [])]), ('LDASLD.PTRC3.Tr', [('general', []), ('neut', []), ('phsA', []), ('phsB', []), ('phsC', []), ('q', []), ('t', []), ('originSrc', [('orCat', []), ('orIdent', [])])]), ('LDASLD.RBRF1.Beh', [('q', []), ('stVal', []), ('t', [])]), ('LDASLD.RBRF1.Beh', [('subEna', []), ('subID', []), ('subQ', []), ('subVal', [])]), ('LDASLD.RBRF1.OpEx', [('general', []), ('neut', []), ('phsA', []), ('phsB', []), ('phsC', []), ('q', []), ('t', []), ('originSrc', [('orCat', []), ('orIdent', [])])]), ('LDASLD.RBRF2.Beh', [('q', []), ('stVal', []), ('t', [])]), ('LDASLD.RBRF2.Beh', [('subEna', []), ('subID', []), ('subQ', []), ('subVal', [])]), ('LDASLD.RBRF2.OpEx', [('general', []), ('neut', []), ('phsA', []), ('phsB', []), ('phsC', []), ('q', []), ('t', []), ('originSrc', [('orCat', []), ('orIdent', [])])]), ('LDASLD.RBRF3.Beh', [('q', []), ('stVal', []), ('t', [])]), ('LDASLD.RBRF3.OpEx', [('general', []), ('neut', []), ('phsA', []), ('phsB', []), ('phsC', []), ('q', []), ('t', []), ('originSrc', [('orCat', []), ('orIdent', [])])]), ('LDASLD.LPHD0.NamPlt', [('paramRev', []), ('valRev', [])]), ('LDASLD.LPHD0.PhyHealth', [('q', []), ('stVal', []), ('t', [])]), ('LDASLD.LPHD0.PhyHealth', [('subEna', []), ('subID', []), ('subQ', []), ('subVal', [])]), ('LDASLD.LPHD0.Proxy', [('q', []), ('stVal', []), ('t', [])]), ('LDASLD.LPHD0.Proxy', [('subEna', []), ('subID', []), ('subQ', []), ('subVal', [])]), ('LDASLD.LLN0.Mod', [('q', []), ('stVal', []), ('t', [])]), ('LDASLD.LLN0.Mod', [('subEna', []), ('subID', []), ('subQ', []), ('subVal', [])]), ('LDASLD.RBRF3.Beh', [('subEna', []), ('subID', []), ('subQ', []), ('subVal', [])])]))
442 |
443 | def test_DataSet_as_list(self):
444 | ied = self.SCD_HANDLER.get_IED_by_name('AUT1A_SITE_1')
445 | ld = ied.get_children_LDs()[0]
446 |
447 | result = ld.get_dataset_by_name("PVR_LLN0_DS_RPT_DQCHG_EXT").as_list()
448 | assert(result == ['LDASLD.LLN0.Beh.q', 'LDASLD.LLN0.Beh.stVal', 'LDASLD.LLN0.Beh.t', 'LDASLD.LLN0.Beh.subEna', 'LDASLD.LLN0.Beh.subID', 'LDASLD.LLN0.Beh.subQ', 'LDASLD.LLN0.Beh.subVal', 'LDASLD.LLN0.Health.q', 'LDASLD.LLN0.Health.stVal', 'LDASLD.LLN0.Health.t', 'LDASLD.LLN0.Health.subEna', 'LDASLD.LLN0.Health.subID', 'LDASLD.LLN0.Health.subQ', 'LDASLD.LLN0.Health.subVal', 'LDASLD.LLN0.NamPlt.paramRev', 'LDASLD.LLN0.NamPlt.valRev', 'LDASLD.PTRC1.Beh.q', 'LDASLD.PTRC1.Beh.stVal', 'LDASLD.PTRC1.Beh.t', 'LDASLD.PTRC1.Beh.subEna', 'LDASLD.PTRC1.Beh.subID', 'LDASLD.PTRC1.Beh.subQ', 'LDASLD.PTRC1.Beh.subVal', 'LDASLD.PTRC1.Tr.general', 'LDASLD.PTRC1.Tr.neut', 'LDASLD.PTRC1.Tr.phsA', 'LDASLD.PTRC1.Tr.phsB', 'LDASLD.PTRC1.Tr.phsC', 'LDASLD.PTRC1.Tr.q', 'LDASLD.PTRC1.Tr.t', 'LDASLD.PTRC1.Tr.originSrc.orCat', 'LDASLD.PTRC1.Tr.originSrc.orIdent', 'LDASLD.PTRC2.Beh.q', 'LDASLD.PTRC2.Beh.stVal', 'LDASLD.PTRC2.Beh.t', 'LDASLD.PTRC2.Beh.subEna', 'LDASLD.PTRC2.Beh.subID', 'LDASLD.PTRC2.Beh.subQ', 'LDASLD.PTRC2.Beh.subVal', 'LDASLD.PTRC2.Tr.general', 'LDASLD.PTRC2.Tr.neut', 'LDASLD.PTRC2.Tr.phsA', 'LDASLD.PTRC2.Tr.phsB', 'LDASLD.PTRC2.Tr.phsC', 'LDASLD.PTRC2.Tr.q', 'LDASLD.PTRC2.Tr.t', 'LDASLD.PTRC2.Tr.originSrc.orCat', 'LDASLD.PTRC2.Tr.originSrc.orIdent', 'LDASLD.PTRC3.Beh.q', 'LDASLD.PTRC3.Beh.stVal', 'LDASLD.PTRC3.Beh.t', 'LDASLD.PTRC3.Beh.subEna', 'LDASLD.PTRC3.Beh.subID', 'LDASLD.PTRC3.Beh.subQ', 'LDASLD.PTRC3.Beh.subVal', 'LDASLD.PTRC3.Tr.general', 'LDASLD.PTRC3.Tr.neut', 'LDASLD.PTRC3.Tr.phsA', 'LDASLD.PTRC3.Tr.phsB', 'LDASLD.PTRC3.Tr.phsC', 'LDASLD.PTRC3.Tr.q', 'LDASLD.PTRC3.Tr.t', 'LDASLD.PTRC3.Tr.originSrc.orCat', 'LDASLD.PTRC3.Tr.originSrc.orIdent', 'LDASLD.RBRF1.Beh.q', 'LDASLD.RBRF1.Beh.stVal', 'LDASLD.RBRF1.Beh.t', 'LDASLD.RBRF1.Beh.subEna', 'LDASLD.RBRF1.Beh.subID', 'LDASLD.RBRF1.Beh.subQ', 'LDASLD.RBRF1.Beh.subVal', 'LDASLD.RBRF1.OpEx.general', 'LDASLD.RBRF1.OpEx.neut', 'LDASLD.RBRF1.OpEx.phsA', 'LDASLD.RBRF1.OpEx.phsB', 'LDASLD.RBRF1.OpEx.phsC', 'LDASLD.RBRF1.OpEx.q', 'LDASLD.RBRF1.OpEx.t', 'LDASLD.RBRF1.OpEx.originSrc.orCat', 'LDASLD.RBRF1.OpEx.originSrc.orIdent', 'LDASLD.RBRF2.Beh.q', 'LDASLD.RBRF2.Beh.stVal', 'LDASLD.RBRF2.Beh.t', 'LDASLD.RBRF2.Beh.subEna', 'LDASLD.RBRF2.Beh.subID', 'LDASLD.RBRF2.Beh.subQ', 'LDASLD.RBRF2.Beh.subVal', 'LDASLD.RBRF2.OpEx.general', 'LDASLD.RBRF2.OpEx.neut', 'LDASLD.RBRF2.OpEx.phsA', 'LDASLD.RBRF2.OpEx.phsB', 'LDASLD.RBRF2.OpEx.phsC', 'LDASLD.RBRF2.OpEx.q', 'LDASLD.RBRF2.OpEx.t', 'LDASLD.RBRF2.OpEx.originSrc.orCat', 'LDASLD.RBRF2.OpEx.originSrc.orIdent', 'LDASLD.RBRF3.Beh.q', 'LDASLD.RBRF3.Beh.stVal', 'LDASLD.RBRF3.Beh.t', 'LDASLD.RBRF3.OpEx.general', 'LDASLD.RBRF3.OpEx.neut', 'LDASLD.RBRF3.OpEx.phsA', 'LDASLD.RBRF3.OpEx.phsB', 'LDASLD.RBRF3.OpEx.phsC', 'LDASLD.RBRF3.OpEx.q', 'LDASLD.RBRF3.OpEx.t', 'LDASLD.RBRF3.OpEx.originSrc.orCat', 'LDASLD.RBRF3.OpEx.originSrc.orIdent', 'LDASLD.LPHD0.NamPlt.paramRev', 'LDASLD.LPHD0.NamPlt.valRev', 'LDASLD.LPHD0.PhyHealth.q', 'LDASLD.LPHD0.PhyHealth.stVal', 'LDASLD.LPHD0.PhyHealth.t', 'LDASLD.LPHD0.PhyHealth.subEna', 'LDASLD.LPHD0.PhyHealth.subID', 'LDASLD.LPHD0.PhyHealth.subQ', 'LDASLD.LPHD0.PhyHealth.subVal', 'LDASLD.LPHD0.Proxy.q', 'LDASLD.LPHD0.Proxy.stVal', 'LDASLD.LPHD0.Proxy.t', 'LDASLD.LPHD0.Proxy.subEna', 'LDASLD.LPHD0.Proxy.subID', 'LDASLD.LPHD0.Proxy.subQ', 'LDASLD.LPHD0.Proxy.subVal', 'LDASLD.LLN0.Mod.q', 'LDASLD.LLN0.Mod.stVal', 'LDASLD.LLN0.Mod.t', 'LDASLD.LLN0.Mod.subEna', 'LDASLD.LLN0.Mod.subID', 'LDASLD.LLN0.Mod.subQ', 'LDASLD.LLN0.Mod.subVal', 'LDASLD.RBRF3.Beh.subEna', 'LDASLD.RBRF3.Beh.subID', 'LDASLD.RBRF3.Beh.subQ', 'LDASLD.RBRF3.Beh.subVal'])
449 |
450 | def test_DataSet_get_path_in_dataset(self):
451 | ied = self.SCD_HANDLER.get_IED_by_name('AUT1A_SITE_1')
452 | ld = ied.get_children_LDs()[0]
453 | ds = ld.get_dataset_by_name("PVR_LLN0_DS_RPT_DQCHG_EXT")
454 | assert ds.get_path_in_dataset('LDASLD.LLN0.Beh.stVal') == ['root', 'LDASLD.LLN0.Beh', "stVal"]
455 | with pytest.raises(AttributeError):
456 | ds.get_path_in_dataset('toto')
457 |
458 | def test_LD_get_extrefs(self):
459 | ied = self.SCD_HANDLER.get_IED_by_name('BCU_4LINE2_1')
460 | ld = ied.get_children_LDs()[0]
461 |
462 | extrefs = ld.get_inputs_extrefs()
463 | assert len(extrefs) == 58
464 | assert extrefs[0] == {'desc': 'DYN_LDADD_Position filtree du DJ_1_Dbpos_1_stVal_3', 'doName': 'Pos', 'iedName': 'IEDTEST_SITE_1', 'intAddr': 'VDF', 'ldInst': 'XX_BCU_4LINE2_1_LDCMDDJ_1', 'lnClass': 'CSWI', 'lnInst': '1', 'pDO': 'Pos', 'pLN': 'CSWI', 'pServT': 'GOOSE', 'serviceType': 'GOOSE', 'srcCBName': 'PVR_LLN0_CB_GSE_INT', 'srcLDInst': 'XX_BCU_4LINE2_1_LDCMDDJ_1'}
465 |
466 | goose_extrefs = ld.get_inputs_goose_extrefs()
467 | assert goose_extrefs[0] == {'iedName': 'IEDTEST_SITE_1', 'ldInst': 'XX_BCU_4LINE2_1_LDCMDDJ_1', 'lnClass': 'CSWI', 'lnInst': '1', 'doName': 'Pos', 'intAddr': 'VDF', 'serviceType': 'GOOSE', 'pLN': 'CSWI', 'pDO': 'Pos', 'pServT': 'GOOSE', 'srcLDInst': 'XX_BCU_4LINE2_1_LDCMDDJ_1', 'srcCBName': 'PVR_LLN0_CB_GSE_INT', 'desc': 'DYN_LDADD_Position filtree du DJ_1_Dbpos_1_stVal_3'}
468 | assert len(goose_extrefs) == 21
469 |
470 | def test_get_LD_by_inst_ko(self):
471 | ied = self.SCD_HANDLER.get_IED_by_name('MUA_4BUS1_1')
472 | with pytest.raises(scdl.SCLLoaderError):
473 | ied.get_LD_by_inst("LDTM2")
474 |
475 | def test_LD_get_sampledvaluecontrols(self):
476 | ied = self.SCD_HANDLER.get_IED_by_name('MUA_4BUS1_1')
477 | ld = ied.get_LD_by_inst("LDTM")
478 |
479 | result = ld.get_sampledvaluecontrols()
480 |
481 | assert len(result) == 1
482 | assert result[0].smvID == 'XX_MUA_4BUS1_1_LDTM_1/LLN0.PVR_LLN0_CB_SMV_INT'
483 | assert result[0].datSet == 'PVR_LLN0_DS_SMV_INT'
484 | assert result[0].name == 'PVR_LLN0_CB_SMV_INT'
485 |
486 | def test_LD_get_sampledvaluecontrol_by_name(self):
487 | ied = self.SCD_HANDLER.get_IED_by_name('MUA_4BUS1_1')
488 | ld = ied.get_LD_by_inst("LDTM")
489 |
490 | assert ld.get_sampledvaluecontrol_by_name("toto") is None
491 | assert ld.get_sampledvaluecontrol_by_name("PVR_LLN0_CB_SMV_INT").name == "PVR_LLN0_CB_SMV_INT"
492 | assert ld.get_sampledvaluecontrol_by_name("PVR_LLN0_CB_SMV_INT").datSet == "PVR_LLN0_DS_SMV_INT"
493 |
494 |
495 | def test_LD_get_gsecontrols(self):
496 | ied = self.SCD_HANDLER.get_IED_by_name('BCU_4LINE2_1')
497 | ld = ied.get_children_LDs()[0]
498 |
499 | result = ld.get_gsecontrols()
500 |
501 | assert len(result) == 1
502 | assert result[0].type == 'GOOSE'
503 | assert result[0].datSet == 'PVR_LLN0_GSE_EXT'
504 | assert result[0].name == 'PVR_LLN0_CB_GSE_EXT'
505 |
506 | def test_LD_get_gsecontrol_by_name(self):
507 | ied = self.SCD_HANDLER.get_IED_by_name('BCU_4LINE2_1')
508 | ld = ied.get_children_LDs()[0]
509 |
510 | assert ld.get_gsecontrol_by_name("toto") is None
511 | assert ld.get_gsecontrol_by_name("PVR_LLN0_CB_GSE_EXT").name == "PVR_LLN0_CB_GSE_EXT"
512 | assert ld.get_gsecontrol_by_name("PVR_LLN0_CB_GSE_EXT").datSet == "PVR_LLN0_GSE_EXT"
513 |
514 | def test_LD_get_reportcontrols(self):
515 | ied = self.SCD_HANDLER.get_IED_by_name('BCU_4LINE2_1')
516 | ld = ied.get_children_LDs()[0]
517 |
518 | result = ld.get_reportcontrols()
519 | assert len(result) == 1
520 | assert result[0].buffered == 'true'
521 | assert result[0].datSet == 'PVR_LLN0_DS_RPT_DQCHG_EXT'
522 |
523 | def test_LD_get_reportcontrol_by_name(self):
524 | ied = self.SCD_HANDLER.get_IED_by_name('BCU_4LINE2_1')
525 | ld = ied.get_children_LDs()[0]
526 |
527 | assert ld.get_reportcontrol_by_name("toto") is None
528 | assert ld.get_reportcontrol_by_name("PVR_LLN0_CB_RPT_DQCHG_EXT").buffered == 'true'
529 | assert ld.get_reportcontrol_by_name("PVR_LLN0_CB_RPT_DQCHG_EXT").datSet == 'PVR_LLN0_DS_RPT_DQCHG_EXT'
530 |
531 | def test_LD_get_datasets(self):
532 | ied = self.SCD_HANDLER.get_IED_by_name('BCU_4LINE2_1')
533 | ld = ied.get_children_LDs()[0]
534 |
535 | result = ld.get_datasets()
536 | assert len(result) == 2
537 | assert result[0].name == "PVR_LLN0_GSE_EXT"
538 | assert len(result[0].FCDA) == 2
539 |
540 | def test_LD_get_dataset_by_name(self):
541 | ied = self.SCD_HANDLER.get_IED_by_name('BCU_4LINE2_1')
542 | ld = ied.get_children_LDs()[0]
543 |
544 | assert ld.get_dataset_by_name("toto") is None
545 | assert ld.get_dataset_by_name("PVR_LLN0_GSE_EXT").name == "PVR_LLN0_GSE_EXT"
546 | assert len(ld.get_dataset_by_name("PVR_LLN0_GSE_EXT").FCDA) == 2
547 |
548 | def test_LD_get_LN_by_name(self):
549 | ied = self.SCD_HANDLER.get_IED_by_name('AUT1A_SITE_1')
550 | ld = ied.get_children_LDs()[0]
551 | ln_name = 'PTRC1'
552 |
553 | result = ld.get_LN_by_name(ln_name)
554 | assert isinstance(result, LN)
555 | assert result.name == ln_name
556 |
557 | def test_IED_get_LN_by_name(self):
558 | ied = self.SCD_HANDLER.get_IED_by_name('AUT1A_SITE_1')
559 | ld_inst = 'LDASLD'
560 | ln_name = 'PTRC1'
561 |
562 | result = ied.get_LN_by_name(ld_inst, ln_name)
563 | assert isinstance(result, LN)
564 | assert result.name == ln_name
565 |
566 | def test_IED_get_LD_by_inst(self):
567 | ied = self.SCD_HANDLER.get_IED_by_name('AUT1A_SITE_1')
568 | ld_inst = 'LDASLD'
569 |
570 | result = ied.get_LD_by_inst(ld_inst)
571 | assert isinstance(result, LD)
572 | assert result.name == ld_inst
573 |
574 | def test_get_ieds_by_type(self):
575 | ieds = self.SCD_HANDLER.get_IED_by_type('TYPE1')
576 | assert len(ieds) == 2
577 | assert isinstance(ieds[0], IED)
578 |
579 | def test_get_associated_fc(self):
580 | ied = self.SCD_HANDLER.get_IED_by_name('AUT1A_SITE_1')
581 | ln = ied.PROCESS_AP.Server.LDASLD.PTRC2
582 |
583 | assert(ln.Tr.originSrc.orIdent.get_associated_fc() == "ST")
584 | assert(ln.Tr.d.get_associated_fc() == "DC")
585 | with pytest.raises(AttributeError):
586 | ln.get_associated_fc()
587 |
588 | def test_get_name_subtree(self):
589 | ied = self.SCD_HANDLER.get_IED_by_name('AUT1A_SITE_1')
590 | ln = ied.PROCESS_AP.Server.LDASLD.PTRC2
591 | with pytest.raises(AssertionError):
592 | ied.get_name_subtree()
593 | assert(ied.PROCESS_AP.Server.LDASLD.get_name_subtree() == ('LDASLD', [('LLN0', [('Beh', [('blkEna', []), ('d', []), ('q', []), ('stVal', []), ('subEna', []), ('subID', []), ('subQ', []), ('subVal', []), ('t', [])]), ('Health', [('blkEna', []), ('d', []), ('q', []), ('stVal', []), ('subEna', []), ('subID', []), ('subQ', []), ('subVal', []), ('t', [])]), ('InRef1', [('d', []), ('intAddr', []), ('purpose', []), ('setSrcCB', []), ('setSrcRef', []), ('setTstCB', []), ('setTstRef', []), ('tstEna', [])]), ('InRef2', [('d', []), ('intAddr', []), ('purpose', []), ('setSrcCB', []), ('setSrcRef', []), ('setTstCB', []), ('setTstRef', []), ('tstEna', [])]), ('InRef3', [('d', []), ('intAddr', []), ('purpose', []), ('setSrcCB', []), ('setSrcRef', []), ('setTstCB', []), ('setTstRef', []), ('tstEna', [])]), ('InRef4', [('d', []), ('intAddr', []), ('purpose', []), ('setSrcCB', []), ('setSrcRef', []), ('setTstCB', []), ('setTstRef', []), ('tstEna', [])]), ('InRef5', [('d', []), ('intAddr', []), ('purpose', []), ('setSrcCB', []), ('setSrcRef', []), ('setTstCB', []), ('setTstRef', []), ('tstEna', [])]), ('InRef6', [('d', []), ('intAddr', []), ('purpose', []), ('setSrcCB', []), ('setSrcRef', []), ('setTstCB', []), ('setTstRef', []), ('tstEna', [])]), ('InRef7', [('d', []), ('intAddr', []), ('purpose', []), ('setSrcCB', []), ('setSrcRef', []), ('setTstCB', []), ('setTstRef', []), ('tstEna', [])]), ('Mod', [('ctlModel', []), ('blkEna', []), ('d', []), ('q', []), ('stVal', []), ('subEna', []), ('subID', []), ('subQ', []), ('subVal', []), ('t', [])]), ('NamPlt', [('ldNs', []), ('configRev', []), ('d', []), ('paramRev', []), ('swRev', []), ('valRev', []), ('vendor', [])])]), ('RBRF2', [('Beh', [('blkEna', []), ('d', []), ('q', []), ('stVal', []), ('subEna', []), ('subID', []), ('subQ', []), ('subVal', []), ('t', [])]), ('OpEx', [('d', []), ('general', []), ('neut', []), ('phsA', []), ('phsB', []), ('phsC', []), ('q', []), ('t', []), ('originSrc', [('orCat', []), ('orIdent', [])])])]), ('RBRF1', [('Beh', [('blkEna', []), ('d', []), ('q', []), ('stVal', []), ('subEna', []), ('subID', []), ('subQ', []), ('subVal', []), ('t', [])]), ('OpEx', [('d', []), ('general', []), ('neut', []), ('phsA', []), ('phsB', []), ('phsC', []), ('q', []), ('t', []), ('originSrc', [('orCat', []), ('orIdent', [])])])]), ('PTRC2', [('Beh', [('blkEna', []), ('d', []), ('q', []), ('stVal', []), ('subEna', []), ('subID', []), ('subQ', []), ('subVal', []), ('t', [])]), ('Tr', [('d', []), ('general', []), ('neut', []), ('phsA', []), ('phsB', []), ('phsC', []), ('q', []), ('t', []), ('originSrc', [('orCat', []), ('orIdent', [])])])]), ('PTRC1', [('Beh', [('blkEna', []), ('d', []), ('q', []), ('stVal', []), ('subEna', []), ('subID', []), ('subQ', []), ('subVal', []), ('t', [])]), ('Tr', [('d', []), ('general', []), ('neut', []), ('phsA', []), ('phsB', []), ('phsC', []), ('q', []), ('t', []), ('originSrc', [('orCat', []), ('orIdent', [])])])]), ('RBRF3', [('Beh', [('blkEna', []), ('d', []), ('q', []), ('stVal', []), ('subEna', []), ('subID', []), ('subQ', []), ('subVal', []), ('t', [])]), ('OpEx', [('d', []), ('general', []), ('neut', []), ('phsA', []), ('phsB', []), ('phsC', []), ('q', []), ('t', []), ('originSrc', [('orCat', []), ('orIdent', [])])])]), ('LPHD0', [('NamPlt', [('configRev', []), ('d', []), ('paramRev', []), ('swRev', []), ('valRev', []), ('vendor', [])]), ('PhyHealth', [('blkEna', []), ('d', []), ('q', []), ('stVal', []), ('subEna', []), ('subID', []), ('subQ', []), ('subVal', []), ('t', [])]), ('PhyNam', [('d', []), ('hwRev', []), ('location', []), ('mRID', []), ('model', []), ('serNum', []), ('swRev', []), ('vendor', [])]), ('Proxy', [('blkEna', []), ('d', []), ('q', []), ('stVal', []), ('subEna', []), ('subID', []), ('subQ', []), ('subVal', []), ('t', [])])]), ('PTRC3', [('Beh', [('blkEna', []), ('d', []), ('q', []), ('stVal', []), ('subEna', []), ('subID', []), ('subQ', []), ('subVal', []), ('t', [])]), ('Tr', [('d', []), ('general', []), ('neut', []), ('phsA', []), ('phsB', []), ('phsC', []), ('q', []), ('t', []), ('originSrc', [('orCat', []), ('orIdent', [])])])])]))
594 | assert(ln.get_name_subtree() == ('PTRC2', [('Beh', [('blkEna', []), ('d', []), ('q', []), ('stVal', []), ('subEna', []), ('subID', []), ('subQ', []), ('subVal', []), ('t', [])]), ('Tr', [('d', []), ('general', []), ('neut', []), ('phsA', []), ('phsB', []), ('phsC', []), ('q', []), ('t', []), ('originSrc', [('orCat', []), ('orIdent', [])])])]))
595 | assert(ln.Tr.d.get_name_subtree() == ('d', []) )
596 | assert(ln.Tr.get_name_subtree() == ('Tr', [('d', []), ('general', []), ('neut', []), ('phsA', []), ('phsB', []), ('phsC', []), ('q', []), ('t', []), ('originSrc', [('orCat', []), ('orIdent', [])])]))
597 | assert(ln.Tr.originSrc.get_name_subtree() == ('originSrc', [('orCat', []), ('orIdent', [])]))
598 | assert(ln.get_name_subtree("ST") == ('PTRC2', [('Beh', [('q', []), ('stVal', []), ('t', [])]), ('Tr', [('general', []), ('neut', []), ('phsA', []), ('phsB', []), ('phsC', []), ('q', []), ('t', []), ('originSrc', [('orCat', []), ('orIdent', [])])])]))
599 |
600 | def test_get_path_from_ld(self):
601 | ied = self.SCD_HANDLER.get_IED_by_name('AUT1A_SITE_1')
602 | ln = ied.PROCESS_AP.Server.LDASLD.PTRC2
603 | with pytest.raises(AssertionError):
604 | ied.get_path_from_ld()
605 | assert ied.PROCESS_AP.Server.LDASLD.get_path_from_ld() == "LDASLD"
606 | assert ln.get_path_from_ld() == 'LDASLD.PTRC2'
607 | assert ln.Tr.d.get_path_from_ld() =='LDASLD.PTRC2.Tr.d'
608 | assert ln.Tr.get_path_from_ld() == 'LDASLD.PTRC2.Tr'
609 | assert ln.Tr.originSrc.orCat.get_path_from_ld() == 'LDASLD.PTRC2.Tr.originSrc.orCat'
610 |
611 | def test_get_object_reference(self):
612 | ied = self.SCD_HANDLER.get_IED_by_name('AUT1A_SITE_1')
613 | ln = ied.PROCESS_AP.Server.LDASLD.PTRC2
614 | assert ln.get_object_reference() == 'XX_AUT1A_SITE_1_LDASLD_1/PTRC2'
615 | assert ln.Tr.d.get_object_reference() == 'XX_AUT1A_SITE_1_LDASLD_1/PTRC2.Tr.d'
616 | assert ln.Tr.get_object_reference() == 'XX_AUT1A_SITE_1_LDASLD_1/PTRC2.Tr'
617 | assert ln.Tr.originSrc.get_object_reference() == 'XX_AUT1A_SITE_1_LDASLD_1/PTRC2.Tr.originSrc'
618 |
619 | def test_get_DO_nodes(self):
620 | ied = self.SCD_HANDLER.get_IED_by_name('AUT1A_SITE_1')
621 | ld = ied.PROCESS_AP.Server.LDASLD
622 |
623 | assert len(ld.get_DO_nodes()) == 27
624 | assert "LDASLD.PTRC2.Tr" in ld.PTRC2.Tr.get_DO_nodes()
625 | assert "LDASLD.PTRC2.Tr" in ld.PTRC2.Tr.originSrc.get_DO_nodes()
626 | assert ld.PTRC2.Tr.originSrc.get_DO_nodes()["LDASLD.PTRC2.Tr"].cdc == 'ACT'
627 |
628 | def test_get_mms_var_name(self):
629 | ied = self.SCD_HANDLER.get_IED_by_name('AUT1A_SITE_1')
630 | ln = ied.PROCESS_AP.Server.LDASLD.PTRC2
631 | assert ln.Tr.d.get_mms_var_name() == 'XX_AUT1A_SITE_1_LDASLD_1/PTRC2$DC$Tr$d'
632 | assert ln.Tr.get_mms_var_name('DC') == 'XX_AUT1A_SITE_1_LDASLD_1/PTRC2$DC$Tr'
633 | assert ln.Tr.originSrc.get_mms_var_name() == 'XX_AUT1A_SITE_1_LDASLD_1/PTRC2$ST$Tr$originSrc'
634 |
635 | def test_get_parent_with_class(self):
636 | ied = self.SCD_HANDLER.get_IED_by_name('AUT1A_SITE_1')
637 | da = ied.PROCESS_AP.Server.LDASLD.PTRC2.Tr.originSrc
638 | assert ied.get_parent_with_class(LD) is None
639 | assert da.get_parent_with_class(DO).name == 'Tr'
640 | assert da.get_parent_with_class(LN).name == 'PTRC2'
641 | assert da.get_parent_with_class(LD).name == 'LDASLD'
642 | assert da.get_parent_with_class(IED).name == 'AUT1A_SITE_1'
643 | assert da.get_parent_with_class(DA) is None
644 |
645 | def test_get_GOCB_reference(self):
646 | ied = self.SCD_HANDLER.get_IED_by_name('BCU_4LINE2_1')
647 | ld = ied.get_children_LDs()[0]
648 | assert ld.get_gsecontrol_by_name("PVR_LLN0_CB_GSE_EXT").get_GOCB_reference() == "BCU_4LINE2_1LDADD/LLN0$GO$PVR_LLN0_CB_GSE_EXT"
649 |
--------------------------------------------------------------------------------