mi-mx 0.1.0__tar.gz
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.
- mi_mx-0.1.0/LICENSE +21 -0
- mi_mx-0.1.0/MANIFEST.in +1 -0
- mi_mx-0.1.0/PKG-INFO +142 -0
- mi_mx-0.1.0/README.md +91 -0
- mi_mx-0.1.0/pyproject.toml +30 -0
- mi_mx-0.1.0/setup.cfg +4 -0
- mi_mx-0.1.0/src/mi_mx.egg-info/PKG-INFO +142 -0
- mi_mx-0.1.0/src/mi_mx.egg-info/SOURCES.txt +59 -0
- mi_mx-0.1.0/src/mi_mx.egg-info/dependency_links.txt +1 -0
- mi_mx-0.1.0/src/mi_mx.egg-info/entry_points.txt +2 -0
- mi_mx-0.1.0/src/mi_mx.egg-info/requires.txt +17 -0
- mi_mx-0.1.0/src/mi_mx.egg-info/top_level.txt +1 -0
- mi_mx-0.1.0/src/mx/__init__.py +1 -0
- mi_mx-0.1.0/src/mx/__main__.py +81 -0
- mi_mx-0.1.0/src/mx/actions/__init__.py +0 -0
- mi_mx-0.1.0/src/mx/actions/action.py +76 -0
- mi_mx-0.1.0/src/mx/actions/extract.py +98 -0
- mi_mx-0.1.0/src/mx/actions/flow.py +34 -0
- mi_mx-0.1.0/src/mx/actions/gate.py +95 -0
- mi_mx-0.1.0/src/mx/actions/project.py +122 -0
- mi_mx-0.1.0/src/mx/actions/rank_restrict.py +126 -0
- mi_mx-0.1.0/src/mx/actions/read.py +108 -0
- mi_mx-0.1.0/src/mx/actions/rename.py +88 -0
- mi_mx-0.1.0/src/mx/actions/restrict.py +208 -0
- mi_mx-0.1.0/src/mx/actions/scalar_switch.py +96 -0
- mi_mx-0.1.0/src/mx/actions/select.py +219 -0
- mi_mx-0.1.0/src/mx/actions/set_action.py +116 -0
- mi_mx-0.1.0/src/mx/actions/signal.py +27 -0
- mi_mx-0.1.0/src/mx/actions/single_select.py +12 -0
- mi_mx-0.1.0/src/mx/actions/traverse.py +314 -0
- mi_mx-0.1.0/src/mx/actions/zero_one_card_select.py +12 -0
- mi_mx-0.1.0/src/mx/activity.py +58 -0
- mi_mx-0.1.0/src/mx/assigner_state_machine.py +13 -0
- mi_mx-0.1.0/src/mx/completion_event.py +44 -0
- mi_mx-0.1.0/src/mx/db_names.py +6 -0
- mi_mx-0.1.0/src/mx/deprecated/__init__.py +0 -0
- mi_mx-0.1.0/src/mx/deprecated/bridge.py +42 -0
- mi_mx-0.1.0/src/mx/dispatched_event.py +37 -0
- mi_mx-0.1.0/src/mx/domain.py +231 -0
- mi_mx-0.1.0/src/mx/exceptions.py +47 -0
- mi_mx-0.1.0/src/mx/file_names.py +6 -0
- mi_mx-0.1.0/src/mx/initial_states.py +75 -0
- mi_mx-0.1.0/src/mx/instance.py +12 -0
- mi_mx-0.1.0/src/mx/instance_set.py +46 -0
- mi_mx-0.1.0/src/mx/interaction_event.py +91 -0
- mi_mx-0.1.0/src/mx/lifecycle_state_machine.py +26 -0
- mi_mx-0.1.0/src/mx/log.conf +42 -0
- mi_mx-0.1.0/src/mx/method.py +183 -0
- mi_mx-0.1.0/src/mx/multiple_assigner_state_machine.py +17 -0
- mi_mx-0.1.0/src/mx/mx_logger.py +52 -0
- mi_mx-0.1.0/src/mx/mxtypes.py +18 -0
- mi_mx-0.1.0/src/mx/operation.py +50 -0
- mi_mx-0.1.0/src/mx/rvname.py +39 -0
- mi_mx-0.1.0/src/mx/scenario.py +173 -0
- mi_mx-0.1.0/src/mx/scenarios/__init__.py +0 -0
- mi_mx-0.1.0/src/mx/scenarios/ev_scenario_REF.py +115 -0
- mi_mx-0.1.0/src/mx/single_assigner_state_machine.py +13 -0
- mi_mx-0.1.0/src/mx/state_activity.py +23 -0
- mi_mx-0.1.0/src/mx/state_machine.py +222 -0
- mi_mx-0.1.0/src/mx/system.py +62 -0
- mi_mx-0.1.0/src/mx/xe.py +109 -0
mi_mx-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Leon Starr
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
mi_mx-0.1.0/MANIFEST.in
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include src/mx/log.conf
|
mi_mx-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mi-mx
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Shlaer-Mellor Executable UML Model Execution Environment
|
|
5
|
+
Author-email: Leon Starr <leon_starr@modelint.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Leon Starr
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: repository, https://github.com/modelint/model-execution
|
|
29
|
+
Project-URL: documentation, https://github.com/modelint/model-execution/wiki
|
|
30
|
+
Keywords: shlaer-mellor,metamodel,executable uml,mbse,xuml,xtuml,platform independent,sysml
|
|
31
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
32
|
+
Classifier: Programming Language :: Python
|
|
33
|
+
Classifier: Programming Language :: Python :: 3
|
|
34
|
+
Requires-Python: >=3.11
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
License-File: LICENSE
|
|
37
|
+
Requires-Dist: xcm-parser
|
|
38
|
+
Requires-Dist: xsm-parser
|
|
39
|
+
Requires-Dist: mi-configurator
|
|
40
|
+
Requires-Dist: mi-pyral
|
|
41
|
+
Requires-Dist: sip-parser
|
|
42
|
+
Requires-Dist: PyYAML
|
|
43
|
+
Requires-Dist: tomli; python_version < "3.13"
|
|
44
|
+
Provides-Extra: build
|
|
45
|
+
Requires-Dist: build; extra == "build"
|
|
46
|
+
Requires-Dist: twine; extra == "build"
|
|
47
|
+
Provides-Extra: dev
|
|
48
|
+
Requires-Dist: bump2version; extra == "dev"
|
|
49
|
+
Requires-Dist: pytest; extra == "dev"
|
|
50
|
+
Dynamic: license-file
|
|
51
|
+
|
|
52
|
+
## Model execution engine
|
|
53
|
+
|
|
54
|
+
# Loading a System
|
|
55
|
+
|
|
56
|
+
We supply mx with a system to run, an initial context, and a scenario to execute
|
|
57
|
+
|
|
58
|
+
`mx -s elevator -c three_bank1 -x lobby_to_three`
|
|
59
|
+
|
|
60
|
+
The required arguments are:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
-s / --system
|
|
64
|
+
-c / --context
|
|
65
|
+
-x / --scenario
|
|
66
|
+
```
|
|
67
|
+
Optional arguments are:
|
|
68
|
+
```
|
|
69
|
+
-D / --debug
|
|
70
|
+
-V / --version
|
|
71
|
+
```
|
|
72
|
+
### -s or --system
|
|
73
|
+
|
|
74
|
+
Here you specify the name of a directory containing the following components:
|
|
75
|
+
```
|
|
76
|
+
system_name/
|
|
77
|
+
system.ral - Metamodel produced by xuml-populate (can be named anything you like, with any extension)
|
|
78
|
+
db_types/ - Directory of yaml files mapping user types to TclRAL system types (must have this name)
|
|
79
|
+
domain_name1_types.yaml - Each yaml file name must begin with domain name or alias
|
|
80
|
+
domain_name2_types.yaml
|
|
81
|
+
domain_name3_types.yaml
|
|
82
|
+
```
|
|
83
|
+
Example:
|
|
84
|
+
```
|
|
85
|
+
elevator/ - Any name ok
|
|
86
|
+
elevator.ral - Any name ok, ev.txt, mm3.ral, etc.
|
|
87
|
+
db_types/ - Must be this name
|
|
88
|
+
evman_types.yaml - could have named it evman.yaml, elevator_management.yaml,
|
|
89
|
+
- evman_user_to_tcl_types.yaml, etc
|
|
90
|
+
- but prefix must be either evman (alias) or elevator_management
|
|
91
|
+
- case insensitive, so EVMAN also okay
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
The `system.ral` file is actually just a text file serialization of a TclRAL database.
|
|
96
|
+
Specifically, it is a populated SM Metamodel that you can generate with the xuml-populate tool. The metamodel is populated with one or more modeled domains. In our example, this is the elevator management domain. We could also add in the transport and sio domains defined in the elevator case study if we like, but for now we just have the elevator management (EVMAN) domain.
|
|
97
|
+
|
|
98
|
+
### -c or --context
|
|
99
|
+
|
|
100
|
+
This is yet another directory that contains a single initial context per domain. It is structured like this:
|
|
101
|
+
```
|
|
102
|
+
context_name/ - Any name that describes your aggregate initial context
|
|
103
|
+
domain1.sip - One initial population per domain in the system
|
|
104
|
+
domain2.sip
|
|
105
|
+
domain3.sip
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
An initial context is a population of initial instances and states. That way we can begin a scenario with a known set of instances in known states for those instances with modeled lifecycles (state machines).
|
|
109
|
+
|
|
110
|
+
Each domain's context is defined with a single *.sip (scenario instance population) file.
|
|
111
|
+
|
|
112
|
+
In our example we have only one domain population:
|
|
113
|
+
```
|
|
114
|
+
three_bank/
|
|
115
|
+
evman_three_bank1.sip
|
|
116
|
+
```
|
|
117
|
+
We named it 'three_bank' since we are using three separate elevator banks, 'lower floors',
|
|
118
|
+
'express', and 'freight'.
|
|
119
|
+
|
|
120
|
+
If we were running the trans and sio domains, we could have supplied one *.sip file for each
|
|
121
|
+
in this directory as well.
|
|
122
|
+
|
|
123
|
+
Note that each *.sip file name must begin with a domain name or alias.
|
|
124
|
+
|
|
125
|
+
See the sip-parser repository wiki for details on the grammar.
|
|
126
|
+
|
|
127
|
+
MX invokes the sip-parser when it loads the file and will throw any errors it finds in the process.
|
|
128
|
+
|
|
129
|
+
### -x or --scenario
|
|
130
|
+
|
|
131
|
+
Finally, we provide a sequence of interactions in the form of a scenario file to run against the populated system.
|
|
132
|
+
|
|
133
|
+
This is specified in a *.scn file. *(grammar/parser yet to be designed)*
|
|
134
|
+
|
|
135
|
+
You use the sequence of interactions to drive validation or exploration.
|
|
136
|
+
|
|
137
|
+
For example, you might specify that a cabin going up is requested from the lobby floor
|
|
138
|
+
in the lower floors bank. It arrives, floor 3 is requested, the doors close, the cabin transits and then arrives at that floor with the doors opening.
|
|
139
|
+
|
|
140
|
+
This scenario will result in the appropriate events signaled in the loaded system and collect any responses and status updates of interest along the way.
|
|
141
|
+
|
|
142
|
+
You can define multiple initial contexts for a system and run the same or different scenarios against each.
|
mi_mx-0.1.0/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
## Model execution engine
|
|
2
|
+
|
|
3
|
+
# Loading a System
|
|
4
|
+
|
|
5
|
+
We supply mx with a system to run, an initial context, and a scenario to execute
|
|
6
|
+
|
|
7
|
+
`mx -s elevator -c three_bank1 -x lobby_to_three`
|
|
8
|
+
|
|
9
|
+
The required arguments are:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
-s / --system
|
|
13
|
+
-c / --context
|
|
14
|
+
-x / --scenario
|
|
15
|
+
```
|
|
16
|
+
Optional arguments are:
|
|
17
|
+
```
|
|
18
|
+
-D / --debug
|
|
19
|
+
-V / --version
|
|
20
|
+
```
|
|
21
|
+
### -s or --system
|
|
22
|
+
|
|
23
|
+
Here you specify the name of a directory containing the following components:
|
|
24
|
+
```
|
|
25
|
+
system_name/
|
|
26
|
+
system.ral - Metamodel produced by xuml-populate (can be named anything you like, with any extension)
|
|
27
|
+
db_types/ - Directory of yaml files mapping user types to TclRAL system types (must have this name)
|
|
28
|
+
domain_name1_types.yaml - Each yaml file name must begin with domain name or alias
|
|
29
|
+
domain_name2_types.yaml
|
|
30
|
+
domain_name3_types.yaml
|
|
31
|
+
```
|
|
32
|
+
Example:
|
|
33
|
+
```
|
|
34
|
+
elevator/ - Any name ok
|
|
35
|
+
elevator.ral - Any name ok, ev.txt, mm3.ral, etc.
|
|
36
|
+
db_types/ - Must be this name
|
|
37
|
+
evman_types.yaml - could have named it evman.yaml, elevator_management.yaml,
|
|
38
|
+
- evman_user_to_tcl_types.yaml, etc
|
|
39
|
+
- but prefix must be either evman (alias) or elevator_management
|
|
40
|
+
- case insensitive, so EVMAN also okay
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
The `system.ral` file is actually just a text file serialization of a TclRAL database.
|
|
45
|
+
Specifically, it is a populated SM Metamodel that you can generate with the xuml-populate tool. The metamodel is populated with one or more modeled domains. In our example, this is the elevator management domain. We could also add in the transport and sio domains defined in the elevator case study if we like, but for now we just have the elevator management (EVMAN) domain.
|
|
46
|
+
|
|
47
|
+
### -c or --context
|
|
48
|
+
|
|
49
|
+
This is yet another directory that contains a single initial context per domain. It is structured like this:
|
|
50
|
+
```
|
|
51
|
+
context_name/ - Any name that describes your aggregate initial context
|
|
52
|
+
domain1.sip - One initial population per domain in the system
|
|
53
|
+
domain2.sip
|
|
54
|
+
domain3.sip
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
An initial context is a population of initial instances and states. That way we can begin a scenario with a known set of instances in known states for those instances with modeled lifecycles (state machines).
|
|
58
|
+
|
|
59
|
+
Each domain's context is defined with a single *.sip (scenario instance population) file.
|
|
60
|
+
|
|
61
|
+
In our example we have only one domain population:
|
|
62
|
+
```
|
|
63
|
+
three_bank/
|
|
64
|
+
evman_three_bank1.sip
|
|
65
|
+
```
|
|
66
|
+
We named it 'three_bank' since we are using three separate elevator banks, 'lower floors',
|
|
67
|
+
'express', and 'freight'.
|
|
68
|
+
|
|
69
|
+
If we were running the trans and sio domains, we could have supplied one *.sip file for each
|
|
70
|
+
in this directory as well.
|
|
71
|
+
|
|
72
|
+
Note that each *.sip file name must begin with a domain name or alias.
|
|
73
|
+
|
|
74
|
+
See the sip-parser repository wiki for details on the grammar.
|
|
75
|
+
|
|
76
|
+
MX invokes the sip-parser when it loads the file and will throw any errors it finds in the process.
|
|
77
|
+
|
|
78
|
+
### -x or --scenario
|
|
79
|
+
|
|
80
|
+
Finally, we provide a sequence of interactions in the form of a scenario file to run against the populated system.
|
|
81
|
+
|
|
82
|
+
This is specified in a *.scn file. *(grammar/parser yet to be designed)*
|
|
83
|
+
|
|
84
|
+
You use the sequence of interactions to drive validation or exploration.
|
|
85
|
+
|
|
86
|
+
For example, you might specify that a cabin going up is requested from the lobby floor
|
|
87
|
+
in the lower floors bank. It arrives, floor 3 is requested, the doors close, the cabin transits and then arrives at that floor with the doors opening.
|
|
88
|
+
|
|
89
|
+
This scenario will result in the appropriate events signaled in the loaded system and collect any responses and status updates of interest along the way.
|
|
90
|
+
|
|
91
|
+
You can define multiple initial contexts for a system and run the same or different scenarios against each.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mi-mx"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Shlaer-Mellor Executable UML Model Execution Environment"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [{ name = "Leon Starr", email = "leon_starr@modelint.com" }]
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
classifiers = [
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Programming Language :: Python",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
]
|
|
17
|
+
keywords = ["shlaer-mellor", "metamodel", "executable uml", "mbse", "xuml", "xtuml", "platform independent", "sysml"]
|
|
18
|
+
dependencies = ["xcm-parser", "xsm-parser", "mi-configurator", "mi-pyral", "sip-parser", "PyYAML", 'tomli; python_version < "3.13"']
|
|
19
|
+
requires-python = ">=3.11"
|
|
20
|
+
|
|
21
|
+
[project.optional-dependencies]
|
|
22
|
+
build = ["build", "twine"]
|
|
23
|
+
dev = ["bump2version", "pytest"]
|
|
24
|
+
|
|
25
|
+
[project.scripts]
|
|
26
|
+
mx = "mx.__main__:main"
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
repository = "https://github.com/modelint/model-execution"
|
|
30
|
+
documentation = "https://github.com/modelint/model-execution/wiki"
|
mi_mx-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mi-mx
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Shlaer-Mellor Executable UML Model Execution Environment
|
|
5
|
+
Author-email: Leon Starr <leon_starr@modelint.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Leon Starr
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: repository, https://github.com/modelint/model-execution
|
|
29
|
+
Project-URL: documentation, https://github.com/modelint/model-execution/wiki
|
|
30
|
+
Keywords: shlaer-mellor,metamodel,executable uml,mbse,xuml,xtuml,platform independent,sysml
|
|
31
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
32
|
+
Classifier: Programming Language :: Python
|
|
33
|
+
Classifier: Programming Language :: Python :: 3
|
|
34
|
+
Requires-Python: >=3.11
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
License-File: LICENSE
|
|
37
|
+
Requires-Dist: xcm-parser
|
|
38
|
+
Requires-Dist: xsm-parser
|
|
39
|
+
Requires-Dist: mi-configurator
|
|
40
|
+
Requires-Dist: mi-pyral
|
|
41
|
+
Requires-Dist: sip-parser
|
|
42
|
+
Requires-Dist: PyYAML
|
|
43
|
+
Requires-Dist: tomli; python_version < "3.13"
|
|
44
|
+
Provides-Extra: build
|
|
45
|
+
Requires-Dist: build; extra == "build"
|
|
46
|
+
Requires-Dist: twine; extra == "build"
|
|
47
|
+
Provides-Extra: dev
|
|
48
|
+
Requires-Dist: bump2version; extra == "dev"
|
|
49
|
+
Requires-Dist: pytest; extra == "dev"
|
|
50
|
+
Dynamic: license-file
|
|
51
|
+
|
|
52
|
+
## Model execution engine
|
|
53
|
+
|
|
54
|
+
# Loading a System
|
|
55
|
+
|
|
56
|
+
We supply mx with a system to run, an initial context, and a scenario to execute
|
|
57
|
+
|
|
58
|
+
`mx -s elevator -c three_bank1 -x lobby_to_three`
|
|
59
|
+
|
|
60
|
+
The required arguments are:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
-s / --system
|
|
64
|
+
-c / --context
|
|
65
|
+
-x / --scenario
|
|
66
|
+
```
|
|
67
|
+
Optional arguments are:
|
|
68
|
+
```
|
|
69
|
+
-D / --debug
|
|
70
|
+
-V / --version
|
|
71
|
+
```
|
|
72
|
+
### -s or --system
|
|
73
|
+
|
|
74
|
+
Here you specify the name of a directory containing the following components:
|
|
75
|
+
```
|
|
76
|
+
system_name/
|
|
77
|
+
system.ral - Metamodel produced by xuml-populate (can be named anything you like, with any extension)
|
|
78
|
+
db_types/ - Directory of yaml files mapping user types to TclRAL system types (must have this name)
|
|
79
|
+
domain_name1_types.yaml - Each yaml file name must begin with domain name or alias
|
|
80
|
+
domain_name2_types.yaml
|
|
81
|
+
domain_name3_types.yaml
|
|
82
|
+
```
|
|
83
|
+
Example:
|
|
84
|
+
```
|
|
85
|
+
elevator/ - Any name ok
|
|
86
|
+
elevator.ral - Any name ok, ev.txt, mm3.ral, etc.
|
|
87
|
+
db_types/ - Must be this name
|
|
88
|
+
evman_types.yaml - could have named it evman.yaml, elevator_management.yaml,
|
|
89
|
+
- evman_user_to_tcl_types.yaml, etc
|
|
90
|
+
- but prefix must be either evman (alias) or elevator_management
|
|
91
|
+
- case insensitive, so EVMAN also okay
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
The `system.ral` file is actually just a text file serialization of a TclRAL database.
|
|
96
|
+
Specifically, it is a populated SM Metamodel that you can generate with the xuml-populate tool. The metamodel is populated with one or more modeled domains. In our example, this is the elevator management domain. We could also add in the transport and sio domains defined in the elevator case study if we like, but for now we just have the elevator management (EVMAN) domain.
|
|
97
|
+
|
|
98
|
+
### -c or --context
|
|
99
|
+
|
|
100
|
+
This is yet another directory that contains a single initial context per domain. It is structured like this:
|
|
101
|
+
```
|
|
102
|
+
context_name/ - Any name that describes your aggregate initial context
|
|
103
|
+
domain1.sip - One initial population per domain in the system
|
|
104
|
+
domain2.sip
|
|
105
|
+
domain3.sip
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
An initial context is a population of initial instances and states. That way we can begin a scenario with a known set of instances in known states for those instances with modeled lifecycles (state machines).
|
|
109
|
+
|
|
110
|
+
Each domain's context is defined with a single *.sip (scenario instance population) file.
|
|
111
|
+
|
|
112
|
+
In our example we have only one domain population:
|
|
113
|
+
```
|
|
114
|
+
three_bank/
|
|
115
|
+
evman_three_bank1.sip
|
|
116
|
+
```
|
|
117
|
+
We named it 'three_bank' since we are using three separate elevator banks, 'lower floors',
|
|
118
|
+
'express', and 'freight'.
|
|
119
|
+
|
|
120
|
+
If we were running the trans and sio domains, we could have supplied one *.sip file for each
|
|
121
|
+
in this directory as well.
|
|
122
|
+
|
|
123
|
+
Note that each *.sip file name must begin with a domain name or alias.
|
|
124
|
+
|
|
125
|
+
See the sip-parser repository wiki for details on the grammar.
|
|
126
|
+
|
|
127
|
+
MX invokes the sip-parser when it loads the file and will throw any errors it finds in the process.
|
|
128
|
+
|
|
129
|
+
### -x or --scenario
|
|
130
|
+
|
|
131
|
+
Finally, we provide a sequence of interactions in the form of a scenario file to run against the populated system.
|
|
132
|
+
|
|
133
|
+
This is specified in a *.scn file. *(grammar/parser yet to be designed)*
|
|
134
|
+
|
|
135
|
+
You use the sequence of interactions to drive validation or exploration.
|
|
136
|
+
|
|
137
|
+
For example, you might specify that a cabin going up is requested from the lobby floor
|
|
138
|
+
in the lower floors bank. It arrives, floor 3 is requested, the doors close, the cabin transits and then arrives at that floor with the doors opening.
|
|
139
|
+
|
|
140
|
+
This scenario will result in the appropriate events signaled in the loaded system and collect any responses and status updates of interest along the way.
|
|
141
|
+
|
|
142
|
+
You can define multiple initial contexts for a system and run the same or different scenarios against each.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
src/mi_mx.egg-info/PKG-INFO
|
|
6
|
+
src/mi_mx.egg-info/SOURCES.txt
|
|
7
|
+
src/mi_mx.egg-info/dependency_links.txt
|
|
8
|
+
src/mi_mx.egg-info/entry_points.txt
|
|
9
|
+
src/mi_mx.egg-info/requires.txt
|
|
10
|
+
src/mi_mx.egg-info/top_level.txt
|
|
11
|
+
src/mx/__init__.py
|
|
12
|
+
src/mx/__main__.py
|
|
13
|
+
src/mx/activity.py
|
|
14
|
+
src/mx/assigner_state_machine.py
|
|
15
|
+
src/mx/completion_event.py
|
|
16
|
+
src/mx/db_names.py
|
|
17
|
+
src/mx/dispatched_event.py
|
|
18
|
+
src/mx/domain.py
|
|
19
|
+
src/mx/exceptions.py
|
|
20
|
+
src/mx/file_names.py
|
|
21
|
+
src/mx/initial_states.py
|
|
22
|
+
src/mx/instance.py
|
|
23
|
+
src/mx/instance_set.py
|
|
24
|
+
src/mx/interaction_event.py
|
|
25
|
+
src/mx/lifecycle_state_machine.py
|
|
26
|
+
src/mx/log.conf
|
|
27
|
+
src/mx/method.py
|
|
28
|
+
src/mx/multiple_assigner_state_machine.py
|
|
29
|
+
src/mx/mx_logger.py
|
|
30
|
+
src/mx/mxtypes.py
|
|
31
|
+
src/mx/operation.py
|
|
32
|
+
src/mx/rvname.py
|
|
33
|
+
src/mx/scenario.py
|
|
34
|
+
src/mx/single_assigner_state_machine.py
|
|
35
|
+
src/mx/state_activity.py
|
|
36
|
+
src/mx/state_machine.py
|
|
37
|
+
src/mx/system.py
|
|
38
|
+
src/mx/xe.py
|
|
39
|
+
src/mx/actions/__init__.py
|
|
40
|
+
src/mx/actions/action.py
|
|
41
|
+
src/mx/actions/extract.py
|
|
42
|
+
src/mx/actions/flow.py
|
|
43
|
+
src/mx/actions/gate.py
|
|
44
|
+
src/mx/actions/project.py
|
|
45
|
+
src/mx/actions/rank_restrict.py
|
|
46
|
+
src/mx/actions/read.py
|
|
47
|
+
src/mx/actions/rename.py
|
|
48
|
+
src/mx/actions/restrict.py
|
|
49
|
+
src/mx/actions/scalar_switch.py
|
|
50
|
+
src/mx/actions/select.py
|
|
51
|
+
src/mx/actions/set_action.py
|
|
52
|
+
src/mx/actions/signal.py
|
|
53
|
+
src/mx/actions/single_select.py
|
|
54
|
+
src/mx/actions/traverse.py
|
|
55
|
+
src/mx/actions/zero_one_card_select.py
|
|
56
|
+
src/mx/deprecated/__init__.py
|
|
57
|
+
src/mx/deprecated/bridge.py
|
|
58
|
+
src/mx/scenarios/__init__.py
|
|
59
|
+
src/mx/scenarios/ev_scenario_REF.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mx
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version = "0.1.0"
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Blueprint Model Execution
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
# System
|
|
6
|
+
import logging
|
|
7
|
+
import logging.config
|
|
8
|
+
import sys
|
|
9
|
+
import argparse
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
import atexit
|
|
12
|
+
|
|
13
|
+
# MX
|
|
14
|
+
from mx.xe import XE
|
|
15
|
+
from mx import version
|
|
16
|
+
|
|
17
|
+
_logpath = Path("mx.log")
|
|
18
|
+
_progname = 'Blueprint Model Execution'
|
|
19
|
+
|
|
20
|
+
def clean_up():
|
|
21
|
+
"""Normal and exception exit activities"""
|
|
22
|
+
_logpath.unlink(missing_ok=True)
|
|
23
|
+
|
|
24
|
+
def get_logger():
|
|
25
|
+
"""Initiate the logger"""
|
|
26
|
+
log_conf_path = Path(__file__).parent / 'log.conf' # Logging configuration is in this file
|
|
27
|
+
logging.config.fileConfig(fname=log_conf_path, disable_existing_loggers=False)
|
|
28
|
+
return logging.getLogger(__name__) # Create a logger for this module
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# Configure the expected parameters and actions for the argparse module
|
|
32
|
+
def parse(cl_input):
|
|
33
|
+
parser = argparse.ArgumentParser(description=_progname)
|
|
34
|
+
parser.add_argument('-s', '--system', action='store',
|
|
35
|
+
help='Name of the metamodel TclRAL database *.ral file populated with one or more domains')
|
|
36
|
+
parser.add_argument('-c', '--context', action='store',
|
|
37
|
+
help='Name of the context directory specifying the initialized domain dbs and a *.sip file')
|
|
38
|
+
parser.add_argument('-x', '--scenario', action='store',
|
|
39
|
+
help='Name of the scenario *.yaml file to run against the populated system')
|
|
40
|
+
parser.add_argument('-D', '--debug', action='store_true',
|
|
41
|
+
help='Debug mode'),
|
|
42
|
+
parser.add_argument('-L', '--log', action='store_true',
|
|
43
|
+
help='Generate a diagnostic log file')
|
|
44
|
+
parser.add_argument('-v', '--verbose', action='store_true',
|
|
45
|
+
help='Verbose messages')
|
|
46
|
+
parser.add_argument('-V', '--version', action='store_true',
|
|
47
|
+
help='Print the current version of the model execution app')
|
|
48
|
+
return parser.parse_args(cl_input)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def main():
|
|
52
|
+
# Start logging
|
|
53
|
+
logger = get_logger()
|
|
54
|
+
logger.info(f'{_progname} version: {version}')
|
|
55
|
+
|
|
56
|
+
# Parse the command line args
|
|
57
|
+
args = parse(sys.argv[1:])
|
|
58
|
+
|
|
59
|
+
if args.version:
|
|
60
|
+
# Just print the version and quit
|
|
61
|
+
print(f'{_progname} version: {version}')
|
|
62
|
+
sys.exit(0)
|
|
63
|
+
|
|
64
|
+
if not args.log:
|
|
65
|
+
# If no log file is requested, remove the log file before termination
|
|
66
|
+
atexit.register(clean_up)
|
|
67
|
+
|
|
68
|
+
# Domain specified
|
|
69
|
+
if args.system:
|
|
70
|
+
xe = XE() # Create the singleton instance
|
|
71
|
+
xe.initialize(mmdb_path=Path(args.system), context_dir=Path(args.context),
|
|
72
|
+
scenario_file=Path(args.scenario), verbose=args.verbose, debug=args.debug)
|
|
73
|
+
|
|
74
|
+
print("\nNo problemo") # Comment this line out before release
|
|
75
|
+
logger.info("No problemo") # We didn't die on an exception, basically
|
|
76
|
+
if args.verbose or args.debug:
|
|
77
|
+
print("\nNo problemo")
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
if __name__ == "__main__":
|
|
81
|
+
main()
|
|
File without changes
|