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

Note:

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, if you need the motion-derivatives, YOU must add the 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. units for the Data-Type you select in the Math FB.

For example:

If you select Linear Coordinates in the Math FB, then 50mm at the input-connector becomes 0.05 meters in an equation inside the Math FB dialog

If you select Rotary Coordinates in the Math FB, then 50mm at the input-connector becomes (0.05*2*pi/360) radians in an equation inside the Math FB dialog.

What can you do with a Math FB?

You can use the Math FB to do:

Simple Algebra

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

Input variables, Parametric Equations, ... .

Use the output from other Function-Blocks to calculate a function of a machine-cycle. 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.

Change the Units of a Variable

Change the units at the input-connector of a Math FB to different units at its output-connector. To use a motion as a Force-Function to apply to a Spring FB you must convert the motion units, (e.g. 50mm) to Force units (e.g. Newtons).

How to add the Math FB and Open the Math FB dialog/interface.

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 an input-connector 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 an output-connector 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 equations and 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 three 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 these letters for the three data-channels - p, v, and a ALWAYS - even if the data at the input-connector is not motion-data.  

E.g. even if the wire is from 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:

It is easier to understand with 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 TWO inputs and Power is the ONE output.

Input 1: you can get Torque data from a Force-Data FBRed-14-1b.

Input 2: you can get Angular-Velocity data from a Motion-Dimension FBRed-14-2.

The Output Data-Type from the Math FB must set to Power in the Math FB

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 - note the three Data-Channels at output-connectors of the Force-Data FB and the Motion-Dimension FB.

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 input wire), Channel 1 (p = Torque)

v(1): Wire-Number 1 (bottom input 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 see 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.

Function-Blocks : Data-Types & Data-Channels

Output-Connector from :

Output

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

(3 output-connectors)

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

(5 output-connectors)

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