File tree Expand file tree Collapse file tree 5 files changed +41
-1
lines changed
Expand file tree Collapse file tree 5 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/Model.py" DESTINATION ${CMAKE_INSTALL
1818install (FILES "${CMAKE_CURRENT_SOURCE_DIR} /NewAPI.py" DESTINATION ${CMAKE_INSTALL_PREFIX} /lib/OMSimulator)
1919install (FILES "${CMAKE_CURRENT_SOURCE_DIR} /OMSimulator.py" DESTINATION ${CMAKE_INSTALL_PREFIX} /lib/OMSimulator)
2020install (FILES "${CMAKE_CURRENT_SOURCE_DIR} /Scope.py" DESTINATION ${CMAKE_INSTALL_PREFIX} /lib/OMSimulator)
21+ install (FILES "${CMAKE_CURRENT_SOURCE_DIR} /System.py" DESTINATION ${CMAKE_INSTALL_PREFIX} /lib/OMSimulator)
2122install (FILES "${CMAKE_CURRENT_SOURCE_DIR} /Types.py" DESTINATION ${CMAKE_INSTALL_PREFIX} /lib/OMSimulator)
2223
2324IF (WIN32 AND MSVC )
Original file line number Diff line number Diff line change 1- from OMSimulator import Scope , Types
1+ from OMSimulator import Scope , System , Types
22
33
44class Model :
@@ -14,6 +14,13 @@ def delete(self):
1414 else :
1515 raise Exception ('error {}' .format (Types .Status (status )))
1616
17+ def addSystem (self , cref : str , type_ : Types .System ):
18+ new_cref = self .cref + '.' + cref
19+ status = Scope ._capi .addSystem (new_cref , type_ .value )
20+ if Types .Status (status ) != Types .Status .OK :
21+ raise Exception ('error {}' .format (Types .Status (status )))
22+ return System .System (new_cref )
23+
1724 def instantiate (self ):
1825 status = Scope ._capi .instantiate (self .cref )
1926 if Types .Status (status ) != Types .Status .OK :
Original file line number Diff line number Diff line change 1+ from OMSimulator import Scope , Types
2+
3+
4+ class System :
5+ def __init__ (self , cref : str ):
6+ self ._cref = cref
7+
8+ @property
9+ def cref (self ):
10+ return self ._cref
11+
12+ @property
13+ def type (self ):
14+ type_ , status = Scope ._capi .getSystemType (self .cref )
15+ if Types .Status (status ) != Types .Status .OK :
16+ raise Exception ('error {}' .format (Types .Status (status )))
17+ return Types .System (type_ )
18+
19+ def addSystem (self , cref : str , type_ : Types .System ):
20+ new_cref = self .cref + '.' + cref
21+ status = Scope ._capi .addSystem (new_cref , type_ .value )
22+ if Types .Status (status ) != Types .Status .OK :
23+ raise Exception ('error {}' .format (Types .Status (status )))
24+ return System (new_cref )
Original file line number Diff line number Diff line change @@ -8,3 +8,10 @@ class Status(Enum):
88 ERROR = 3
99 FATAL = 4
1010 PENDING = 5
11+
12+ class System (Enum ):
13+ 'oms_system_enu_t'
14+ NONE = 0
15+ TLM = 1 # TLM system
16+ WC = 2 # Weakly Coupled system
17+ SC = 3 # Strongly Coupled system
Original file line number Diff line number Diff line change 66from OMSimulator .Model import Model
77from OMSimulator .NewAPI import *
88from OMSimulator .OMSimulator import OMSimulator
9+ from OMSimulator .System import System
910
1011__version__ = '@OMS_SHORT_VERSION_STRING@'
1112__copyright__ = '''\
You can’t perform that action at this time.
0 commit comments