Help - Search - Members - Calendar
Full Version: Simulation failed.Internal error code generation of expression...
Modelica Forum > Modelica > MathModelica / OpenModelica
Lord_Kelvin71
Hi,

I got this error while solving for this model:

model Synchronous
import Modelica.Constants.*;
import Modelica.Electrical.Analog.Basic.*;
import Modelica.Electrical.Analog.Sources.*;
import Modelica.Electrical.Analog.Sensors.*;
import Modelica.Electrical.Analog.Interfaces.*;

parameter Real m_Rs, m_Rf, m_Lss, m_Lff, m_Mss, m_Msf, m_Jr;
parameter Integer m_P;

constant Real[4, 4] m_R = {
{ m_Rs, 0., 0., 0. },
{ 0., m_Rs, 0., 0. },
{ 0., 0., m_Rs, 0. },
{ 0., 0., 0., m_Rf }
};

Real[4] m_V, m_I;
Real[4, 4] m_L, m_dL;
Real m_Theta, m_Te, m_Tm, m_Omega;
Pin p[4], n[4];

protected
constant Real alpha = 2. * pi / 3.;

initial equation
m_I = { 0., 0., 0., 0. };
m_Theta = 0.;
m_Omega = 0.;

equation
m_Tm = m_Te + m_Jr * der(m_Omega);
m_dL = {
{ 0., 0., 0., -m_P * m_Msf * sin(m_P * m_Theta) },
{ 0., 0., 0., -m_P * m_Msf * sin(m_P * m_Theta + alpha) },
{ 0., 0., 0., -m_P * m_Msf * sin(m_P * m_Theta - alpha) },
{ -m_P * m_Msf * sin(m_P * m_Theta), -m_P * m_Msf * sin(m_P * m_Theta + alpha), -m_P * m_Msf * sin(m_P * m_Theta - alpha), 0. }
};
m_Te = 1. / 2. * m_I * m_dL * m_I;
der(m_Theta) = m_Omega;
m_L = {
{ m_Lss, m_Mss, m_Mss, m_Msf * cos(m_P * m_Theta) },
{ m_Mss, m_Lss, m_Mss, m_Msf * cos(m_P * m_Theta + alpha) },
{ m_Mss, m_Mss, m_Lss, m_Msf * cos(m_P * m_Theta - alpha) },
{ m_Msf * cos(m_P * m_Theta), m_Msf * cos(m_P * m_Theta + alpha), m_Msf * cos(m_P * m_Theta - alpha), m_Lff }
};
m_V = {
p[1].v - n[1].v,
p[2].v - n[2].v,
p[3].v - n[3].v,
p[4].v - n[4].v
};
0. = p[1].i + n[1].i;
0. = p[2].i + n[2].i;
0. = p[3].i + n[3].i;
0. = p[4].i + n[4].i;
m_I = {
p[1].i,
p[2].i,
p[3].i,
p[4].i
};
m_V = m_R * m_I + der(m_L * m_I);
end Synchronous;

model test_circuit
import Modelica.Electrical.Analog.Basic.*;
import Modelica.Electrical.Analog.Sources.*;
import Modelica.Electrical.Analog.Sensors.*;

Synchronous m_S(m_Rs = 0.0102, m_Rf = 0.52, m_Lss = 1e-3, m_Lff = 1e-6, m_Mss = -1e-6, m_Msf = -1e-6, m_Jr = 100., m_P = 2);
ConstantVoltage m_V(V = 67.);
Resistor[3] m_R(R = 5.);
Ground m_GND;

equation
m_S.m_Tm = 100.;
connect(m_S.p[1], m_R[1].p);
connect(m_S.p[2], m_R[2].p);
connect(m_S.p[3], m_R[3].p);

connect(m_R[1].n, m_GND.p);
connect(m_R[2].n, m_GND.p);
connect(m_R[3].n, m_GND.p);

connect(m_S.n[1], m_GND.p);
connect(m_S.n[2], m_GND.p);
connect(m_S.n[3], m_GND.p);

connect(m_V.p, m_S.p[4]);
connect(m_V.n, m_GND.p);
connect(m_S.n[4], m_GND.p);
end test_circuit;

simulate(test_circuit, startTime = 0., stopTime = 0.02, numberOfIntervals = 1000)

Please help. Thanks

Angelo
Jawhar
Hi Angelo,

Where's the error message?
Try to use an .mos script to run your model and after every command put getErrorString();
Try to run your script using omc with line command. After, try to find test_circuit.log. This way you will have more expressive errors.

Regards,

Jawhar
Lord_Kelvin71
QUOTE(Jawhar @ Oct 22 2007, 04:33 PM) *

Hi Angelo,

Where's the error message?
Try to use an .mos script to run your model and after every command put getErrorString();
Try to run your script using omc with line command. After, try to find test_circuit.log. This way you will have more expressive errors.

Regards,

Jawhar


This is the log file after omc +s synchronous6.mos

Click to view attachment
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.