0

I'm using FMPy to simulate some FMUs which have String output variables, yet these are not available in the simulation results (object returned by simulate_fmu(filename)).

Are these variables handled in a different way? If so, how can I access them?

Thank you.

Edit 1:

I runned a simulation using values.fmu which has a String output variable (string_out).

Minimal example:

import fmpy
# fmu path
fmu_name = "C:\\fmusdk\\fmu20\\fmu\\cs\\x64\\values.fmu"
# Simulate
res = fmpy.simulate_fmu(fmu_name, stop_time=2., debug_logging=False)
# Results
print('Results names and types: ' + str(res.dtype))

Note: to run the example you have to download and install fmusdk, which requires one of Microsoft Visual Studio 2005 (VS8), 2008 (VS9), 2010 (VS10), 2012 (VS11), 2013 (VS12) or 2015 (VS14).

Output:

Results names and types: [('time', '<f8'), ('int_out', '<i4'), ('bool_out', '?')]

Expected:

I expected that res contained the output variable string_out.

Using debug_logging:

I realised that fmi2GetString is never called, so it wouldn't be possible for the output to have the values of string_out. Because of this I'm not sure if FMPy supports TypeDefinitions String or not.

System details:

Python version: 3.7.3

FMPy version: 0.2.10

diasdm
  • 35
  • 5
  • Welcome to SO, What have you tried to achieve your wanted results? What has your research concerning your problem shown? Can you provide code of your tries? Please provide a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) wherever required. Also please take the time to read [How to Ask](https://stackoverflow.com/questions/how-to-ask) – Pratibha Apr 03 '19 at 14:13
  • I have updated my question with the results I obtained so far – diasdm Apr 03 '19 at 16:32

1 Answers1

1

Strings are only supported as parameters (as of FMPy 0.2.10). If you need Strings as input or output you can build a custom simulation loop and use the fmu.setString() and fmu.getString() functions directly.

You can use the custom_input.py example as a starting point.

Torsten Sommer
  • 308
  • 1
  • 4