Friends from SystemModeler Group I am doing optimal control over power electronic systems such as inverters and dc-dc sources. The approach I have adopted is to design the controller in Mathemetica and then passing my equations to system modeler trough WSMCreateModel. I have gone through this process to send linear state space models into SystemModeler without troubles. To do the same for nonlinear systems I believe one has to create the model using the system of differential equations and the to establish the connections. My system of ODEs is
EqnRiccati={Derivative[1][P11][t] == -2.5*10^6 EE^2 P11[t]^2 + 100000. P13[t] +
100000. P31[t],
Derivative[1][P12][t] == -2.5*10^6 EE^2 P11[t] P12[t] -
100000. P13[t] + 100000. P32[t],
Derivative[1][P13][t] == -500. P11[t] + 1200.48 P12[t] -
2.5*10^6 EE^2 P11[t] P13[t] + 100000. P33[t],
Derivative[1][P14][t] == -1200.48 P12[t] -
2.5*10^6 EE^2 P11[t] P14[t] - 314.159 P15[t] + 100000. P34[t],
Derivative[1][P15][t] ==
314.159 P14[t] - 2.5*10^6 EE^2 P11[t] P15[t] + 100000. P35[t],
Derivative[1][P21][t] == -2.5*10^6 EE^2 P11[t] P12[t] +
100000. P23[t] - 100000. P31[t],
Derivative[1][P22][t] ==
1000. - 2.5*10^6 EE^2 P12[t]^2 - 100000. P23[t] - 100000. P32[t],
Derivative[1][P23][t] == -2.5*10^6 EE^2 P12[t] P13[t] -
500. P21[t] + 1200.48 P22[t] - 100000. P33[t],
Derivative[1][P24][t] == -2.5*10^6 EE^2 P12[t] P14[t] -
1200.48 P22[t] - 314.159 P25[t] - 100000. P34[t],
Derivative[1][P25][t] == -2.5*10^6 EE^2 P12[t] P15[t] +
314.159 P24[t] - 100000. P35[t],
Derivative[1][P31][t] == -500. P11[t] -
2.5*10^6 EE^2 P11[t] P13[t] + 1200.48 P21[t] + 100000. P33[t],
Derivative[1][P32][t] == -500. P12[t] -
2.5*10^6 EE^2 P12[t] P13[t] + 1200.48 P22[t] - 100000. P33[t],
Derivative[1][P33][t] == -500. P13[t] - 2.5*10^6 EE^2 P13[t]^2 +
1200.48 P23[t] - 500. P31[t] + 1200.48 P32[t],
Derivative[1][P34][t] == -500. P14[t] -
2.5*10^6 EE^2 P13[t] P14[t] + 1200.48 P24[t] - 1200.48 P32[t] -
314.159 P35[t],
Derivative[1][P35][t] == -500. P15[t] -
2.5*10^6 EE^2 P13[t] P15[t] + 1200.48 P25[t] + 314.159 P34[t],
Derivative[1][P41][t] == -2.5*10^6 EE^2 P11[t] P14[t] -
1200.48 P21[t] + 100000. P43[t] - 314.159 P51[t],
Derivative[1][P42][t] == -2.5*10^6 EE^2 P12[t] P14[t] -
1200.48 P22[t] - 100000. P43[t] - 314.159 P52[t],
Derivative[1][P43][t] == -2.5*10^6 EE^2 P13[t] P14[t] -
1200.48 P23[t] - 500. P41[t] + 1200.48 P42[t] - 314.159 P53[t],
Derivative[1][P44][t] == -2.5*10^6 EE^2 P14[t]^2 - 1200.48 P24[t] -
1200.48 P42[t] - 314.159 P45[t] - 314.159 P54[t],
Derivative[1][P45][t] == -2.5*10^6 EE^2 P14[t] P15[t] -
1200.48 P25[t] + 314.159 P44[t] - 314.159 P55[t],
Derivative[1][P51][t] == -2.5*10^6 EE^2 P11[t] P15[t] +
314.159 P41[t] + 100000. P53[t],
Derivative[1][P52][t] == -2.5*10^6 EE^2 P12[t] P15[t] +
314.159 P42[t] - 100000. P53[t],
Derivative[1][P53][t] == -2.5*10^6 EE^2 P13[t] P15[t] +
314.159 P43[t] - 500. P51[t] + 1200.48 P52[t],
Derivative[1][P54][t] == -2.5*10^6 EE^2 P14[t] P15[t] +
314.159 P44[t] - 1200.48 P52[t] - 314.159 P55[t],
Derivative[1][P55][t] == -2.5*10^6 EE^2 P15[t]^2 + 314.159 P45[t] +
314.159 P54[t]}
Then I use the following Mathematica statements
conns1 = {EE \[Element] "Modelica.Blocks.Interfaces.RealInput",
Table[Symbol["P" <> ToString[FromDigits[{1, i}]]][t], {i,
5}] \[Element] "Modelica.Blocks.Interfaces.RealOutput"};
m1 = WSMCreateModel["SmartGrid.Examples.RiccatiSys", EqnRiccati, t,
conns1];
Everything seems to be fine up to here but in the SystemModeler I hot the following error messages
Multiple declarations of component P11 found.
Multiple declarations of component P12 found.
Multiple declarations of component P13 found.
Multiple declarations of component P14 found.
Multiple declarations of component P15 found.
Since Mathematica is doing the translation I do not know why is doing multiple declarations. Any ideas?? Thanks Jesus