MCPcopy Create free account
hub / github.com/NTNU-IHB/PythonFMU / SetupExperiment

Method SetupExperiment

src/pythonfmu/PySlaveInstance.cpp:227–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225 }
226
227 void SetupExperiment(double startTime, std::optional<double> stop, std::optional<double> tolerance) override
228 {
229 py_safe_run([this, startTime, stop, tolerance](PyGILState_STATE gilState) {
230 PyObject* pyStop = stop ? Py_BuildValue("d", *stop) : (Py_INCREF(Py_None), Py_None);
231 PyObject* pyTol = tolerance ? Py_BuildValue("d", *tolerance) : (Py_INCREF(Py_None), Py_None);
232
233 auto f = PyObject_CallMethod(pInstance_, "setup_experiment", "(dOO)", startTime, pyStop, pyTol);
234
235 Py_DECREF(pyStop);
236 Py_DECREF(pyTol);
237
238 if (f == nullptr) {
239 handle_py_exception("[setupExperiment] PyObject_CallMethod", gilState);
240 }
241 Py_DECREF(f);
242 clearLogBuffer();
243 });
244 }
245
246 void EnterInitializationMode() override
247 {

Callers 1

fmi2SetupExperimentFunction · 0.80

Calls 1

py_safe_runFunction · 0.85

Tested by

no test coverage detected