Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » jp_ducreux
  • » Profile

Posts

Posts

Thanks for the fast and good answer !

Hello,

I installed OpenModelica 1.11.0 beta 1 on a windows 10 64 bits computer. I tried the bouncing ball example and the compilation failed with the message "cannot find -lopenblas".

Did I make anything wrong ?

Thanks for your help

I'm trying to use a simple electrical circuit with one diod on Openmodelica 1.9.3. I wrote the code below :

Code:

model TKJ1

  Modelica.Electrical.Analog.Sources.SineVoltage sinevoltage(V = 100, freqHz = 235);
  Modelica.Electrical.Analog.Basic.Resistor resistor(R = 0.001);
  Modelica.Electrical.Analog.Basic.Inductor inductor(L = 1e-6);
  Modelica.Electrical.Analog.Basic.Resistor Rcharge(R = 100);
  Modelica.Electrical.Analog.Semiconductors.Diode diode1;
  Modelica.Electrical.Analog.Basic.Ground ground;
equation
  connect(ground.p, Rcharge.n);
  connect(Rcharge.p, diode1.n);
  connect(diode1.p, inductor.n);
  connect(inductor.p, resistor.n);
  connect(resistor.p, sinevoltage.p);
  connect(ground.p, sinevoltage.n);
end TKJ1;

With the defaut simulation parameters, the simulation failed with the following message :

LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
stdout | warning | <p>The corrector could not converge.</p>
stdout | warning | <p>can't continue. time = 0.005647</p>
stdout | info | <p>model terminate | Integrator failed. | Simulation terminated at time 0.0056473</p>
LOG_STATS | info | <p>### STATISTICS ###</p>
stdout | error | <p>Process crashed<br>
Simulation process failed. Exited with code -8.</p>

I changed the maximum step size after event detection to 1e-6. The simulation finished correctly :


LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_NLS_V | warning | <p>Warning: maximal number of iteration reached but no root found</p>
LOG_STATS | info | <p>### STATISTICS ###</p>
stdout | OMEditInfo | <p>Simulation process finished successfully.</p>

The results are correct but the warnings are still there. It seems that diode model is very sensitive to simulation parameters. Any help on this topic will be deeply appreciated.

Oct-22-13 23:05:04
Matrix inductance

Hi,

I have tested your workaround and it works fine.

Thank you for your fast and efficient answer.

Regards

Jean - Pierre

Oct-22-13 18:35:08
Matrix inductance

I'm trying to build with Modelica matrix component like M_Transformer. But here I need a matrix inductance where each term is not necessary a parameter. For instance some terms could depend on a real variable. I tried to use the M_Transformer in the example below.

Code:


model M_Transfo
parameter Real W=314.1592;
Modelica.Electrical.Analog.Sources.SineVoltage E1(
     V=1000.0*sqrt(2),
     phase = 0,
     freqHz = W/2.0/Modelica.Constants.pi);
     
  Modelica.Electrical.Analog.Sources.SineVoltage E2(
     V = 1000.0*sqrt(2),
     phase = -2.0*Modelica.Constants.pi/3.0,
     freqHz = W/2.0/Modelica.Constants.pi);
     
  Modelica.Electrical.Analog.Sources.SineVoltage E3(
     V=1000.0*sqrt(2),
     phase = -4.0*Modelica.Constants.pi/3.0,
     freqHz = W/2.0/Modelica.Constants.pi);

  Modelica.Electrical.Analog.Basic.Resistor R1(R=0.1);
  Modelica.Electrical.Analog.Basic.Resistor R2(R=0.1);
  Modelica.Electrical.Analog.Basic.Resistor R3(R=0.1);
 
  Modelica.Electrical.Analog.Basic.Inductor L1(L=0.01);
  Modelica.Electrical.Analog.Basic.Inductor L2(L=0.01);
  Modelica.Electrical.Analog.Basic.Inductor L3(L=0.01);
 
  Modelica.Electrical.Analog.Basic.Resistor RAS(R=1.0);
  Modelica.Electrical.Analog.Basic.Resistor RBS(R=1.0);
  Modelica.Electrical.Analog.Basic.Resistor RCS(R=1.0);
 
  Modelica.Electrical.Analog.Basic.Ground g;
 
  Modelica.Electrical.Analog.Basic.M_Transformer Mind;
 
  Modelica.Electrical.Analog.Basic.Resistor RLINK(R=1.0e5);
 
 
equation
  connect(E1.n,g.p);
  connect(E2.n,g.p);
  connect(E3.n,g.p);
  connect(E1.p,R1.n);
  connect(E2.p,R2.n);
  connect(E3.p,R3.n);
  connect(R1.p,L1.n);
  connect(R2.p,L2.n);
  connect(R3.p,L3.n);
  connect(L1.p,RAS.n);
  connect(RAS.p,Mind.n[1]);
  connect(L2.p,RBS.n);
  connect(RBS.p,Mind.n[2]);
  connect(L3.p,RCS.n);
  connect(RCS.p,Mind.n[3]);
  connect(Mind.p[1],RLINK.n);
  connect(Mind.p[2],RLINK.n);
  connect(Mind.p[3],RLINK.n);
  connect(RLINK.p,g.p);

end M_Transfo;

With OMShell, the command "simulate(M_Transfo,stopTime=0.1,outputFormat="csv")" gave the following warnings :

record SimulationResult
    resultFile = "C:/DOCUME~1/DUCREU~1/LOCALS~1/Temp/M_Transfo_res.csv",
    simulationOptions = "startTime = 0.0, stopTime = 0.1, numberOfIntervals = 500, tolerance = 0.000001, method = 'dassl', fileNamePrefix = 'M_Transfo', options = '', outputFormat = 'csv', variableFilter = '.*', measureTime = false, cflags = '', simflags = ''",
    messages = "",
    timeFrontend = 0.422195837739154,
    timeBackend = 0.04046408132877223,
    timeSimCode = 0.01800731657235766,
    timeTemplates = 0.13097502615555887,
    timeCompile = 3.4024824384104684,
    timeSimulation = 0.5404206400534146,
    timeTotal = 4.554931702213549
end SimulationResult;
[C:\OpenModelica1.9.1\lib\omlibrary\Modelica 3.2.1\Electrical\Analog\Basic.mo:597:47-597:57:writable] Warning: Non-array modification 'true' for array component, possibly due to missing 'each'.

It seems that the last warning concerns Modelica library so, I can't do anything to avoid this message.

This first step was successfull. Then, as a second step,  I tried to build my own M_Transformer using the model in Modelica library. Nothing else changed in the whole model as shown in the script here :

Code:


model VM_ind

  class VM_Transformer
       parameter Integer N(final min=1)=3 "number of inductors";
     protected
       parameter Integer dimL=div(N*(N+1),2);
     public
       parameter Modelica.SIunits.Inductance L[dimL]={1,0.1,0.2,2,0.3,3}
                                 "inductances and coupling inductances";
       Modelica.Electrical.Analog.Interfaces.PositivePin p[N] "Positive pin"
              annotation (Placement(transformation(
          extent={{-80,-40},{-62,40}}, rotation=0)));
       Modelica.Electrical.Analog.Interfaces.NegativePin n[N] "Negative pin"
              annotation (Placement(transformation(
          extent={{62,-40},{80,40}}, rotation=0)));

       Modelica.SIunits.Voltage v[N];
       Modelica.SIunits.Current i[N](each start=0.0);
       Modelica.SIunits.Inductance Lm[N,N];
     algorithm
       for s in 1:N loop
         for z in 1:N loop
           Lm[z,s]:= if (z>=s) then L[(s-1)*N+z-div((s-1)*s,2)] else
                 Lm[s,z];
         end for;
       end for;

     equation
       for j in 1:N loop
         v[j] = p[j].v - n[j].v;
         0 = p[j].i + n[j].i;
         i[j] = p[j].i;
       end for;

       v =Lm*der(i);
  end VM_Transformer;
 
  VM_Transformer Mind;
  parameter Real W=314.1592;
  Modelica.Electrical.Analog.Sources.SineVoltage E1(
     V=1000.0*sqrt(2),
     phase = 0,
     freqHz = W/2.0/Modelica.Constants.pi);
     
  Modelica.Electrical.Analog.Sources.SineVoltage E2(
     V = 1000.0*sqrt(2),
     phase = -2.0*Modelica.Constants.pi/3.0,
     freqHz = W/2.0/Modelica.Constants.pi);
     
  Modelica.Electrical.Analog.Sources.SineVoltage E3(
     V=1000.0*sqrt(2),
     phase = -4.0*Modelica.Constants.pi/3.0,
     freqHz = W/2.0/Modelica.Constants.pi);

  Modelica.Electrical.Analog.Basic.Resistor R1(R=0.1);
  Modelica.Electrical.Analog.Basic.Resistor R2(R=0.1);
  Modelica.Electrical.Analog.Basic.Resistor R3(R=0.1);
 
  Modelica.Electrical.Analog.Basic.Inductor L1(L=0.01);
  Modelica.Electrical.Analog.Basic.Inductor L2(L=0.01);
  Modelica.Electrical.Analog.Basic.Inductor L3(L=0.01);
 
  Modelica.Electrical.Analog.Basic.Resistor RAS(R=1.0);
  Modelica.Electrical.Analog.Basic.Resistor RBS(R=1.0);
  Modelica.Electrical.Analog.Basic.Resistor RCS(R=1.0);
 
  Modelica.Electrical.Analog.Basic.Ground g;
 
  Modelica.Electrical.Analog.Basic.Resistor RLINK(R=1.0e5);
 
equation
  connect(E1.n,g.p);
  connect(E2.n,g.p);
  connect(E3.n,g.p);
  connect(E1.p,R1.n);
  connect(E2.p,R2.n);
  connect(E3.p,R3.n);
  connect(R1.p,L1.n);
  connect(R2.p,L2.n);
  connect(R3.p,L3.n);
  connect(L1.p,RAS.n);
  connect(RAS.p,Mind.n[1]);
  connect(L2.p,RBS.n);
  connect(RBS.p,Mind.n[2]);
  connect(L3.p,RCS.n);
  connect(RCS.p,Mind.n[3]);
  connect(Mind.p[1],RLINK.n);
  connect(Mind.p[2],RLINK.n);
  connect(Mind.p[3],RLINK.n);
  connect(RLINK.p,g.p);


end VM_ind;

In OMShell, the command "simulate(VM_ind,stopTime=0.1,outputFormat="csv")" gave the following errors :
[indent]record SimulationResult
    resultFile = "",
    simulationOptions = "startTime = 0.0, stopTime = 0.1, numberOfIntervals = 500, tolerance = 0.000001, method = 'dassl', fileNamePrefix = 'VM_ind', options = '', outputFormat = 'csv', variableFilter = '.*', measureTime = false, cflags = '', simflags = ''",
    messages = "Simulation failed for model: VM_ind
Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
Error: Error building simulator. Build log: gcc   -falign-functions -msse2 -mfpmath=sse   -I\"C:/OpenModelica1.9.1//include/omc\" -I.   -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o VM_ind.o VM_ind.c
gcc   -falign-functions -msse2 -mfpmath=sse   -I\"C:/OpenModelica1.9.1//include/omc\" -I.   -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o VM_ind_functions.o VM_ind_functions.c
gcc   -falign-functions -msse2 -mfpmath=sse   -I\"C:/OpenModelica1.9.1//include/omc\" -I.   -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o VM_ind_records.o VM_ind_records.c
gcc   -falign-functions -msse2 -mfpmath=sse   -I\"C:/OpenModelica1.9.1//include/omc\" -I.   -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o VM_ind_01exo.o VM_ind_01exo.c
gcc   -falign-functions -msse2 -mfpmath=sse   -I\"C:/OpenModelica1.9.1//include/omc\" -I.   -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o VM_ind_02nls.o VM_ind_02nls.c
gcc   -falign-functions -msse2 -mfpmath=sse   -I\"C:/OpenModelica1.9.1//include/omc\" -I.   -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o VM_ind_03lsy.o VM_ind_03lsy.c
gcc   -falign-functions -msse2 -mfpmath=sse   -I\"C:/OpenModelica1.9.1//include/omc\" -I.   -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o VM_ind_04set.o VM_ind_04set.c
gcc   -falign-functions -msse2 -mfpmath=sse   -I\"C:/OpenModelica1.9.1//include/omc\" -I.   -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o VM_ind_05evt.o VM_ind_05evt.c
VM_ind_05evt.c: In function 'function_ZeroCrossings':
VM_ind_05evt.c:62: error: '$Ps' undeclared (first use in this function)
VM_ind_05evt.c:62: error: (Each undeclared identifier is reported only once
VM_ind_05evt.c:62: error: for each function it appears in.)
VM_ind_05evt.c: In function 'function_updateRelations':
VM_ind_05evt.c:102: error: '$Ps' undeclared (first use in this function)
mingw32-make: *** [VM_ind_05evt.o] Error 1

",
    timeFrontend = 0.0,
    timeBackend = 0.0,
    timeSimCode = 0.0,
    timeTemplates = 0.0,
    timeCompile = 0.0,
    timeSimulation = 0.0,
    timeTotal = 0.0
end SimulationResult;

I don't understand where I could make a mistake. I'm using [OpenModelica 1.9.1+dev(r17770) on Windows Vista and and Windows8 with the same occuring problem. Any help will be greatly appreciated.

Regards,

Jean-Pierre

  • Index
  • » Users
  • » jp_ducreux
  • » Profile
You are here: