Real-time input updates, and compiled model for use in HW in the loop system #2207
Replies: 2 comments 1 reply
-
Sooo, here's what I've learned so far. I can export an executable from the GUI, and hopsan creates a whole build directory complete with build and link scripts. Very nice and clean. Looking at the generated exec_main.cpp, I can see the required setup/run/teardown process of running the model. It seems that I can call There is a mechanism to change parameters between calls to simulate() ( |
Beta Was this translation helpful? Give feedback.
-
This sounds like an interesting project! We have previously used Hopsan for real-time simulation mostly using S-functions exported to Simulink or by exporting Veristand DLLs to LabVIEW. I think you are on the right track, assuming you want to control the simulation directly using C++ functions. If you have some target environment available that supports the FMI standard, you might be able to export an FMU file instead. As you mention, the Reconfiguring components are not necessary. There are one or two special components that e.g. changes the number of ports depending on a parameter value, but I doubt you will be using any of those. Also keep in mind that you can only change input variables, not constants, during simulation. Constants are only read once when starting the simulation, so changing them later will have no effect. |
Beta Was this translation helpful? Give feedback.
-
I want to create a model which will be used as part of hardware in the loop testing. Ideally, I want to create a shared lib of the model which will be linked to, and call something like singleStep(), getSimState(), updateInputs().
I learned that many Simulink Simscape components do not allow for real-time updating of parameters during a simulation if you export the model as C source code. Is there any such limitation in the generated code from Hopsan? Can I modify Signal/Sources on the fly?
Are there examples or tutorials to show how to accomplish this?
Appreciate the help, thanks.
Beta Was this translation helpful? Give feedback.
All reactions