﻿ Getting Started Tutorials - MechDesigner > Tutorial 18: Maths FB > Step 18:0: Introduction to the Maths-FB

# Step 18:0: Introduction to the Maths-FB

### The Maths FB

IMPORTANT NOTES:

 Equations You must enter the equations correctly with the correct syntax. The Maths FB will check the syntax, but not the equation itself. If you enter an incorrect equation, the output will be incorrect. For example, if you enter the equation  ((u*t) + (0.5*a*t))to find the final velocity of a point that has constant acceleration then the result will be incorrect. The correct equation is ((u*t) + (0.5*a*t*t)). You MUST press the Enter key on your keyboard immediately after you enter or edit an equation. Motion Derivatives YOU must add the symbolic equation of each motion derivative. If your application needs position, velocity and acceleration, then you must enter the three equations separately. If you do not add the motion derivatives (velocity and acceleration), their values remain at zero. Units Use the Output Data Type in the Maths FB dialog-box drop-down box to select the units at the output-connector. The units inside the Maths FB are S.I. units. For example, •50mm at the input connector becomes 0.05m and applied to an equation.•50° at the input-connector becomes (50*2*pi/360) rads. and applied to an equation.

#### What can you do with a Maths FB?

 The Maths FB can use data that is available at the output-connectors of other FBs. You can use the Maths FB to do: Simple Algebra For example: 2+3. The output will be 5, of course. Parametric Constants For example, connect the output of a Motion-Dimension FB of a Crank and the output of a Force-Data FB of the same Joint. You can use the Maths 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 Maths FB. You can edit the Gearing FB, so that it becomes a parametric-constant of an equation in the Maths FB, for example Friction Coefficient. Change the Units of a Variable For example, change the units at the input-connector of a Maths FB - for example: mm or degrees - to different units at the output-connector of the Maths FB - for example: Newtons.

#### To Add a Maths FB and open the Maths FB dialog-box Add a Maths FB: 1.Click modeling-FB toolbar > Maths FB2.Click the graphic-areaThe Maths FB is now in the graphic-area Open a Maths FB dialog-box 1.Double-click the Maths FB. or

Math FB dialog-box - Basic Navigation and Example Add Connectors; Edit Output Data Type   Add Input button - to add input-connectors to the Maths FB. •A new input-connector shows at its left each time you click Add Input. You need one input-connector for each variable or parameter in you equation.Add Output button - to add output-connectors to the Maths FB. •Each output-connector (and wire) has three data-channels, and •Click the drop-down box to select the Data-Type for all of the output-connectorsUpdate button - click this button to update ANY change in the dialog. It is easy to use the Add Input and Add Output buttons add input and output-connectors. It is also easy to connect wires to the input and output-connectors. However, to be able to use the Maths FB you MUST understand Wire-Numbers/Input-Connectors and Data-Channels Three wires connected to the input of a Math FB Wire Numbers  and Data-Channels The image above shows three Wires connected to three input-connectors. Each Wire has a three Data-Channels. We need to explain more.... Wire-Numbers - refer to the image above. IMPORTANT : Wire Numbers start at 0 •Input-Connector 1 = Wire Number 0 - connected to the TOP input-connector•Input-Connector 1 = Wire Number 1 - connected to the next input-connector, one down from the top.•Input-Connector 1 = Wire Number 2 - connected to the next input-connector down, again•Input-Connector 1 = ...Data-Channel Each wire has 3(three) data-channels. Each data-channel has a letter - p, v, and a •p = Data-Channel 1•v = Data-Channel 2•a = Data-Channel 3The letters for the Data-Channels are ALWAYS p, v, a EVEN if the wire is not from a motion Function-Block. For example, from a Force-Data FB Each variable in an equation is identified by its: Data-Channel(Wire-Number) 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? By way of an example, to calculate Power from Torque × Angular Velocity P =  Ʈ . ω 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. To get Torque data: we must add a Force-Data FB to the model. To get Angular-Velocity data: the output from the Motion-Dimension FB is in the model. There is one output-connector when we add the Maths FB to the model. Prepare the model: 1.Add a Rocker - see Tutorial 1 2.Edit the CAD-Line of the Rocker, to open the CAD-Line dialog-box.In CAD-Line dialog-box | Mass Properties tab > User Mass Properties . Enter a value for the Mass In CAD-Line dialog-box | Mass Properties tab > User Mass Properties . Enter X and Y values to move the Mass from the start-Point of the CAD-Line. We will not enter a value for the Inertia or Radius of Gyration. This makes the mass a Point Mass - as if the mass of the Rocker is reduced to a particle. 3.Add a Force-Data FB, open the Force-Data FB dialog-box, select the Pin-Joint, and select the Point in the Base-Part to find the Torque that acts-on the Base-Part.Edit the Maths FB Set the Output Data Type to Power. Click UPDATE after we select the Output Data Type and before we add equations. The Maths FB uses SI units for all data at its input-connectors The equation in the Maths FB is: p(0)*v(1) OR Wire-Number 0 (top), Channel 1 (p = Torque) × Wire-Number 1 (bottom wire), Channel 2 (v = Angular Velocity) SYNTAX and VALID Equations: Click the Update after you edit the equation to find if its syntax is correct or not 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. The at the left of each equation shows whether its syntax is correct. Data-Channels and Input-Connectors When you click the Add Input button, you do not change anything inside the dialog-box. You only add a new input-connector. Each wire you connect to the input-connector has three(3) data-channels (typically, three motion-derivatives) The input and the data-channel of an input is identified with a letter and a number. •The letter gives the data-channel on each input. The letters are always:p = Channel 1 ; v = Channel 2 ; a = Channel 3 •We identify each input-connector with a number:The input-connector is in parentheses in an equation. (0), (1), (2)... for input-connectors 1, 2 and 3 respectively. Thus, examples might be: p(0) = Data-channel 1, with input-connector 1 a(2) = Data-channel 3, with input-connector 3 v(1) = Data-channel 2, with input-connector 2 Data at Output-Connectors The data at each output-connector are given in sets of three. The image has two sets of three: Output-connector 0 and 1, with Data-Channels 0–2 and 3–5, respectively. Output Data Type: Units (S.I. Units 'inside the Maths FB) Output Data-Type drop-down box specifies the units for all of the output-connectors. If you change the Output Data Type, you should click the 'Update' button at the bottom of the dialog-box. The units that are used within each equation are the SI unit of the 'Output Data Type' : kilogram, metres, seconds, radians WARNING: An input of 18° becomes (2*π*18/360) = 0.314 radians within the Maths FB, and then back to 18° again when the Output Data Type is set to Rotary Coordinates. An input of 18° becomes (2*π*18/360) = 0.314 radians within the Maths FB, BUT the data is converted to 314mm from 0.314radians at the output-connector, when the Output Data Type is set to Linear Coordinates. To look at the values at the output-connector of a Maths FB, plot the values at the output-connector of a Maths FB with a Graph FB. Valid Equations The ,or a at the start of each equation identifies whether the equation is valid. You must make it valid. An invalid equation might be where the number of parentheses is incorrect. Read the message in the Feedback Area.