Understanding module concepts
To understand how to use modules to build a hierarchy, you need to understand 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 output it will generate when the module is run. Once a module is built, its inputs and outputs can be connected to entities in other models (or modules). These entities 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 an entity (for example, 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 an entity to hold this information. These are the module inputs. When you are ready to use the module, you select the entity outside the module that will provide the value for the module input by assigning the module input to an entity.
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 an entity outside the module, you are assigning the actual parameter.
You can assign a module input to any entity that is connected to the module that contains the module input. For the module to run, an entity defined as a module input must be assigned to an entity outside the module that will provide the input value.
Module output – A module output is an entity in the module that contains information generated by the module. A module's outputs can be assigned to other entities when that module is connected to an entity 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 entity or module. You can manually define an entity as a module output, or you can assign it as a module input and it will be automatically defined as a module output.
Levels – Modules within a hierarchy exist in levels. The hierarchy begins with a top level, which is a model. The top-level model contains connections down into one or more modules. Although several modules can exist on the same level, you can view only one module at a time. You can navigate up and down levels to view modules, but you cannot navigate sideways.