Up to this point, we’ve used many of the built-in functions in Modelica in previous examples and particularly in our discussion of Array Functions. While Modelica includes an extensive set of functions for many common calculations, users still need the ability to define their own functions. The process of defining functions is the central topic of this chapter.

As always, we’ll start with several examples to motivate the need for user defined functions. Then we’ll review the important elements of user defined functions in Modelica.