Group Abstract Group Abstract

Message Boards Message Boards

0
|
12.8K Views
|
15 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How does the initialization process in WSM work?

Dear users of SystemModeler

I am trying to build a steady-state analysis module in Mathematica that will take a model from WSM to simulate a base cycle and extrapolate the final conditions to reach the steady-state fastly. I do not have any trouble in nonsingular systems where the number of differential equations matches the number of energy-storing elements. But I am having some problems extending my algorithm to singular systems like the one I have attached here.

In Mathematica, I have checked that the selected state variables are: {L1.i,c2.v} so I guested that it will suffice to give initial conditions for L1, but this is not the case. Instead, I got the following error:

"SystemModelSimulate::eva: The variables {L1.i} are computed from other variables,"

which is corroborated with the equation browser at the simulation center. The following equation may be found: L1.i = L3.i. Shouldn't it be the inverse assignation?

What is the right way to programmatically initialize this kind of system?

Also, can someone direct me to verify the circuit system approach that WSM used in the automated generation of equations.? Is it Modified Nodal Analysis? I cannot find this kind of documentation.

As always, I will appreciate any help you can give me.

Jesus

15 Replies

Dear members, I case some of you found these discussions related to your work. I found this link to the Mathematica documentation that helped me better understand the difficulties of directly initializing dynamical systems. https://reference.wolfram.com/language/tutorial/NDSolveDAE.html Very instructive!! Cheers Jesús

Hi Jesus,

Sorry, I wrote the wrong the name for the model, but I have edited the comment now. The steps are then:

1) Find the Modelica.Electrical.Machines.Examples.SynchronousInductionMachines.SMEE_Rectifier model in the class browser in Model Center.

2) Duplicate the model, by clicking it with the right button and selecting Duplicate. A window will open where you can give a name to this new model.

3) Go to the text view of this new model.

4) You'll find the declaration of the component

Modelica.Electrical.Machines.BasicMachines.SynchronousInductionMachines.SM_ElectricalExcited smee(...)

with a lot of modifications, here represented with ... .

5) Add the modification

idq_dr(each fixed = true)

to it, so you should end up with something like

Modelica.Electrical.Machines.BasicMachines.SynchronousInductionMachines.SM_ElectricalExcited smee(... ,  idq_dr(each fixed = true))

6) Simulate, with either Simulation Center or Mathematica, and you'll be able to set initial values for both smee.idq_dr[1] and smee.idq_dr[2].

POSTED BY: Sergio Vargas

Dear Sergio,

I am afraid I do not know where/how to add such modification. Looking at the element smee, I see that I can set phiMechanical or wMechanical, but not idq_dr.

can you be more explicit?

Jesus

Dear Jesus,

In this case, if you duplicate the Modelica.Electrical.Machines.Examples.SynchronousInductionMachines.SMEE_Rectifier model and add the modification

idq_dr(each fixed = true)

to the component

    Modelica.Electrical.Machines.BasicMachines.SynchronousInductionMachines.SM_ElectricalExcited smee

then you can provide initial values to both smee.idq_dr[1] and smee.idq_dr[2].

Sergio

POSTED BY: Sergio Vargas

Actually, there is technically not even a guarantee that there will be a choice at all; one can imagine using integration methods that don't perform reduction to ODE (state-space) form, or ODE forms where the equations used don't have a closed-form relation to the original equations of the model.

This is very clear thank you.

However, I still do not understand why SystemModeler cannot accept the initial values I am declaring in my example.

Thanks again.

Jesus

No, that is not possible, and there is no guarantee that two different Modelica tools (or two different versions of the same tool) will make the same choice of equations. Actually, there is technically not even a guarantee that there will be a choice at all; one can imagine using integration methods that don't perform reduction to ODE (state-space) form, or ODE forms where the equations used don't have a closed-form relation to the original equations of the model.

POSTED BY: Henrik Tidefelt

Is it possible at all, to always know which are the independent differential equations that systemmodeler is simulating?

Regards,

Jesus

Posted 4 years ago

Dear Sergio and Henrik, Looking into more complex systems but in the same subject, I have tried this with a SystemModeler example and I am again having trouble at initializing. I thought I understood before, but I did not. Please help.

Ex1 = SystemModel[
  "Modelica.Electrical.Machines.Examples.SynchronousInductionMachines.\
SMEE_Rectifier"]
Ex1["StateVariables", 
 Method -> {"Elimination" -> All, "ReduceIndex" -> True}]
Ex1["StateVariables"]
Ex1["Balanced"]
SystemModelSimulate[Ex1, {0, 1/50}, <|
  "InitialValues" -> {"capacitor1.v" -> 1, "smee.idq_dr[1]" -> 1}|>]

SystemModelSimulate::eva: The variables {smee.idq_dr[1]} are computed from other variables.

POSTED BY: Updating Name

Dear Jesus,

I'm glad to hear it's working out for you, although I must admit that I found it difficult to see through the computations in the notebook.

It is true that System Modeler doesn't include methods for finding periodic steady-state, so this is a nice examples of building functionality on top of System Modeler using Wolfram Language.

POSTED BY: Henrik Tidefelt
Posted 4 years ago

Dear Henrik and Sergio

Thank you for your generous explanations. I think the setting "fixed" as true reduces my initialization problems. Yes, I think there is a bug in the report yielded by system["StateVariables"] However, to be honest, I still have to process all the information you gave me. I let you know more about it later on.

Best regards to you two.

Jesus

POSTED BY: Updating Name

Hi Jesus,

In the Mathematica side of your question, I believe you are using the SystemModel property "StateVariables" to find the states. To get a picture consistent with the full kernel action in System Modeler, you can use the Method option

SystemModel[model, "StateVariables", Method -> {"Elimination" -> All, "ReduceIndex" -> True}] 

which returns, for your model, L3.i and c2.v. We created a bug report to clarify the process of state classification further in the Mathematica side. Thanks for your input.

Sergio

POSTED BY: Sergio Vargas

Also, can someone direct me to verify the circuit system approach that WSM used in the automated generation of equations.? Is it Modified Nodal Analysis? I cannot find this kind of documentation.

There is no "circuit system approach" applied inside WSM. Instead, WSM – similar to other Modelica tools – relies on generic index reduction and state selection methods. The index reduction used in WSM is based on Pantelides' algorithm for consistent initialization, enhanced in various ways to avoid some of the pitfalls that the purely structural analysis of the basic algorithm would fall into.

POSTED BY: Henrik Tidefelt
POSTED BY: Henrik Tidefelt
POSTED BY: Henrik Tidefelt
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard