VirtualLabBuilder.src.ViewElements.Drawables.Mechanics

Mechanic elements

Information


 

Mechanics package

Mechanics package contains several classes implementing implementing an interactive damper, a set of interactive dampers, an interactive spring and a set of interactive springs.

Package Content

NameDescription
VirtualLabBuilder.src.ViewElements.Drawables.Mechanics.Damper Damper Damper
VirtualLabBuilder.src.ViewElements.Drawables.Mechanics.DamperSet DamperSet Set of dampers
VirtualLabBuilder.src.ViewElements.Drawables.Mechanics.Spring Spring Spring
VirtualLabBuilder.src.ViewElements.Drawables.Mechanics.SpringSet SpringSet Set of springs


VirtualLabBuilder.src.ViewElements.Drawables.Mechanics.Damper VirtualLabBuilder.src.ViewElements.Drawables.Mechanics.Damper

Damper

VirtualLabBuilder.src.ViewElements.Drawables.Mechanics.Damper

Information


                        

This class inherits from the Drawable class.
Creates a damper. The posistion of the two damper extremities (p1[:] and p2[:] variables) can be linked to the model variables.


Parameters

TypeNameDefaultDescription
Reald1/3Length of the damper fixed part divided by the damper length
RealL10.02Distance from the wide to the narrow part of the damper
RealL20.02Width of the narrow part of the damper
IntegerintX1Y10= 0 if the point (x1, y1) change in time and 0 otherwise
IntegerintX2Y20= 0 if the point (x2, y2) change in time and 0 otherwise
Colorcolor1[4]{255,0,255,255}The damper color changes form this color to color2
Colorcolor2[4]{249,204,202,255}The damper color changes form this color to color1

Connectors

TypeNameDescription
ParentpLeftConnector of drawable components
ChildcLeftConnector of drawable components

Modelica definition

model Damper "Damper" 
            extends Drawables.Drawable(numIntColor = 0, numInt = (intX1Y1*2+intX2Y2*2));
  import Modelica.Utilities.*;
  parameter Real d = 1/3 
    "Length of the damper fixed part divided by the damper length";
  parameter Real L1 = 0.02 
    "Distance from the wide to the narrow part of the damper";
  parameter Real L2 = 0.02 "Width of the narrow part of the damper";
  parameter Integer intX1Y1 = 0 
    "= 0 if the point (x1, y1) change in time and 0 otherwise ";
  
  parameter Integer intX2Y2 = 0 
    "= 0 if the point (x2, y2) change in time and 0 otherwise ";
  
  parameter TypesDef.Color color1 = {255,0,255,255} 
    "The damper color changes form this color to color2";
  
  parameter TypesDef.Color color2 = {249,204,202,255} 
    "The damper color changes form this color to color1";
  
  input Real p1[2] "Position of the point (x1, y1)";
  input Real p2[2] "Position of the point (x2, y2)";
  
initial algorithm 
  
  num :=Functions.processingFile(fComponent);
  Functions.damper(fileName, "node"+String(pLeft.nodeReference), "node"+String(num),String(num),
  d, L1, L2, p1[1], p2[1], p1[2], p2[2], intX1Y1, intX2Y2, color1, color2);
  
equation 
  
algorithm 
 vert[numInt+1] :=-1;
 colors[numIntColor+1] :=-1;
  
if (numInt==4) then
    
   vert[1] :=p1[1];
   vert[2] :=p2[1];
   vert[3] :=p1[2];
   vert[4] :=p2[2];
 end if;
  
if (numInt == 2) then
   if 
     (intX1Y1==1) then
   vert[1] :=p1[1];
   vert[2] :=p1[2];
   else
   vert[1] :=p2[1];
   vert[2] :=p2[2];
   end if;
 end if;
end Damper;

VirtualLabBuilder.src.ViewElements.Drawables.Mechanics.DamperSet VirtualLabBuilder.src.ViewElements.Drawables.Mechanics.DamperSet

Set of dampers

VirtualLabBuilder.src.ViewElements.Drawables.Mechanics.DamperSet

Information


                        

Creates a set of dampers. The posistion of the two extremities of each damper (p1[:, :] and p2[:, :] variables) can be linked to the model variables.


Parameters

TypeNameDefaultDescription
IntegerN_dampers2Number of dampers
Reald1/3length of the damper fixed part divided by the damper length
RealL10.02distance from the wide to the narrow part of the damper
RealL20.02width of the narrow part of the damper
IntegerintX1Y10= 0 if the point (x1, y1) change in time and 0 otherwise
IntegerintX2Y20= 0 if the point (x2, y2) change in time and 0 otherwise
Colorcolor1[4]{255,0,255,255}The damper color changes form this color to color2
Colorcolor2[4]{249,204,202,255}The damper color changes form this color to color1

Connectors

TypeNameDescription
ParentparentConnector of the drawable elements
ChildchildConnector of the drawable elements

Modelica definition

model DamperSet "Set of dampers" 
  parameter Integer N_dampers = 2 "Number of dampers";
  parameter Real d = 1/3 
    "length of the damper fixed part divided by the damper length";
  parameter Real L1 = 0.02 
    "distance from the wide to the narrow part of the damper";
  parameter Real L2 = 0.02 "width of the narrow part of the damper";
  parameter Integer intX1Y1 = 0 
    "= 0 if the point (x1, y1) change in time and 0 otherwise ";
  
  parameter Integer intX2Y2 = 0 
    "= 0 if the point (x2, y2) change in time and 0 otherwise ";
  
  parameter TypesDef.Color color1 = {255,0,255,255} 
    "The damper color changes form this color to color2";
  
  parameter TypesDef.Color color2 = {249,204,202,255} 
    "The damper color changes form this color to color1";
  
  input Real p1[N_dampers, 2] "position of the point (x1, y1)";
  input Real p2[N_dampers, 2] "position of the point (x2, y2)";
  
 Damper dampers[N_dampers](each d = d, each L1 = L1, each L2 = L2, each intX1Y1 = intX1Y1, each 
      intX2Y2 =                                                                                           intX2Y2,  each 
      color1 =                                                                                                color1, each 
      color2 =                                                                                                color2);
  VirtualLabBuilder.src.Interfaces.Parent parent 
    "Connector of the drawable elements";
  VirtualLabBuilder.src.Interfaces.Child child 
    "Connector of the drawable elements";
equation 
    connect(dampers[1].pLeft,parent);
    connect(dampers[N_dampers].cLeft,child);
 for i in 1:N_dampers-1 loop
    connect(dampers[i].cLeft,dampers[i+1].pLeft);
 end for;
 for i in 1:N_dampers loop
    dampers[i].p1 = p1[i,1:2];
    dampers[i].p2 = p2[i,1:2];
 end for;
end DamperSet;

VirtualLabBuilder.src.ViewElements.Drawables.Mechanics.Spring VirtualLabBuilder.src.ViewElements.Drawables.Mechanics.Spring

Spring

VirtualLabBuilder.src.ViewElements.Drawables.Mechanics.Spring

Information


                        

This class inherits from the Drawable class.
Creates a spring. The posistion of the two spring extremities (p1[:] and p2[:] variables) can be linked to the model variables.


Parameters

TypeNameDefaultDescription
Reald1/19length of the spring without picks divided by the damper length and two
IntegerN4pick number
RealA0.05amplitude of the picks
IntegerintX1Y10= 0 if the point (x1, y1) change in time and 0 otherwise
IntegerintX2Y20= 0 if the point (x2, y2) change in time and 0 otherwise
Realstroke2Stroke used to draw the lines
ColorlineColor[4]{192,192,192,255}Line Color

Connectors

TypeNameDescription
ParentpLeftConnector of drawable components
ChildcLeftConnector of drawable components

Modelica definition

model Spring "Spring" 
 extends Drawables.Drawable(numIntColor = 0, numInt = (intX1Y1*2+intX2Y2*2));
  import Modelica.Utilities.*;
  parameter Real d = 1/19 
    "length of the spring without picks divided by the damper length and two";
  parameter Integer N = 4 "pick number";
  parameter Real A = 0.05 "amplitude of the picks";
  parameter Integer intX1Y1 = 0 
    "= 0 if the point (x1, y1) change in time and 0 otherwise ";
  
  parameter Integer intX2Y2 = 0 
    "= 0 if the point (x2, y2) change in time and 0 otherwise ";
  
 parameter Real stroke = 2 "Stroke used to draw the lines";
  
  parameter TypesDef.Color lineColor = {192,192,192,255} "Line Color";
  
  input Real p1[2] "position of the point (x1, y1)";
  input Real p2[2] "position of the point (x2, y2)";
  
initial algorithm 
  
  num :=Functions.processingFile(fComponent);
  Functions.spring(fileName, "node"+String(pLeft.nodeReference), "node"+String(num), String(num),
  d, N, A, stroke, p1[1], p2[1], p1[2], p2[2], intX1Y1, intX2Y2, lineColor);
  
equation 
  
algorithm 
 vert[numInt+1] :=-1;
 colors[numIntColor+1] :=-1;
  
if (numInt==4) then
    
   vert[1] :=p1[1];
   vert[2] :=p2[1];
   vert[3] :=p1[2];
   vert[4] :=p2[2];
 end if;
  
if (numInt == 2) then
   if 
     (intX1Y1==1) then
   vert[1] :=p1[1];
   vert[2] :=p1[2];
   else
   vert[1] :=p2[1];
   vert[2] :=p2[2];
   end if;
 end if;
end Spring;

VirtualLabBuilder.src.ViewElements.Drawables.Mechanics.SpringSet VirtualLabBuilder.src.ViewElements.Drawables.Mechanics.SpringSet

Set of springs

VirtualLabBuilder.src.ViewElements.Drawables.Mechanics.SpringSet

Information


                        

Creates a set of dampers. The posistion of the two extremities of each spring (p1[:, :] and p2[:, :] variables) can be linked to the model variables.


Parameters

TypeNameDefaultDescription
IntegerN_springs2Number of springs
Reald1/19length of the spring without picks divided by the damper length and two
IntegerN4pick number
RealA0.05amplitude of the picks
IntegerintX1Y10= 0 if the point (x1, y1) change in time and 0 otherwise
IntegerintX2Y20= 0 if the point (x2, y2) change in time and 0 otherwise
Realstroke2Stroke used to draw the lines
ColorlineColor[4]{192,192,192,255}Line Color

Connectors

TypeNameDescription
ParentparentConnector of the drawable elements
ChildchildConnector of the drawable elements

Modelica definition

model SpringSet "Set of springs" 
 parameter Integer N_springs = 2 "Number of springs";
  parameter Real d =  1/19 
    "length of the spring without picks divided by the damper length and two";
  parameter Integer N =  4 "pick number";
  parameter Real A =  0.05 "amplitude of the picks";
  parameter Integer intX1Y1 =  0 
    "= 0 if the point (x1, y1) change in time and 0 otherwise ";
  
  parameter Integer intX2Y2 =  0 
    "= 0 if the point (x2, y2) change in time and 0 otherwise ";
  
 parameter Real stroke = 2 "Stroke used to draw the lines";
  
  parameter TypesDef.Color lineColor =  {192,192,192,255} "Line Color";
  
  input Real p1[N_springs,2] "position of the point (x1, y1)";
  input Real p2[N_springs, 2] "position of the point (x2, y2)";
  
 Spring springs[N_springs](each d = d, each N = N, each A = A, each intX1Y1 = intX1Y1, each 
      intX2Y2 =                                                                                       intX2Y2, each 
      stroke =                                                                                                stroke,
  each lineColor = lineColor);
  VirtualLabBuilder.src.Interfaces.Parent parent 
    "Connector of the drawable elements";
  VirtualLabBuilder.src.Interfaces.Child child 
    "Connector of the drawable elements";
equation 
    connect(springs[1].pLeft,parent);
    connect(springs[N_springs].cLeft,child);
 for i in 1:N_springs-1 loop
    connect(springs[i].cLeft,springs[i+1].pLeft);
 end for;
 for i in 1:N_springs loop
    springs[i].p1 = p1[i,1:2];
    springs[i].p2 = p2[i,1:2];
 end for;
end SpringSet;

HTML-documentation generated by Dymola Tue Jul 24 18:58:13 2007.