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

Animation of BouncingBall3D fails to visualize in OMNotebook

Animation of BouncingBall3D fails to visualize in OMNotebook

Hi,

I am trying to learn 3D animation with Modelica.
As entry point I am using the "OpenModelica Users Guide Version 2012-09-14".
The example I am trying to run is the BouncingBall animation example from section 3.4.2 of the attached userguide.

For some reason the last statement in OMNotebook i.e. the visualize(BouncingBall) just returns false.
This leaves me somewhat puzzled on what to do? since the BouncingBall is a write off from the userguide and since it compiles and simulates.

Hope someone can help me on what I am doing wrong :-)



<!DOCTYPE OMNotebook>
<Notebook>
  <GroupCell closed="false">
    <TextCell style="Text">
      <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;">
<tr>
<td style="border: none;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:38pt; font-weight:600; color:#000000;">BouncingBall</span></p></td></tr></table></body></html></Text>
    </TextCell>
    <TextCell style="Text">
      <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;">
<tr>
<td style="border: none;">
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="C:/Users/kpe/Google Drev/Arbejde/R&amp;D/Opgaver/ROMO Wind/Modelica/Models/OMNotebook_tempfiles/1.png" /></p></td></tr></table></body></html></Text>
      <Rule name="TextAlignment">Center</Rule>
    </TextCell>
    <GraphCell style="Graph" closed="false">
      <Input>model BouncingBall
  import Modelica.SimpleVisual.*;
  parameter Real e = 0.7 "coefficient of restitution";
  parameter Real g = 9.81 "gravity acceleration";
  Real h(start = 10) "height of ball";
  Real v "velocity of ball";
  Boolean flying(start = true) "true, if ball is flying";
  Boolean impact;
  Real v_new;
  annotation(experiment(StartTime = 0.0, StopTime = 5.0, Tolerance = 1e-06));
  SimpleVisual.PositionSize ball "color=red;shape=sphere;";
equation
  ball.size[1] = 5;
  ball.size[2] = 5;
  ball.size[3] = 5;
  ball.frame_a[1] = 0;
  ball.frame_a[2] = h + ball.size[2] / 2;
  ball.frame_a[3] = 0;
  impact = h <= 0.0;
  der(v) = if flying then -g else 0;
  der(h) = v;
  when {h <= 0.0 and v <= 0.0,impact} then
      v_new = if edge(impact) then -e * pre(v) else 0;
    flying = v_new > 0;
    reinit(v, v_new);
 
  end when;
end BouncingBall;</Input>
      <Output>{BouncingBall}</Output>
    </GraphCell>
    <GraphCell style="Graph" closed="false">
      <Input>loadModel(Modelica)</Input>
      <Output>true</Output>
    </GraphCell>
    <GraphCell style="Graph" closed="false">
      <Input>loadModel(SimpleVisual)</Input>
      <Output>true
OMC-ERROR:
"Warning: Requested package Modelica of version 2.2.1, but this package was already loaded with version 3.1. You might experience problems if these versions are incompatible.
"</Output>
    </GraphCell>
    <GraphCell style="Graph" closed="false">
      <Input>simulate(BouncingBall)</Input>
      <Output>record SimulationResult
    resultFile = "C:/Users/kpe/AppData/Local/Temp/OpenModelica/BouncingBall_res.mat",
    simulationOptions = "startTime = 0.0, stopTime = 5.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'BouncingBall', storeInTemp = false, noClean = false, options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = '', simflags = ''",
    messages = "",
    timeFrontend = 0.634387443072096,
    timeBackend = 0.00993498353302634,
    timeSimCode = 0.00519235019401682,
    timeTemplates = 0.0142337875488665,
    timeCompile = 1.75566108830573,
    timeSimulation = 0.183095446854609,
    timeTotal = 2.60259250671179
end SimulationResult;</Output>
    </GraphCell>
    <GraphCell style="Graph" closed="false">
      <Input>visualize(BouncingBall)</Input>
      <Output>false</Output>
    </GraphCell>
  </GroupCell>
</Notebook>

Re: Animation of BouncingBall3D fails to visualize in OMNotebook

Hi,

It seems we're missing the OMVisualize executable from the OpenModelica installation.
I'll talk with some developers to add it to the next nightly builds.

Cheers,
Adrian Pop/

Re: Animation of BouncingBall3D fails to visualize in OMNotebook

Ok,

I will try tomorrow on a nightly build then :-)

Re: Animation of BouncingBall3D fails to visualize in OMNotebook

Hi,

I don't know yet if we will make this available as we do have another way
to visualize 3D models that we are working on.
The new way is via Modelica 3D and ModelicaServices
which is more close to Modelica "standard" for visualization.

The old visualize command is based on SimpleVisual which is
not "standard" Modelica visualization. We will have to take a decision
about this. I will let you know how things develop.

If you want to play with visualize you can install an older OpenModeilca
version, i think 1.6 was the latest that had this functionality working:
https://build.openmodelica.org/omc/buil … /releases/

Cheers,
Adrian Pop/

Re: Animation of BouncingBall3D fails to visualize in OMNotebook

Hi,

I now included OMVizualize in the latest nightly-build for Windows:
https://build.openmodelica.org/omc/buil … ly-builds/

Cheers,
Adrian Pop/

There are 0 guests and 0 other users also viewing this topic
You are here: