Function Overloading

Function overloading defines two or more functions with the same name but different signature, such as argument or return type. FBD Functions that support overloading take a range of input data types. The output data types depend on the input data types.
FBD Functions follow these rules:
  • Input type promotion
    • Input type promotion
      • Data types rankings from highest to lowest priority:
        LREAL, REAL, ULINT, LINT, UDINT, DINT, UINT, INT, USINT, SINT
      • All inputs promote to the data type of the input with the highest rank before execution
      • If all inputs have a rnak value of DINT or lower, all inputs promote to DINT type before execution
    • Output type depends on the input type
      The function's output type is the promoted input type
For example, Add function,
  • SINT + UINT inputs promote to DINT + DINT inputs. Outputs are DINT
  • USINT + LINT inputs promote to LInt + LINT inputs. Outputs are LINT
  • UNIT + LREAL inputs promote to LREAL + LREAL inputs. Outputs are LREAL
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal