Clear Filters
Clear Filters

Causality for FMU in simscape electrical : how to separate an electrical conserving port into 2 physical or simulink signal ports to create an FMU with it.

11 views (last 30 days)
Hi everyone,
I need some help to generate FMUs of electrical systems.
i have just one resistor connected to a capacitor, both from the simscape eletrical toolbox, and i want to create an FMU of it. As FMI doesn't support acausal connections, i need to change the input and output of my system because otherwise the FMU won't be generated. The 2 components are still connected with an electrical "cable" but i need other kind of input and output ports to create the FMU and i don't know how to make them.
In other terms, i just want to create an FMU with a resistor connected to a capacitor just like the picture, and make a FMU of it, to later be able to connect this FMU with other FMU of this kind to create a bigger electrical distribution.
I was able to do this on OpenModelica thanks to this link : Using physical connectors with an FMU - Claytex

Answers (1)

Javier Gazzarri
Javier Gazzarri on 1 Aug 2023
Hello Enzo,
Do you want to create an FMU block for both components connected in series, or one FMU block for each of them?
In general, you can transform acausal connection to inputs and outputs using PS->Simulink converters (and their inverse) and Simscape sources and sensors. Once this is done, you encapsulate the blocks as a subsystem and generate an FMU from it.
Please let me know if this is what you were looking for.
  1 Comment
Enzo SINACOLA on 1 Aug 2023
Hello Javier,
Thank you for your response, it's what i was looking for but i finally managed to create the FMU with the same components that you said thanks to another person of MathWorks Technical Support Department, who told me basically the same.
The system now looks like that :
For the 2 subsystems, i used the ones in the Network Coupler (Voltage-Current) which i modified a little bit.
And it worked perfectly for all the FMU that i generated except when there is a capacitor.
In this case i had to change the Input Handling of the Simulink-PS converter of the voltage from Zero derivatives to Filter input, derivated calculated because otherwise it generate an error :
=== Simulation (Elapsed: 0.426 sec) ===
Error:['FMU_Capacitor']: Not enough input derivatives were provided for one or more Simulink-PS Converter blocks for the solver chosen. Implicit solvers (ode23t, ode15s, and ode14x) typically require fewer input derivatives than explicit solvers, and local solvers never require any.
The following Simulink-PS Converter blocks have continuous inputs. To provide the derivatives required, you can either turn input filtering on or provide the input derivatives explicitly by selecting the corresponding options on the Input Handling tab:
...'FMU_Capacitor/Port 2 Interface/Simulink-PS Converter' (1 required, 0 provided)
And with this changement in the Input Handling i noticed some delays in the simulation, which i don't want.
So i had to lower the Input filtering time constant, and it kind of removes the delays. But I would have preferred to not do any filtering.

Sign in to comment.


Find more on Electrical Sensors in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!