You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm using dymola-generated FMU for MPC work. I used PyFMI package's function to load the FMU and operate it.
Now my model is based on Modelica Buildings Library 9.0.0 and I found the issues shown below.
Describe the bug
I exported my system model based on MBL 9.0.0 to a co-simulation FMU for model predictive control.
There is only one integer input for the system mode (1,2 or 3).
I divided the simulation period into two parts (t1-t2, t2-t3) with different signals.
When my input signal ('Mode') was changed from 1 to 2 or 2 to 3, the results showed the system didn't have the correct reflection I wanted.
The input 'Mode' is directly connected with one variable called 'TES'.
During the first time range from t1 to t2, the 'TES' is equal to input 'Mode'.
However, during the second time range from t2 to t3, the 'TES' is still the old value even though the input 'Mode' has been changed from 1 to 2 or 2 to 3 (this issue is shown in Figure 1).
The system didn't work correctly during the second time range either, which is very weird.
I tried different IDEs, Spyder or Pycharm, and Dymola versions, 2021, 2021X, and 2023. This issue still exists.
I also tried one example model (Buildings.Fluid.Storage.Examples.Stratified) in MBL 9.0.0, but the issue also exists.
And another strange stuff is that sometimes the 'TES' could follow the 'Mode', but some variables will restart from their initial guess (this issue is shown in Figure 2).
Expected behavior
Issue 1:
Throughout the simulation period, the variables in the system model should be influenced by the inputs.
Now they are influenced just in the first time range.
Issue 2:
The variables in the second time range should start from their previous values in the last time range instead of the initial guess.
Screenshots
Figure 1. The input cannot influence the system model except for the first time range.
Figure 2. The variables restart from their initial guess.
I'm wondering if there are any comments or suggestions for this issue.
This issue is really weird.
I would appreciate any hints.
Thanks for your kind help!
The text was updated successfully, but these errors were encountered:
Hello, I'm using dymola-generated FMU for MPC work. I used PyFMI package's function to load the FMU and operate it.
Now my model is based on Modelica Buildings Library 9.0.0 and I found the issues shown below.
Describe the bug
I exported my system model based on MBL 9.0.0 to a co-simulation FMU for model predictive control.
There is only one integer input for the system mode (1,2 or 3).
I divided the simulation period into two parts (t1-t2, t2-t3) with different signals.
When my input signal ('Mode') was changed from 1 to 2 or 2 to 3, the results showed the system didn't have the correct reflection I wanted.
Pseudocode:
model.reset()
model.initialize()
model.set('Mode', int(2))
model.simulate(start_time=t1, final_time=t2,
input=None, options=demo_options)
states = model.get_fmu_state()
model_options['initialize'] = False
model.set_fmu_state(states)
model.set('Mode', int(3))
model.simulate(start_time=t2, final_time=t3,
input=None, options=demo_options)
The input 'Mode' is directly connected with one variable called 'TES'.
During the first time range from t1 to t2, the 'TES' is equal to input 'Mode'.
However, during the second time range from t2 to t3, the 'TES' is still the old value even though the input 'Mode' has been changed from 1 to 2 or 2 to 3 (this issue is shown in Figure 1).
The system didn't work correctly during the second time range either, which is very weird.
I tried different IDEs, Spyder or Pycharm, and Dymola versions, 2021, 2021X, and 2023. This issue still exists.
I also tried one example model (Buildings.Fluid.Storage.Examples.Stratified) in MBL 9.0.0, but the issue also exists.
And another strange stuff is that sometimes the 'TES' could follow the 'Mode', but some variables will restart from their initial guess (this issue is shown in Figure 2).
Expected behavior
Issue 1:
Throughout the simulation period, the variables in the system model should be influenced by the inputs.
Now they are influenced just in the first time range.
Issue 2:
The variables in the second time range should start from their previous values in the last time range instead of the initial guess.
Screenshots
Figure 1. The input cannot influence the system model except for the first time range.
Figure 2. The variables restart from their initial guess.
Version
PyFMI: 2.9.7
Modelica Buildings Library: 9.0.0
Modelica 4.0.0. Dymola 2021, 2021X, 2023
Windows 10
Additional context
I'm wondering if there are any comments or suggestions for this issue.
This issue is really weird.
I would appreciate any hints.
Thanks for your kind help!
The text was updated successfully, but these errors were encountered: