fmu-manipulation-toolbox 1.8.4.2__py3-none-any.whl → 1.8.4.3b0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. fmu_manipulation_toolbox/__version__.py +1 -1
  2. fmu_manipulation_toolbox/assembly.py +1 -1
  3. fmu_manipulation_toolbox/checker.py +5 -3
  4. fmu_manipulation_toolbox/{fmu_container.py → container.py} +66 -52
  5. fmu_manipulation_toolbox/gui.py +1 -1
  6. fmu_manipulation_toolbox/{fmu_operations.py → operations.py} +35 -19
  7. fmu_manipulation_toolbox/resources/fmi-3.0/fmi3Annotation.xsd +51 -0
  8. fmu_manipulation_toolbox/resources/fmi-3.0/fmi3AttributeGroups.xsd +119 -0
  9. fmu_manipulation_toolbox/resources/fmi-3.0/fmi3BuildDescription.xsd +117 -0
  10. fmu_manipulation_toolbox/resources/fmi-3.0/fmi3InterfaceType.xsd +80 -0
  11. fmu_manipulation_toolbox/resources/fmi-3.0/fmi3LayeredStandardManifest.xsd +93 -0
  12. fmu_manipulation_toolbox/resources/fmi-3.0/fmi3ModelDescription.xsd +131 -0
  13. fmu_manipulation_toolbox/resources/fmi-3.0/fmi3Terminal.xsd +87 -0
  14. fmu_manipulation_toolbox/resources/fmi-3.0/fmi3TerminalsAndIcons.xsd +84 -0
  15. fmu_manipulation_toolbox/resources/fmi-3.0/fmi3Type.xsd +207 -0
  16. fmu_manipulation_toolbox/resources/fmi-3.0/fmi3Unit.xsd +69 -0
  17. fmu_manipulation_toolbox/resources/fmi-3.0/fmi3Variable.xsd +413 -0
  18. fmu_manipulation_toolbox/resources/fmi-3.0/fmi3VariableDependency.xsd +64 -0
  19. fmu_manipulation_toolbox/resources/linux64/container.so +0 -0
  20. fmu_manipulation_toolbox/resources/win32/client_sm.dll +0 -0
  21. fmu_manipulation_toolbox/resources/win32/server_sm.exe +0 -0
  22. fmu_manipulation_toolbox/resources/win64/client_sm.dll +0 -0
  23. fmu_manipulation_toolbox/resources/win64/container.dll +0 -0
  24. fmu_manipulation_toolbox/resources/win64/server_sm.exe +0 -0
  25. fmu_manipulation_toolbox/split.py +298 -0
  26. {fmu_manipulation_toolbox-1.8.4.2.dist-info → fmu_manipulation_toolbox-1.8.4.3b0.dist-info}/METADATA +1 -1
  27. {fmu_manipulation_toolbox-1.8.4.2.dist-info → fmu_manipulation_toolbox-1.8.4.3b0.dist-info}/RECORD +31 -19
  28. fmu_manipulation_toolbox-1.8.4.3b0.dist-info/entry_points.txt +7 -0
  29. fmu_manipulation_toolbox/cli.py +0 -235
  30. fmu_manipulation_toolbox-1.8.4.2.dist-info/entry_points.txt +0 -3
  31. {fmu_manipulation_toolbox-1.8.4.2.dist-info → fmu_manipulation_toolbox-1.8.4.3b0.dist-info}/WHEEL +0 -0
  32. {fmu_manipulation_toolbox-1.8.4.2.dist-info → fmu_manipulation_toolbox-1.8.4.3b0.dist-info}/licenses/LICENSE.txt +0 -0
  33. {fmu_manipulation_toolbox-1.8.4.2.dist-info → fmu_manipulation_toolbox-1.8.4.3b0.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
1
- 'V1.8.4.2'
1
+ 'V1.8.4.3-beta'
@@ -7,7 +7,7 @@ import uuid
7
7
  import xml.parsers.expat
8
8
  import zipfile
9
9
 
10
- from .fmu_container import FMUContainer, AutoWired
10
+ from .container import FMUContainer, AutoWired
11
11
 
12
12
  logger = logging.getLogger("fmu_manipulation_toolbox")
13
13
 
@@ -3,11 +3,11 @@ import inspect
3
3
  import os
4
4
  import xmlschema
5
5
  from xmlschema.validators.exceptions import XMLSchemaValidationError
6
- from .fmu_operations import OperationAbstract
6
+ from .operations import OperationAbstract
7
7
 
8
8
 
9
9
  class OperationGenericCheck(OperationAbstract):
10
- SUPPORTED_FMI_VERSIONS = ('2.0',)
10
+ SUPPORTED_FMI_VERSIONS = ('2.0', '3.0')
11
11
 
12
12
  def __init__(self):
13
13
  self.compliant_with_version = None
@@ -20,8 +20,10 @@ class OperationGenericCheck(OperationAbstract):
20
20
  print(f"ERROR: Expected FMI {','.join(self.SUPPORTED_FMI_VERSIONS)} versions.")
21
21
  return
22
22
 
23
+ fmi_name = f"fmi{attrs['fmiVersion'][0]}"
24
+
23
25
  xsd_filename = os.path.join(os.path.dirname(__file__), "resources", "fmi-" + attrs['fmiVersion'],
24
- "fmi2ModelDescription.xsd")
26
+ f"{fmi_name}ModelDescription.xsd")
25
27
  try:
26
28
  xmlschema.validate(self.fmu.descriptor_filename, schema=xsd_filename)
27
29
  except XMLSchemaValidationError as error:
@@ -7,7 +7,7 @@ from datetime import datetime
7
7
  from pathlib import Path
8
8
  from typing import *
9
9
 
10
- from .fmu_operations import FMU, OperationAbstract
10
+ from .operations import FMU, OperationAbstract, FMUError
11
11
  from .version import __version__ as tool_version
12
12
 
13
13
 
@@ -16,55 +16,61 @@ logger = logging.getLogger("fmu_manipulation_toolbox")
16
16
 
17
17
  class FMUPort:
18
18
  def __init__(self, attrs: Dict[str, str]):
19
- self.name = attrs["name"]
20
- self.vr = int(attrs["valueReference"])
21
- self.causality = attrs.get("causality", "local")
22
- self.attrs = attrs.copy()
23
- self.attrs.pop("name")
24
- self.attrs.pop("valueReference")
25
- if "causality" in self.attrs:
26
- self.attrs.pop("causality")
27
- self.type_name = None
28
- self.child = None
19
+ self.causality = attrs.pop("causality", "local")
20
+ self.variability = attrs.pop("variability", "continuous")
21
+ self.name = attrs.pop("name")
22
+ self.vr = int(attrs.pop("valueReference"))
23
+ self.description = attrs.pop("description", None)
24
+
25
+ self.type_name = attrs.pop("type_name", None)
26
+ self.start_value = attrs.pop("start", None)
27
+ self.initial = attrs.pop("initial", None)
29
28
 
30
29
  def set_port_type(self, type_name: str, attrs: Dict[str, str]):
31
30
  self.type_name = type_name
32
- self.child = attrs.copy()
33
- for unsupported in ("unit", "declaredType"):
34
- if unsupported in self.child:
35
- self.child.pop(unsupported)
36
-
37
- def xml(self, vr: int, name=None, causality=None, start=None):
38
-
39
- if self.child is None:
40
- raise FMUContainerError(f"FMUPort has no child. Bug?")
41
-
42
- child_str = f"<{self.type_name}"
43
- if self.child:
44
- if start is not None and 'start' in self.child:
45
- self.child['start'] = start
46
- child_str += " " + " ".join([f'{key}="{value}"' for (key, value) in self.child.items()]) + "/>"
47
- else:
48
- child_str += "/>"
31
+ self.start_value = attrs.pop("start", None)
32
+ self.initial = attrs.pop("initial", None)
49
33
 
34
+ def xml(self, vr: int, name=None, causality=None, start=None, fmi_version=2):
50
35
  if name is None:
51
36
  name = self.name
52
37
  if causality is None:
53
38
  causality = self.causality
54
-
55
- variability = "continuous" if self.type_name == "Real" else "discrete"
56
-
57
- scalar_attrs = {
58
- "name": name,
59
- "valueReference": vr,
60
- "causality": causality,
61
- "variability": variability,
62
- }
63
- scalar_attrs.update(self.attrs)
64
-
65
- scalar_attrs_str = " ".join([f'{key}="{value}"' for (key, value) in scalar_attrs.items()])
66
-
67
- return f'<ScalarVariable {scalar_attrs_str}>{child_str}</ScalarVariable>'
39
+ if start is None:
40
+ start = self.start_value
41
+ if self.variability is None:
42
+ self.variability = "continuous" if self.type_name == "Real" else "discrete"
43
+
44
+
45
+ if fmi_version == 2:
46
+ child_dict = {
47
+ "start": start,
48
+ }
49
+ if "Float" in self.type_name:
50
+ type_name = "Real"
51
+ elif "Int" in self.type_name:
52
+ type_name = "Integer"
53
+ else:
54
+ type_name = self.type_name
55
+
56
+ child_str = (f"<{type_name} " +
57
+ " ".join([f'{key}="{value}"' if value is not None else ""
58
+ for (key, value) in child_dict.items()]) +
59
+ "/>")
60
+
61
+ scalar_attrs = {
62
+ "name": name,
63
+ "valueReference": vr,
64
+ "causality": causality,
65
+ "variability": self.variability,
66
+ "initial": self.initial,
67
+ "description": self.description,
68
+ }
69
+ scalar_attrs_str = " ".join([f'{key}="{value}"' if value is not None else ""
70
+ for (key, value) in scalar_attrs.items()])
71
+ return f'<ScalarVariable {scalar_attrs_str}>{child_str}</ScalarVariable>'
72
+ else:
73
+ return f'FIX ME'
68
74
 
69
75
 
70
76
  class EmbeddedFMU(OperationAbstract):
@@ -76,7 +82,6 @@ class EmbeddedFMU(OperationAbstract):
76
82
  self.name = Path(filename).name
77
83
  self.id = Path(filename).stem
78
84
 
79
- self.fmi_version = None
80
85
  self.step_size = None
81
86
  self.start_time = None
82
87
  self.stop_time = None
@@ -92,12 +97,22 @@ class EmbeddedFMU(OperationAbstract):
92
97
  raise FMUContainerError(f"FMU '{self.name}' does not implement Co-Simulation mode.")
93
98
 
94
99
  def fmi_attrs(self, attrs):
95
- self.guid = attrs['guid']
96
- self.fmi_version = attrs['fmiVersion']
100
+ fmi_version = attrs['fmiVersion']
101
+ if fmi_version == "2.0":
102
+ self.guid = attrs['guid']
103
+ if fmi_version == "3.0":
104
+ self.guid = attrs['instantiationToken']
105
+
97
106
 
98
107
  def scalar_attrs(self, attrs) -> int:
99
- self.current_port = FMUPort(attrs)
100
- self.ports[self.current_port.name] = self.current_port
108
+ if 'type_name' in attrs: # FMI 3.0
109
+ type_name = attrs.pop('type_name')
110
+ port = FMUPort(attrs)
111
+ port.type_name = type_name
112
+ self.ports[port.name] = port
113
+ else: # FMI 2.0
114
+ self.current_port = FMUPort(attrs)
115
+ self.ports[self.current_port.name] = self.current_port
101
116
 
102
117
  return 0
103
118
 
@@ -199,6 +214,7 @@ class ValueReferenceTable:
199
214
  def __init__(self):
200
215
  self.vr_table: Dict[str, int] = {
201
216
  "Real": 0,
217
+ "Float64": 0,
202
218
  "Integer": 0,
203
219
  "Boolean": 0,
204
220
  "String": 0,
@@ -268,10 +284,8 @@ class FMUContainer:
268
284
  fmu = EmbeddedFMU(self.fmu_directory / fmu_filename)
269
285
  self.involved_fmu[fmu.name] = fmu
270
286
  self.execution_order.append(fmu)
271
- if not fmu.fmi_version == "2.0":
272
- raise FMUContainerError("Only FMI-2.0 is supported by FMUContainer")
273
287
  logger.debug(f"Adding FMU #{len(self.execution_order)}: {fmu}")
274
- except Exception as e:
288
+ except (FMUContainerError, FMUError) as e:
275
289
  raise FMUContainerError(f"Cannot load '{fmu_filename}': {e}")
276
290
 
277
291
  return fmu
@@ -346,9 +360,9 @@ class FMUContainer:
346
360
  cport = ContainerPort(self.get_fmu(fmu_filename), port_name)
347
361
 
348
362
  try:
349
- if cport.port.type_name == 'Real':
363
+ if cport.port.type_name in ('Real', 'Float64', 'Float32'):
350
364
  value = float(value)
351
- elif cport.port.type_name == 'Integer':
365
+ elif cport.port.type_name in ('Integer', 'Int8', 'UInt8', 'Int16', 'UInt16', 'Int32', 'UInt32', 'Int64', 'UInt64'):
352
366
  value = int(value)
353
367
  elif cport.port.type_name == 'Boolean':
354
368
  value = int(bool(value))
@@ -12,7 +12,7 @@ from functools import partial
12
12
  from typing import Optional
13
13
 
14
14
  from .gui_style import gui_style
15
- from .fmu_operations import *
15
+ from .operations import *
16
16
  from .assembly import Assembly, AssemblyNode
17
17
  from .checker import checker_list
18
18
  from .help import Help
@@ -8,23 +8,29 @@ import xml.parsers.expat
8
8
  import zipfile
9
9
  import hashlib
10
10
  from pathlib import Path
11
+ from typing import *
11
12
 
12
13
 
13
14
  class FMU:
14
15
  """Unpack and Repack facilities for FMU package. Once unpacked, we can process Operation on
15
16
  modelDescription.xml file."""
17
+
18
+ FMI2_TYPES = ('Real', 'Integer', 'String', 'Boolean', 'Enumeration')
19
+ FMI3_TYPES = ('Float64')
20
+
16
21
  def __init__(self, fmu_filename):
17
22
  self.fmu_filename = fmu_filename
18
23
  self.tmp_directory = tempfile.mkdtemp()
24
+ self.fmi_version = None
19
25
 
20
26
  try:
21
27
  with zipfile.ZipFile(self.fmu_filename) as zin:
22
28
  zin.extractall(self.tmp_directory)
23
29
  except FileNotFoundError:
24
- raise FMUException(f"'{fmu_filename}' does not exist")
30
+ raise FMUError(f"'{fmu_filename}' does not exist")
25
31
  self.descriptor_filename = os.path.join(self.tmp_directory, "modelDescription.xml")
26
32
  if not os.path.isfile(self.descriptor_filename):
27
- raise FMUException(f"'{fmu_filename}' is not valid: {self.descriptor_filename} not found")
33
+ raise FMUError(f"'{fmu_filename}' is not valid: {self.descriptor_filename} not found")
28
34
 
29
35
  def __del__(self):
30
36
  shutil.rmtree(self.tmp_directory)
@@ -45,7 +51,7 @@ class FMU:
45
51
  manipulation.manipulate(self.descriptor_filename, apply_on)
46
52
 
47
53
 
48
- class FMUException(Exception):
54
+ class FMUError(Exception):
49
55
  def __init__(self, reason):
50
56
  self.reason = reason
51
57
 
@@ -63,12 +69,13 @@ class Manipulation:
63
69
  self.parser.StartElementHandler = self.start_element
64
70
  self.parser.EndElementHandler = self.end_element
65
71
  self.parser.CharacterDataHandler = self.char_data
66
- self.skip_until = None
72
+ self.skip_until: Optional[str] = None
67
73
  self.operation.set_fmu(fmu)
74
+ self.fmu = fmu
68
75
 
69
- self.current_port = 0
70
- self.port_translation = []
71
- self.port_name = []
76
+ self.current_port: int = 0
77
+ self.port_translation: List[int] = []
78
+ self.port_names_list: List[str] = []
72
79
  self.apply_on = None
73
80
 
74
81
  @staticmethod
@@ -78,19 +85,27 @@ class Manipulation:
78
85
  else:
79
86
  return value
80
87
 
88
+ def start_variable(self, attrs):
89
+ causality = OperationAbstract.scalar_get_causality(attrs)
90
+ port_name = attrs['name']
91
+ if not self.apply_on or causality in self.apply_on:
92
+ if self.operation.scalar_attrs(attrs):
93
+ self.remove_port(port_name)
94
+ else:
95
+ self.keep_port(port_name)
96
+ else: # Keep ScalarVariable as it is.
97
+ self.keep_port(port_name)
98
+
99
+
81
100
  def start_element(self, name, attrs):
82
101
  if self.skip_until:
83
102
  return
84
103
  try:
85
104
  if name == 'ScalarVariable':
86
- causality = OperationAbstract.scalar_get_causality(attrs)
87
- if not self.apply_on or causality in self.apply_on:
88
- if self.operation.scalar_attrs(attrs):
89
- self.remove_port(attrs['name'])
90
- else:
91
- self.keep_port(attrs['name'])
92
- else: # Keep ScalarVariable as it is.
93
- self.keep_port(attrs['name'])
105
+ self.start_variable(attrs)
106
+ elif name in self.fmu.FMI3_TYPES:
107
+ attrs['type_name'] = name
108
+ self.start_variable(attrs)
94
109
  elif name == 'CoSimulation':
95
110
  self.operation.cosimulation_attrs(attrs)
96
111
  elif name == 'DefaultExperiment':
@@ -99,7 +114,7 @@ class Manipulation:
99
114
  self.operation.fmi_attrs(attrs)
100
115
  elif name == 'Unknown':
101
116
  self.unknown_attrs(attrs)
102
- elif name in ('Real', 'Integer', 'String', 'Boolean', 'Enumeration'):
117
+ elif name in self.fmu.FMI2_TYPES:
103
118
  self.operation.scalar_type(name, attrs)
104
119
 
105
120
  except ManipulationSkipTag:
@@ -107,6 +122,7 @@ class Manipulation:
107
122
  return
108
123
 
109
124
  if attrs:
125
+ attrs.pop('fmi_type', None) # FMI 3.0: this attr was added during manipulation
110
126
  attrs_list = [f'{key}="{self.escape(value)}"' for (key, value) in attrs.items()]
111
127
  print(f"<{name}", " ".join(attrs_list), ">", end='', file=self.out)
112
128
  else:
@@ -125,12 +141,12 @@ class Manipulation:
125
141
  print(data, end='', file=self.out)
126
142
 
127
143
  def remove_port(self, name):
128
- self.port_name.append(name)
144
+ self.port_names_list.append(name)
129
145
  self.port_translation.append(None)
130
146
  raise ManipulationSkipTag
131
147
 
132
148
  def keep_port(self, name):
133
- self.port_name.append(name)
149
+ self.port_names_list.append(name)
134
150
  self.current_port += 1
135
151
  self.port_translation.append(self.current_port)
136
152
 
@@ -140,7 +156,7 @@ class Manipulation:
140
156
  if new_index:
141
157
  attrs['index'] = self.port_translation[int(attrs['index']) - 1]
142
158
  else:
143
- print(f"WARNING: Removed port '{self.port_name[index]}' is involved in dependencies tree.")
159
+ print(f"WARNING: Removed port '{self.port_names_list[index]}' is involved in dependencies tree.")
144
160
  raise ManipulationSkipTag
145
161
 
146
162
  def manipulate(self, descriptor_filename, apply_on=None):
@@ -0,0 +1,51 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
3
+ <xs:annotation>
4
+ <xs:documentation>
5
+ Copyright(c) 2008-2011 MODELISAR consortium,
6
+ 2012-2024 Modelica Association Project "FMI".
7
+ All rights reserved.
8
+
9
+ This file is licensed by the copyright holders under the 2-Clause BSD License
10
+ (https://opensource.org/licenses/BSD-2-Clause):
11
+
12
+ ----------------------------------------------------------------------------
13
+ Redistribution and use in source and binary forms, with or without
14
+ modification, are permitted provided that the following conditions are met:
15
+
16
+ - Redistributions of source code must retain the above copyright notice,
17
+ this list of conditions and the following disclaimer.
18
+
19
+ - Redistributions in binary form must reproduce the above copyright notice,
20
+ this list of conditions and the following disclaimer in the documentation
21
+ and/or other materials provided with the distribution.
22
+
23
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25
+ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
27
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
30
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
33
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ ----------------------------------------------------------------------------
35
+ </xs:documentation>
36
+ </xs:annotation>
37
+ <xs:complexType name="fmi3Annotations">
38
+ <xs:sequence maxOccurs="unbounded">
39
+ <xs:element name="Annotation">
40
+ <xs:complexType mixed="true">
41
+ <xs:sequence>
42
+ <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
43
+ </xs:sequence>
44
+ <xs:attribute name="type" type="xs:normalizedString" use="required">
45
+ </xs:attribute>
46
+ </xs:complexType>
47
+ </xs:element>
48
+ </xs:sequence>
49
+ </xs:complexType>
50
+ <xs:element name="Annotations" type="fmi3Annotations"/>
51
+ </xs:schema>
@@ -0,0 +1,119 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
3
+ <xs:annotation>
4
+ <xs:documentation>
5
+ Copyright(c) 2008-2011 MODELISAR consortium,
6
+ 2012-2024 Modelica Association Project "FMI".
7
+ All rights reserved.
8
+
9
+ This file is licensed by the copyright holders under the 2-Clause BSD License
10
+ (https://opensource.org/licenses/BSD-2-Clause):
11
+
12
+ ----------------------------------------------------------------------------
13
+ Redistribution and use in source and binary forms, with or without
14
+ modification, are permitted provided that the following conditions are met:
15
+
16
+ - Redistributions of source code must retain the above copyright notice,
17
+ this list of conditions and the following disclaimer.
18
+
19
+ - Redistributions in binary form must reproduce the above copyright notice,
20
+ this list of conditions and the following disclaimer in the documentation
21
+ and/or other materials provided with the distribution.
22
+
23
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25
+ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
27
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
30
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
33
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ ----------------------------------------------------------------------------
35
+ </xs:documentation>
36
+ </xs:annotation>
37
+ <xs:attributeGroup name="fmi3RealBaseAttributes">
38
+ <xs:attribute name="quantity" type="xs:normalizedString"/>
39
+ <xs:attribute name="unit" type="xs:normalizedString"/>
40
+ <xs:attribute name="displayUnit" type="xs:normalizedString"/>
41
+ <xs:attribute name="relativeQuantity" type="xs:boolean" default="false"/>
42
+ <xs:attribute name="unbounded" type="xs:boolean" default="false"/>
43
+ </xs:attributeGroup>
44
+ <xs:attributeGroup name="fmi3Float64Attributes">
45
+ <xs:attribute name="min" type="xs:double"/>
46
+ <xs:attribute name="max" type="xs:double"/>
47
+ <xs:attribute name="nominal" type="xs:double"/>
48
+ </xs:attributeGroup>
49
+ <xs:attributeGroup name="fmi3Float32Attributes">
50
+ <xs:attribute name="min" type="xs:float"/>
51
+ <xs:attribute name="max" type="xs:float"/>
52
+ <xs:attribute name="nominal" type="xs:float"/>
53
+ </xs:attributeGroup>
54
+ <xs:attributeGroup name="fmi3IntegerBaseAttributes">
55
+ <xs:attribute name="quantity" type="xs:normalizedString"/>
56
+ </xs:attributeGroup>
57
+ <xs:attributeGroup name="fmi3Int8Attributes">
58
+ <xs:attribute name="min" type="xs:byte"/>
59
+ <xs:attribute name="max" type="xs:byte"/>
60
+ </xs:attributeGroup>
61
+ <xs:attributeGroup name="fmi3UInt8Attributes">
62
+ <xs:attribute name="min" type="xs:unsignedByte"/>
63
+ <xs:attribute name="max" type="xs:unsignedByte"/>
64
+ </xs:attributeGroup>
65
+ <xs:attributeGroup name="fmi3Int16Attributes">
66
+ <xs:attribute name="min" type="xs:short"/>
67
+ <xs:attribute name="max" type="xs:short"/>
68
+ </xs:attributeGroup>
69
+ <xs:attributeGroup name="fmi3UInt16Attributes">
70
+ <xs:attribute name="min" type="xs:unsignedShort"/>
71
+ <xs:attribute name="max" type="xs:unsignedShort"/>
72
+ </xs:attributeGroup>
73
+ <xs:attributeGroup name="fmi3Int32Attributes">
74
+ <xs:attribute name="min" type="xs:int"/>
75
+ <xs:attribute name="max" type="xs:int"/>
76
+ </xs:attributeGroup>
77
+ <xs:attributeGroup name="fmi3UInt32Attributes">
78
+ <xs:attribute name="min" type="xs:unsignedInt"/>
79
+ <xs:attribute name="max" type="xs:unsignedInt"/>
80
+ </xs:attributeGroup>
81
+ <xs:attributeGroup name="fmi3Int64Attributes">
82
+ <xs:attribute name="min" type="xs:long"/>
83
+ <xs:attribute name="max" type="xs:long"/>
84
+ </xs:attributeGroup>
85
+ <xs:attributeGroup name="fmi3UInt64Attributes">
86
+ <xs:attribute name="min" type="xs:unsignedLong"/>
87
+ <xs:attribute name="max" type="xs:unsignedLong"/>
88
+ </xs:attributeGroup>
89
+ <xs:attributeGroup name="fmi3RealVariableAttributes">
90
+ <xs:attribute name="derivative" type="xs:unsignedInt"/>
91
+ <xs:attribute name="reinit" type="xs:boolean" default="false"/>
92
+ </xs:attributeGroup>
93
+ <xs:attributeGroup name="fmi3EnumerationAttributes">
94
+ <xs:attribute name="min" type="xs:long"/>
95
+ <xs:attribute name="max" type="xs:long"/>
96
+ </xs:attributeGroup>
97
+ <xs:attributeGroup name="fmi3ClockAttributes">
98
+ <xs:attribute name="canBeDeactivated" type="xs:boolean" default="false"/>
99
+ <xs:attribute name="priority" type="xs:unsignedInt" use="optional"/>
100
+ <xs:attribute name="intervalVariability" use="required">
101
+ <xs:simpleType>
102
+ <xs:restriction base="xs:normalizedString">
103
+ <xs:enumeration value="constant"/>
104
+ <xs:enumeration value="fixed"/>
105
+ <xs:enumeration value="tunable"/>
106
+ <xs:enumeration value="changing"/>
107
+ <xs:enumeration value="countdown"/>
108
+ <xs:enumeration value="triggered"/>
109
+ </xs:restriction>
110
+ </xs:simpleType>
111
+ </xs:attribute>
112
+ <xs:attribute name="intervalDecimal" type="xs:double" use="optional"/>
113
+ <xs:attribute name="shiftDecimal" type="xs:double" default="0"/>
114
+ <xs:attribute name="supportsFraction" type="xs:boolean" default="false"/>
115
+ <xs:attribute name="resolution" type="xs:unsignedLong" use="optional"/>
116
+ <xs:attribute name="intervalCounter" type="xs:unsignedLong" use="optional"/>
117
+ <xs:attribute name="shiftCounter" type="xs:unsignedLong" default="0"/>
118
+ </xs:attributeGroup>
119
+ </xs:schema>
@@ -0,0 +1,117 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
3
+ <xs:include schemaLocation="fmi3Annotation.xsd"/>
4
+ <xs:annotation>
5
+ <xs:documentation>
6
+ Copyright(c) 2008-2011 MODELISAR consortium,
7
+ 2012-2024 Modelica Association Project "FMI".
8
+ All rights reserved.
9
+
10
+ This file is licensed by the copyright holders under the 2-Clause BSD License
11
+ (https://opensource.org/licenses/BSD-2-Clause):
12
+
13
+ ----------------------------------------------------------------------------
14
+ Redistribution and use in source and binary forms, with or without
15
+ modification, are permitted provided that the following conditions are met:
16
+
17
+ - Redistributions of source code must retain the above copyright notice,
18
+ this list of conditions and the following disclaimer.
19
+
20
+ - Redistributions in binary form must reproduce the above copyright notice,
21
+ this list of conditions and the following disclaimer in the documentation
22
+ and/or other materials provided with the distribution.
23
+
24
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26
+ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
28
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
31
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
33
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
34
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
+ ----------------------------------------------------------------------------
36
+ </xs:documentation>
37
+ </xs:annotation>
38
+ <xs:element name="fmiBuildDescription">
39
+ <xs:complexType>
40
+ <xs:sequence>
41
+ <xs:element name="BuildConfiguration" maxOccurs="unbounded">
42
+ <xs:complexType>
43
+ <xs:sequence>
44
+ <xs:element name="SourceFileSet" minOccurs="0" maxOccurs="unbounded">
45
+ <xs:complexType>
46
+ <xs:sequence>
47
+ <xs:element name="SourceFile" maxOccurs="unbounded">
48
+ <xs:complexType>
49
+ <xs:sequence>
50
+ <xs:element ref="Annotations" minOccurs="0"/>
51
+ </xs:sequence>
52
+ <xs:attribute name="name" type="xs:normalizedString" use="required"/>
53
+ </xs:complexType>
54
+ </xs:element>
55
+ <xs:element name="PreprocessorDefinition" minOccurs="0" maxOccurs="unbounded">
56
+ <xs:complexType>
57
+ <xs:sequence>
58
+ <xs:element name="Option" minOccurs="0" maxOccurs="unbounded">
59
+ <xs:complexType>
60
+ <xs:attribute name="value" type="xs:normalizedString"/>
61
+ <xs:attribute name="description" type="xs:string"/>
62
+ </xs:complexType>
63
+ </xs:element>
64
+ <xs:element ref="Annotations" minOccurs="0"/>
65
+ </xs:sequence>
66
+ <xs:attribute name="name" type="xs:normalizedString" use="required"/>
67
+ <xs:attribute name="optional" type="xs:boolean" default="false"/>
68
+ <xs:attribute name="value" type="xs:normalizedString"/>
69
+ <xs:attribute name="description" type="xs:string"/>
70
+ </xs:complexType>
71
+ </xs:element>
72
+ <xs:element name="IncludeDirectory" minOccurs="0" maxOccurs="unbounded">
73
+ <xs:complexType>
74
+ <xs:sequence>
75
+ <xs:element ref="Annotations" minOccurs="0"/>
76
+ </xs:sequence>
77
+ <xs:attribute name="name" type="xs:normalizedString" use="required"/>
78
+ </xs:complexType>
79
+ </xs:element>
80
+ <xs:element ref="Annotations" minOccurs="0"/>
81
+ </xs:sequence>
82
+ <xs:attribute name="name" type="xs:normalizedString"/>
83
+ <xs:attribute name="language" type="xs:normalizedString"/>
84
+ <xs:attribute name="compiler" type="xs:normalizedString"/>
85
+ <xs:attribute name="compilerOptions" type="xs:string"/>
86
+ </xs:complexType>
87
+ </xs:element>
88
+ <xs:element name="Library" minOccurs="0" maxOccurs="unbounded">
89
+ <xs:complexType>
90
+ <xs:sequence>
91
+ <xs:element ref="Annotations" minOccurs="0"/>
92
+ </xs:sequence>
93
+ <xs:attribute name="name" type="xs:normalizedString" use="required"/>
94
+ <xs:attribute name="version" type="xs:normalizedString"/>
95
+ <xs:attribute name="external" type="xs:boolean" default="false"/>
96
+ <xs:attribute name="description" type="xs:string"/>
97
+ </xs:complexType>
98
+ </xs:element>
99
+ <xs:element ref="Annotations" minOccurs="0"/>
100
+ </xs:sequence>
101
+ <xs:attribute name="modelIdentifier" type="xs:normalizedString" use="required"/>
102
+ <xs:attribute name="platform" type="xs:normalizedString"/>
103
+ <xs:attribute name="description" type="xs:string"/>
104
+ </xs:complexType>
105
+ </xs:element>
106
+ <xs:element ref="Annotations" minOccurs="0"/>
107
+ </xs:sequence>
108
+ <xs:attribute name="fmiVersion" use="required">
109
+ <xs:simpleType>
110
+ <xs:restriction base="xs:normalizedString">
111
+ <xs:pattern value="3[.](0|[1-9][0-9]*)([.](0|[1-9][0-9]*))?(-.+)?"/>
112
+ </xs:restriction>
113
+ </xs:simpleType>
114
+ </xs:attribute>
115
+ </xs:complexType>
116
+ </xs:element>
117
+ </xs:schema>