- Index
- » Users
- » peb
- » Profile
Posts
Posts
Would be possible to use Modelica "previous()" or "pre()" function. It seems those are related to discrete domain. Do they work on continuous domain as well?
%Unwrap the signal xw(n)
xu = xw;
for i=2:length(xw)
difference = xw(i)-xw(i-1);
if difference > pi
xu(i:end) = xu(i:end) - 2*pi;
elseif difference < -pi
xu(i:end) = xu(i:end) + 2*pi;
end
end
I would prefer to do it "continually" but not on sampled signal batch as code snippet ...
Any idea how to do it under Modelica?
Thanks.
Actually I am looking for "unwrap" Matlab-like function in Modelica scope
http://www.mathworks.com/help/matlab/ref/unwrap.html
...
v_angle = atan2(v_beta, v_alpha);
unwrapped_angle = unwrap(v_angle);
der(v_freq) = unwrapped_angle;
...
Dears,
I am trying to determine the frequency of v_signal (rotational vector) which is given by its alpha,beta components.
v_angle = atan2(v_beta, v_alpha);
der(v_freq) = v_angle;
Unfortunately atan2 returns the angle with discontinuity and following der() function can't determine frequency of v_signal.
I am looking for a solution in Modelica for this. Do you have any idea to solve this?
Thank you.
Best regards,
peb
running as a script
# test.py
import OMPython
cmds =
["loadModel(Modelica)",
"model test end test;",
"loadFile(\"C:/OpenModelica1.9.1/testmodels/BouncingBall.mo\")",
"getIconAnnotation(Modelica.Electrical.Analog.Basic.Resistor)",
"getElementsInfo(Modelica.Electrical.Analog.Basic.Resistor)",
"simulate(BouncingBall)",
"plot(h)"]
for cmd in cmds:
answer = OMPython.execute(cmd)
print "\nResult:\n%s"%answer
I was able to run it successfully
Thanks.
Peter
none of suggestions work.
OMPython.execute("loadFile(\\"C:\OpenModelica1.9.1\share\doc\omc\testmodels\BouncingBall.mo\\")")
File "<ipython-input-46-83eba15eed46>", line 1
OMPython.execute("loadFile(\\"C:\OpenModelica1.9.1\share\doc\omc\testmodels\BouncingBall.mo\\")")
^
SyntaxError: invalid syntax
OMPython.execute("loadFile(/"C:\OpenModelica1.9.1\share\doc\omc\testmodels\BouncingBall.mo/")")
File "<ipython-input-47-bc6fc4e03811>", line 1
OMPython.execute("loadFile(/"C:\OpenModelica1.9.1\share\doc\omc\testmodels\BouncingBall.mo/")")
^
SyntaxError: invalid syntax
and calling
OMPython.execute('getErrorString()')
Out[48]: '""\n'
Dears,
I would like to find out how OMPython works since I am running test example I got this
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win 32
Type "help", "copyright", "credits" or "license" for more information.
>>> import OMPython
>>> OMPython.run()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'run'
>>>
and by
from OMPython import OMCSession
OMPython = OMCSession()
2015-02-21 14:25:18,296 - OMCSession - INFO - OMC Server is up and running at file:///c:\users\r59400\appdata\local\temp\openmodelica.objid.3227f5e8bc9f47df965e415f12a08a2a
INFO:OMCSession:OMC Server is up and running at file:///c:\users\r59400\appdata\local\temp\openmodelica.objid.3227f5e8bc9f47df965e415f12a08a2a
OMPython.execute('getVersion()')
Out[6]: '"1.9.1 (r22929) (RML version)"\n'
OMPython.execute("loadModel(Modelica)")
Out[7]: True
but I can't run examples:
OMPython.execute("loadFile(\"C:\OpenModelica1.9.1\share\doc\omc\testmodels\BouncingBall.mo\")")
Out[10]: False
OMPython.execute("loadFile(\"C:\OpenModelica1.9.1\share\doc\omc\testmodels\dcmotor.mo\")")
Out[11]: False
any idea what's wrong or how OMPython to correctly use?
Thank you.
Best regards,
Peter
Dears,
I am changing my model "parameters" and always it runs but sometimes end up with crashes - what needs to change to have more stable simulation?
Process crashed
Simulation process exited with code -8
Process crashed
Simulation process exited with code -7
what the code means? any way to debug it?
Thanks.
peb
Dears,
I run Modelica simulation and it ends up with crash:
Process crashed
Simulation process exited with code -8
Any idea what that means? Any idea how to fix it or debug it?
Thank you.
Best regards,
Peter
Dears,
I am looking for a way how to work with Modelica & Embedded control running on microcontroller (32bit ARM Cortex M4).
Reason for that is to compare a model developed under Modelica with real one running on MCU. The idea is to apply same stimuli (input) for both real and Modelica model and find out differences and then adjust Modelica model accordingly to match real system. Further is it possible to have something like processor-in-the-loop or hardware-in-the-loop simulation?
Do you have idea how to create such approach under Modelica? Or even example how to do it under openmodelica/python etc..?
Thanks.
Best regards,
peb
Dears,
I would like to modify model parameters. How can I interact with model during simulation?
Thank you.
peb
I did "PI controller model" as
model pi
Real y;
Real u;
Real x;
parameter Real K = 1;
parameter Real Ti = 1;
equation
der(x) = u;
y = K * u + Ti * x;
end pi;
it seems to be working fine and even comparing to Modelica built-in controller
model test_pi
pi controller(K = 10, Ti = 10);
Modelica.Blocks.Continuous.PI mcontroller(k = 10);
equation
mcontroller.u = 1;
controller.u = 1;
end test_pi;
I am really appreciate a help of you.
I would like to ask that if I can run simple model (e.g. PI) in "open-loop". I apply just input signal and await what's on output by running simulation and plotting it.
I did try:
model pi
Real y(start = 0);
Real u(start = 0, fixed = true);
parameter Real K = 1;
parameter Real Ti = 1;
equation
u = K * y + Ti * u;
y = der(u);
end pi;
model test_pi
pi controller;
Real fbck(start = 1, fixed = true);
equation
controller.y = fbck;
end test_pi;
other way how to do it? I just want the integrator to be 0 at start - expect to see that input value is integrated... I want to keep "fbck" at some non-zero const value..
Simulation Output (crashed)
assert | debug | division by zero at time 0, (a=1) / (b=0), where divisor b expression is: 1.0 - controller.Ti Debug more
assert | info | simulation terminated by an assertion at initialization
Process crashed
Simulation process exited with code -1
I did my PI as
model pi
Real y(start = 0);
Real u(start = 0);
parameter Real K = 1;
parameter Real Ti = 1;
equation
u = K * y + Ti * u;
y = der(u);
end pi;
and I just want to try it:
model test_pi
pi controller;
Real fbck;
equation
fbck = 1;
controller.y = fbck;
end test_pi;
[:0:0-0:0] Error: Too many equations, over-determined system. The model has 1 equation(s) and 0 variable(s).
is there a way how to go around this?
Do you have any tricks how to handle integration under Modelica?
It seems to me that integration under "function" is not working as I expected - maybe I am doing something wrong
function pi
input Real y;
output Real u;
protected
Real K = 1;
Real Ti = 1;
algorithm
u := K * y + Ti * der(u);
end pi;
Now "variables K,Ti" seems OK but cannot run test_pi:
I got following
[C:/OpenModelica1.9.1/work/pi.mo:8:3-8:27] Warning: u was used before it was defined (given a value). Additional such uses may exist for the variable, but some messages were suppressed.
Simulation Output
test_pi_functions.c
gcc -falign-functions -msse2 -mfpmath=sse -I"C:/OpenModelica1.9.1//include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -c -o test_pi_records.o test_pi_records.c
gcc -falign-functions -msse2 -mfpmath=sse -I"C:/OpenModelica1.9.1//include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -c -o test_pi_01exo.o test_pi_01exo.c
test_pi_functions.c: In function 'omc_pi':
test_pi_functions.c:20: error: '$P$DER$Pu' undeclared (first use in this function)
test_pi_functions.c:20: error: (Each undeclared identifier is reported only once
test_pi_functions.c:20: error: for each function it appears in.)
mingw32-make: *** [test_pi_functions.o] Error 1
mingw32-make: *** Waiting for unfinished jobs....
Compilation process exited with code 2
Dears,
I am looking for advice, I want to have a very simple PI controller implemented as function:
function pi
input Real y;
output Real u;
parameter Real K = 1 "Proportional gain";
parameter Real Ti = 1 "Integral time";
algorithm
u := K * y + Ti * der(u);
end pi;
I try to use this pi-function in my test-model as
model test_pi
import pi;
Real y(start = 1);
Real action;
equation
action = pi(y);
end test_pi;
Unfortunately I am getting
[C:/OpenModelica1.9.1/work/pi.mo:5:3-5:40] Warning: Invalid public variable Ki, function variables that are not input/output must be protected.
[C:/OpenModelica1.9.1/work/pi.mo:4:3-4:43] Warning: Invalid public variable K, function variables that are not input/output must be protected.
What's the correct way to have params within function?
Thank you.
Best regards,
Peb
Dears,
are there some examples on use OMOptim?
I've downloaded OpenModelica Optimization Application by CDAC - I am not sure it OMOptim example...
Thank you,
Peb
Dears,
do you have some examples/documentation or procedure on how to use OpenModelica & PySimulator?
Thank you
peb
Thanks. I am looking for something "Processor-In-Loop" or "Hardware-In-Loop", - I do have my inner loop (100usec) executed withing uC and I would like to control it to set required speed/torque and check response. Now I wonder if this OpenModelica is capable to do it?
I would like to build-up simple test bench on motor control... To measure, evaluate, and design an application. I am having simple pmsm control, running on embedded system which I would like to connect to get sampled data then compare with simulation reference platform. Is there any demo to get this?
thank you
peb
I have simple model and looking for interactive simulation - where can I find some example how is is done? Unfortunately documentation does not show hot do it ...
Is there a way how to debug modelica code?
I think it is very frustrated to write a code with OMEdit - text mode. I lost several times my code edited. Is there some option to preserve a code even if it's not clean (with errors)?
Dear all,
I would lke to use OMEdit to edit a new Modelica file (text iput) - what is the best way?
I am always getting error (OMEdit Error) not allowing add any text...
Best regards,
Peter
Dears,
I would like to add some functionality which is not defined within libraries and I prefer to add it as "code" therefore I would like to ask how can I create "user defined" function with OpenModelica Connection Editor?
Thank you!
Best regards,
Peter
Hello All,
I've got simple openmodelica model (see bellow). Since OpenModelica is having trouble to run - it does not run actually. It comes to my mind "What OpenModelica is for?" "Is it really worthy to wotk with?".
Best regards,
Peter
model ipfc
Modelica.Electrical.Analog.Basic.Ground ground annotation(Placement(visible = true, transformation(origin = {-81.1099,21.0586}, extent = {{-3.15998,-3.15998},{3.15998,3.15998}}, rotation = 0)));
Modelica.Electrical.Analog.Basic.Capacitor capacitor1(C = 0.01) annotation(Placement(visible = true, transformation(origin = {-28.6981,26.1005}, extent = {{-4.20593,4.20593},{4.20593,-4.20593}}, rotation = -90)));
Modelica.Electrical.Analog.Basic.Resistor Rload(R = 5) annotation(Placement(visible = true, transformation(origin = {-3.39624,25.9358}, extent = {{-2.87271,2.87271},{2.87271,-2.87271}}, rotation = -90)));
Modelica.Electrical.Analog.Ideal.IdealDiode D4(Ron = 0.001, Goff = 0.001, Vknee = 2) annotation(Placement(visible = true, transformation(origin = {-49.5239,21.4337}, extent = {{3.15998,-3.15998},{-3.15998,3.15998}}, rotation = -270)));
Modelica.Electrical.Analog.Ideal.IdealDiode D2(Ron = 0.001, Goff = 0.001, Vknee = 2) annotation(Placement(visible = true, transformation(origin = {-61.4442,21.0026}, extent = {{2.8727,-2.8727},{-2.8727,2.8727}}, rotation = -270)));
Modelica.Electrical.Analog.Ideal.IdealDiode D3(Ron = 0.001, Goff = 0.001, Vknee = 2) annotation(Placement(visible = true, transformation(origin = {-49.6713,41.6747}, extent = {{2.8727,-2.8727},{-2.8727,2.8727}}, rotation = -270)));
Modelica.Electrical.Analog.Ideal.IdealDiode D1(Ron = 0.001, Goff = 0.001, Vknee = 2) annotation(Placement(visible = true, transformation(origin = {-59.7107,41.5987}, extent = {{3.15998,-3.15998},{-3.15998,3.15998}}, rotation = -270)));
Modelica.Electrical.Analog.Sources.SineVoltage Source(V = 230, freqHz = 50) annotation(Placement(visible = true, transformation(origin = {-78.1847,31.9503}, extent = {{-3.47598,3.47598},{3.47598,-3.47598}}, rotation = -90)));
Modelica.Electrical.Analog.Basic.Inductor Lsource(L = 1e-007) annotation(Placement(visible = true, transformation(origin = {-69.3965,38.4532}, extent = {{-2.61155,-2.61155},{2.61155,2.61155}}, rotation = 0)));
equation
connect(Lsource.p,Source.p) annotation(Line(points = {{-72.0081,38.4532},{-78.1412,38.4532},{-78.1412,35.4263},{-78.1847,35.4263}}));
connect(D1.p,Lsource.n) annotation(Line(points = {{-59.7107,38.4387},{-66.0348,38.4387},{-66.0348,38.4532},{-66.785,38.4532}}));
connect(Source.p,D1.p) annotation(Line(points = {{-76.1967,33.7696},{-62.0269,33.7696},{-62.0269,38.1284},{-62.0382,38.1284}}));
connect(D3.p,D4.n) annotation(Line(points = {{-49.6713,38.802},{-43.7874,38.802},{-43.7874,24.5937},{-49.5239,24.5937}}));
connect(D1.p,D2.n) annotation(Line(points = {{-62.0382,38.1284},{-57.6232,38.1284},{-57.6232,23.8753},{-61.4442,23.8753}}));
connect(ground.p,Source.n) annotation(Line(points = {{-81.1099,24.2186},{-81.1099,27.0428},{-76.1967,27.0428},{-76.1967,26.8176}}));
connect(Source.n,D4.n) annotation(Line(points = {{-76.1967,26.8176},{-49.5261,26.8176},{-49.5261,24.5937},{-49.5239,24.5937}}));
connect(capacitor1.p,Rload.p) annotation(Line(points = {{-28.6981,30.3064},{-3.38035,30.3064},{-3.38035,28.8085},{-3.39624,28.8085}}));
connect(D4.p,capacitor1.n) annotation(Line(points = {{-49.5239,18.2737},{-28.6937,18.2737},{-28.6937,21.8945},{-28.6981,21.8945}}));
connect(D2.p,D4.p) annotation(Line(points = {{-61.4442,18.1299},{-49.6833,18.1299},{-49.6833,18.2737},{-49.5239,18.2737}}));
connect(D3.n,capacitor1.p) annotation(Line(points = {{-49.6713,44.5474},{-28.6151,44.5474},{-28.6151,30.3064},{-28.6981,30.3064}}));
connect(D1.n,D3.n) annotation(Line(points = {{-62.0382,44.4484},{-49.6047,44.4484},{-49.6047,44.5474},{-49.6713,44.5474}}));
connect(capacitor1.n,Rload.n) annotation(Line(points = {{-28.6981,21.8945},{-3.35281,21.8945},{-3.35281,22.9766},{-3.39624,22.9766},{-3.39624,23.0631}}));
end ipfc;
Have you chance to fix it?
Best regards,
Peter
Wow. That's really fine you can replicate it.
And it's really cool you can fix it!
Best regards,
Peter
And even if I delete all connections and my model is without connections at all. Then some connect lines are still left.
just delete some connections and try to connect them
I just try it again - added input inductor and OMEdit generated wrong connection
model ipfc
Modelica.Electrical.Analog.Basic.Ground ground2 annotation(Placement(visible = true, transformation(origin = {-77.6162,12.0216}, extent = {{-3.15998,-3.15998},{3.15998,3.15998}}, rotation = 0)));
Modelica.Electrical.Analog.Basic.Resistor Rload(R = 5) annotation(Placement(visible = true, transformation(origin = {1.92278,25.8121}, extent = {{-6.1579,6.1579},{6.1579,-6.1579}}, rotation = -90)));
Modelica.Electrical.Analog.Basic.Capacitor Cbus(C = 0.01) annotation(Placement(visible = true, transformation(origin = {-19.3103,25.1065}, extent = {{-6.77369,6.77369},{6.77369,-6.77369}}, rotation = -90)));
Modelica.Electrical.Analog.Ideal.IdealDiode D2(Ron = 0.001, Goff = 0.001, Vknee = 2) annotation(Placement(visible = true, transformation(origin = {-43.0547,14.4396}, extent = {{2.8727,-2.8727},{-2.8727,2.8727}}, rotation = -270)));
Modelica.Electrical.Analog.Sources.SineVoltage Source(V = 230, freqHz = 50) annotation(Placement(visible = true, transformation(origin = {-77.4522,23.9803}, extent = {{-2.15831,2.15831},{2.15831,-2.15831}}, rotation = -90)));
Modelica.Electrical.Analog.Ideal.IdealDiode D3(Ron = 0.001, Goff = 0.001, Vknee = 2) annotation(Placement(visible = true, transformation(origin = {-34.5142,37.6862}, extent = {{3.47597,-3.47597},{-3.47597,3.47597}}, rotation = -270)));
Modelica.Electrical.Analog.Ideal.IdealDiode D4(Ron = 0.001, Goff = 0.001, Vknee = 2) annotation(Placement(visible = true, transformation(origin = {-32.5772,15.4961}, extent = {{3.15998,-3.15998},{-3.15998,3.15998}}, rotation = -270)));
Modelica.Electrical.Analog.Ideal.IdealDiode D1(Ron = 0.001, Goff = 0.001, Vknee = 2) annotation(Placement(visible = true, transformation(origin = {-46.0811,42.7728}, extent = {{3.15998,-3.15998},{-3.15998,3.15998}}, rotation = -270)));
Modelica.Electrical.Analog.Basic.Inductor inductor1 annotation(Placement(visible = true, transformation(origin = {-63.9523,35.749}, extent = {{-5.08917,-5.08917},{5.08917,5.08917}}, rotation = 0)));
equation
connect(D1.p[-1],D2.n[-1]) annotation(Line(points = {{-46.0811,39.6128},{-46.3065,39.6128},{-46.3065,17.3123},{-43.0547,17.3123}}));
connect(D1.n[-1],D3.n[-1]) annotation(Line(points = {{-46.0811,45.9327},{-34.6022,45.9327},{-34.6022,41.1622},{-34.5142,41.1622}}));
connect(D3.p[-1],D4.n[-1]) annotation(Line(points = {{-34.5142,34.2102},{-28.9899,34.2102},{-32.5772,18.6561},{-32.5772,18.6561}}));
connect(Source.p,D1.p) annotation(Line(points = {{-77.4522,26.1386},{-43.2308,26.1386},{-43.2308,34.7885},{-43.3597,34.7885}}));
connect(Source.n,ground2.p) annotation(Line(points = {{-77.4522,21.822},{-77.5689,21.822},{-77.5689,15.1815},{-77.6162,15.1815}}));
connect(D4.p,Cbus.n) annotation(Line(points = {{-32.5772,12.3362},{-19.1941,12.3362},{-19.1941,18.3328},{-19.3103,18.3328}}));
connect(D2.p,D4.p) annotation(Line(points = {{-43.0547,11.5669},{-32.5772,11.5669},{-32.5772,12.3362},{-32.5772,12.3362}}));
connect(Source.n,D4.n) annotation(Line(points = {{-77.4522,21.822},{-32.5772,21.822},{-32.5772,18.6561},{-32.5772,18.6561}}));
connect(D3.p,D4.n) annotation(Line(points = {{-34.5142,34.2102},{-32.5772,34.2102},{-32.5772,18.6561},{-32.5772,18.6561}}));
connect(D1.p,D2.n) annotation(Line(points = {{-43.3597,34.7885},{-42.9666,34.7885},{-42.9666,17.3123},{-43.0547,17.3123}}));
connect(Cbus.n,Rload.n) annotation(Line(points = {{-19.3103,18.3328},{1.84897,18.3328},{1.84897,19.6542},{1.92278,19.6542}}));
connect(Cbus.p,Rload.p) annotation(Line(points = {{-19.3103,31.8802},{1.76093,31.8802},{1.76093,31.97},{1.92278,31.97}}));
connect(D3.n,Cbus.p) annotation(Line(points = {{-34.5142,41.1622},{-19.2822,41.1622},{-19.2822,31.8802},{-19.3103,31.8802}}));
connect(D1.n,D3.n) annotation(Line(points = {{-43.3597,41.1085},{-34.6022,41.1085},{-34.6022,41.1622},{-34.5142,41.1622}}));
end ipfc;
I am using Windows 7 - 32bit and OpenModelica 1.8.
The OMEdit does wrong indexing and moreover it leaves old connection if components are addded/deleted, and not displaying new variables in "Plotting" window.
If you suggest something I can try...
Peter
I deleted annotation to be simpler: Wrong indexing comes from OMEdit. It creates this and I don't why?
model ipfc
Modelica.Electrical.Analog.Basic.Ground ground2 annotation(Placement(visible = true, transformation(origin = {-77.6162,12.0216}, extent = {{-3.15998,-3.15998},{3.15998,3.15998}}, rotation = 0)));
Modelica.Electrical.Analog.Basic.Resistor Rload(R = 5) annotation(Placement(visible = true, transformation(origin = {1.92278,25.8121}, extent = {{-6.1579,6.1579},{6.1579,-6.1579}}, rotation = -90)));
Modelica.Electrical.Analog.Basic.Capacitor Cbus(C = 0.01) annotation(Placement(visible = true, transformation(origin = {-19.3103,25.1065}, extent = {{-6.77369,6.77369},{6.77369,-6.77369}}, rotation = -90)));
Modelica.Electrical.Analog.Ideal.IdealDiode D2(Ron = 0.001, Goff = 0.001, Vknee = 2) annotation(Placement(visible = true, transformation(origin = {-43.0547,14.4396}, extent = {{2.8727,-2.8727},{-2.8727,2.8727}}, rotation = -270)));
Modelica.Electrical.Analog.Ideal.IdealDiode D1(Ron = 0.001, Goff = 0.001, Vknee = 2) annotation(Placement(visible = true, transformation(origin = {-43.3597,37.9485}, extent = {{3.15998,-3.15998},{-3.15998,3.15998}}, rotation = -270)));
Modelica.Electrical.Analog.Sources.SineVoltage Source(V = 230, freqHz = 50) annotation(Placement(visible = true, transformation(origin = {-77.4522,23.9803}, extent = {{-2.15831,2.15831},{2.15831,-2.15831}}, rotation = -90)));
Modelica.Electrical.Analog.Ideal.IdealDiode D3(Ron = 0.001, Goff = 0.001, Vknee = 2) annotation(Placement(visible = true, transformation(origin = {-34.5142,37.6862}, extent = {{3.47597,-3.47597},{-3.47597,3.47597}}, rotation = -270)));
Modelica.Electrical.Analog.Ideal.IdealDiode D4(Ron = 0.001, Goff = 0.001, Vknee = 2) annotation(Placement(visible = true, transformation(origin = {-32.5772,15.4961}, extent = {{3.15998,-3.15998},{-3.15998,3.15998}}, rotation = -270)));
equation
connect(Source.p,D1.p) annotation(Line(points = {{-77.4522,26.1386},{-43.2308,26.1386},{-43.2308,34.7885},{-43.3597,34.7885}}));
connect(Source.n,ground2.p) annotation(Line(points = {{-77.4522,21.822},{-77.5689,21.822},{-77.5689,15.1815},{-77.6162,15.1815}}));
connect(D4.p,Cbus.n) annotation(Line(points = {{-32.5772,12.3362},{-19.1941,12.3362},{-19.1941,18.3328},{-19.3103,18.3328}}));
connect(D2.p,D4.p) annotation(Line(points = {{-43.0547,11.5669},{-32.5772,11.5669},{-32.5772,12.3362},{-32.5772,12.3362}}));
connect(Source.n,D4.n) annotation(Line(points = {{-77.4522,21.822},{-32.5772,21.822},{-32.5772,18.6561},{-32.5772,18.6561}}));
connect(D3.p,D4.n) annotation(Line(points = {{-34.5142,34.2102},{-32.5772,34.2102},{-32.5772,18.6561},{-32.5772,18.6561}}));
connect(D1.p,D2.n) annotation(Line(points = {{-43.3597,34.7885},{-42.9666,34.7885},{-42.9666,17.3123},{-43.0547,17.3123}}));
connect(Cbus.n,Rload.n) annotation(Line(points = {{-19.3103,18.3328},{1.84897,18.3328},{1.84897,19.6542},{1.92278,19.6542}}));
connect(Cbus.p,Rload.p) annotation(Line(points = {{-19.3103,31.8802},{1.76093,31.8802},{1.76093,31.97},{1.92278,31.97}}));
connect(D3.n,Cbus.p) annotation(Line(points = {{-34.5142,41.1622},{-19.2822,41.1622},{-19.2822,31.8802},{-19.3103,31.8802}}));
connect(D1.n,D3.n) annotation(Line(points = {{-43.3597,41.1085},{-34.6022,41.1085},{-34.6022,41.1622},{-34.5142,41.1622}}));
end ipfc;
Problems are still there, I re-installed the tool (openmodelica) and model it again (diagrammatically). Unfortunately with the same problems, simulation does not run, and by reconnecting, adding/deleting components Connection Editor makes mismatch on model text view. It's kind of weird behavior.
Peter
After some work (reconnecting diagram) I get this on text view:
model ipfc
Modelica.Electrical.Analog.Basic.Inductor inductor1(L = 1e-006)
Modelica.Electrical.Analog.Basic.Ground ground1
Modelica.Electrical.Analog.Sources.SineVoltage Source(V = 230, freqHz = 50)
Modelica.Electrical.Analog.Basic.Resistor Rload(R = 5)
Modelica.Electrical.Analog.Basic.Capacitor Cbus(C = 0.01)
Modelica.Electrical.Analog.Ideal.IdealDiode D2(Ron = 0.001, Goff = 0.001, Vknee = 2)
Modelica.Electrical.Analog.Ideal.IdealDiode D3(Ron = 0.001, Goff = 0.001, Vknee = 2)
Modelica.Electrical.Analog.Ideal.IdealDiode D4(Ron = 0.001, Goff = 0.001, Vknee = 2)
Modelica.Electrical.Analog.Ideal.IdealDiode D1(Ron = 0.001, Goff = 0.001, Vknee = 2)
equation
connect(D3.n[-1],Cbus.p[-1])
connect(D3.p[-1],D4.n[-1])
connect(D1.p[-1],D2.n[-1])
connect(inductor1.n[-1],D1.p[-1])
connect(Cbus.n,ground1.p)
connect(inductor1.n,D1.p)
connect(Source.p,inductor1.p)
connect(D1.p,D2.n)
connect(D1.n,Cbus.p)
connect(Source.n,D4.n)
connect(D3.p,D4.n)
connect(Source.p,inductor1.p)
connect(D2.p,D4.p)
connect(D4.p,Cbus.n)
connect(D3.n,Cbus.p)
connect(D1.n,Cbus.p)
connect(Source.n,ground1.p)
connect(Cbus.n,Rload.n)
connect(Cbus.p,Rload.p)
end ipfc;
My simple rectifier model which does not run on my machine:
model ipfc
Modelica.Electrical.Analog.Basic.Inductor inductor1(L = 1e-006)
Modelica.Electrical.Analog.Basic.Ground ground1
Modelica.Electrical.Analog.Sources.SineVoltage Source(V = 230, freqHz = 50)
Modelica.Electrical.Analog.Basic.Resistor Rload(R = 5)
Modelica.Electrical.Analog.Basic.Capacitor Cbus(C = 0.01)
Modelica.Electrical.Analog.Ideal.IdealDiode D2(Ron = 0.001, Goff = 0.001, Vknee = 2)
Modelica.Electrical.Analog.Ideal.IdealDiode D3(Ron = 0.001, Goff = 0.001, Vknee = 2)
Modelica.Electrical.Analog.Ideal.IdealDiode D4(Ron = 0.001, Goff = 0.001, Vknee = 2)
Modelica.Electrical.Analog.Ideal.IdealDiode D1(Ron = 0.001, Goff = 0.001, Vknee = 2)
equation
connect(Cbus.n,ground1.p)
connect(inductor1.n,D1.p)
connect(Source.p,inductor1.p)
connect(D1.p,D2.n)
connect(D1.n,Cbus.p)
connect(D1.n,D3.n)
connect(Source.n,D4.n)
connect(D3.p,D4.n)
connect(Source.p,inductor1.p)
connect(D2.p,D4.p)
connect(D4.p,Cbus.n)
connect(D3.n,Cbus.p)
connect(D1.n,D3.n)
connect(D1.n,Cbus.p)
connect(Source.n,ground1.p)
connect(Cbus.n,Rload.n)
connect(Cbus.p,Rload.p)
end ipfc;
Morevover,
I've added resistor component and after simulation this component was not in "Plot Variables". Then I've deleted this component but ""Modelica Text View" does not reflect this and old component is still there.
I am using OMEdit 1.8.
Peter
Hello all,
I have simple simulation: sinusoidal source, input rectifier, filtering cap, and resistive load. As soon as resistive load is bigger (low resistor, high current) simulation works, and if my resistive load is low (high resistor, low current) simulation does not work (stops during simulation process). I guess it is convergence problem. Unfortunately I was now able attached the modelica file.
Any change to simulation to start working?
Thank you!
Best regards,
peter
Hello guys,
I am trying to implement digital control which employ variable pulse generation. I need to sample the current signal in the middle of pules (variable pulse). After this sampling I need to execute the calculation of new pulse width where this pulse is valid in the next sampling period.
Any help idea how to do it under modelica?
Best regards,
Peter
P.S. I can establish regular sample interval with "sample" command then how to trigger within this sampling period, moreover I would need to have independent timer synchronized with this sample interval (every interval to reset the timer to 0).
Well,
it seems to me the Modelica capabilities of built-in libraries are not ideal for advanced control algorithms and are not well suited for DSP control.
So I need to mimic advanced microcontroller behavior (Analog to digital converter, Advanced pulse width modulator, timers, etc...) and no capabilities of Modelica libraries reflect this.
Best regards,
Peter
"For now my solution is"
Modelica.Electrical.Analog.Ideal.IdealClosingSwitch Switch1
Modelica.Blocks.Nonlinear.FixedDelay Delay1
Modelica.Blocks.Sources.Pulse Pulse1
Modelica.Blocks.Math.RealToBoolean Realtoboolean1
connect(Pulse1.y,Delay1.u)
connect(Delay1.y,Realtoboolean1.u)
connect(Realtoboolean1.y, Switch1.control)
I am not sure is perfect but it works...
Further I need to add digital control - another challenge
Best regards,
Peter
Hello guys,
I have maybe simple question. I need to delay pulse signal. Unfortunately I am not able to connect components.
I use Modelica.Electrical.Analog.Sources.PulseVoltage and Modelica.Blocks.Nonlinear.FixedDelay - I am not able to connect them.
I need to generate pulses to my transistors which are shifted so I decided to use FixedDelay.
Is there better way to do a delay of pulsing voltage? How to do a mix between Blocks.Nonlinear and Electrical components?
Best regards,
Peter
I changed it within Eclipse/MDT and removed +g=MetaModelica parameter as you suggested but it does not help - the same results.
Then I tried it with OMShell and simulation runs with following warning but it runs at least.
OUTPUT:
record SimulationResult
resultFile = "kruh_res.mat",
simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'test', storeInTemp = false, noClean = false, options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = ''",
messages = "",
timeFrontend = 0.203040510888774,
timeBackend = 0.00654214385838666,
timeSimCode = 0.00436536431159411,
timeTemplates = 0.0235498701169384,
timeCompile = 6.57502087727141,
timeSimulation = 0.269681993090355,
timeTotal = 7.0823182984472
end SimulationResult;
[C:/OpenModelica1.7.0/lib/omlibrary/msl31/Modelica/Blocks/Nonlinear.mo:19:12-23:97:writable] Warning: If-equations are only partially supported. Ignoring assert(lim.u >= lim.uMin - 0.01 * abs(lim.uMin) and lim.u <= lim.uMax + 0.01 * abs(lim.uMax),"Limiter: During initialization the limits have been ignored.However, the result is that the input u is not within the required limits: u = " + String(lim.u,0,true,6) + ", uMin = " + String(lim.uMin,0,true,6) + ", uMax = " + String(lim.uMax,0,true,6));
Hello all,
I am using to use openmodelica 1.7.0, with Eclipse 0.7.7. I want to use Modelica libraries I've create test model see bellow.
Simulating this model I am getting the errors see bellow. I use Eclipse, MDT console to call the model. I can note that Integrator, Abs, Sine works O.K. My question is if I am incorrectly using/calling Modelica libraries (Limiter), if so what is correct call for Modelica libs?
Thanks.
Best regards,
peb
MODEL:
model test
import Modelica.Blocks.Sources;
import Modelica.Blocks.Continuous;
Real s;
Modelica.Blocks.Sources.Sine sin1(phase=90,amplitude=2);
Modelica.Blocks.Continuous.Integrator integ;
Modelica.Blocks.Math.Abs bs;
Modelica.Blocks.Nonlinear.Limiter lim;
equation
s = sin1.y;
integ.u=s;
bs.u = s;
//connect(sin1.y,lim.u);
lim.u=s;
end test;
ERRORS:
record SimulationResult
resultFile = "",
simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'test', storeInTemp = false, noClean = false, options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = ''",
messages = "Simulation failed for model: kruh
[C:/OpenModelica1.7.0/lib/omlibrary/msl31/Modelica/Blocks/Nonlinear.mo:19:12-23:97:writable] Warning: If-equations are only partially supported. Ignoring assert(lim.u >= lim.uMin - 0.01 * abs(lim.uMin) and lim.u <= lim.uMax + 0.01 * abs(lim.uMax),\"Limiter: During initialization the limits have been ignored.However, the result is that the input u is not within the required limits: u = \" + String(lim.u,0,true,6) + \", uMin = \" + String(lim.uMin,0,true,6) + \", uMax = \" + String(lim.uMax,0,true,6));
Error: Error building simulator. Buildlog: Nespr vn syntaxe pý?kazu
perl C:/OpenModelica1.7.0//share/omc/scripts/convert_lines.pl kruh.cpp kruh.conv.cpp.tmp
g++ -I. -o kruh.exe kruh.conv.cpp -L\"C:/Workspace/test\" \"-LC:/OpenModelica1.7.0/lib/omlibrary/msl31/Resources/Library/mingw32\" \"-LC:/OpenModelica1.7.0/lib/omlibrary/msl31/Resources/Library/win32\" \"-LC:/OpenModelica1.7.0/lib/omlibrary/msl31/Resources/Library\" -lModelicaExternalC -lsim -linteractive -I\"C:/OpenModelica1.7.0//include/omc\" -O3 -falign-functions -msse2 -mfpmath=sse -lsendData -lQtNetwork-mingw -lQtCore-mingw -lQtGui-mingw -luuid -lole32 -lws2_32 -L\"C:/OpenModelica1.7.0//lib/omc\" -lc_runtime -lregex -Wl,-Bstatic -lf2c -Wl,-Bdynamic kruh_records.c
kruh.cpp: In function `int checkForAsserts()':
kruh.cpp:1034: error: `mmc_GC_local_state' was not declared in this scope
kruh.cpp:1044: error: invalid conversion from `const void*' to `void*'
kruh.cpp:1044: error: initializing argument 1 of `void* const stringAppend(void*, void*)'
kruh.cpp:1044: error: invalid conversion from `const void*' to `void*'
kruh.cpp:1044: error: initializing argument 2 of `void* const stringAppend(void*, void*)'
kruh.cpp:1045: error: invalid conversion from `const void*' to `void*'
kruh.cpp:1045: error: initializing argument 2 of `void* const stringAppend(void*, void*)'
kruh.cpp:1047: error: invalid conversion from `const void*' to `void*'
kruh.cpp:1047: error: initializing argument 2 of `void* const stringAppend(void*, void*)'
kruh.cpp:1048: error: invalid conversion from `const void*' to `void*'
kruh.cpp:1048: error: initializing argument 2 of `void* const stringAppend(void*, void*)'
\\MinGW\\bin\\mingw32-make: *** [kruh] 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;
Is this still workaround for openmodelica 1.7.0?
Thanks.
/peb
I upgraded my Ubuntu to 10.10 (maverick).
OMEdit runs.
Thanks for advice!
BR,
peb
Thanks.
Anyway, it seems I need to play with my Ubuntu further on. Unfortunately I wanted to stick with LTS...
I run OMEdit in command line
$ OMEdit
and response is
> OMEdit not available on Debian
I did try it and installed from nightly-ubuntu and no luck...
Hi all,
I wanna get started with OMEdit under Ubuntu 10.04 LTS. I've added URI: http://build.openmodelica.org/apt, Distribution: release, Components: contrib in Software Sources within Synaptic Package Manager - I've installed it via Synaptic.
It's installed under Applications->Science->OMEdit but unfortunately it NEVER starts and runs.
Am I missing something?
Do you have positive experience? Any suggestion how to resolve it...
BR,
Peter
Hello all,
I just playing with DrControl - very nice course materials. I would like to have question: right now I am using Python/SciPy & python-control.sourceforge.net to design params for control system. I wonder if there is a way to design control system using/within openmodelica to further enrich the simulation (design the control).
Thanks!
Regards,
/pB.
Hello Uwe,
Are you really right that you were installed OpenModelica correctly for Win 7 (64bit)?
I use Windows 7 Ultimate - 64bit and I got error "OMC errors" starting OMShell.
regards,
peb
Hello All,
does OpenModelica 1.5.0 rc2 support Windows 7 - 64bit.
I get "OMC Error" - was unable to start OMC, therefore OMShell will not work correctly.
Thanks!
Regards,
peb.
- Index
- » Users
- » peb
- » Profile