Understanding Module Concepts

To understand how to use modules to build a hierarchy, you need to know the basic concepts of working with modules:

Module – A module is a self-contained model that specifies the inputs it needs to run and the outputs it will generate when the module is run. Once a module is built, its inputs and outputs can be connected to variables in other models (or modules). These variables provide the input values for the module and accept the output values from the module.

You can think of a module as a "black box" that has inputs and outputs. To connect the module to other modules, you need to specify what information needs to come from other modules ("Module Inputs") and what information is sent out to other modules ("Module Outputs").

Module input – A module input is a variable (say, a stock or a converter) that contains information that the module needs in order to run. When you build a module, you decide what information in the module needs to come from outside the module and you create a variable to hold this information. These are the module inputs. When you're ready to use the module, you select the variable outside the module that will provide the value for the module input by assigning the module input to a variable.

If you think of a module as a mathematical function, unassigned module inputs (and outputs) correspond to the formal parameters of a function. When you assign the input to a variable outside the module, you're assigning the actual parameter.

You can assign a module input to any variable that's connected to the module that contains that module input. For the module to run, a variable defined as a module input must be assigned to a variable outside the module that will provide the input value.

Module output – A module output is a variable in the module that contains information generated by the module. A module's outputs can be assigned to other variables when that module is connected to a variable or another module (thus, the module output value is assigned to a module input). This allows you to have the results of one module become the input value to another variable or module. You can manually define a variable as a module output, or you can assign it as a module input and it'll be automatically defined as a module output.

Levels – Modules within a hierarchy exist in levels. The hierarchy begins with the top level, which is the model. The top-level model contains connections down into one or more modules. Although several modules can exist on the same level, you can only view one module at a time. You can navigate up and down levels to view modules, but you can't navigate sideways.

Concept Link IconSee Also