Browse FAQs

EcoStruxure Machine Expert - How do I scale a REAL value to a specified output range?

Published date: 26 June 2019

Scale a REAL value to a specified output range

Product Line
EcoStruxure Machine Expert / SoMachine v4.1 or higher

There is a function block named "FB_Scaling" for linear scaling of values based on an input and output range in the Schneider Electric "Toolbox" library.

To add the Library,
  1. In the Devices Tree, double-click on the "Library Manager" Node
  2. Then in the Library Manager pane, click on the "Add library" button
  3. Expand the "Util" list
  4. Choose "Toolbox"
  5. Click OK
  6. Now, you should be able to see the "Toolbox, (Schneider Electric)" library in your list of Libraries
    Name: "Toolbox, (Schneider Electric)"
    Namespace: "SE_TBX"
    Effective Version: ""
  7. Select the row, then expand "Equipment Control"
  8. FB_Scaling is the function block that is needed for scaling

To program the Function Block,
  1. Add the Function Block to a POU by dragging and dropping a Box from the Toolbox in visual (CFC, LD, FBD) languages (or Right-click and select Input Assistant intText-based (ST, IL) languages).
    FB_Scaling is located under Function Blocks > SE_TBX -> Equipment Control
  2. Assign a value of 'True' or a BOOL Variable to the i_xEn input pin
  3. Assign the Variable to be scaled to the i_rIput input pin
  4. Assign the input range to be scaled to i_MinIput and i_rMaxIput
  5. Assign the Output range to be scaled to i_MinOput and i_rMaxOput
  6. Assign the Variable of the resultant scaled value to the q_rOput output pin

The input and output values are not limited by the values assigned to i_rMinIput, i_rMaxIput, i_rMinOput, and i_rMaxOput. These ranges are only used in the linear transformation calculation to obtain the scaled value output dynamically:

Slope = (i_rMaxOput - i_rMinOput) / (i_rMaxIput - i_rMinIput)
Offset = i_rOutputMax - (Slope * i_rMaxIput)
q_rOput = (Slope * i_rIput) + Offset

For more information, see HTML Help section:
Schneider Electric Libraries -> Generic Libraries -> Toolbox Library Guide -> Equipment Control Functions -> FB_Scaling: Scaling Input Signals

The documentation can also be found as a PDF file:
Title: "EcoStruxure Machine Expert - Miscellaneous Functions, Toolbox Library Guide"
Reference Number: EIO0000000096

See Chapter 17 – FB_Scaling: Scaling Input Signals on Page 133

Was this helpful?

What can we do to improve the information ?

Can't find what you are looking for?

Reach out to our customer care team to receive information on technical support, assistance for complaints and more.