Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concatenate multiple FMUs with NN #139

Closed
awecefil opened this issue Jul 9, 2024 · 1 comment
Closed

Concatenate multiple FMUs with NN #139

awecefil opened this issue Jul 9, 2024 · 1 comment

Comments

@awecefil
Copy link

awecefil commented Jul 9, 2024

Problem Description:

I want to know if FMIFlux can currently chain multiple FMUs and NNs together. For example, I have constructed a circuit system in OpenModelica that includes a voltage source and a resistor. Using OpenModelica, I split this system into three subsystems (voltage source, resistor, and ground), and exported each as an independent FMU. I then tried importing these three subsystem FMUs into OpenModelica and connecting their inputs/outputs for simulation. Unsurprisingly, the simulation results were the same as the original circuit system.
Diagram as follow, from left to right, it sequentially shows the Voltage Source FMU, Resistor FMU, and Ground FMU:
image

Now, I want to know two things:

  1. Is it possible to achieve the same functionality described above in FMIFlux or other FMI packages?
  2. Is it possible in FMIFlux to chain NNs and multiple FMUs together? For example, I want to replace the original linear resistor with an NN and use training data to simulate a nonlinear resistor.

Current Attempts:

I found that FMIFlux currently supports using Parallel to chain multiple FMUs and NNs (via Chain). However, after looking into it in detail, I discovered that the Parallel function allows multiple FMUs to run concurrently and produce results. We can then concatenate the results or perform other operations like summation. However, this is different from sequentially chaining multiple subsystem FMUs as I intend.

If there is any misunderstanding on my part, please correct me. Thank you.

@ThummeTo
Copy link
Owner

Exactly, there are two to different operation modes:

  • "co-simulation" which uses different solvers to solve the models independently of each other and syncs signals after every time step
  • "model integration" which actually combines the two ODE systems (or ME-FMUs) into a single one and then solves the combined system.

As you correctly noticed, the parallel example simulates the FMUs in CS-mode.
From the text, it sounds like you want to do "model-integration", but importing FMUs in OpenModelica and simulate them together sounds like co-simulation to me....

Can you specify:
(a) if you want to operate in CS or ME mode?
(b) if ME: if you want to use the same solver for both FMUs (model integration) or different solvers for every FMU.
(c) do you want to connect states/state derivatives or inputs/outputs

In any case I think there is a solution for your problem, but it is easier to discuss if we further specify.

Best regards!

PS: I convert this to discussion :-)

Repository owner locked and limited conversation to collaborators Jul 11, 2024
@ThummeTo ThummeTo converted this issue into discussion #140 Jul 11, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants