<< Click to Display Table of Contents >> Navigation: MechDesigner Reference & User Interface > Dialogs > Dialog: Function-Block: Math (with Calculator) |
See Add Math FB See also : Tutorial 18: Math FB
Use a Math FB to add new math functions.
Use a Math FB to change the Data-Type and units . For example, change Motion units to Force units, and connect a Math FB to a Spring FB.
A Calculator interface can help you select different functions.
|
To open the Math FB dialog:
|
The Math FB dialog is now open.
Math FB dialog |
1.Click the button to add an input-connectors to the Math FB. You need one input-connector for each variable or parameter in your equation. |
1.Click the button to add an output-connector from the Math FB. You need one output-connector for each output. |
1.Click the button when you: •Change the Output Data-Type •Edit an equation |
The Output Data-Type applies to All of output-connectors from the Math FB. To select a different Output Data-Type 1.Click the drop-down box 2.Select the Output Data-Type Notes: Inside the Math FB, all units are SI units. A change to the Data-Type may change the value at the output-connector of the Math FB. |
Output Data-Type, Output-Connectors, Data-Channels
For example: If you select Linear Coordinates as the Output Data-Type, then ALL of the equations use Linear Units If you have two(2) output-connectors, there are 6 equations. •The units for Data-Channels Q0[Dis.] and Q1[Dis.] are Displacement, with units of •The units for Data-Channels Q0[Vel.] and Q1[Vel.] are Velocity, with units of •The units for Data-Channels Q0[Acc.] and Q1[Acc.] are Acc, with units of •Data-Channels/Equations 0, 1, 2 are for the Output-Connector #1 •Data-Channels/Equations 3, 4, 5 are for Output-Connector #2 |
Wire Numbers / input-connectors and Data-Channels
The image below shows three(3) Wires connected to three(3) Input-Connectors. Each Wire has three Data-Channels. |
|
3 Wires, 3 Input-Connectors |
Wire-Numbers - refer to the image above. Wire numbers start at 0 •Input-Connector 1, Wire 0 - connected to the TOP input-connector •Input-Connector 2, Wire 1 •Input-Connector 3, Wire 2 - connected to the BOTTOM input-connector |
Each wire has 3(three) data-channels. Each data-channel is designated with a letter: •p = Data-Channel 1 •v = Data-Channel 2 •a = Data-Channel 3 The format to reference a Wire-Number and Data-Channel in an equation is Data-Channel (Wire-Number) Example - Entries in an Equation: p(0) : p refers to Data-channel 1 ; and (0) refers to input-connector 1 a(2) : a refers to Data-channel 3 ; and (2) refers to input-connector 3 v(1) : v refers to Data-channel 2 ; and (1) refers to input-connector 2 |
As an example, to calculate Power : P = Ʈ . ω Power (N.m./sec) = Torque(N.m.) × Angular Velocity (rad/sec) Torque data and Angular-Velocity data are inputs to the equation. Power is the output. You need two input-connectors and one output-connector. Edit the Math FB to open the Math FB dialog. 1.Add two Input-Connectors with the Add-Input button 2.Select Power as the Output Data-Type 3.Click the UPDATE button |
Prepare the model (see above) 1.Add a Rocker - see Tutorial 1 2.Edit the CAD-Line of the Rocker, to open the CAD-Line dialog. In CAD-Line dialog > Mass Properties tab > User Mass Properties . Enter X and Y values to move the Center-of-Mass away from the start-Point (origin) of the CAD-Line. 3.Add a Force-Data FB, open the Force-Data FB dialog, select the Pin-Joint, and select the Point in the Base-Part to find the Torque that acts-on the Base-Part. |
See image above - the Data-Channels on the wire of the Force-Data FB and the Motion-Dimension FB The Math FB uses SI units for all data 'inside'. Enter the Equation Click the first equation in the Math FB The Equation-Editor opens - see below. You need to enter this equation@ Q0 [Power] = p(0)*v(1) |
p(0) = Wire-Number 0 (top input-connector), Channel 1 (p = Torque) × v(1) = Wire-Number 1 (input-connector below top), Channel 2 (v = Angular Velocity) |
SYNTAX and VALID Equations Click the Update after you edit the equation to find out if the syntax is correct For example, it may not have correct number of parentheses. The reason is given as a message in the Feedback-Area. The at the left of each equation shows if its syntax is correct. IMPORTANT Data from Motion FBs If you connect a wire from a Motion FB to the input of a Math FB, Set the Output Data-Type in the MOTION FB to Linear or Rotary. |
There are 4 possible sources of confusion with respect to 'units' when you use the Math FB. SI Units Inside the Math FB, the units are SI. Example: •If the Motion FB is set to Rotary, and the output from it is 90º, then the value internal to the Math FB is 1.57radians. •If the Motion FB is set to Linear, and the output from it is 100mm, the value internal to the Math FB is 0.1m. If you multiply these together with the Math FB, the internal result is 0.157 - of course. SI Units are converted to Engineering Units The SI units and values that are internal to the Math FB are converted back to Engineering Units of the Output Data-Type. Example continued... •If the Output Data-Type is Linear Coordinates, then 0.157 is 157mm at the output-connector when the Engineering Units in the Machine Settings dialog are mm. •If the Output Data-Type is Rotary Coordinates, then 0.157 is 9º at the output-connector when the Engineering Units in the Machine Settings dialog are degrees. The reason? 0.157rads (inside the Math FB) = 9º (outside the Math FB). Linear-Coordinates to a Rocker, Rotary-Coordinates to a Slider Example continued... Rotary units to move a Linear Slider! In the Math FB, if you set the Output Data Type to Rotary Coordinates, then 0.157 is 0.157rads internally to the Math FB. It is 9º at the output, when the Engineering-Units are degrees. If you connect the Math FB to a Motion-Dimension FB to move a Slider, then the 9º is equal to 9mm. Linear Units to move a Rotary Rocker! In the Math FB, if you set the Output Data Type to Linear Coordinates, then 0.157 is 0.157m internally. It is 157mm at the output when the Engineering-Units are mm. |
Equation-Editor with Calculator
Equation-Editor with Calculator |
The Equation-Editor provides a few of the common mathematical functions you can add to each equation. Note 1: When open and close brackets show within a function button, you should enter a value that is constant or a value that changes over a machine-cycle. Example 1: Sin( ) You can enter a constant -. e.g. Sin(3.14) You can also enter a variable, e.g. Sin(p(1)) p(1) is data-channel #1 of input-connector #2. Note 2: ALL data “inside” the Math FB are SI units. Calculator Functions1.Position, Velocity, and Acceleration Values for a linear or angular input •P( ) ; V( ) ; A( ) 2.Standard Algebra •Arithmetic: +, –, ∕ , * •Power: ^ •Brackets: ( ) 3.Boolean •> : <output> =1 if <value 1> > <value 2>, else 0 •< : <output> =1 if <value 1> > <value 2>, else 0 4.Trigonometry (all inputs in radians) •Standard: Sin( ), Cosine( ), Tangent( ) •Hyperbolic: Sinh( ), Cosh( ), Tansh( ) •Inverse: ArcSin( ), ArcCos( ) , ArcTan2( ; ) 5.Limit (input ; maximum value ; minimum value) : <output> = <input> if <input> is less than maximum value AND more than minimum value. <output> = <maximum-value> if <input> is greater than maximum <output> = <minimum-value> if <input> is less than minimum 6.OverLimit (input ; limit-value) : <output> = <input> if <input> is 'greater than limit-value' <output> = <limit-value> if <input> is 'less than limit-value' 7.UnderLimit (input ; limit value) : <output> = <input> if <input> is 'less than limit-value' <output> = <limit-value> if <input> is 'greater than limit-value' 8.Limits (input ; maximum value ; minimum value) : <output> = <input> if <input> is 'greater than maximum value' OR less than minimum value'. <output> = <maximum-value> if <input> is 'less than maximum' AND 'more than minimum-value <output> = <minimum-value> if <input> is 'greater than minimum-value AND 'less than maximum-value' 9.Numerical Keypad 10.1...9, 0, Π. 11.Abs( ) 12.Mag( ; ) (assumes the two values are 'orthogonal' and uses Pythagoras to find the 'resultant') 13.Sqrt( ); 14.DegToRad( ) 15.RadToDeg( ) |
Limit Function Limit (input ; maximum value ; minimum value) : <output> = <input> if <input> is less than maximum value AND greater than minimum value. <output> = <maximum-value> if <input> is greater than maximum <output> = <minimum-value> if <input> is greater than minimum Note that the arguments in the Limit Function are SI units for the units in the model. For example, 75 millimeters in the model is 0.075 meters in the function. |
Under Limit Function UnderLimit (input ; limit value) : <output> = <input> if <input> is 'less than limit-value' <output> = <limit-value> if <input> is 'greater than limit-value' |
Over Limit Function OverLimit (input ; limit-value) : <output> = <input> if <input> is 'greater than limit-value' <output> = <limit-value> if <input> is 'less than limit-value' |