Open moxxensen opened 2 years ago
I'm looking a way to simulate FMU sample by sample, instead of simulating all the way from start to stop time. It looks like high-level fmpy.simulate_fmu(fmu)
does not suppose to support that. Is there a recommended way to do that with fmpy? I assumed that #341 issue is exactly about that and would like to know more about the implementation possibilities or future features.
In order to give more details, here is example of my application: I need to design and implement a regulator, that controls a complex plant. The plant is exported as FMU model with corresponding inputs and outputs. The regulator will be developed in python/scipy first and then will be reimplemented in C++ for an end user application. But it need to be tested in sample-by-sample basis: plant model generates single output, the regulator reads plant's output and generates single sample of control as next plant's input and so on.
@Robotics010, the easiest way to achieve this, is to write a custom simulation loop. You can use custom_input.py as a starting point.
Thanks @t-sommer, I didn't note this example. I'll post here later about the result.
Yey! I've got custom_input.py example adapted to my application. Thanks for a reference.
What @moxxensen did mean more by Add Real Time option
? It looks like sample-by-sample behavior already has been implemented. If so, the issue can be closed. Or there is something need to be developed further among Real-Time support features?
What @moxxensen did mean more by Add Real Time option?
Real Time as in "synchronous with the wall clock time".
Hi @t-sommer , PROBLEM: We cannot produce reliable co-simulation (CS) fmu's from our modelling tool. We can produce ME fmu's. A CS fmu is needed so that we can either:
QUESTION: Since we can produce very reliable simulations by coupling our model-exchange (ME) fmu's to your CVODE solver in FMPy (thank you!!!!), we would like to know if there is any existing way we can export these ME fmu's + CVODE solver as CS fmu's from FMPy? Or are there examples of coupling something like doStep to use an ME fmu?
If NO to both questions, we will try to dig more and see how to create our own CS fmu's, so any clues would be helpful.
Thanks again for your wonderful toolset!
To test FMU's sometimes it is helpful to simulate it in Real Time