pythonfmu3 0.3.3__tar.gz → 0.3.4__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.
Files changed (70) hide show
  1. {pythonfmu3-0.3.3/pythonfmu3.egg-info → pythonfmu3-0.3.4}/PKG-INFO +1 -1
  2. pythonfmu3-0.3.4/pythonfmu3/_version.py +1 -0
  3. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/fmi3slave.py +57 -21
  4. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_cs.cpp +20 -10
  5. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_cs.hpp +20 -10
  6. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/pythonfmu-export/src/cppfmu/fmi_functions.cpp +10 -10
  7. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.cpp +40 -29
  8. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.hpp +10 -10
  9. pythonfmu3-0.3.4/pythonfmu3/resources/binaries/x86_64-linux/libpythonfmu-export.so +0 -0
  10. pythonfmu3-0.3.4/pythonfmu3/resources/binaries/x86_64-windows/pythonfmu-export.dll +0 -0
  11. pythonfmu3-0.3.4/pythonfmu3/tests/slaves/pythonslave_arraytypes.py +80 -0
  12. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/test_integration.py +106 -0
  13. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/variables.py +68 -44
  14. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4/pythonfmu3.egg-info}/PKG-INFO +1 -1
  15. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3.egg-info/SOURCES.txt +1 -0
  16. pythonfmu3-0.3.3/pythonfmu3/_version.py +0 -1
  17. pythonfmu3-0.3.3/pythonfmu3/resources/binaries/x86_64-linux/libpythonfmu-export.so +0 -0
  18. pythonfmu3-0.3.3/pythonfmu3/resources/binaries/x86_64-windows/pythonfmu-export.dll +0 -0
  19. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/LICENSE +0 -0
  20. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/MANIFEST.in +0 -0
  21. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/README.md +0 -0
  22. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/__init__.py +0 -0
  23. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/__main__.py +0 -0
  24. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/builder.py +0 -0
  25. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/cosimulation.py +0 -0
  26. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/default_experiment.py +0 -0
  27. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/deploy.py +0 -0
  28. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/enums.py +0 -0
  29. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/logmsg.py +0 -0
  30. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/modelexchange.py +0 -0
  31. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/osutil.py +0 -0
  32. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/pythonfmu-export/.clang-format +0 -0
  33. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/pythonfmu-export/CMakeLists.txt +0 -0
  34. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/pythonfmu-export/build_unix.sh +0 -0
  35. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/pythonfmu-export/build_win.sh +0 -0
  36. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/pythonfmu-export/src/CMakeLists.txt +0 -0
  37. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_common.hpp +0 -0
  38. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/pythonfmu-export/src/fmi/fmi3FunctionTypes.h +0 -0
  39. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/pythonfmu-export/src/fmi/fmi3Functions.h +0 -0
  40. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/pythonfmu-export/src/fmi/fmi3PlatformTypes.h +0 -0
  41. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/pythonfmu-export/src/pythonfmu/IPyState.hpp +0 -0
  42. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/pythonfmu-export/src/pythonfmu/PyState.hpp +0 -0
  43. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/__init__.py +0 -0
  44. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/conftest.py +0 -0
  45. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/data/csvdemo.csv +0 -0
  46. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/data/hello.txt +0 -0
  47. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/slaves/PythonSlaveWithException.py +0 -0
  48. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/slaves/localmodule.py +0 -0
  49. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/slaves/pythonslave.py +0 -0
  50. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/slaves/pythonslaveMX.py +0 -0
  51. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/slaves/pythonslaveMXCS.py +0 -0
  52. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/slaves/pythonslave_read_file.py +0 -0
  53. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/slaves/slavewithdep.py +0 -0
  54. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/test_builder.py +0 -0
  55. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/test_deploy.py +0 -0
  56. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/test_docs.py +0 -0
  57. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/test_fmi3slave.py +0 -0
  58. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/test_logger.py +0 -0
  59. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/test_multiple_fmus.py +0 -0
  60. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/test_variables.py +0 -0
  61. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/tests/utils.py +0 -0
  62. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/unit.py +0 -0
  63. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3/variable_types.py +0 -0
  64. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3.egg-info/dependency_links.txt +0 -0
  65. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3.egg-info/entry_points.txt +0 -0
  66. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3.egg-info/not-zip-safe +0 -0
  67. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3.egg-info/requires.txt +0 -0
  68. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/pythonfmu3.egg-info/top_level.txt +0 -0
  69. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/setup.cfg +0 -0
  70. {pythonfmu3-0.3.3 → pythonfmu3-0.3.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pythonfmu3
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: A lightweight framework that enables the packaging of Python3.x code as co-simulation FMUs.
5
5
  Home-page: https://github.com/stephensmith25/PythonFMU3
6
6
  Author: Stephen Smith
@@ -0,0 +1 @@
1
+ __version__ = "0.3.4"
@@ -183,8 +183,7 @@ class Fmi3SlaveBase(object):
183
183
  initial_unknown = list(
184
184
  filter(lambda v: (v.causality == Fmi3Causality.output and (v.initial in allowed_variability))
185
185
  or v.causality == Fmi3Causality.calculatedParameter
186
- or v in continuous_state_derivatives and v.initial in allowed_variability
187
- or v.variability == Fmi3Variability.continuous and v.initial in allowed_variability and v.causality != Fmi3Causality.independent, self.vars.values())
186
+ or v in continuous_state_derivatives and v.initial in allowed_variability, self.vars.values())
188
187
  )
189
188
 
190
189
  for v in outputs:
@@ -282,10 +281,13 @@ class Fmi3SlaveBase(object):
282
281
  for vr in vrs:
283
282
  var = self.vars[vr]
284
283
  if isinstance(var, Int32):
285
- refs.append(int(var.getter()))
284
+ if len(var.dimensions) == 0:
285
+ refs.append(int(var.getter()))
286
+ else:
287
+ refs.extend(map(int, var.getter()))
286
288
  else:
287
289
  raise TypeError(
288
- f"Variable with valueReference={vr} is not of type Integer!"
290
+ f"Variable with valueReference={vr} is not of type Int32!"
289
291
  )
290
292
  return refs
291
293
 
@@ -294,7 +296,10 @@ class Fmi3SlaveBase(object):
294
296
  for vr in vrs:
295
297
  var = self.vars[vr]
296
298
  if isinstance(var, (Enumeration, Int64)):
297
- refs.append(int(var.getter()))
299
+ if len(var.dimensions) == 0:
300
+ refs.append(int(var.getter()))
301
+ else:
302
+ refs.extend(map(int, var.getter()))
298
303
  else:
299
304
  raise TypeError(
300
305
  f"Variable with valueReference={vr} is not of type Int64!"
@@ -306,11 +311,14 @@ class Fmi3SlaveBase(object):
306
311
  for vr in vrs:
307
312
  var = self.vars[vr]
308
313
  if isinstance(var, UInt64):
309
- val = var.getter()
310
- refs.append(val if isinstance(val, ctypes.c_uint64) else ctypes.c_uint64(val))
314
+ if len(var.dimensions) == 0:
315
+ val = var.getter()
316
+ refs.append(ctypes.c_uint64(val) if not isinstance(val, ctypes.c_uint64) else val)
317
+ else:
318
+ refs.extend(map(ctypes.c_uint64, var.getter()))
311
319
  else:
312
320
  raise TypeError(
313
- f"Variable with valueReference={vr} is not of type UInt64!"
321
+ f"Variable with valueReference={vr} is not of type Uint64!"
314
322
  )
315
323
  return refs
316
324
 
@@ -325,7 +333,7 @@ class Fmi3SlaveBase(object):
325
333
  refs.extend(var.getter())
326
334
  else:
327
335
  raise TypeError(
328
- f"Variable with valueReference={vr} is not of type Real!"
336
+ f"Variable with valueReference={vr} is not of type Float64!"
329
337
  )
330
338
  return refs
331
339
 
@@ -334,7 +342,11 @@ class Fmi3SlaveBase(object):
334
342
  for vr in vrs:
335
343
  var = self.vars[vr]
336
344
  if isinstance(var, Boolean):
337
- refs.append(bool(var.getter()))
345
+ if len(var.dimensions) == 0:
346
+ refs.append(bool(var.getter()))
347
+ else:
348
+ refs.extend(var.getter())
349
+
338
350
  else:
339
351
  raise TypeError(
340
352
  f"Variable with valueReference={vr} is not of type Boolean!"
@@ -354,30 +366,48 @@ class Fmi3SlaveBase(object):
354
366
  return refs
355
367
 
356
368
  def set_int32(self, vrs: List[int], values: List[int]):
357
- for vr, value in zip(vrs, values):
369
+ offset = 0
370
+ for vr in vrs:
358
371
  var = self.vars[vr]
359
372
  if isinstance(var, Int32):
360
- var.setter(value)
373
+ size = var.size(self.vars)
374
+ if size > 1:
375
+ var.setter(values[offset:offset+size])
376
+ else:
377
+ var.setter(values[offset])
378
+ offset += size
361
379
  else:
362
380
  raise TypeError(
363
- f"Variable with valueReference={vr} is not of type Integer!"
381
+ f"Variable with valueReference={vr} is not of type Int32!"
364
382
  )
365
383
 
366
384
  def set_int64(self, vrs: List[int], values: List[int]):
367
- for vr, value in zip(vrs, values):
385
+ offset = 0
386
+ for vr in vrs:
368
387
  var = self.vars[vr]
369
388
  if isinstance(var, (Enumeration, Int64)):
370
- var.setter(value)
389
+ size = var.size(self.vars)
390
+ if size > 1:
391
+ var.setter(values[offset:offset+size])
392
+ else:
393
+ var.setter(values[offset])
394
+ offset += size
371
395
  else:
372
396
  raise TypeError(
373
- f"Variable with valueReference={vr} is not of type Integer!"
397
+ f"Variable with valueReference={vr} is not of type Int64!"
374
398
  )
375
399
 
376
400
  def set_uint64(self, vrs: List[int], values: List[int]):
377
- for vr, value in zip(vrs, values):
401
+ offset = 0
402
+ for vr in vrs:
378
403
  var = self.vars[vr]
379
404
  if isinstance(var, UInt64):
380
- var.setter(value)
405
+ size = var.size(self.vars)
406
+ if size > 1:
407
+ var.setter(values[offset:offset+size])
408
+ else:
409
+ var.setter(values[offset])
410
+ offset += size
381
411
  else:
382
412
  raise TypeError(
383
413
  f"Variable with valueReference={vr} is not of type UInt64!"
@@ -396,14 +426,20 @@ class Fmi3SlaveBase(object):
396
426
  offset += size
397
427
  else:
398
428
  raise TypeError(
399
- f"Variable with valueReference={vr} is not of type Real!"
429
+ f"Variable with valueReference={vr} is not of type Float64!"
400
430
  )
401
431
 
402
432
  def set_boolean(self, vrs: List[int], values: List[bool]):
403
- for vr, value in zip(vrs, values):
433
+ offset = 0
434
+ for vr in vrs:
404
435
  var = self.vars[vr]
405
436
  if isinstance(var, Boolean):
406
- var.setter(value)
437
+ size = var.size(self.vars)
438
+ if size > 1:
439
+ var.setter(values[offset:offset+size])
440
+ else:
441
+ var.setter(values[offset])
442
+ offset += size
407
443
  else:
408
444
  raise TypeError(
409
445
  f"Variable with valueReference={vr} is not of type Boolean!"
@@ -66,7 +66,8 @@ void SlaveInstance::SetFloat64(
66
66
  void SlaveInstance::SetInt32(
67
67
  const FMIValueReference /*vr*/[],
68
68
  std::size_t nvr,
69
- const FMIInt32 /*value*/[])
69
+ const FMIInt32 /*value*/[],
70
+ std::size_t nValues)
70
71
  {
71
72
  if (nvr != 0) {
72
73
  throw std::logic_error("Attempted to set nonexistent variable");
@@ -76,7 +77,8 @@ void SlaveInstance::SetInt32(
76
77
  void SlaveInstance::SetInt64(
77
78
  const FMIValueReference /*vr*/[],
78
79
  std::size_t nvr,
79
- const FMIInt64 /*value*/[])
80
+ const FMIInt64 /*value*/[],
81
+ std::size_t nValues)
80
82
  {
81
83
  if (nvr != 0) {
82
84
  throw std::logic_error("Attempted to set nonexistent variable");
@@ -86,7 +88,8 @@ void SlaveInstance::SetInt64(
86
88
  void SlaveInstance::SetUInt64(
87
89
  const FMIValueReference /*vr*/[],
88
90
  std::size_t nvr,
89
- const FMIUInt64 /*value*/[])
91
+ const FMIUInt64 /*value*/[],
92
+ std::size_t nValues)
90
93
  {
91
94
  if (nvr != 0) {
92
95
  throw std::logic_error("Attempted to set nonexistent variable");
@@ -97,7 +100,8 @@ void SlaveInstance::SetUInt64(
97
100
  void SlaveInstance::SetBoolean(
98
101
  const FMIValueReference /*vr*/[],
99
102
  std::size_t nvr,
100
- const FMIBoolean /*value*/[])
103
+ const FMIBoolean /*value*/[],
104
+ std::size_t nValues)
101
105
  {
102
106
  if (nvr != 0) {
103
107
  throw std::logic_error("Attempted to set nonexistent variable");
@@ -108,7 +112,8 @@ void SlaveInstance::SetBoolean(
108
112
  void SlaveInstance::SetString(
109
113
  const FMIValueReference /*vr*/[],
110
114
  std::size_t nvr,
111
- const FMIString /*value*/[])
115
+ const FMIString /*value*/[],
116
+ std::size_t nValues)
112
117
  {
113
118
  if (nvr != 0) {
114
119
  throw std::logic_error("Attempted to set nonexistent variable");
@@ -131,7 +136,8 @@ void SlaveInstance::GetFloat64(
131
136
  void SlaveInstance::GetInt32(
132
137
  const FMIValueReference /*vr*/[],
133
138
  std::size_t nvr,
134
- FMIInt32 /*value*/[]) const
139
+ FMIInt32 /*value*/[],
140
+ std::size_t nValues) const
135
141
  {
136
142
  if (nvr != 0) {
137
143
  throw std::logic_error("Attempted to get nonexistent variable");
@@ -142,7 +148,8 @@ void SlaveInstance::GetInt32(
142
148
  void SlaveInstance::GetInt64(
143
149
  const FMIValueReference /*vr*/[],
144
150
  std::size_t nvr,
145
- FMIInt64 /*value*/[]) const
151
+ FMIInt64 /*value*/[],
152
+ std::size_t nValues) const
146
153
  {
147
154
  if (nvr != 0) {
148
155
  throw std::logic_error("Attempted to get nonexistent variable");
@@ -153,7 +160,8 @@ void SlaveInstance::GetInt64(
153
160
  void SlaveInstance::GetUInt64(
154
161
  const FMIValueReference /*vr*/[],
155
162
  std::size_t nvr,
156
- FMIUInt64 /*value*/[]) const
163
+ FMIUInt64 /*value*/[],
164
+ std::size_t nValues) const
157
165
  {
158
166
  if (nvr != 0) {
159
167
  throw std::logic_error("Attempted to get nonexistent variable");
@@ -164,7 +172,8 @@ void SlaveInstance::GetUInt64(
164
172
  void SlaveInstance::GetBoolean(
165
173
  const FMIValueReference /*vr*/[],
166
174
  std::size_t nvr,
167
- FMIBoolean /*value*/[]) const
175
+ FMIBoolean /*value*/[],
176
+ std::size_t nValues) const
168
177
  {
169
178
  if (nvr != 0) {
170
179
  throw std::logic_error("Attempted to set nonexistent variable");
@@ -175,7 +184,8 @@ void SlaveInstance::GetBoolean(
175
184
  void SlaveInstance::GetString(
176
185
  const FMIValueReference /*vr*/[],
177
186
  std::size_t nvr,
178
- FMIString /*value*/[]) const
187
+ FMIString /*value*/[],
188
+ std::size_t nValues) const
179
189
  {
180
190
  if (nvr != 0) {
181
191
  throw std::logic_error("Attempted to set nonexistent variable");
@@ -76,23 +76,28 @@ public:
76
76
  virtual void SetInt32(
77
77
  const FMIValueReference vr[],
78
78
  std::size_t nvr,
79
- const FMIInt32 value[]);
79
+ const FMIInt32 value[],
80
+ std::size_t nValues);
80
81
  virtual void SetInt64(
81
82
  const FMIValueReference vr[],
82
83
  std::size_t nvr,
83
- const FMIInt64 value[]);
84
+ const FMIInt64 value[],
85
+ std::size_t nValues);
84
86
  virtual void SetUInt64(
85
87
  const FMIValueReference vr[],
86
88
  std::size_t nvr,
87
- const FMIUInt64 value[]);
89
+ const FMIUInt64 value[],
90
+ std::size_t nValues);
88
91
  virtual void SetBoolean(
89
92
  const FMIValueReference vr[],
90
93
  std::size_t nvr,
91
- const FMIBoolean value[]);
94
+ const FMIBoolean value[],
95
+ std::size_t nValues);
92
96
  virtual void SetString(
93
97
  const FMIValueReference vr[],
94
98
  std::size_t nvr,
95
- const FMIString value[]);
99
+ const FMIString value[],
100
+ std::size_t nValues);
96
101
 
97
102
  /* Called from fmi3GetXxx()/fmiGetXxx().
98
103
  * Throws std::logic_error by default.
@@ -105,23 +110,28 @@ public:
105
110
  virtual void GetInt32(
106
111
  const FMIValueReference vr[],
107
112
  std::size_t nvr,
108
- FMIInt32 value[]) const;
113
+ FMIInt32 value[],
114
+ std::size_t nValues) const;
109
115
  virtual void GetInt64(
110
116
  const FMIValueReference vr[],
111
117
  std::size_t nvr,
112
- FMIInt64 value[]) const;
118
+ FMIInt64 value[],
119
+ std::size_t nValues) const;
113
120
  virtual void GetUInt64(
114
121
  const FMIValueReference vr[],
115
122
  std::size_t nvr,
116
- FMIUInt64 value[]) const;
123
+ FMIUInt64 value[],
124
+ std::size_t nValues) const;
117
125
  virtual void GetBoolean(
118
126
  const FMIValueReference vr[],
119
127
  std::size_t nvr,
120
- FMIBoolean value[]) const;
128
+ FMIBoolean value[],
129
+ std::size_t nValues) const;
121
130
  virtual void GetString(
122
131
  const FMIValueReference vr[],
123
132
  std::size_t nvr,
124
- FMIString value[]) const;
133
+ FMIString value[],
134
+ std::size_t nValues) const;
125
135
 
126
136
  // Called from fmi3DoStep()/fmiDoStep(). Must be implemented in model code.
127
137
  virtual FMIStatus DoStep(
@@ -334,7 +334,7 @@ fmi3Status fmi3GetInt32(
334
334
  {
335
335
  const auto component = reinterpret_cast<Component*>(c);
336
336
  try {
337
- component->slave->GetInt32(vr, nvr, values);
337
+ component->slave->GetInt32(vr, nvr, values, nValues);
338
338
  return fmi3OK;
339
339
  } catch (const cppfmu::FatalError& e) {
340
340
  component->logger.Log(fmi3Fatal, "", e.what());
@@ -354,7 +354,7 @@ fmi3Status fmi3GetInt64(
354
354
  {
355
355
  const auto component = reinterpret_cast<Component*>(c);
356
356
  try {
357
- component->slave->GetInt64(vr, nvr, values);
357
+ component->slave->GetInt64(vr, nvr, values, nValues);
358
358
  return fmi3OK;
359
359
  } catch (const cppfmu::FatalError& e) {
360
360
  component->logger.Log(fmi3Fatal, "", e.what());
@@ -374,7 +374,7 @@ fmi3Status fmi3GetUInt64(
374
374
  {
375
375
  const auto component = reinterpret_cast<Component*>(c);
376
376
  try {
377
- component->slave->GetUInt64(vr, nvr, values);
377
+ component->slave->GetUInt64(vr, nvr, values, nValues);
378
378
  return fmi3OK;
379
379
  } catch (const cppfmu::FatalError& e) {
380
380
  component->logger.Log(fmi3Fatal, "", e.what());
@@ -394,7 +394,7 @@ fmi3Status fmi3GetBoolean(
394
394
  {
395
395
  const auto component = reinterpret_cast<Component*>(c);
396
396
  try {
397
- component->slave->GetBoolean(vr, nvr, values);
397
+ component->slave->GetBoolean(vr, nvr, values, nValues);
398
398
  return fmi3OK;
399
399
  } catch (const cppfmu::FatalError& e) {
400
400
  component->logger.Log(fmi3Fatal, "", e.what());
@@ -414,7 +414,7 @@ fmi3Status fmi3GetString(
414
414
  {
415
415
  const auto component = reinterpret_cast<Component*>(c);
416
416
  try {
417
- component->slave->GetString(vr, nvr, values);
417
+ component->slave->GetString(vr, nvr, values, nValues);
418
418
  return fmi3OK;
419
419
  } catch (const cppfmu::FatalError& e) {
420
420
  component->logger.Log(fmi3Fatal, "", e.what());
@@ -455,7 +455,7 @@ fmi3Status fmi3SetInt32(
455
455
  {
456
456
  const auto component = reinterpret_cast<Component*>(c);
457
457
  try {
458
- component->slave->SetInt32(vr, nvr, values);
458
+ component->slave->SetInt32(vr, nvr, values, nValues);
459
459
  return fmi3OK;
460
460
  } catch (const cppfmu::FatalError& e) {
461
461
  component->logger.Log(fmi3Fatal, "", e.what());
@@ -475,7 +475,7 @@ fmi3Status fmi3SetInt64(
475
475
  {
476
476
  const auto component = reinterpret_cast<Component*>(c);
477
477
  try {
478
- component->slave->SetInt64(vr, nvr, values);
478
+ component->slave->SetInt64(vr, nvr, values, nValues);
479
479
  return fmi3OK;
480
480
  } catch (const cppfmu::FatalError& e) {
481
481
  component->logger.Log(fmi3Fatal, "", e.what());
@@ -495,7 +495,7 @@ fmi3Status fmi3SetUInt64(
495
495
  {
496
496
  const auto component = reinterpret_cast<Component*>(c);
497
497
  try {
498
- component->slave->SetUInt64(vr, nvr, values);
498
+ component->slave->SetUInt64(vr, nvr, values, nValues);
499
499
  return fmi3OK;
500
500
  } catch (const cppfmu::FatalError& e) {
501
501
  component->logger.Log(fmi3Fatal, "", e.what());
@@ -515,7 +515,7 @@ fmi3Status fmi3SetBoolean(
515
515
  {
516
516
  const auto component = reinterpret_cast<Component*>(c);
517
517
  try {
518
- component->slave->SetBoolean(vr, nvr, values);
518
+ component->slave->SetBoolean(vr, nvr, values, nValues);
519
519
  return fmi3OK;
520
520
  } catch (const cppfmu::FatalError& e) {
521
521
  component->logger.Log(fmi3Fatal, "", e.what());
@@ -535,7 +535,7 @@ fmi3Status fmi3SetString(
535
535
  {
536
536
  const auto component = reinterpret_cast<Component*>(c);
537
537
  try {
538
- component->slave->SetString(vr, nvr, values);
538
+ component->slave->SetString(vr, nvr, values, nValues);
539
539
  return fmi3OK;
540
540
  } catch (const cppfmu::FatalError& e) {
541
541
  component->logger.Log(fmi3Fatal, "", e.what());
@@ -285,13 +285,16 @@ void PySlaveInstance::SetFloat64(const cppfmu::FMIValueReference* vr, std::size_
285
285
  });
286
286
  }
287
287
 
288
- void PySlaveInstance::SetInt32(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIInt32* values)
288
+ void PySlaveInstance::SetInt32(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIInt32* values, std::size_t nValues)
289
289
  {
290
- py_safe_run([this, &vr, nvr, &values](PyGILState_STATE gilState) {
290
+ py_safe_run([this, &vr, nvr, &values, nValues](PyGILState_STATE gilState) {
291
291
  PyObject* vrs = PyList_New(nvr);
292
- PyObject* refs = PyList_New(nvr);
292
+ PyObject* refs = PyList_New(nValues);
293
293
  for (int i = 0; i < nvr; i++) {
294
294
  PyList_SetItem(vrs, i, Py_BuildValue("i", vr[i]));
295
+ }
296
+
297
+ for (int i = 0; i < nValues; i++) {
295
298
  PyList_SetItem(refs, i, Py_BuildValue("i", values[i]));
296
299
  }
297
300
 
@@ -306,13 +309,15 @@ void PySlaveInstance::SetInt32(const cppfmu::FMIValueReference* vr, std::size_t
306
309
  });
307
310
  }
308
311
 
309
- void PySlaveInstance::SetInt64(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIInt64* values)
312
+ void PySlaveInstance::SetInt64(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIInt64* values, std::size_t nValues)
310
313
  {
311
- py_safe_run([this, &vr, nvr, &values](PyGILState_STATE gilState) {
314
+ py_safe_run([this, &vr, nvr, &values, nValues](PyGILState_STATE gilState) {
312
315
  PyObject* vrs = PyList_New(nvr);
313
- PyObject* refs = PyList_New(nvr);
316
+ PyObject* refs = PyList_New(nValues);
314
317
  for (int i = 0; i < nvr; i++) {
315
318
  PyList_SetItem(vrs, i, Py_BuildValue("i", vr[i]));
319
+ }
320
+ for (int i = 0; i < nValues; i++) {
316
321
  PyList_SetItem(refs, i, Py_BuildValue("L", values[i]));
317
322
  }
318
323
 
@@ -327,13 +332,15 @@ void PySlaveInstance::SetInt64(const cppfmu::FMIValueReference* vr, std::size_t
327
332
  });
328
333
  }
329
334
 
330
- void PySlaveInstance::SetUInt64(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIUInt64* values)
335
+ void PySlaveInstance::SetUInt64(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIUInt64* values, std::size_t nValues)
331
336
  {
332
- py_safe_run([this, &vr, nvr, &values](PyGILState_STATE gilState) {
337
+ py_safe_run([this, &vr, nvr, &values, nValues](PyGILState_STATE gilState) {
333
338
  PyObject* vrs = PyList_New(nvr);
334
- PyObject* refs = PyList_New(nvr);
339
+ PyObject* refs = PyList_New(nValues);
335
340
  for (int i = 0; i < nvr; i++) {
336
341
  PyList_SetItem(vrs, i, Py_BuildValue("i", vr[i]));
342
+ }
343
+ for (int i = 0; i < nValues; i++) {
337
344
  PyList_SetItem(refs, i, Py_BuildValue("K", values[i]));
338
345
  }
339
346
 
@@ -348,13 +355,15 @@ void PySlaveInstance::SetUInt64(const cppfmu::FMIValueReference* vr, std::size_t
348
355
  });
349
356
  }
350
357
 
351
- void PySlaveInstance::SetBoolean(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIBoolean* values)
358
+ void PySlaveInstance::SetBoolean(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIBoolean* values, std::size_t nValues)
352
359
  {
353
- py_safe_run([this, &vr, nvr, &values](PyGILState_STATE gilState) {
360
+ py_safe_run([this, &vr, nvr, &values, nValues](PyGILState_STATE gilState) {
354
361
  PyObject* vrs = PyList_New(nvr);
355
- PyObject* refs = PyList_New(nvr);
362
+ PyObject* refs = PyList_New(nValues);
356
363
  for (int i = 0; i < nvr; i++) {
357
364
  PyList_SetItem(vrs, i, Py_BuildValue("i", vr[i]));
365
+ }
366
+ for (int i = 0; i < nValues; i++) {
358
367
  PyList_SetItem(refs, i, PyBool_FromLong(values[i]));
359
368
  }
360
369
 
@@ -369,13 +378,15 @@ void PySlaveInstance::SetBoolean(const cppfmu::FMIValueReference* vr, std::size_
369
378
  });
370
379
  }
371
380
 
372
- void PySlaveInstance::SetString(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIString const* values)
381
+ void PySlaveInstance::SetString(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIString const* values, std::size_t nValues)
373
382
  {
374
- py_safe_run([this, &vr, nvr, &values](PyGILState_STATE gilState) {
383
+ py_safe_run([this, &vr, nvr, &values, nValues](PyGILState_STATE gilState) {
375
384
  PyObject* vrs = PyList_New(nvr);
376
385
  PyObject* refs = PyList_New(nvr);
377
386
  for (int i = 0; i < nvr; i++) {
378
387
  PyList_SetItem(vrs, i, Py_BuildValue("i", vr[i]));
388
+ }
389
+ for (int i = 0; i < nValues; i++) {
379
390
  PyList_SetItem(refs, i, Py_BuildValue("s", values[i]));
380
391
  }
381
392
 
@@ -413,9 +424,9 @@ void PySlaveInstance::GetFloat64(const cppfmu::FMIValueReference* vr, std::size_
413
424
  });
414
425
  }
415
426
 
416
- void PySlaveInstance::GetInt32(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIInt32* values) const
427
+ void PySlaveInstance::GetInt32(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIInt32* values, std::size_t nValues) const
417
428
  {
418
- py_safe_run([this, &vr, nvr, &values](PyGILState_STATE gilState) {
429
+ py_safe_run([this, &vr, nvr, &values, nValues](PyGILState_STATE gilState) {
419
430
  PyObject* vrs = PyList_New(nvr);
420
431
  for (int i = 0; i < nvr; i++) {
421
432
  PyList_SetItem(vrs, i, Py_BuildValue("i", vr[i]));
@@ -426,7 +437,7 @@ void PySlaveInstance::GetInt32(const cppfmu::FMIValueReference* vr, std::size_t
426
437
  handle_py_exception("[getInt32] PyObject_CallMethod", gilState);
427
438
  }
428
439
 
429
- for (int i = 0; i < nvr; i++) {
440
+ for (int i = 0; i < nValues; i++) {
430
441
  PyObject* value = PyList_GetItem(refs, i);
431
442
  values[i] = static_cast<cppfmu::FMIInt32>(PyLong_AsLong(value));
432
443
  }
@@ -435,9 +446,9 @@ void PySlaveInstance::GetInt32(const cppfmu::FMIValueReference* vr, std::size_t
435
446
  });
436
447
  }
437
448
 
438
- void PySlaveInstance::GetInt64(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIInt64* values) const
449
+ void PySlaveInstance::GetInt64(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIInt64* values, std::size_t nValues) const
439
450
  {
440
- py_safe_run([this, &vr, nvr, &values](PyGILState_STATE gilState) {
451
+ py_safe_run([this, &vr, nvr, &values, nValues](PyGILState_STATE gilState) {
441
452
  PyObject* vrs = PyList_New(nvr);
442
453
  for (int i = 0; i < nvr; i++) {
443
454
  PyList_SetItem(vrs, i, Py_BuildValue("i", vr[i]));
@@ -448,7 +459,7 @@ void PySlaveInstance::GetInt64(const cppfmu::FMIValueReference* vr, std::size_t
448
459
  handle_py_exception("[getInt64] PyObject_CallMethod", gilState);
449
460
  }
450
461
 
451
- for (int i = 0; i < nvr; i++) {
462
+ for (int i = 0; i < nValues; i++) {
452
463
  PyObject* value = PyList_GetItem(refs, i);
453
464
  values[i] = static_cast<cppfmu::FMIInt64>(PyLong_AsLongLong(value));
454
465
  }
@@ -457,9 +468,9 @@ void PySlaveInstance::GetInt64(const cppfmu::FMIValueReference* vr, std::size_t
457
468
  });
458
469
  }
459
470
 
460
- void PySlaveInstance::GetUInt64(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIUInt64* values) const
471
+ void PySlaveInstance::GetUInt64(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIUInt64* values, std::size_t nValues) const
461
472
  {
462
- py_safe_run([this, &vr, nvr, &values](PyGILState_STATE gilState) {
473
+ py_safe_run([this, &vr, nvr, &values, nValues](PyGILState_STATE gilState) {
463
474
  PyObject* vrs = PyList_New(nvr);
464
475
  for (int i = 0; i < nvr; i++) {
465
476
  PyList_SetItem(vrs, i, Py_BuildValue("i", vr[i]));
@@ -470,7 +481,7 @@ void PySlaveInstance::GetUInt64(const cppfmu::FMIValueReference* vr, std::size_t
470
481
  handle_py_exception("[getUInt64] PyObject_CallMethod", gilState);
471
482
  }
472
483
 
473
- for (int i = 0; i < nvr; i++) {
484
+ for (int i = 0; i < nValues; i++) {
474
485
  PyObject* item = PyList_GetItem(refs, i);
475
486
  PyObject* value = PyObject_GetAttrString(item, "value");
476
487
  if (value && PyLong_Check(value))
@@ -484,9 +495,9 @@ void PySlaveInstance::GetUInt64(const cppfmu::FMIValueReference* vr, std::size_t
484
495
  });
485
496
  }
486
497
 
487
- void PySlaveInstance::GetBoolean(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIBoolean* values) const
498
+ void PySlaveInstance::GetBoolean(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIBoolean* values, std::size_t nValues) const
488
499
  {
489
- py_safe_run([this, &vr, nvr, &values](PyGILState_STATE gilState) {
500
+ py_safe_run([this, &vr, nvr, &values, nValues](PyGILState_STATE gilState) {
490
501
  PyObject* vrs = PyList_New(nvr);
491
502
  for (int i = 0; i < nvr; i++) {
492
503
  PyList_SetItem(vrs, i, Py_BuildValue("i", vr[i]));
@@ -497,7 +508,7 @@ void PySlaveInstance::GetBoolean(const cppfmu::FMIValueReference* vr, std::size_
497
508
  handle_py_exception("[getBoolean] PyObject_CallMethod", gilState);
498
509
  }
499
510
 
500
- for (int i = 0; i < nvr; i++) {
511
+ for (int i = 0; i < nValues; i++) {
501
512
  PyObject* value = PyList_GetItem(refs, i);
502
513
  values[i] = PyObject_IsTrue(value);
503
514
  }
@@ -506,9 +517,9 @@ void PySlaveInstance::GetBoolean(const cppfmu::FMIValueReference* vr, std::size_
506
517
  });
507
518
  }
508
519
 
509
- void PySlaveInstance::GetString(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIString* values) const
520
+ void PySlaveInstance::GetString(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIString* values, std::size_t nValues) const
510
521
  {
511
- py_safe_run([this, &vr, nvr, &values](PyGILState_STATE gilState) {
522
+ py_safe_run([this, &vr, nvr, &values, nValues](PyGILState_STATE gilState) {
512
523
  clearStrBuffer();
513
524
  PyObject* vrs = PyList_New(nvr);
514
525
  for (int i = 0; i < nvr; i++) {
@@ -520,7 +531,7 @@ void PySlaveInstance::GetString(const cppfmu::FMIValueReference* vr, std::size_t
520
531
  handle_py_exception("[getString] PyObject_CallMethod", gilState);
521
532
  }
522
533
 
523
- for (int i = 0; i < nvr; i++) {
534
+ for (int i = 0; i < nValues; i++) {
524
535
  PyObject* value = PyUnicode_AsEncodedString(PyList_GetItem(refs, i), "utf-8", nullptr);
525
536
  values[i] = PyBytes_AsString(value);
526
537
  strBuffer.emplace_back(value);
@@ -34,18 +34,18 @@ public:
34
34
  cppfmu::FMIFloat64& endOfStep) override;
35
35
 
36
36
  void SetFloat64(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIFloat64* value, std::size_t nValues) override;
37
- void SetInt32(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIInt32* value) override;
38
- void SetInt64(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIInt64* value) override;
39
- void SetUInt64(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIUInt64* value) override;
40
- void SetBoolean(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIBoolean* value) override;
41
- void SetString(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIString const* value) override;
37
+ void SetInt32(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIInt32* value, std::size_t nValues) override;
38
+ void SetInt64(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIInt64* value, std::size_t nValues) override;
39
+ void SetUInt64(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIUInt64* value, std::size_t nValues) override;
40
+ void SetBoolean(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIBoolean* value, std::size_t nValues) override;
41
+ void SetString(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIString const* value, std::size_t nValues) override;
42
42
 
43
43
  void GetFloat64(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIFloat64* value, std::size_t nValues) const override;
44
- void GetInt32(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIInt32* value) const override;
45
- void GetInt64(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIInt64* value) const override;
46
- void GetUInt64(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIUInt64* value) const override;
47
- void GetBoolean(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIBoolean* value) const override;
48
- void GetString(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIString* value) const override;
44
+ void GetInt32(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIInt32* value, std::size_t nValues) const override;
45
+ void GetInt64(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIInt64* value, std::size_t nValues) const override;
46
+ void GetUInt64(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIUInt64* value, std::size_t nValues) const override;
47
+ void GetBoolean(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIBoolean* value, std::size_t nValues) const override;
48
+ void GetString(const cppfmu::FMIValueReference* vr, std::size_t nvr, cppfmu::FMIString* value, std::size_t nValues) const override;
49
49
 
50
50
  void GetFMUstate(fmi3FMUState& State) override;
51
51
  void SetFMUstate(const fmi3FMUState& State) override;