- Index
- » Users
- » pravin
- » Profile
Posts
Posts
I have tried this with 1.14.0 dev but it is still not working. It is showing error that the array dimension must be known at compile time.
How to set annotations for library(line size, line color, line type, canvas size, grid or no grid canvas etc)?
We are indeed working on fixing library issues with newer version. Thanks a lot for your help.
Yes. Thank you. But I am using OpenModelica 1.11 due to some compatibility issues for the library I am working on. Is it possible to update OMEdit to newer version and use OpenModelica 1.11?
I want to pass value of 'm' to instantiated models and use it as array size, but while compiling it is saying array size of 's' is not defined, you need to define array size while compiling. Is there any other way to do this except specifically writing (m = m) while instantiating?
Code:
package Test
model one
outer parameter Integer m;
Real s[m];
equation
s = fill(7, m);
end one;
model three
inner parameter Integer m = 2;
one to, th;
end three;
end Test;
I have attached model which was working in previous build and giving error
"LOG_NLS_V | warning | <p>proper start-values for some of the following iteration variables might help</p>
LOG_NLS_V | warning | <p>[1] Real $cse5(start=0, nominal=1)</p>"
Please run test model from attached package.
1511336674_post.mo
Thanks
I am trying to solve optimization problem with CLI. I have attached file. I am running "optimize(opr, numberOfIntervals = 10, stopTime = 1, tolerance = 1e-5)" this command in CLI. But it is not showing answer in message window. Instead it gives me the path of .mat file and when I am opening that file using OMEdit it only contains "3".
Why is this happening?
1504680683_post.mo
I am also facing the same problem. Can someone please reply?
I am working on a model where multiple instantiation of model is required and some equations are written in new model where these model are instantiated.
I am instantiating "reboiler" model in "column". There is one array variable called mixMolFrac[2] in reboiler. I need to assign different values to this variable hence I am using if-else conditions. My if- else also coming inside for loop hence I am writing this in algorithm section since writing it in equation section was producing some extra equations.
When I write it in algorithm in if- else as "reboiler.mixMolFrac[:] := {0, 0}" it is showing
[19] 01:26:52 Translation Error
Internal error checkAndGetAlgorithmOutputs failed.
[20] 01:26:52 Translation Error
No system for the symbolic initialization was generated
But if I write this in equation as "reboiler.mixMolFrac[:] = {0, 0}" without if-else, it is giving right results.
There are eight variables which I am writing in if-else in algorithm but only these two variables are giving problem.
Thanks in advance.
Please reply asap
You can write "b = data.a.Tc". Also if you instantiate the Hydrogen model in testdata model and equate it to c then also it will work.
Although I am not sure why this error is coming.
When there is for and if-else in else part of if-else statement equations are not sorted. Please see the "main" in attached model. Why is this happening? Is there any alternative algorithm also if I want to do same thing in equation section. Is that possible?
Thanks.
Code:
package post
connector conn
Real P;
end conn;
model stage
conn out annotation(
Placement(visible = true, transformation(origin = {96, -4}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {96, -4}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Real P;
equation
out.P = P;
end stage;
model main
//last for loop is responsible for problem
stage Stage[noOfStages];// instantiation of stages
Boolean boolOut[noOfStages](each start = true);//for selecting stage which is having output
parameter Integer noOfStages = 3, noOfOut = 1, outStages[noOfOut] = {2}"output stage numbers";
conn Out[noOfOut]"output connector";//only comes in model if there are outputs since its index can be changed
algorithm
//for stages having output, boolOut is false
for i in 1:noOfStages loop
for j in 1:noOfOut loop
if i == outStages[j] then
boolOut[i] := false;
end if;
end for;
end for;
//assigning the values to all stages out
//When I am running model without this for loop it runs fine but this for loop is making some problem
for i in 1:noOfStages loop
if boolOut[i] then
Stage[i].out.P := 0;
else
for j in 1:noOfOut loop
if i == outStages[j] then
Stage[i].out.P := Out[j].P;
end if;
end for;
end if;
end for;
//known output value
Out[1].P := 20;
end main;
Hi,
I want to calculate T in following model. I have made three models. In fist model (dewpoint) I am getting "Jacobian determinant is NaN" and "Invalid root: (1.#INF)^(2)" errors. I tried to simplify and created second model (dewpoint1) . It is working and giving right results for two components. I tried same equations for three components in third model (dewpoint2) but it is showing error.
Why error coming in dewpoint2?
Is there any reference to learn about solvable systems in openmodelica and how to make other systems solvable?
Thank you in advance
package post
package Database
model General
parameter Real VP[6];
end General;
model Methanol
extends General(VP = {101, 73.40342, -6548.076, -7.409987, 5.72492E-06, 2});
end Methanol;
model Ethanol
extends General(VP = {101, 88.0754, -7652.06, -9.471507, 5.928087E-06, 2});
end Ethanol;
model Water
extends General(VP = {101, 74.55502, -7295.586, -7.442448, 0.0000042881, 2});
end Water;
end Database;
model dewpoint
parameter Database.General comp[3] = {meth, eth, wat};
Database data;
parameter data.Methanol meth;
parameter data.Ethanol eth;
parameter data.Water wat;
Real P = 101325, T(start = 0.001);
parameter Real z[3] = {0.33, 0.33, 0.34};
equation
1 / P = sum(z ./ exp(comp[:].VP[2] + comp[:].VP[3] / T + comp[:].VP[4] * log(T) + comp[:].VP[5] .* T .^comp[:].VP[6]));
end dewpoint;
model dewpoint1
parameter Database.General comp[NOC] = {meth, eth};
Database data;
parameter data.Methanol meth;
parameter data.Ethanol eth;
parameter data.Water wat;
parameter Integer NOC = 2;
Real P = 101325, T(start = 0.001), Psat[2](each start = 0.001), s[NOC];
parameter Real z[NOC] = {0.5, 0.5};
equation
Psat = exp(comp[:].VP[2] + comp[:].VP[3] / T + comp[:].VP[4] * log(T) + comp[:].VP[5] .* T .^comp[:].VP[6]);
P = product(Psat[:]) / sum(s[:]);
algorithm
for i in 1:NOC loop
s[i] := 1;
for j in 1:NOC loop
if i == j then
s[i] := s[i] * z[i];
else
s[i] := s[i] * Psat[i];
end if;
end for;
end for;
end dewpoint1;
model dewpoint2
parameter Database.General comp[3] = {meth, eth, wat};
Database data;
parameter data.Methanol meth;
parameter data.Ethanol eth;
parameter data.Water wat;
parameter Integer NOC = 3;
Real P = 101325, T(start = 0.001, min = 0.001), Psat[3](each start = 0.001), s[NOC];
parameter Real z[NOC] = {0.33, 0.33, 0.34};
equation
Psat = exp(comp[:].VP[2] + comp[:].VP[3] / T + comp[:].VP[4] * log(T) + comp[:].VP[5] .* T .^ comp[:].VP[6]);
P = product(Psat[:]) / sum(s[:]);
algorithm
for i in 1:NOC loop
s[i] := 1;
for j in 1:NOC loop
if i == j then
s[i] := s[i] * z[i];
else
s[i] := s[i] * Psat[i];
end if;
end for;
end for;
end dewpoint2;
end post;
Thank you very much. It have answered my all questions.
Thank you very much for instant reply.
I am new to coding. I have made enumeration of just names and then trying to assign value to record instantiated by general properties using if else statements. Since we can create drop down menu using enumeration which is not available as choices. I am trying to create model which can fully used with just GUI.
What do you mean by we need components not record in Database. Component is enumeration. enumeration cannot contain parameters and their values. I have more parameters also which are not given in code. Some of them are array.
Is it possible to define them inside enumeration?
One different question. Is it possible to have different dialog boxes for different parameters in array. eg. If I want to make an array of Component component[2]. I have to write {Test1.Component.Air, Test1.Component.Argon} in GUI dialog box. So if we have different dialog box we can choose both by using drop down menu.
Is this making sense or am I missing something?
Thanks
Pravin
Hi , I am working on creating models using OpenModelica at IITB. I am trying make model where component can be selected by using drop down menu. I have done it as shown in code.
package Test1
type Component = enumeration(Air, Argon, Bromine, Carbontetrachloride, Carbonmonoxide);
package Database
extends Modelica.Icons.VariantsPackage;
record General_Properties
parameter Integer SN;
parameter String name;
parameter Real Tc;
parameter Real Pc;
parameter Real Vc;
parameter Real Cc;
parameter Real Tb;
parameter Real Tm;
parameter Real TT;
parameter Real TP;
parameter Real MW;
end General_Properties;
record Air
extends General_Properties(SN = 1, name = "Air", Tc = 132.45, Pc = 3774000, Vc = 0.09147, Cc = 0.313, Tb = 78.67, Tm = 59.15, TT = 59.15, TP = 5642.15, MW = 28.96);
end Air;
record Argon
extends General_Properties(SN = 2, name = "Argon", Tc = 150.86, Pc = 4898000, Vc = 0.07457, Cc = 0.291, Tb = 87.27, Tm = 83.8039, TT = 83.8, TP = 68906.1, MW = 39.948);
end Argon;
record Bromine
extends General_Properties(SN = 3, name = "Bromine", Tc = 584.15, Pc = 1.03E+07, Vc = 0.135, Cc = 0.286, Tb = 331.9, Tm = 265.9, TT = 265.85, TP = 5853.37);
end Bromine;
record Carbontetrachloride
extends General_Properties(SN = 4, name = "Carbontetrachloride", Tc = 556.3, Pc = 4557000, Vc = 0.276, Cc = 0.271, Tb = 349.79, Tm = 250.33, TT = 250.33, TP = 1122.46, MW = 153.822);
end Carbontetrachloride;
record Carbonmonoxide
extends General_Properties(SN = 5, name = "Carbonmonoxide", Tc = 132.85, Pc = 3494000, Vc = 0.0931, Cc = 0.292, Tb = 81.66, Tm = 68.15, TT = 68.15, TP = 15400, MW = 28.01);
end Carbonmonoxide;
end Database;
function get_comp
extends Modelica.Icons.Function;
output Database.General_Properties Comp;
input Component component;
algorithm
if component == Component.Air then
Comp := Database.Air;
elseif component == Component.Argon then
Comp := Database.Argon;
elseif component == Component.Bromine then
Comp := Database.Bromine;
elseif component == Component.Carbontetrachloride then
Comp := Database.Carbontetrachloride;
elseif component == component.Carbonmonoxide then
Comp := Database.Carbonmonoxide;
end if;
end get_comp;
model MS
extends Modelica.Icons.SourcesPackage;
parameter Component component;
Database.General_Properties comp;
equation
comp = get_comp(component);
end MS;
model Test
MS mS1(component = Test1.Component.Argon) annotation(Placement(visible = true, transformation(origin = {-2, 48}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
end Test;
end Test1;
But I am getting type mismatch error. Is there any way to assign value to a record or a model in an algorithm or an equation section?
Also Is it possible to make separate dialog boxes for each parameter in an array, rather than using single box for all parameters in an array?
I am also getting similar error
DQKern_ProcessHT.Chap11.Two.Main.c: In function 'DQKern_ProcessHT_Chap11_Two_Main_eqFunction_64':
DQKern_ProcessHT.Chap11.Two.Main.c:299: error: '$PG$lB11$rB' undeclared (first use in this function)
DQKern_ProcessHT.Chap11.Two.Main.c:299: error: (Each undeclared identifier is reported only once
DQKern_ProcessHT.Chap11.Two.Main.c:299: error: for each function it appears in.)
\MinGW\bin\mingw32-make: *** [DQKern_ProcessHT.Chap11.Two.Main.o] Error 1
\MinGW\bin\mingw32-make: *** Waiting for unfinished jobs....
Compilation process failed. Exited with code 2.
- Index
- » Users
- » pravin
- » Profile