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
  • » MProp
  • » Profile

Posts

Posts

Sep-18-15 07:01:28
Error of "no such file or directory"

From my limited expirience with OpenModelica I would say it is not possible to call external c function via modelica paths.
At least this is not possible with external table data for the CombiTable models.

The solutions for this was to use the loadResource function to convert modelica paths to absoulte file paths

So try to load the external file with the output of this code line:

Code:

Modelica.Utilities.Files.loadResource("modelica://<LibraryName>/Resources/Include") 

This is a common error in using OpenModelica.
There should be some kind of FAQ for this.

You have to redeclare a full fluid model by adding

Code:

redeclare package Medium = Modelica.Media.Water.StandardWater

or any other medium you might be interested in.
This can be done either in the parameter windows in the modifiers section, either it can be done in text view. Just compare it to the text view of the example.

Sep-02-15 13:55:30
Lots of errors when saving model in library

I got it. In my Linux version 1.9.3 r25881 I can save all models in this library just as fine as in dymola.
Can't wait till 1.9.3 release.

Aug-31-15 08:05:47
Lots of errors when saving model in library

Regarding libraries I have another question.

When I try to save a Model existing in my new user created library, I get an error for each and every model in this library unable to save.
The error message reads:

[1] 09:39:56 Scripting Error
Failed to load package SubpackageName() using MODELICAPATH
Path to Library;Path to folder containing library folder.

[2] 09:39:56 Grammar Error
[Path to Packagepackage.mo: 3:1-6:10]: Expected the package to have within ; but got within Library Name;.

Perhaps I made a mistake with creating the library, altough I was working along the "Writing libraries compliant to the Modelica specification" article in the wiki.

EDIT:
I doubt there is a mistake as in Dymola demo saving of models in this library just works fine.

@20088921
From my expirience, I would say there is no fluid defined in your model, or there is some other small dumb error preventing OpenModelica to understand your model.
But I would bet on the missing fluid model. Check your model modifiers in the Text View for "redeclare Package" or something like that.

@claudio34
No idea on that error message. Most likely it would help someone else solving this problem if you provide the model with which this error occurs.

Aug-28-15 05:52:07
I am despairing on this topic

Wow, thanks. Now I understand.
But why can pictures be accessed directly via modelica:// links and other files can not?

However THANK YOU!

Aug-27-15 12:30:40
I am despairing on this topic

I was creating a small library for personal use, that I don't have to load all the models I use models over and over again.

The problem now is, that I have a model using the CombiTable2D with tableOnFile = true.
Until now I used absolute file path to the table file. But with the library at hand, I wanted to store this table file along the model and make the whole libraray a little bit portable.

I read in another thread, that relative file paths are evil in OpenModelica. But the Modelica Standard Library use relative file paths for all the images inside the documentation, so where is the problem doing the same with a table.txt file?

I don't quite understand the first part of your question in conjunction with the second one. How can you open your csv-output file if you don't know where to find it?

I will try to answer you anyway, as I just found out yesterday how to do this.
You can find the output file in C:\Users\"UserName"\AppData\Local\Temp\OpenModelica\OMEdit as stated in the simulation window. The model_name_res.csv file can be opened as is in Excel, but this is not favourable, as it is awful to read this way. Better import it to Excel.
In my 2010 version of Excel this is found in Data - from text, then browse to the correct folder and choose the csv file you want the data from. A wizard will open, where you can format the imported text. You can leave nearly all settings to standard, just choose the right separator sign and there you go.

Hope this will help you

Aug-03-15 11:52:13
Something inside this code prevents default values in attribute window

Ok, by using try and error method, I found the problem.
It is this line:

Code:

 parameter Real mm = 0.026 annotation(Dialog(group = "Parameters for c_p Curve", tab = "Cp Curve")), mt = -1.72 annotation(Dialog(group = "Parameters for c_p Curve", tab = "Cp Curve")), tm = -0.044 annotation(Dialog(group = "Parameters for c_p Curve", tab = "Cp Curve")), tt = 3.13 annotation(Dialog(group = "Parameters for c_p Curve", tab = "Cp Curve")); 

By replacing it with one parameter per line, instead of all in one line, the Connectors and parameters are reappearing.
I don't know, if this is a bug or a feature, but it seems to me like a bug.

Jul-31-15 14:44:41
Something inside this code prevents default values in attribute window

So I did some more research and found this behavior not only on my main Installation in Windows 1.9.2 (r25117), but also on Linux build 1.9.3(r25881).
Editing the attributes via rightliclick - attributes leads to crash on saving changes.

Jul-29-15 09:46:11
Something inside this code prevents default values in attribute window

I expirienced a strange behavior of OMedit

I created a model with some connectors of Type RealInput and RealOutput. After some changes to code I decided to add units to the connectors via

Code:

(units="m")

This is where my problem started, cause after i saved that the input and output symbols disapeared from icon and diagram view, but are still visible in text view. So I deleted the units, but they did not come back.
I added a new connector RealInput and added again unit and it disapeared again from diagram and icon view.
The strange thing is, this problem is persistent in this model but does not appear in any other model I created, so I added the file as attachement.

After some more investigation i found out in any model that has some of following code included you can not add any new block. That is because there are no attributes written for this blocks. So if you look for the attributes of a new added block all fields are empty.
This is not specifically to the file I attached, but any other model I created using most of the code from this.

Another strange thing is, that besides the strange behavior for adding new blocks, the model can be used fine in simulation. Even added connectors without an attribute can be used to connect the model to others, altough not with the comfortable graphic connection interface but connecting via text input.

So can anyone with more expirience in programming than me look trough the code and give a hint why OpenModelica behaves this way.

Code:

model PowerProp_102_ "Model to generate a power demand of a propeller"

  extends PropellerIcon;
  import SI = Modelica.SIunits;
  import SI_conv = Modelica.SIunits.Conversions;
  outer Modelica.Fluid.System system "System wide properties";
  constant Real R_s(final unit = "J/(kg.K)") = 287.058 "Specific gas constant of dry air";
  //Variables
  // Power calculation
  Real j "Performance factor";
  Real c_p "Power coefficient";
  // Environment
  SI.Density rho = system.p_ambient / (R_s * system.T_ambient) "Density of the air specified in the system block";
  //Parameters
  // Blade parameters
  parameter SI.Diameter D(fixed = true) = 2 "Diameter of propeller" annotation(Dialog(group = "Blade parameters"));
  // Additional paramters for Cp Curves
  parameter Real mm = 0.026 annotation(Dialog(group = "Parameters for c_p Curve", tab = "Cp Curve")), mt = -1.72 annotation(Dialog(group = "Parameters for c_p Curve", tab = "Cp Curve")), tm = -0.044 annotation(Dialog(group = "Parameters for c_p Curve", tab = "Cp Curve")), tt = 3.13 annotation(Dialog(group = "Parameters for c_p Curve", tab = "Cp Curve"));
  //Diagnostics
  parameter SI_conv.NonSIunits.AngularVelocity_rpm n_start = 2000;
  //Connectors
  Modelica.Blocks.Interfaces.RealInput V(final unit = "m/s") "TAS" annotation(Placement(visible = true, transformation(origin = {-108, -1.33227e-15}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-92, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Interfaces.RealInput beta(final unit = "deg") "Blade angle" annotation(Placement(visible = true, transformation(origin = {-3.55271e-15, -108}, extent = {{-20, -20}, {20, 20}}, rotation = 90), iconTransformation(origin = {0, -100}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
  Modelica.Blocks.Interfaces.RealInput n(final unit = "1/min") "Rotational speed" annotation(Placement(visible = true, transformation(origin = {108, -40}, extent = {{20, -20}, {-20, 20}}, rotation = 0), iconTransformation(origin = {98, -50}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  Modelica.Blocks.Interfaces.RealOutput P_prop(final unit = "W") "Power demand" annotation(Placement(visible = true, transformation(origin = {112, 3.55271e-15}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {100, 2}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
initial equation
  P_prop = 40000;
equation
  //Propellerleistung
  j = V / (n / 60 * D);
  c_p = P_prop / (rho * (n / 60) ^ 3 * D ^ 5);
  c_p = (mm * beta + mt) * j + tm * beta + tt;
  //Diagnostics
  //v = der(flange.s);
  annotation(Documentation(info = "<html>
<p>This model calculates the power demand of the propeller from true air speed V[m/s], blade angle &beta;[°], rotational speed n[1/min] and air density &rho; from the system definition.<br>
Air density is not included directly in the system definition block. So it is calculated using formula as follows.</p>
<code>&rho; = p / (R<sub>s</sub> * T)</code>
<p>with pressure p[Pa] and temperatur T[K] from the system block and specific gas constant of dry air R<sub>s</sub> = 287.058 J/Kg.K. For moist air there are several formulas that can be used e.g. Magnus-Formula, but in this iteration moist air is not considered.</p>
<p>The calculation of the power demand is done via a merely coarse interpolated propeller diagram. The propeller diagram is assumed linear and linear interpolated. Therefore there are four parameters to define this double linear system.</p>
</html>", revisions = "<html>
<ul>
<li><i>28 Jul 2015</i>
    by <a href=\"mailto:mayr19@hm.edu\">Matthias Maximilian Mayr</a><br>
       First release of model</li>
</ul>
</html>"), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2}), graphics = {Line(origin = {50, 0}, points = {{-50, 0}, {50, 0}}, thickness = 3), Line(origin = {-87, -25.14}, points = {{-13, 15.1437}, {5, 15.1437}, {13, 9.14373}, {13, -2.85627}, {7, -8.85627}, {7, -8.85627}}, color = {0, 85, 255}, thickness = 1.25, smooth = Smooth.Bezier), Line(origin = {-77, -19.14}, points = {{-13, 15.1437}, {5, 15.1437}, {13, 9.14373}, {13, -2.85627}, {7, -8.85627}, {7, -8.85627}}, color = {0, 85, 255}, thickness = 1.25, smooth = Smooth.Bezier), Line(origin = {-75, -11.14}, points = {{-13, 15.1437}, {5, 15.1437}, {13, 23.1437}, {9, 33.1437}}, color = {0, 85, 255}, thickness = 1.25, smooth = Smooth.Bezier), Line(origin = {-85, -3.14}, points = {{-13, 15.1437}, {5, 15.1437}, {13, 23.1437}, {9, 35.1437}, {-3, 35.1437}, {-3, 35.1437}}, color = {0, 85, 255}, thickness = 1.25, smooth = Smooth.Bezier), Text(origin = {1, 98}, extent = {{-109, 30}, {93, -22}}, textString = "%name"), Line(origin = {-1.99, -64.75}, points = {{-12.0087, 8.7525}, {-18.0087, -5.24753}, {1.99135, -13.2475}, {17.9913, -5.24753}, {13.9913, 8.7525}}, thickness = 1.5, arrow = {Arrow.None, Arrow.Filled}, smooth = Smooth.Bezier), Text(origin = {-60, 3}, extent = {{-6, 7}, {10, -15}}, textString = "V"), Text(origin = {32, -89}, extent = {{-16, 9}, {12, -5}}, textString = "beta"), Text(origin = {88, 15}, extent = {{-34, 31}, {14, -15}}, textString = "P_prop"), Text(origin = {82, -49}, extent = {{-16, 13}, {8, -11}}, textString = "n"), Line(origin = {42.01, -0.75}, rotation = -90, points = {{-12.0087, 8.7525}, {-18.0087, -5.24753}, {1.99135, -13.2475}, {17.9913, -5.24753}, {13.9913, 8.7525}}, thickness = 1.5, arrow = {Arrow.None, Arrow.Filled}, smooth = Smooth.Bezier)}));
end PowerProp_102_;

propmodel-102-.zip

Jul-17-15 12:12:25
Saving causes new tab stop on annotations in /* operator

Hi,

Is anyone else expiriencing this bug?
Every time I save my model a new tab stop is created on any annotation line between /* and */ this causes them to travel right an an amount of way in some models.

Jul-14-15 14:03:03
any idea is appreciated

Hi,
I want to model a stop for a cylinder, so when the piston hits the bottom there will be no further movement.

So I grabbed the sweptVolume model and added a little bit, so that when a certain position is reached a strong spring is kicking in and forces the piston to a hold.

I also found a model of a stop from an old Modelica Library, that sets position and velocity to zero, when the stop is reached. It forces the position and velocity to be state variables. I tried to replicate that in my model, which is currently commented out.

But neither of this ideas had satisfactory results. Now  I am out of ideas, so I will be happy for every new idea of you.

Cylinder Code

Code:

model SweptVolumeWithStop "varying cylindric volume depending on the position of the piston"

  import Modelica.Constants.pi;
  import SI = Modelica.SIunits;
  parameter SI.Area pistonCrossArea "cross sectional area of piston";
  parameter SI.Volume clearance "remaining volume at zero piston stroke";
  SI.Volume V "fluid volume";
  //SI.Velocity v(stateSelect = StateSelect.always) "speed of piston";
  SI.Force F_stop "";
  //SI.Position ps(stateSelect = StateSelect.always) = flange.s;
  //parameter SI.Position smin = Modelica.Constants.small;
  //parameter SI.Position smax = 1;
  parameter SI.ModulusOfElasticity E = 1e6;
  // Mass and energy balance, ports
  extends Modelica.Fluid.Vessels.BaseClasses.PartialLumpedVessel(final fluidVolume = V, heatTransfer(surfaceAreas = {pistonCrossArea + 2 * sqrt(pistonCrossArea * pi) * (flange.s + clearance / pistonCrossArea)}));
  Modelica.Mechanics.Translational.Interfaces.Flange_b flange "translation flange for piston" annotation(Placement(transformation(extent = {{-10, 90}, {10, 110}}, rotation = 0)));
equation
  //assert(flange.s >= 0, "Piston stroke (given by flange.s) must not be smaller than zero!");
  //v = der(flange.s);
  // volume size
  V = clearance + flange.s * pistonCrossArea;
  0 = flange.f + (medium.p - system.p_ambient) * pistonCrossArea + F_stop;
  if flange.s <= clearance / pistonCrossArea then
    F_stop = sqrt(0.5) * pistonCrossArea * E / 7e-3 * abs(flange.s - clearance / pistonCrossArea);
  else
    F_stop = 0;
  end if;
  // energy balances
  Wb_flow = medium.p * pistonCrossArea * (-der(flange.s));
  // definition of port pressures
  for i in 1:nPorts loop
    vessel_ps_static[i] = medium.p;
  end for;
  /*algorithm
                    when initial() then
                      assert(ps > smin or ps >= smin and v >= 0, "Error in initialization of hard stop. (s - L/2) must be >= smin ");
                      assert(ps < smax or ps <= smax and v <= 0, "Error in initialization of hard stop. (s + L/2) must be <= smax ");
                    end when;
                    when not ps < smax then
                      reinit(ps, smax);
                      if not initial() or v > 0 then
                        reinit(v, 0);
                      end if;
                    end when;
                    when not ps > smin then
                      reinit(ps, smin);
                      if not initial() or v < 0 then
                        reinit(v, 0);
                      end if;
                    end when;*/
  annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-50, 36}, {50, -90}}, lineColor = {0, 0, 255}, pattern = LinePattern.None, lineThickness = 1, fillColor = {170, 213, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{-52, 62}, {-48, 62}, {-48, -30}, {-52, -30}, {-52, 62}}, lineColor = {95, 95, 95}, smooth = Smooth.None, fillColor = {135, 135, 135}, fillPattern = FillPattern.Backward), Polygon(points = {{48, 60}, {52, 60}, {52, -34}, {48, -34}, {48, 60}}, lineColor = {95, 95, 95}, smooth = Smooth.None, fillColor = {135, 135, 135}, fillPattern = FillPattern.Backward), Rectangle(extent = {{-48, 40}, {48, 30}}, lineColor = {95, 95, 95}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Forward), Rectangle(extent = {{-6, 92}, {6, 40}}, lineColor = {95, 95, 95}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Forward), Polygon(points = {{-48, -90}, {48, -90}, {48, 70}, {52, 70}, {52, -94}, {-52, -94}, {-52, 70}, {-48, 70}, {-48, -90}}, lineColor = {95, 95, 95}, smooth = Smooth.None, fillColor = {135, 135, 135}, fillPattern = FillPattern.Backward), Line(visible = use_HeatTransfer, points = {{-100, 0}, {-52, 0}}, smooth = Smooth.None, color = {198, 0, 0})}));
end SweptVolumeWithStop;


Code of test environment


Code:

model test_cylinder

  inner Modelica.Fluid.System system annotation(Placement(visible = true, transformation(origin = {72, -70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.Boundary_pT boundary(p = 200000, nPorts = 1, redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater) annotation(Placement(visible = true, transformation(origin = {-70, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe(length = 20, diameter = 0.01, redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater) annotation(Placement(visible = true, transformation(origin = {-28, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  SweptVolumeWithStop sweptvolumewithstop1(pistonCrossArea = 1, clearance = 2e-7, nPorts = 1, use_portsData = false, redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater) annotation(Placement(visible = true, transformation(origin = {30, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Mechanics.Translational.Components.InitializeFlange initializeflange1(use_s_start = true, use_v_start = false, use_a_start = false) annotation(Placement(visible = true, transformation(origin = {70, 70}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant const(k = 1e-3) annotation(Placement(visible = true, transformation(origin = {70, 44}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Mechanics.Translational.Sources.Force force1 annotation(Placement(visible = true, transformation(origin = {-2, 90}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Ramp ramp1(height = -3e6, duration = 50) annotation(Placement(visible = true, transformation(origin = {-50, 90}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(ramp1.y, force1.f) annotation(Line(points = {{-39, 90}, {-14, 90}, {-14, 90}, {-14, 90}}, color = {0, 0, 127}));
  connect(force1.flange, sweptvolumewithstop1.flange) annotation(Line(points = {{8, 90}, {30, 90}, {30, 60}, {30, 60}}, color = {0, 127, 0}));
  connect(const.y, initializeflange1.s_start) annotation(Line(points = {{81, 44}, {94, 44}, {94, 76}, {84, 76}, {84, 76}}, color = {0, 0, 127}));
  connect(initializeflange1.flange, sweptvolumewithstop1.flange) annotation(Line(points = {{60, 70}, {30, 70}, {30, 60}, {30, 60}}, color = {0, 127, 0}));
  connect(pipe.port_b, sweptvolumewithstop1.ports[1]) annotation(Line(points = {{-18, 30}, {30, 30}, {30, 40}, {30, 40}}, color = {0, 127, 255}));
  connect(boundary.ports[1], pipe.port_a) annotation(Line(points = {{-60, 30}, {-38, 30}, {-38, 30}, {-38, 30}}, color = {0, 127, 255}));
  annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), experiment(StartTime = 0, StopTime = 50, Tolerance = 0.0001, Interval = 0.1));
end test_cylinder;

Models of old Modelica Library (I guess)

Code:

model Stop "Sliding mass with hard stop and Stribeck friction"

  extends FrictionBase(s(stateSelect = StateSelect.always));
  Modelica.SIunits.Velocity v(stateSelect = StateSelect.always) "Absolute velocity of flange_a and flange_b";
  Modelica.SIunits.Acceleration a "Absolute acceleration of flange_a and flange_b";
  parameter Modelica.SIunits.Mass m = 1 "mass";
  parameter Real F_prop(final unit = "N/ (m/s)", final min = 0) = 1 "velocity dependent friction";
  parameter Modelica.SIunits.Force F_Coulomb = 5 "constant friction: Coulomb force";
  parameter Modelica.SIunits.Force F_Stribeck = 10 "Stribeck effect";
  parameter Real fexp(final unit = "1/ (m/s)", final min = 0) = 2 "exponential decay";
equation
  // Constant auxiliary variables
  f0 = F_Coulomb + F_Stribeck;
  f0_max = f0 * 1.001;
  free = f0 <= 0 and F_prop <= 0 and s > smin + L / 2 and s < smax - L / 2;
  // Velocity and acceleration of flanges
  v = der(s);
  a = der(v);
  v_relfric = v;
  a_relfric = a;
  // Equilibrium of forces
  0 = flange_a.f + flange_b.f - f - m * der(v);
  // Friction force
  f = if locked then sa else if free then 0 else if startForward then F_prop * v + F_Coulomb + F_Stribeck else if startBackward then F_prop * v - F_Coulomb - F_Stribeck else if pre(mode) == Forward then F_prop * v + F_Coulomb + F_Stribeck * exp(-fexp * abs(v)) else F_prop * v - F_Coulomb - F_Stribeck * exp(-fexp * abs(v));
  // Define events for hard stops and reinitiliaze the state variables velocity v and position s
algorithm
  when initial() then
    assert(s > smin + L / 2 or s >= smin + L / 2 and v >= 0, "Error in initialization of hard stop. (s - L/2) must be >= smin ");
    assert(s < smax - L / 2 or s <= smax - L / 2 and v <= 0, "Error in initialization of hard stop. (s + L/2) must be <= smax ");
  end when;
  when not s < smax - L / 2 then
    reinit(s, smax - L / 2);
    if not initial() or v > 0 then
      reinit(v, 0);
    end if;
  end when;
  when not s > smin + L / 2 then
    reinit(s, smin + L / 2);
    if not initial() or v < 0 then
      reinit(v, 0);
    end if;
  end when;
end Stop;

And the BaseClass of this

Code:

partial model FrictionBase "Base class of Coulomb friction elements"

  extends Modelica.Mechanics.Translational.Interfaces.PartialRigid;
  import SI = Modelica.SIunits;
  parameter SI.Position smax = 25 "right stop for (right end of) sliding mass";
  parameter SI.Position smin = -25 "left stop for (left end of) sliding mass";
  parameter SI.Velocity v_small = 1e-3 "Relative velocity near to zero (see model info text)";
  // Equations to define the following variables have to be defined in subclasses
  SI.Velocity v_relfric "Relative velocity between frictional surfaces";
  SI.Acceleration a_relfric "Relative acceleration between frictional surfaces";
  SI.Force f "Friction force (positive, if directed in opposite direction of v_rel)";
  SI.Force f0 "Friction force for v=0 and forward sliding";
  SI.Force f0_max "Maximum friction force for v=0 and locked";
  Boolean free "true, if frictional element is not active";
  // Equations to define the following variables are given in this class
  Real sa "Path parameter of friction characteristic f = f(a_relfric)";
  Boolean startForward "true, if v_rel=0 and start of forward sliding or v_rel > v_small";
  Boolean startBackward "true, if v_rel=0 and start of backward sliding or v_rel < -v_small";
  Boolean locked "true, if v_rel=0 and not sliding";
  constant Integer Unknown = 3 "Value of mode is not known";
  constant Integer Free = 2 "Element is not active";
  constant Integer Forward = 1 "v_rel > 0 (forward sliding)";
  constant Integer Stuck = 0 "v_rel = 0 (forward sliding, locked or backward sliding)";
  constant Integer Backward = -1 "v_rel < 0 (backward sliding)";
  Integer mode(final min = Backward, final max = Unknown, start = Unknown);
equation
  /* Friction characteristic
             (locked is introduced to help the Modelica translator determining
              the different structural configurations, if for each configuration
              special code shall be generated)
          */
  startForward = pre(mode) == Stuck and (sa > f0_max and s < smax - L / 2 or pre(startForward) and sa > f0 and s < smax - L / 2) or pre(mode) == Backward and v_relfric > v_small or initial() and v_relfric > 0;
  startBackward = pre(mode) == Stuck and (sa < (-f0_max) and s > smin + L / 2 or pre(startBackward) and sa < (-f0) and s > smin + L / 2) or pre(mode) == Forward and v_relfric < (-v_small) or initial() and v_relfric < 0;
  locked = not free and not (pre(mode) == Forward or startForward or pre(mode) == Backward or startBackward);
  a_relfric = if locked then 0 else if free then sa else if startForward then sa - f0 else if startBackward then sa + f0 else if pre(mode) == Forward then sa - f0 else sa + f0;
  /* Friction torque has to be defined in a subclass. Example for a clutch:
               f = if locked then sa else if free then 0 else cgeo*fn*
                        (if startForward  then  Math.tempInterpol1( w_relfric, mue_pos, 2)
                     else if startBackward then -Math.tempInterpol1(-w_relfric, mue_pos, 2)
                     else if pre(mode) == Forward then Math.tempInterpol1(w_relfric, mue_pos, 2)
                     else -Math.tempInterpol1(-w_relfric, mue_pos, 2));
          */
  // finite state machine to determine configuration
  mode = if free then Free else if (pre(mode) == Forward or pre(mode) == Free or startForward) and v_relfric > 0 and s < smax - L / 2 then Forward else if (pre(mode) == Backward or pre(mode) == Free or startBackward) and v_relfric < 0 and s > smin + L / 2 then Backward else Stuck;
end FrictionBase;

Jun-11-15 12:04:26
Changing something via text view disables parameter canching via Parameter Window

Hi,
I am starting with fluid simulation in OpenModelica and there is one thing that bugs me.

When I first put my model together, I can change all the values via the parameter window (rightclick on block - parameter).
But after entering the fluid via the text view, which is the only way as far as I know, there is no chance to change parameters via gui any more.
I surely can write new values in the parameter window fields, but they are not saved.

I hope that I explained my problem good enough and that someone is expiriencing this problem too.
Maybe even someone has a solution to this.

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