Dynasim (2004): Dymola. User's Manual. Dynasim AB.Version 5.3a.
Name | Description |
---|---|
BBModel | Virtual-lab model |
![]() | Virtual-lab view description |
BBInteractive | Interactive model |
x | Ball position. |
v | Ball velocity. |
ebounce | Ellasticity coefficient. |
Dynasim (2004): Dymola. User's Manual. Dynasim AB.Version 5.3a.
Type | Name | Default | Description |
---|---|---|---|
Height | xStart | 10 | [m] |
Velocity | vStart | 0 | [m/s] |
Mass | m | 2 | [kg] |
Real | ebounceIni | 0.8 | Initial value of the ellasticity coefficient |
Real | vsmall | 1e-4 |
model BBModel "Virtual-lab model" import Modelica.SIunits; parameter SIunits.Height xStart = 10; parameter SIunits.Velocity vStart = 0; SIunits.Height x(start=xStart, stateSelect = StateSelect.always); SIunits.Velocity v(start = vStart); SIunits.Force f; parameter SIunits.Mass m=2; parameter Real ebounceIni=0.8 "Initial value of the ellasticity coefficient"; //Code added Real ebounce( start = ebounceIni); //Code added Real var( start = 0); //Code added parameter Real vsmall = 1e-4; Boolean locked(start = false); equation der(x)=v; m*der(v)= f; f=if locked then 0 else -m*Modelica.Constants.g_n; when (x<0 or locked) then reinit(x,0); reinit(v, if locked then 0 else -ebounce*v); end when; der(ebounce) = 0; //Code added der(var) = 0; //Code added locked=if pre(locked) then x<=0 else x<=0 and abs(v)<=vsmall and f<=0; when var>0.5 then reinit(x,xStart); reinit(v,vStart); end when; end BBModel;
Type | Name | Default | Description |
---|---|---|---|
Real | Tcom | 0.1 | Communication interval |
Integer | serverPort | 4242 | Server Port number |
String | sourceCodePath | "C:/Program Files/Dymola/Sou... | Path where the C-functions, graphics.jar and delayrun.exe are located |
String | fileName | "gui.java" | Java file name |
model BBView "Virtual-lab view description" extends VirtualLabBuilder.VLabModels.PartialView(fileName = "BBall.java"); VirtualLabBuilder.ViewElements.Containers.PlottingPanel PP( axesType="cartesian1", title="Ball", titleX="time (s)", titleY="x(t)", autoScaleY="false", maxY=12, position="CENTER"); VirtualLabBuilder.ViewElements.Containers.Dialog D(varName="var", xPosition=600); VirtualLabBuilder.ViewElements.Containers.MainFrame MF(LayoutPolicy= "BorderLayout()", Width=600); VirtualLabBuilder.ViewElements.Containers.DrawingPanel DP( YMin=0, position="CENTER", YMax=12); VirtualLabBuilder.ViewElements.Containers.Panel pNorth( LayoutPolicy="GridLayout", position="NORTH", nRows=1, nColumns=4); VirtualLabBuilder.ViewElements.BasicElements.CheckBox checkBox(label="Show plot"); VirtualLabBuilder.ViewElements.Drawables.Trail trail(nSkip=0, maximumPoints=2000); VirtualLabBuilder.ViewElements.BasicElements.InfoButton infoButton( tooltip="Displays the introduction of the lab", sizeFont=20, path="D:\\VisualizacionDymola\\BouncingBall\\BBModel.html", title="Introduction", xPos=600, image="D:\\VisualizacionDymola\\BouncingBall\\info.jpg", label="Info"); VirtualLabBuilder.ViewElements.InteractiveControls.Button1Action reset(label="Reset", tooltip= "Reset"); src.ViewElements.InteractiveControls.Slider slider(stringFormat= "ebounce = 0.0"); src.ViewElements.Drawables.Oval oval(intCenter=1); equation connect(slider.cLLeft, checkBox.pLLeft); connect(checkBox.cLLeft, infoButton.pLLeft); connect(infoButton.cLLeft, reset.pLLeft); connect(root.cLLeft, MF.pLLeft); connect(pNorth.cLRight, slider.pLLeft); connect(pNorth.cLLeft, DP.pLLeft); connect(MF.cLLeft, D.pLLeft); connect(MF.cLRight, pNorth.pLLeft); connect(DP.cRight, oval.pLeft); connect(PP.cRight, trail.pLeft); connect(D.cLRight, PP.pLLeft); end BBView;
model BBInteractive "Interactive model" VirtualLabBuilder.VLabModels.VirtualLab interactive(redeclare model ViewI = BBView, redeclare model ModelI = BBModel, Tcom=0.001); equation interactive.View.oval.Center = {0.0, interactive.Model.x}; interactive.View.oval.Axes = {0.1, 1}; interactive.View.trail.point = {time, interactive.Model.x}; interactive.View.slider.var = interactive.Model.ebounce; interactive.View.reset.var = interactive.Model.var; end BBInteractive;