I generally do not use modules to build very small models (only a couple of stocks and flows), which may then lead me to use sectors as the model grows because they are very convenient. By the time I have three sectors, though, it starts to become clear that I should have used modules. I will then need to convert my sector-based model into a module-based model. Historically, I also have a number of sector-based models that are crying to be module-based.
Converting from sectors to modules is not very difficult:
- Make sure there are no connections or flows between sectors. Replace any of these with ghosts in the target sector.
- In a new model, create one module for every sector.
- Copy and paste the structure from each sector into its corresponding module.
- Connect the modules: At this point, the model structure has been rearranged into modules, but none of the modules are connected. The ghosts that were in the sectors became real entities when they were pasted into the modules. Go back to identify all of these connections and reconnect them in the module-based model.
Stepping Through a Sample Model
Let’s walk through an example. A small sector-based model is shown below (and is available by clicking here).
This model violates what I would call good sector etiquette: there are connectors that run between the sectors. This is often useful in a small model such as this because it makes the feedback loops visible. However, in a larger model, this can lead to problems such as crossed connections and difficulty in maintaining the model because sectors cannot be easily moved.