def newModel(cref: str) -> Model: status = Scope._capi.newModel(cref) if Types.Status(status) == Types.Status.OK: Scope._Scope.append(cref) else: raise Exception('error {}'.format(Types.Status(status))) return Model(cref)
def exportSnapshot(self, ident: str = None) -> str: contents, status = Scope._capi.exportSnapshot(self.cref + ('.' + ident if ident else '')) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status))) return contents
def importFile(file: str) -> Model: cref, status = Scope._capi.importFile(file) if Types.Status(status) == Types.Status.OK: Scope._Scope.append(cref) else: raise Exception('error {}'.format(Types.Status(status))) return Model(cref)
def resultFile(self, file: str): _, bufferSize, status = Scope._capi.getResultFile(self.cref) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status))) status = Scope._capi.setResultFile(self.cref, file, bufferSize) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status)))
def addSystem(self, cref: str, type_: Types.System): new_cref = self.cref + '.' + cref status = Scope._capi.addSystem(new_cref, type_.value) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status))) return System.System(new_cref)
def resultFile(self): file, _, status = Scope._capi.getResultFile(self.cref) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status))) return file
def stopTime(self): value, status = Scope._capi.getStopTime(self.cref) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status))) return value
def stopTime(self, value: float): status = Scope._capi.setStopTime(self.cref, value) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status)))
def modelState(self): modelState, status = Scope._capi.getModelState(self.cref) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status))) return Types.ModelState(modelState)
def setLoggingLevel(level: int) -> None: if not isinstance(level, int): raise Exception('bad argument: {}'.format(level)) status = Scope._capi.setLoggingLevel(level) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status)))
def delete(self): status = Scope._capi.delete(self.cref) if Types.Status(status) == Types.Status.OK: Scope._Scope = [cref for cref in Scope._Scope if cref != self.cref] else: raise Exception('error {}'.format(Types.Status(status)))
def initialize(self): status = Scope._capi.initialize(self.cref) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status)))
def addConnection(self, conA: str, conB: str): new_conA = self.cref + '.' + conA new_conB = self.cref + '.' + conB status = Scope._capi.addConnection(new_conA, new_conB) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status)))
def setString(self, cref: str, value: str) -> None: status = Scope._capi.setString(self.cref + '.' + cref, value) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status)))
def addSubModel(self, cref: str, path: str): new_cref = self.cref + '.' + cref status = Scope._capi.addSubModel(new_cref, path) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status))) return SubModel(new_cref)
def type(self): type_, status = Scope._capi.getSystemType(self.cref) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status))) return Types.System(type_)
def setLogFile(path: str, size=None) -> None: status = Scope._capi.setLogFile(path) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status))) if size: setMaxLogFileSize(size)
def fixedStepSize(self): stepSize, status = Scope._capi.getFixedStepSize(self.cref) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status))) return stepSize
def reset(self): status = Scope._capi.reset(self.cref) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status)))
def fixedStepSize(self, stepSize: float): status = Scope._capi.setFixedStepSize(self.cref, stepSize) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status)))
def setWorkingDirectory(dir: str) -> None: status = Scope._capi.setWorkingDirectory(dir) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status)))
def exportDependencyGraphs(self, initialization: str, event: str, simulation: str) -> None: status = Scope._capi.exportDependencyGraphs(self.cref, initialization, event, simulation) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status)))
def setCommandLineOption(cmd: str) -> None: status = Scope._capi.setCommandLineOption(cmd) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status)))
def stepUntil(self, stopTime: float): status = Scope._capi.stepUntil(self.cref, stopTime) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status)))
def exportSSVTemplate(self, ident: str, filename: str) -> None: status = Scope._capi.exportSSVTemplate( self.cref + ('.' + ident if ident else ''), filename) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status)))
def getString(self, cref: str): value, status = Scope._capi.getString(self.cref + '.' + cref) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status))) return value
def setLoggingInterval(self, loggingInterval: float) -> None: status = Scope._capi.setLoggingInterval(self.cref, loggingInterval) if Types.Status(status) != Types.Status.OK: raise Exception('error {}'.format(Types.Status(status)))