Step 18:0: Introduction to the Math-FB

<< Click to Display Table of Contents >>

Navigation:  Getting Started Tutorials - MechDesigner > Tutorial 18: Math FB >

Step 18:0: Introduction to the Math-FB

Math FB

IMPORTANT NOTES:

Equations

You must enter the equations correctly with the correct syntax. The Math FB will check the syntax, but not the equation itself. If you enter a meaningless equation, the output will not be correct.

For example, to find, after a time-period, the displacement of a point that has constant acceleration, if you enter:

((u*t) + (0.5*a*t), the syntax is correct, but the equation is meaningless

((u*t) + (0.5*a*t*t) the syntax is also correct, and the displacement of the Point is correct.

Note - a bad example. I would design a motion in MotionDesigner with Constant-Acceleration.

Motion-Derivatives

MechDesigner continually calculates the Position, Velocity, and Acceleration of all Points and Parts in your model when all Parts are kinematically-defined.

However, YOU must add the symbolic equation for each motion-derivative.

If you do not add the equations for each motion-derivatives (velocity and acceleration), their values remain equal to those motion-derivatives of the data at the input-connector.

Units

The units inside the Math FB are S.I.. For example:

50mm at the input-connector becomes 0.05m when applied to an equation inside the Math FB dialog

50° at the input-connector becomes (50*2*pi/360)rads when applied to an equation inside the Math FB dialog

What can you do with a Math FB?

The Math FB can use data that is available at the output-connectors of other FBs.

You can use the Math FB to do:

Simple Algebra

For example: 2+3. The output will be 5, of course.

Parametric Constants

For example, connect the output from a Motion-Dimension FB and the output from a Force-Data FB at the same joint. You can use the Math FB to multiply the Torque(Nm) and the Velocity(rad/sec) values to give the Power(kW) as the output.

Top-Tip: Connect a Gearing FB to the input of a Math FB. You can edit the Gearing FB, so that it becomes a parametric-constant of an equation in the Math FB, for example, a Friction Coefficient.

Change the Units of a Variable

For example, change the units at the input-connector of a Math FB to different units at its output-connector - for example: mm to Newtons.

To Add a Math FB, and Open the Math FB dialog

GST-ModellingFBtoolbar-Maths

Add a Math FB:

1.Click Modeling-FB toolbar > Math FB

2.Click the graphics-area

The Math FB is now in the graphics-area

Open a Math FB dialog

1.Double-click the Math FB.

or

1.See How to edit an Elements.

The Math FB dialog is now open

Math FB dialog

GST-Dialog-MathFB-default

Add Input Red-14-1b

You need one input-connector for each variable or parameter in your equation.

1.Click Add Input to add one input-connectors to the Math FB.

Add Output Red-14-2

You need one output-connector for each variable and its motion-derivative

1.Click Add Output to add one output-connectors from the Math FB.

Output Data-TypeRed-14-4

1.Click the drop-down box to select the Data-Type that applies to all of the output-connectors.

Wire Numbers and Data-Channels

The format of each parameter is an equation is: Data-Channel (Wire-Number)

Three wires connected to the input of a Math FB

Three wires connected to the input of a Math FB

The image above has three(3) Wires connected to input-connectors of a Math FB.

Wire-Numbers - IMPORTANT : Wire-Numbers start at 0

Input-Connector 1 = Wire Number 0 - connected to the TOP input-connector

Input-Connector 2 = Wire Number 1 - connected to the next input-connector, one down from the top

Input-Connector 3 = Wire Number 2 - connected to the next input-connector, one down again

and so on ...

Data-Channel

Each wire has 3(three) data-channels.

In the Math FB, we use a letter for data-channel has a letter - p, v, and a ALWAYS even if data is not motion-data.  

E.g. even if the wire is from the output of a Force-Data FB

p = Data-Channel 1

v = Data-Channel 2

a = Data-Channel 3

Example Entries in an Equation:

p(0) : the p refers to Data-channel 1, and (0) refers to input-connector 1

a(2) : the a refers to Data-channel 3, and (2) refers to input-connector 3

v(1) : the v refers to Data-channel 2, and (1) refers to input-connector 2

How many input and output-connectors? - and Example:

As an example, we will calculate Power :

P =  Ʈ . ω

Power (N.m./sec) = Torque(N.m.) × Angular Velocity (rad/sec)

Torque data and Angular-Velocity data are the inputs and Power is the output.

Thus, you need two input-connectors and one output-connector.

You get Torque data from a Force-Data FBRed-14-1b.

You get Angular-Velocity data from a Motion-Dimension FBRed-14-2.

GST-Maths-FB-ForceTorque

Prepare the model:

1.Add a Rocker - see Tutorial 1

2.Edit the CAD-Line of the Rocker, to open the CAD-Line dialog.

In Mass Properties tab > User Mass Properties >
Enter a Mass.
Enter a Center-of-Mass (X-axis) and a Center-of-Mass (Y-axis) to move the Center-of-Mass from the start-Point of the CAD-Line.

Do not enter a value for Inertia or Radius of Gyration.

The mass is at a single point. In cosmology we would use the term Black-Hole! In kinematics and kinetostatics we use the term Point-Mass.

3.Add a Force-Data FB, and open the Force-Data dialog.

4.Select the Pin-Joint, and select the Point in the Base-Part to find the Torque that acts-on the Base-Part.

GST-Dialog-FB-Maths-PowerCalc-Ex-01A

See image above - the three Data-Channels at the Force-Data FB output-connector and the Motion-Dimension FB output-connector.

Prepare the Math FB:

1.Open the Math FB dialog

2.Add two Input-Connectors with the Add-Input button

3.Select Power as the Output Data Type.

4.Click UPDATE button after we select the Output Data Type and before we add equations.

5.Enter the Equations to calculate Power.

The Math FB uses SI units for all data at its input-connectors

The equation in the Math FB is:

Red-14-3 × Red-14-4 (see image above)

p(0)*v(1)

p(0): Wire-Number 0 (top wire), Channel 1 (p = Torque)

v(1): Wire-Number 1 (bottom wire), Channel 2 (v = Angular Velocity)

MathFB- Power= Torque x Ang.Vel

MathFB-
Power= Torque x Ang.Vel

SYNTAX and VALID Equations:

Click the Update after you add the equation to find if its syntax is correct or not correct.

The OK-tiny-11-15 at the left of each equation confirms that the syntax is correct.

For example, the syntax is not correct if it does not have the correct number of parentheses. The reason is given as a message in the Feedback-Area.

Data-Channels and Units at the output-connector of different Function-Blocks.

Function-Blocks - Data-Types and Data-Channels

Output-Connector from

Data Type

Data-Channel 1

Data-Channel 2

Data-Channel 3

Linear Motion FB

Rotary

Machine Angle

Machine Angular Velocity

Machine Angular Acceleration

Gearing FB

Linear

Position - mm

Linear Velocity - mm/s

Linear Acceleration - mm/s/s

Rotary

Angle - deg

Angular Velocity deg/s

Angular Acceleration deg/s/s

Motion FB

Linear

Position - mm

Linear Velocity - mm/s

Linear Acceleration - mm/s/s

Rotary

Angle - deg

Angular Velocity - rad/s

Angular Acceleration - deg/s/s

Motion-Dimension FB

Linear

Position (mm)

Linear Velocity -mm/s

Linear Acceleration - mm/s/s

Rotary

Angle -deg

Angular Velocity -rad/s

Angular Acceleration - rad/s/s

Measurement FB

Linear

Position - mm

Linear Velocity - mm/s

Linear Acceleration - mm/s/s

Rotary

Angle -deg

Angular Velocity -rad/s

Angular Acceleration - rad/s/s

Point-Data FB

Linear

Linear

Linear

X Position mm

Y Position - mm

Magnitude - mm

X Velocity - mm/s

Y Velocity - mm/s

Mag. Velocity- mm/s

X Acceleration - mm/s/s

Y Acceleration - mm/s/s

Mag. Acceleration - mm/s/s

Cam-Data FB

Rotary

Pressure Angle - deg

Contact Pressure Angel 1 - deg

Contact Pressure Angle 2 - deg

Linear

Inner Cam Radius-of-Curvature

Outer Cam Radius-of-Curvature

------

Force

Contact Force Total - N

Contact Force, X component - N

Contact Force, Y component

Stress/Pressure

Inner Cam Shear Stress- N/mm2

Outer Cam Shear Stress - N/mm2

------

Linear

Sliding-Velocity (mm/s)

------

------

Force-Data FB

Force

Joint Total Force / Torque

X Component - N

Y Component - N

Force

Cam Contact Force - N

X Component - N

Y Component  - N

Force

Spring Force - N

X Component - N

Y Component - N

Math FB

See Math FB dialog