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

Posts

Posts

Instead of a switch you can use a TriggeredSampler.  I think that might do what you want.  You can trigger it every 30 seconds and it will then hold the output constant for until the next sample transition. 

You can just run the docker image without using the GUI (although it does still start some graphics stuff in the background). 
For example you can run a bash shell then use OMShell:

docker run -it dersh/om-desktop-stable /bin/bash

Then you can run:
OMShell-terminal


Or you can directly run omc.  For example to see the omc help you can do this:
docker run -it dersh/om-desktop-stable omc -h

Run the image:

docker run -d -p 25901:5901 -p 26901:6901 dersh/om-desktop-stable

Then, connect to the image using a web-browser by opening the URL. If you are running both on the same machine open this:

http://localhost:26901/vnc.html?password=headless

Then, click connect, and you should see a desktop in your browser.  Then, on the upper left of the desktop you should see "Applications"  Click that, then Development->OMEdit and you should see the OMEdit GUI and can run anything that you want.

You can just look at the dockerfiles that I created.  All they do is take a base image for xubuntu and add OpenModelica on top.  I chose an image that includes a GUI that is accessible from the host using novnc, so that you don't have to use X11 on your host. 
In case you are having trouble finding the files they are here and here

The link is to a discussion of an OpenModelica docker container.  You should be able to just run that container.  Or, if you can look at the code to build it, and modify it for your own use. 
I'm not sure what else you don't understand about it? 

Thanks for the suggestions.  I think that the rm has to be in the same RUN command, or it will cause a new layer to be added, so there is no net benefit in the size.
I've implemented both suggestions (I added the rm to the layer).  They are building now and should be available shortly.
X11 from/to Docker can be annoying to setup properly.  So, hopefully this implementation can make it easier for any users.

I've created an OpenModelica Docker image that includes a desktop.  There are two versions, one is stable (1.16) and the other is based on the newest nightly (1.17.x).  To use them first Install docker (on Mac, Windows or Linux) then run either:
docker run -d -p 25901:5901 -p 26901:6901 dersh/om-desktop-stable

or

docker run -d -p 25901:5901 -p 26901:6901 dersh/om-desktop-nightly

Then connect to the instance by using a web browser to go to:

http://localhost:26901/vnc.html?password=headless

and you should see a desktop and be able to run OpenModelica. 
You should also be able to run the docker image on a remote machine and then connect to it for viewing, as above.

I just tried it  out, and it is working fine. 

I just downloaded the new image.  It opens fine in VirtualBox, but I can't find OMEdit, or anything else Modelica related in the virtual machine.  So, perhaps an install step was skipped?

It sounds like what you  want is a CombiTable2D:

CombiTable2D

Jul-11-19 13:56:53
Help installing OM on Mac OS.

What currently works for me is to install macports.  Then:

echo rsync://build.openmodelica.org/macports/ >> /opt/local/etc/macports/sources.conf
sudo port selfupdate
sudo port install openmodelica-devel +libraries

The instructions don't mention that you need to run with "sudo". 
Also, after the install there is a bug in the port file and it builds a component of OM that it doesn't correctly install.  So, Macports then complains that there is a linking error and tries to rebuild a few times before it finally gives up. 
But, best I can tell, OM does then work fine (except, I assume, for that one mysterious component that is not being linked properly)

Jan-16-19 19:49:13
VirtualBox VM with OpenModelica and guest additions and more

It appears that the setting of linux version probably doesn't matter:
VBox Version  It appears to just be a convenient way to do a bunch of other settings.  Hopefully, those are already correct. 
You probably also need to upgrade your version of Linux to upgrade the vbox add ons.

Jan-08-19 14:59:21
VirtualBox VM with OpenModelica and guest additions and more

I don't know what OS the newer OpenModelica VMs are built on.  I have an older one around, and that one does use Ubuntu.  I just tried to mount the Guest CD and got an error that it could not mount because the VM doesn't have an optical disk.  So, you probably need to add a virtual CD, and perhaps some drivers.  Or you can add the guest additions, as suggested above, and suggested here:  Title from the command line in Ubuntu.

Jan-08-19 01:38:46
VirtualBox VM with OpenModelica and guest additions and more

I believe that recent versions of the provided VM are broken.  I have tried a few different downloads and a few different versions of VirtualBox and I get the same failed result.  It seems that something is wrong with how they are currently being built.  I have already filed a ticket:

5262https://trac.openmodelica.org/OpenModelica/ticket/5262


Guest additions is not really a OpenModelica issue, but is instead an issue with VirtualBox.  But, perhaps this will help:
VBox Additions

Usually, I use a native build of OpenModelica on my Mac, but that currently fails as well. 

Sep-13-18 21:49:00
Mean Value Of a Signal

Here's an example of the sum of a random variable:

sampling-test.mo

Sep-13-18 14:48:53
Mean Value Of a Signal

You can take your continuous signal, then pass it through Modelica.Blocks.Continuous.Sampler then integrate it.  Between each sample the value will be constant, but the integral will increase.  But, when you divide by the time, you should be able to correct that out.  You can also then use sampler again after, if you want it not to change. 

Sep-13-18 13:43:38
Mean Value Of a Signal

The mean of a time varying signal is going to be time varying.  So, I really don't understand what you are looking for.  Can you explain more of what you want?

Sep-07-18 14:09:11
Mean Value Of a Signal

The sum of a continuous signal is the integration.  So, you can use Modelica.Blocks.Continuous.Integrator to get that sum.  Then, divide by t to get the average.

Jun-04-18 13:47:36
How to reconcile a conflict between MacPorts ports of openmodelica-devel and octave?

This really is a problem of macports and octave, not openmodelica.  OM is using the current version of sundials (the port is named sundials  currently version 3.1.0).  Whille, for some reason, octave is using the sundials2 port (currently 2.7).  And these ports are written in a way that they are incompatible with each other. 

Mar-06-18 14:01:51
How can I test the performance of a variable capacitor
Category: Developer

I see two problems with your example.  1)  Your ground is not actually connected to anything.  2)  You have a variable capacitor, but it is not being given a value.  See attached for a version that is working for me.
PEvaricap.mo

Dec-09-17 18:18:30
Category: Programming

Put in an entry for both the start and end of the month that are the same.  That way it will be constant during the month and change at the end.  If January is 31*24*60*60 seconds long, you could do:
table=[0 10
2678400 10
2678401 20
5097600 20
...

Then for the first 2678400 seconds the output would be 10, then, in 1 second it will change to a value of 20 and hold that value for all of Feb. etc.

Dec-09-17 17:39:20
Category: Programming

Maybe what you want is a TimeTable for your input.  It takes a table of times and values and outputs the value as the simulation progresses.  You would need to convert months to seconds of the year. 

You could use a sawtooth with a 24 hour period.  Then, use that as the input to a combitable1d, instead of a timetable. 

Feb-06-17 17:45:34
Trying to plot the most simple linear function in Modelica
Category: Programming

If you are using OMEdit, you can just click the "New Parametric plot" button and it will open a plot where you can select any two variables to plot against each other.

It looks like there was a missing feature in OMEdit to do that edit in the diagram view, but you could still do it in the text view.  See here:  Title  That link also helps explain how to use tables. 
I don't see that problem now, as I can edit the file names, so I think that it has been fixed in newer versions of OMEdit. 

If you can save the audio data in an accessible file format, you could then read it in with CombiTable1D and then can plot the data. 

Dec-21-16 23:29:40
trying to install the openmodelica-devel port in a mac, the port is missing. using the search...

It looks to me like some other part of your install of macports is missing.  Maybe +clang is trying to select non-installed clang compiler. 
I think that the default build settings now should work OK.  So, I would just try this:

port install openmodelica-devel +libraries


You do need to have Xcode installed for most ports, including openmodelica, to build (while binary only ports can install without it)

Dec-20-16 15:32:28
trying to install the openmodelica-devel port in a mac, the port is missing. using the search...

I have never seen OpenModelica available in the Macports.org repository.  I have been building it from source on my Mac using Macports for a long time.  The way I have always done it, is to follow the instructions above.  What these instructions do is first require you to add openmodelica as a valid source to your macports installation:

echo rsync://build.openmodelica.org/macports/ >> /opt/local/etc/macports/sources.conf # assuming you installed into /opt/local

Note, that this only has to happen once for each installation of Macports. sources.conf just tells macports where to search for packages (binary and source)
Then, when you do:

sudo port install openmodelica-devel


it will search both macports and openmodelica to find the source code and use it to build.

It would be possible for someone to add the source to the macports.org repository but I am not aware of it ever happening before (If so, I could have missed it)

Dec-20-16 14:05:35
trying to install the openmodelica-devel port in a mac, the port is missing. using the search...

I assume that you are trying to build on a Mac.  If so, you need to add openmodelica to your sources so that it is available. 
See the first step of this:  Mac Instructions 

I have a model with 2900 equations.  It runs for a little while, but then I get this:
stdout | warning | <p>The corrector could not converge.</p>
stdout | warning | <p>can't continue. time = 7.149656</p>
stdout | info | <p>model terminate | Integrator failed. | Simulation terminated at time 7.14966</p>

I am using the default, dassl integrator.  Is there any way to find out more about what is causing the problem?  Is there a particular equation etc?
This  error message is not very specific, so debugging is difficult.
I also tried to enable "DASSL Solver Information" but that just triggered an error message:
assert | debug | <p>unrecognized option -lv LOG_DDASRT,LOG_STATS</p>
So, there is likely a bug in OMEdit where it is not passing the correct logging flags.

I am trying to model the flow in pipe.  The conditions need to change once the pipe is full.  I have attempted to model this, but I keep getting a divide by zero once the pipe is full.
I am trying to understand why this is happening.  I have attached the simple model.  When I run TestTrap1 is works for a period of time, then gives divide by zero errors.  If anyone can make any suggestions for getting it to work, I would greatly appreciate it. 
Thanks.
FlowPackageTest.mo

Just to further explain my question, Zwieback answer and my own.
Yes, Zwieback, you are correct that R is a parameter.  But, if you look at my code, the intention was that the acos equation could only occur when level is between 0 and 2R, due to the if and elseif conditionals. 
R is the radius of a pipe and level is the level of fluid in the pipe.  So, level can either be <0 or (pipe is empty), over 2R (the pipe is full) or between them (pipe is partially full).  The acos equation should only happen when the pipe is partially full, in which case the acos should always be valid. 
However, the "gotcha" in the above is about events.  The conditionals are only tested with events, as I now understand.  And during the simulation it is possible to have the acos equation be valid, when level exceeds 2R. 
The answer was to replace conditionals with if noEvent(level <0) and elseif noEvent (level >=2*R)

To answer my own question, I believe that this is an event problem and the answer is to use noEvent on the conditionals.

I am modeling a pipe that can be either full, empty or partially full.  I am trying to use the following code segment, but I keep getting errors.

Code:

if level <= 0 then

  //empty pipe
      phi = 0.0;
  fitting_in.P = fitting_out.P;
    //Full pipe
elseif level >= 2 * R then
  //full pipe
      phi = 2 * Modelica.Constants.pi;
  fitting_in.q = -fitting_out.q;
else
  //partially full pipe
  phi = 2 * acos((R - level) / R);
  fitting_in.P = fitting_out.P;
end if;
    A = 0.5 * R ^ 2 * (phi - m.sin(phi));

And when I run my simulation, I get the following errors:
assert | warning | The following assertion has been violated at time 35.327627
assert | debug | Model error: Argument of acos(DIVISION(pipeArray1.pipeSegment[2].R - pipeArray1.levels[2]) / pipeArray1.pipeSegment[2].R) outside the domain -1.0 <= -1.0017 <= 1.0

In this simulation, the level should be going up, until the pipe is full. 
level represents the height from the bottom of the pipe and R is a parameter.  What I am trying to do is if the level ever rises to, or above, the top of the pipe, the phi, the angle fro the center of the pipe to the fill level, should be fixed at 2pi.  But, during my simulation, the above error shows that the //full pipe calculation is not being used, and instead it is still using the acos calculation. 
From above, the acos should only be used when level is < 2*R, so (R-level)/R) should be >-1. 

Essentially, I am trying to have three different modes of operation, and using one to protect against acos of an out of range number.  But, for some reason the simulation is calculating into this "illegal" range and giving me an error. 
Any guidance about how to handle this kind of situation would be very helpful.

Jan-12-16 19:01:44
sum all the values at all times and give one unique output in result
Category: Programming

The sum of a continuous number is the integral.  You should be able to use the integrator block to do what you need:  Integrator

Dec-16-15 22:48:23
MacPort OpenModelica install fail
Category: Developer

The strange thing about that accelerate warning is that I googled around some and can't find any basis for it.  It sounds like a few years back Apple Accelerate may have not played well with Octave, so they started using Atlas, and it seems like that may have just remained...I haven't yet run into any problems with it, but that is only a small datapoint.
For example see this:
https://lists.gnu.org/archive/html/octa … 00296.html

Dec-15-15 14:03:34
MacPort OpenModelica install fail
Category: Developer

I had run into this problem before.  Best I can tell, the Macports guys seems to think that it is a problem with OM, and the OM guys think that it is a Macports problem.  I have filed a couple of tickets:
OM Ticket 3030
https://trac.openmodelica.org/OpenModelica/ticket/3030

Macports Ticket 46228
https://trac.macports.org/ticket/46228

I have found two work arounds:
1)  Deactivate atlas, as you mentioned, before each upgrade of OM. 
sudo port -f deactivate atlas
When you do the deactivate, you can then do an upgrade of OM, and Macports will then reactivate atlas after the rebuild.  At this point, both OM and Octave seem to work fine for me.  You just have remember to redo the deactivate before any upgrade of OM. 
2)  Install "octave +accelerate" variant, instead of the default +atlas.  Then it doesn't use atlas, and seems to be working fine for me. 

Neither is ideal, but each one does seem to work.  I am not sure of the actual fix is. 

Dec-14-15 14:49:21
MacPort OpenModelica install fail
Category: Developer

There was a bug in building a few days ago, that has since been fixed.  So, it might just be bad timing.  It builds fine for me now on 10.10.5.  So, you might just try:
sudo port sync
sudo port clean openmodelica-devel
sudo port install openmodelica-devel +libraries

Oct-22-15 14:57:24
OSX Builds but fails half the test
Category: Developer

As one additional datapoint, for me the recent commits fix the problems and are all building and running fine, using macports. 
There is one minor issue remaining, which is that I had the plotutils port installed, and that put this file /opt/local/include/plot.h in place.  Apparently, the OM build was finding that and getting confused, instead of using the correct local plot.h.  The work around is just to disable that port during the build of OM.

Oct-20-15 13:38:54
OSX Builds but fails half the test
Category: Developer

While I was trying to fix it, I did add the portgroup to my portfile, on my local machine, but I still was getting an error.  Hopefully, I just did something wrong with it, that you can get right. 

Oct-20-15 13:21:43
OSX Builds but fails half the test
Category: Developer

Did you try going back to an earlier commit?  I found that somewhere between dev-106-ga101226 (2015-09-28) and 1.9.4~dev-133-gf27d20b (2015-10-02) that at least one example stopped working on the mac build. 
At this point, I believe that there are three separate, and likely unrelated, problems with the OSX build.
1)  Recent commits, in the range of 153 and later (2015-10-06), hang during build.  That is visible on the Hudson, and because of that they disabled the Hudson OSX builds until that can be resolved.
2)  Some tests started failing on mac as mentioned above
3)  Macports upgraded qt4 from 4.8.7_1 to 4.8.7_2.  That main point of that change was to move the location of a bunch of qt4 libraries to a more consistent location.  However, that upgrade seems to also break the OM build for Macs.  I have been working some with the Macport developer who made this change to try to get things working again, but so far, no luck on it.

Oct-01-15 12:47:13
Level equation on OpenTank
Category: Programming

The first variable defined in OpenTank is:

Code:

  SI.Height level(stateSelect = StateSelect.prefer, start = level_start_eps) "Level height of tank";

And the first equation is the fliud level equation:

Code:

  V = crossArea * level "Volume of fluid";

Sep-10-15 14:33:09
How can I create a cumulative plot of values with time derived from a time table?
Category: Programming

It looks like my use of pre(), in my earlier version, works in OM, but is outside the Modelica spec.  See:
pre() operator
Determine min max
Determine min max

And an answer here that does solve the problem:
Detect change

However, using pre, or the version in the link above, would actually miss any months that happened to have the same values, since there would be no change.  While sampling, as in my prior answers, will get every change (assuming that you have data for every month, and set the correct sampling interval)

Sep-10-15 14:32:07
How can I create a cumulative plot of values with time derived from a time table?
Category: Programming

It looks like my use of pre(), in my earlier version, works in OM, but is outside the Modelica spec.  See:
pre() operator
Determine min max
Determine min max

And an answer here that does solve the problem:
Detect change

However, using pre, or the version in the link above, would actually miss any months that happened to have the same values, since there would be no change.  While sampling, as in my prior answers, will get every change (assuming that you have data for every month, and set the correct sampling interval)

Sep-10-15 13:03:16
How can I create a cumulative plot of values with time derived from a time table?
Category: Programming

What version of OMEdit are you using?  I am asking because the code I proposed works fine for me.  So, there is a bug in my version or your version.  Right now I am running  1.9.4~dev-9.  I don't know why your version, and Dymola claim it is an error, while my new version of OMEdit seems to accept it fine.

This might work for you instead:

Code:


model IntegrateTest
  Modelica.Blocks.Sources.TimeTable timeTable1(table = [0, 1; 1, 3; 2, 5; 3, 2; 4, 7; 5, 0; 8, 0]) annotation(Placement(visible = true, transformation(origin = {-46, 26}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));

  model SumChange
    extends Modelica.Blocks.Interfaces.SISO;
  equation
    when {not u == pre(u), initial()} then
      y = pre(y) + u;
    end when;
    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})));
  end SumChange;

  model SumTime
    extends Modelica.Blocks.Interfaces.SISO;
    Boolean sampleTrigger;
    parameter Modelica.SIunits.Time samplePeriod = 1.0;
  equation
    sampleTrigger = sample(0, samplePeriod);
    when sampleTrigger then
      y = pre(y) + u;
    end when;
    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})));
  end SumTime;

  SumTime sumTime1 annotation(Placement(visible = true, transformation(origin = {-8, 68}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(timeTable1.y, sumTime1.u) annotation(Line(points = {{-35, 26}, {-30, 26}, {-30, 68}, {-20, 68}, {-20, 68}}, color = {0, 0, 127}));
  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 = 10, Tolerance = 1e-6, Interval = 0.02));
end IntegrateTest;

Sep-09-15 20:11:42
Topic: graphics
how can i reuse graphics

What graphics?  If you are talking about a plot, there is a save button on the plot window that can save the plot as a png file.

Sep-09-15 18:53:25
How can I create a cumulative plot of values with time derived from a time table?
Category: Programming

I think that this version should do what you seem to want.  Take a look at the output of timeTable1 versus the output of sumChange1:

Code:


model IntegrateTest
  Modelica.Blocks.Continuous.Integrator integrator1 annotation(Placement(visible = true, transformation(origin = {4, 24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.TimeTable timeTable1(table = [0, 1; 1, 3; 2, 5; 3, 2; 4, 7; 5, 0; 8, 0]) annotation(Placement(visible = true, transformation(origin = {-46, 26}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Discrete.Sampler sampler1(samplePeriod = 1) annotation(Placement(visible = true, transformation(origin = {-18, -18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Continuous.Integrator integrator2 annotation(Placement(visible = true, transformation(origin = {30, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));

  model SumChange
    extends Modelica.Blocks.Interfaces.SISO;
  equation
    when {not u == pre(u), initial()} then
      y = pre(y) + u;
    end when;
    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})));
  end SumChange;

  SumChange sumChange1 annotation(Placement(visible = true, transformation(origin = {4, -54}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(sampler1.y, sumChange1.u) annotation(Line(points = {{-7, -18}, {0, -18}, {0, -36}, {-24, -36}, {-24, -54}, {-10, -54}, {-10, -54}}, color = {0, 0, 127}));
  connect(sampler1.y, integrator2.u) annotation(Line(points = {{-7, -18}, {6, -18}, {6, -20}, {18, -20}}, color = {0, 0, 127}));
  connect(timeTable1.y, sampler1.u) annotation(Line(points = {{-35, 26}, {-32, 26}, {-32, -8}, {-48, -8}, {-48, -18}, {-30, -18}, {-30, -18}}, color = {0, 0, 127}));
  connect(timeTable1.y, integrator1.u) annotation(Line(points = {{-35, 26}, {-20, 26}, {-20, 24}, {-10, 24}}, color = {0, 0, 127}));
  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 = 10, Tolerance = 1e-6, Interval = 0.02));
end IntegrateTest;

Sep-09-15 15:12:40
How can I create a cumulative plot of values with time derived from a time table?
Category: Programming

First off, remember that the data is considered essentially continuous.  That means that at time 1.5 it has to have a value.  It seems that you are trying to care about the data at each transition.  That said, my suggestion above seems to do what you want, but does it with a 1 second lag.  So, one option would be to move your data 1 second "earlier" and then you would get your expected results.

Sep-09-15 13:26:54
How can I create a cumulative plot of values with time derived from a time table?
Category: Programming

You can just set y_start of the integrator to the value that you want to start with. 

Sep-08-15 18:56:33
How can I create a cumulative plot of values with time derived from a time table?
Category: Programming

Remember that variables in Modelica are generally continuous.  So, they have to have a value between the points you listed below.  One way to do something similar to what you want is to just add an integrator.  But, then the range between the values will matter to the output.  So, make sure that it does what you want.  If you just use timeTable it uses a linear fit between each point.  An option is then to sample every time period of interest, for example every second, and then integrate that value.  Here is a quick example with those two different methods:

Code:

model IntegrateTest

  Modelica.Blocks.Continuous.Integrator integrator1 annotation(Placement(visible = true, transformation(origin = {4, 24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.TimeTable timeTable1(table = [0, 1; 1, 3; 2, 5; 3, 2; 4, 7; 5, 0; 8, 0]) annotation(Placement(visible = true, transformation(origin = {-46, 26}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Discrete.Sampler sampler1(samplePeriod = 1) annotation(Placement(visible = true, transformation(origin = {-18, -18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Continuous.Integrator integrator2 annotation(Placement(visible = true, transformation(origin = {30, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(timeTable1.y, sampler1.u) annotation(Line(points = {{-35, 26}, {-32, 26}, {-32, -8}, {-48, -8}, {-48, -18}, {-30, -18}, {-30, -18}}, color = {0, 0, 127}));
  connect(timeTable1.y, integrator1.u) annotation(Line(points = {{-35, 26}, {-20, 26}, {-20, 24}, {-10, 24}}, color = {0, 0, 127}));
  connect(sampler1.y, integrator2.u) annotation(Line(points = {{-7, -18}, {6, -18}, {6, -20}, {18, -20}, {18, -20}}, color = {0, 0, 127}));
  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})));
end IntegrateTest;

Feb-19-15 13:47:34
Category: Programming

You can make a variable thermal conductor, instead of just using the fixed one.  For an idea about how this might work, compare Modelica.Electrical.Analog.Basic.Resistor and Modelica.Electrical.Analog.Basic.VariableResistor.

You can copy ThermalConductor and then make a variable version, like this:


model VarThermalConductor
  extends Modelica.Thermal.HeatTransfer.Interfaces.Element1D;
  Modelica.Blocks.Interfaces.RealInput G "Constant thermal conductance of material";
equation
  Q_flow = G * dT;
end VarThermalConductor;



Then, you can just connect an input to G and vary that with another block as you want.

Feb-11-15 20:04:08
Installation of openmodellica on mac osx10.10.2 using homebrew
Category: Developer

It sounds like you didn't correctly edit /opt/local/etc/macports/sources.conf.  You said that you replaced it.  Instead, what you should do, is to append this line to it:
rsync://build.openmodelica.org/macports/

The "echo" line above, is supposed to just append it.  Due to ownership you probably need to use sudo. 
If you can no longer get macportss to selfupdate, then something is wrong with your macports install (or config file)

Jan-13-15 18:27:01
Category: Programming

I am trying to make a loop in an algorithm section.  My actual intent is to find the maximum value of the contents of items in an array.  But, I have reduced my example to the simple case that is below (that doesn't do anything useful, except demonstrate my problem)

Here is the error that I am getting:
TestLoop.ItemB.c:155:13: warning: implicit declaration of function '$Pa$lB' is invalid in C99 [-Wimplicit-function-declaration]
      $Pp = $Pa$lB(modelica_integer)$Pi$rB$Pp;
            ^
TestLoop.ItemB.c:155:20: error: unexpected type name 'modelica_integer': expected expression
      $Pp = $Pa$lB(modelica_integer)$Pi$rB$Pp;
                   ^
1 warning and 1 error generated.
make: *** [TestLoop.ItemB.o] Error 1
make: *** Waiting for unfinished jobs....
TestLoop.ItemB_06inz.c:146:13: warning: implicit declaration of function '$Pa$lB' is invalid in C99 [-Wimplicit-function-declaration]
      $Pp = $Pa$lB(modelica_integer)$Pi$rB$Pp;
            ^
TestLoop.ItemB_06inz.c:146:20: error: unexpected type name 'modelica_integer': expected expression
      $Pp = $Pa$lB(modelica_integer)$Pi$rB$Pp;
                   ^
1 warning and 1 error generated.
make: *** [TestLoop.ItemB_06inz.o] Error 1
Compilation process exited with code 2


And here is the simple test case that is giving it to me:

package TestLoop
  model ItemA
    Real p;
  end ItemA;

  model ItemB
    ItemA a[n];
    parameter Integer n = 5;
    Real p;
  equation
    for i in 1:n loop
      a[i].p = time;
    end for;
  algorithm
    for i in 1:n loop
      p := a[i].p;
    end for;
  end ItemB;
  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})));
end TestLoop;

If I change the assignment of p to a fixed value, I don't get an error (p:=a[1].p).  Any suggestions for what is wrong with this?  I am using OpenModelica r23951. 

Nov-20-14 14:08:38
What ist the root password for the pre-install VM?

At least on the 1.9.1 release VM, there is a root password.  But, it is also vagrant.
I would also suggest that on these VMs you add openmodelica to the vboxsf group.  This does make it easier to move files in and out of the VM. 

I have a model that I was working fine in OMEdit.  I then have second, more complex model, extended from that one.  The first model was working, until I made a small change in it.  Now, I am getting the following cryptic error when I try to run the first model. 

[:0:0-0:0] Error: Internal error ./Compiler/BackEnd/SimCodeUtil.mo: function createSimCode failed [Transformation from optimised DAE to simulation code structure failed]
[:0:0-0:0] Error: Internal error ./Compiler/BackEnd/SimCodeUtil.mo: function createEquationsForSystem1 failed for component torn nonlinear Equationsystem{{{269:161}, {316:337}, {281:162}, {270:160}, {271:163}, {272:174}, {276:165}, {277:132}, {273:164}, {274:122}, {275:121}, {268:128}, {257:48}, {261:63}, {262:33}, {263:32}, {264:61}, {265:44}, {266:310}, {267:311}, {258:30}, {259:313}, {260:312}, {250:8}, {251:5}, {252:4}, {253:7}, {254:6}, {255:314}, {256:324}, {282:187}, {283:184}, {284:183}, {278:186}, {279:185}, {280:308}, {249:227}, {246:242}, {245:212}, {244:211}, {243:240}, {242:223}, {241:304}, {240:305}, {247:209}, {248:307}, {239:306}, {238:297}},
{237:166} Size: 1
[:0:0-0:0] Error: Internal error ./Compiler/BackEnd/SimCodeUtil.mo: function createOdeSystem failed for component torn nonlinear Equationsystem{{{269:161}, {316:337}, {281:162}, {270:160}, {271:163}, {272:174}, {276:165}, {277:132}, {273:164}, {274:122}, {275:121}, {268:128}, {257:48}, {261:63}, {262:33}, {263:32}, {264:61}, {265:44}, {266:310}, {267:311}, {258:30}, {259:313}, {260:312}, {250:8}, {251:5}, {252:4}, {253:7}, {254:6}, {255:314}, {256:324}, {282:187}, {283:184}, {284:183}, {278:186}, {279:185}, {280:308}, {249:227}, {246:242}, {245:212}, {244:211}, {243:240}, {242:223}, {241:304}, {240:305}, {247:209}, {248:307}, {239:306}, {238:297}},
{237:166} Size: 1

Meanwhile, the more complex model, does continue to function.  These errors show up in the  OMEdit Messages Browser, and it happens before the progress window opens.  If I just do check, the model does check correctly. 

If I try to open the debugger, I don't see any equations, likely because these errors happen so early in the simulation build process.
Can anyone offer any hints about what these errors mean?  And how to debug them? 
The strange part is that this model is only slightly different from the older version that ran fine, and the extended version also runs fine.  So, something is wrong with something specific to this model.  But, I'm not sure about how to interpret this error.
FYI, I am running r22854, but I got similar errors when I tried it on 1.9.1beta4.

Any guidance?  Thanks,

I have a model (unfortunately, proprietary, so i can't put it here) that I have been working with that is now causing me some difficulties.  The base model is working fine.  I then extended that model, with some additions, and it is also working fine. 
The strange difficulty that I am running into, is that if I extend that model, I run into errors.  And, the occur, even if I do nothing but this:
model Model3
extends model2;
end Model3;

If I check model2, I see that it is balanced with 894 equations and 894 variables. 
If I check Model3 (created with nothing but extends, as above) it shows 1264 equations and 1571 variables (!?!?).  If I try to run this model, I see a bunch of "Model is structurally singular, error found sorting equations", "Internal error pre-optimization model clockPartioning failed", "Too many equations, over-determined system.  The model has 1264 equations and 894 variables"

Any idea what might be going on? 
Shouldn't extending a model, with nothing else, just end up with the identical model, so it should work just fine? 
Of course, I wanted to add some things to the model, and spent a while trying to figure out why the extended model would not work, until I finally removed things and was left with this trivial extends case that still will not work.
(I am using devel 22746, but while writing this, I am building 22854, to see if that changes anything)

Thanks,

You can just use when.  For example:

Code:


Boolean error_message;
Real Temperature-1;
Real Temperature-0;

equation
when time > 20.0 and time < 20.1 and (Temperature-1 - Temperature-0) > 20 then
error_message=true;
end when;

Mar-10-14 23:49:05
The binary release for Mac OSX is pointing to non existing libraries.

The macports version does work.  I think that they are probably using macports to do the build on the server as well, which is then packaged up as the nightly binary.  But, it looks like when it is packaged up the files are being installed into /opt/openmodelica, while by default they go into /opt/local.  All that to say, it is likely that there is a bug in how the packages are being made, and my suggestion is that you use the bug tracker to report it.  https://trac.openmodelica.org/OpenModelica  The developers tend to be very responsive, and that will make sure that they are aware of it, and will hopefully get it fixed.

Dec-10-13 18:02:13
What relative path is used for reading data?
Category: Programming

I am using a CombiTable2D with tableOnFile.  If I give the full path name it is working fine.  But, if I just give a file name (no path) I get an error that the file can't be found.  I have the data file located in the same directory as my .mo file. 
Where does OpenModelica do a relative path search?  I believe that the working directory is created, on a Mac, in /private/var/folders.....  Would the data file have to be located there?  Is there a way to get OpenModelica to find a data file relative to the current .mo file?

Thanks,

Jul-20-13 22:26:54
How to understand new OMC warning messages

I figured out something about that message.  If, in OMEdit, I select Preferences->Simulation I can then put in to OMC Flags:  +d=initialization
Then when I run, it shows the specific variables it is initializing.

Jul-19-13 18:57:54
How to understand new OMC warning messages

I am also seeing:
Translation    14:39:36        0:0-0:0    The initial conditions are not fully specified. Use +d=initialization for more information.

I am not sure, from the warning, where or how to us +d=initialization?  Or how to set initial conditions so this warning going away.  Can anyone offer any guidance?
Does this just mean that some of the variables in my model need start=0.0 (or whatever is an appropriate value?). 

Thanks,

--Adam

Jun-04-13 21:34:57
Modelica installed. Not a single code works!

I am building on a Mac, (using the Macports instructions).  I have been running the daily versions.  I also can't get dassl to work at all.  All the examples consistently give the same results as above, with just the default settings.  On the other hand if I use euler I can get results from the examples that make sense. 
I have tried building both with clang and with gcc44 and they each give the same results with dassl
     DASSL--  SOME ELEMENT OF INFO VECTOR IS NOT ZERO OR ONE
This is both from OMShell and OMEdit.  I also just installed sundials and now I can get results from radau.

Jun-03-13 23:37:17
I am having a few different beginner problems

OK.  I created the ticket. 
In the mean time is there any work around that can be suggested?  It seems like the examples are not very useful for understanding, if all that a new user can do is run them as is. 

Thanks,

Jun-03-13 18:57:11
I am having a few different beginner problems

That helps a lot, although it doesn't copy everything, or solve the problem.  For example I created a file m.mo that contains just the line:
model M extends Modelica.Fluid.Examples.PumpingSystem;end M;
I then opened the file in OMEdit.  What I see has all the blocks, but no connections and no parameters assigned, just default values.  Even stranger, if I try to change any parameters, the new values don't seem to "stick".  So, for example, when I open the above, I see the same layout of items form the PumpingSystem example.  But,under valveOpening it says startTime=0.  If I right click on that, I can see Parameters, and there I can change startTime to 200 (to match the example).  But, if I then click OK, the diagram still shows startTime=0 and if I open the parameter dialog again, it still shows 0. 
So, I still can't really edit the example.

Jun-02-13 23:56:57
I am having a few different beginner problems

I am fairly new to OpenModelica, so I am just trying things out to get things going.  I have run into two different problems, and I decided to just put them together into one message, to see if anyone has any suggestions.

1) I have OMEdit running fine, and I am trying to work with some of the examples.  The problem is that I can't change any values for any of the parameters.  I am guessing that it is because the examples are installed without write permission.  So, I tried copying one of the examples over to a user directory, and then importing it.  But that didn't work, since the original example was already loaded, so I got an error.  So, my main question is how can I edit the examples to help understand them better?  Is there a way to just duplicate an example, so I can make edits?  I also tried just selecting all the blocks, doing a copy, then creating a new model and pasting.  But that didn't work either.  I just would like a version of the examples, that I can easily modify, to help learn from them.


2)  I am running on a Mac.  I was able to install fine using Macports to get the openmodelica_devel working.  I have even done an upgrade, or two that were successfull.  But, for the last few days, the nightly releases have failed to update successfully.  Perhaps it is just something that is wrong in the newest few nightlys, but I wanted to just see if anyone else is having this problem, or has any suggestions?

Thanks,

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