Metodological Issues

The following topics contain papers written by leading system dynamicists and modellers. They focus on various methodological aspects involving the use of Powersim.

Introduction

Powersim as a Tool for System Dynamics Modeling

Using Powersim to Teach Sustainable Economic Development

Feeding Your Models with Real Business Data

Powerful Modeling Using Array Variables


Introduction

Powersim is designed to support a quantitative and experimental approach to management, as described in the system dynamics method. The steps of a system dynamics analysis were first described by Jay W. Forrester in his book "Industrial Dynamics":

1	Identify a problem.

2	Isolate the factors that appear to interact to create the observed symptoms.

3	Trace the cause-and-effect information-feedback loops that link decisions to action to resulting information changes and to new decisions.

4	Formulate acceptable formal decision policies that describe how decisions result from the available information streams.

5	Construct a mathematical model of the decision policies, information sources, and interactions of the system components.

6	Generate the behavior through time of the system as described by the model (usually with a digital computer to execute the lengthy calculations).

7	Compare results against all pertinent available knowledge about the actual system.

8	Revise the model until it is acceptable as a representation of the actual system.

9	Redesign, within the model, the organizational relationships and policies which can be altered in the actual system to find the changes which improve system behavior.

10	Alter the real system in the directions that the model experimentation has shown will lead to improved performance.

Steps 3, 5, 6, 8, and 9 are directly supported by the Powersim software package.


Powersim as a Tool for System Dynamics Modeling

by Professor Pål I. Davidsen

All human beings live in a complex, dynamic reality of natural and social systems. Most systems are not in equilibrium and their states change continuously. In order to understand, adapt to, and control this reality, methods must be developed to capture it in formal models. Powersim is a major contribution to the set of tools that facilitate the study of dynamic systems.

Modeling reality

The mental models of decision makers cannot process the variety and complexity of most of the systems experiencing problems. With the use of computers, however, it is possible to explicitly represent, combine, and formalize these models, and communicate their assumptions to laymen, students, colleagues, and policy designers who will subject them to constructive criticism.

Simulation models, in particular, can be used to investigate the intimate relationship that exists between the structure and behavior of dynamic systems. That is, how problematic behavior arises from the underlying structure of a system and how this structure can be modified to alleviate system's problems.

Method developed at MIT

In the late 1950s, Professor Jay W. Forrester of the Sloan School of Management at the Massachusetts Institute of Technology, developed the system dynamics method for this purpose. Since then, this method has been applied to a wide variety of issues and problems in both the public and private sectors. Large corporations and governmental agencies make use of the insights gained from building system dynamics models in their design of policies and strategies, and in their tactical and operative decision making.

Powersim is a major contribution to the set of tools that facilitate the study of dynamic systems. It is an excellent MS Windows-based software package that makes possible the formulation of simulation models in the graphical notation originally developed by Professor Forrester.

Experimental approach

In order to identify the underlying causes of real problems, realistic models must be developed, analyzed and modified experimentally.

In the past, policy makers have spent a lot of time and effort developing and teaching effective ways to analyze relatively simple models. In particular, they have been concerned with identifying their equilibrium conditions.

Less time and effort have been spent on developing tools that can be used to represent systems in dynamic transition between equilibria never attained.

Within the system dynamics paradigm, emphasis is placed on model conceptualization and on the utilization of a wide spectrum of criteria for model validity that helps ensure that the resulting models correspond to real systems -- structurally as well as behaviorally.

"Better to be almost right than exactly wrong"

The emphasis on realism has two implications. First, it implies that models must reflect the complexity of real systems. Although model simplicity is a virtue, complexity is often a necessity. Second, it implies that optimal solutions in many cases cannot be found in closed form, and that simulation techniques and the experimental identification of realistic solutions must be utilized. As a wise person once noted: "it is better to be almost right than exactly wrong".

Properties of complex systems

Complexity defies human intuition. In particular, there are four kinds of structural properties that humans find cognitively challenging in dynamic systems.

First, there is the origin of dynamic behavior itself - the relationship between flows and levels. Levels accumulate flows and flows cause the levels of levels to change over time. Although simple in principle, humans often find it difficult to distinguish between real levels and flows and to identify the behavioral consequences of flows acting on levels.

Second, there are delays or lags in actual systems. Delays distribute the effects of changes in variables throughout a system over time and often cause information to arrive at its destination in an untimely, and hence harmful, manner. Delays and lags lead humans to discover and give priority to short-run gains and to ignore and postpone actions against future losses. Delayed reactions typically cause systems to over and undershoot and thus to exhibit oscillatory behavior.

Third, there is feedback. Real world systems are usually characterized by circular causality. Their structures contain feedback loops that transmit the dynamic behavior of one attribute to the next until the circle is closed and the signal, in a modified form, is fed back to its origin. Such loops have a tendency to stabilize or to destabilize a system. When humans try to manage a feedback system, their actions are typically amplified or counteracted, depending on which feedback structure are dominating the system at the time.

Finally there are non-linearities. Nonlinearity implies that system attributes influence each other in a non-proportional way and that they interact so that their partial effects, playing out over time, cannot easily be distinguished. Such interactions may cause shifts in the structural dominance of a system over time. That is, substructures that have dominated a system's behavior for some time may, suddenly or gradually, loose their influence while other substructures gain influence. This typically causes a dramatic modification of the system's dynamic behavior.

These characteristics of complex systems tend to mask the relationship between cause and effect, and thus to obscure current problems and hide the means of solving them. Successful solutions are thus often counterintuitive and hard to identify. In addition, there are often uncertainties associated with system, and humans tend to state their perceptions, policies, preferences and attitudes vaguely. As a result, realistic models of systems require the use of both random and fuzzy numbers in simulations.

Supports constructivism

System dynamics supports constructivism. It facilitates the building of microworlds that allow the study of how complex patterns of behavior arise when micro-structures, exhibiting simple behavior patterns in isolation, are connected. Conversely, it facilitates the analysis of the structures underlying complex behavior patterns. Powersim, as a system dynamics tool, is useful for investigating the relationship between micro and macro structure as well as behavior.

Transfer of knowledge

The system dynamics method enables decision makers to use their experience. When people learn from studying one dynamic system they can often transfer their knowledge to other, similar systems. The symbols utilized to create systems dynamics models are quite general. As a result, system dynamics models are often able to generate insights across disciplines. Such generalized models are called generic structures, and their associated behavior is generic as well. The exponential growth or goal seeking behavior arising from simple first order positive and negative feedback loops, the S-shaped pattern created by a shift in dominance between positive and negative loops, and the oscillations typically resulting from lags in negative feedback loops, are simple examples of generic structures and behaviors. Knowledge of such structures and behaviors can be applied to many specific systems, under many specific circumstances.

Powersim is particularly useful at utilizing generic models. These models can be stored in a library from which they can be copied, modified, and incorporated as co-models or integrated (pasted) as sub-models, in a larger "main" model.

The ability of Powersim to describe and solve problems, however, suggests that its real benefit arises from its use in the model building process itself, rather than from its ability to simulate a particular model. As a result, the people who both know the system experiencing the problem, and are charged with implementing model-based results, should participate fully in the modeling process. Their participation increases the likelihood that they will believe the model they helped to create and will implement its results. Powersim's graphical user interface greatly reduces the barriers to the participation of policy makers in the modeling process.

Improving dynamic intuition

Experience tells us that the dynamic intuition of humans is poorly developed. When presented with simple dynamics problems, humans tend not to take feedback, delays, non-linearities, and uncertainties appropriately into account. This is mainly because the training decision makers traditionally receive is inadequate for dynamic thinking. Three conclusions can be drawn from this:

First, students must be trained from an early age to develop a fundamental understanding of complex, dynamic systems. The founder of the field of system dynamics, Professor Forrester, devotes much of his time to the System Dynamics in Education Project at MIT, aimed at developing educational material for students and teachers in American high-schools. Realizing the importance of establishing a dynamic intuition among young people, the Norwegian Ministry of Education have included dynamic modeling as a central part of the new informatics course for Norwegian high schools.

Models are undeniably abstract, and do not always aid in the effective communication of system insight or problem solutions. Recently, however, microworlds or, more specifically, management flight simulators with capturing interfaces, have been developed to create the requisite engagement in complex systems. Although apparently successful, many questions regarding the educational benefits from these simulators remain unanswered.

Although such simulators may serve to trigger an interest in a problem, they typically emphasize behavior at the cost of providing a deeper understanding of the structural origin of that behavior. By making full use of the MS Windows interface, Powersim facilitates the creation of spectacular management flight simulators. In addition, any user of a flight simulator, can gain access to the underlying model structure, and, when necessary, modify that structure.

This illustrates how Powersim aids in both decision making, and policy design that requires a structural understanding and structural modifications to a system.

How are decisions made?

The questions arising from the utilization of microworlds in management training are currently under intense scientific investigation.

How are decisions made in a complex, dynamic environment?

What information is taken into consideration?

How is that information transformed into a decision, and how are decisions being implemented?

What circumstances affect this process?

Which system properties pose the major challenges to the decision maker?

Policy design

These types of questions must be answered in the process of designing appropriate policies. For that purpose, policy makers are exposed to a management flight simulator. Traditionally, these simulators have not allowed the policy maker to experiment with the models underlying their structures (i.e., they have not allowed the policy maker to alter their structures as they would do in real life).

Powersim has been developed so that participants in a management game can simulate off-line while designing their own strategies. Combined with constrained or free access to the underlying model, this allows them to investigate a wide spectrum of research topics in decision and management sciences.

Powersim important for the growth of system dynamics

Managers, scientists, teachers, and students should be highly satisfied with the successful development of Powersim. It will be of major importance to the growth of the field of system dynamics and to the utilization of system dynamics as a policy design method in complex, dynamic environments.

Pål I. Davidsen is a professor in system dynamics at the Department of Information Science at the University of Bergen.


Using Powersim to Teach Sustainable Economic Development

by Dr. Michael J. Radzicki

During the past five years, the daily news has become increasingly filled with stories of economic stagnation and environmental destruction. As a result, student interest has rekindled in an area of economics known as "sustainable economic development." Simply put, sustainable development involves the design of policies that balance economic activity and environmental preservation. It is thus an area that attempts to address a question that has intrigued economists for more than 200 years: How can the needs of the present generation be met without compromising the needs of future generations?

The purpose of this article is to describe how system dynamics and the Powersim software package are being used to teach the economics of sustainable development at the university level. The students involved are undergraduates at Worcester Polytechnic Institute in Worcester, Massachusetts, USA. They typically have no training in either economics or system dynamics prior to their participation in the course in which Powersim is used.

A Quick Overview of the System Dynamics Method

The system dynamics method rests on four fundamental ideas.

The first is that all dynamic behavior in the world occurs when flows are accumulated in levels. A level can be thought of as a bathtub and a flow as a pipe and faucet assembly that fills or drains the tub.

The second fundamental idea is that a systems levels and flows are imbedded in feedback loops. Feedback is the transmission and return of information. In system dynamics modeling, information about a systems levels travels throughout its structure until it reaches its flows. In response to the information, the flows alter the levels and hence close the feedback loops.

Two kinds of feedback loops exist in system dynamics modeling -- positive loops and negative loops. Positive loops generate self-reinforcing behavior and negative loops generate stabilizing or counteracting behavior.

-	An example of a positive loop is the relationship between births and population in a developing country. As the countrys population increases, its number of births will increase and, as more babies are born each year, its original increase in population is reinforced.

-	An example of a negative loop is the relationship between deaths and population in a developing country. As the countrys population increases, more of its people will die and, as more people die each year, the countrys original population increase is counteracted or resisted.

The third fundamental idea in system dynamics modeling is that the feedback loops in any system are often joined together by nonlinear couplings. Essentially this means that information about a systems levels feeds back to affect the levels in nonproportional (and often complicated and unpredictable) ways.

The last fundamental idea in system dynamics modeling is that the dynamic behavior inherent in a systems interacting web of levels, flows, feedback loops, and nonlinear couplings cannot be ascertained by the unaided human mind, nor solved for mathematically, in closed form. As a result, computer simulation is required to reveal the dynamic behavior of complex systems.

The Traditional Approach to Sustainable Economic Development

The very name of the subdiscipline -- sustainable economic development -- conjures up an image of an economic system changing over time in response to (and often in spite of) the efforts of policy makers to control it. Yet, the traditional approach to teaching sustainable development involves forcing students to learn a collection of static (and often incompatible) models that attempt to identify policies that will foster sustained economic activity. When the traditional approach ventures into the arena of dynamic analysis, moreover, it usually does so in a verbal and imprecise manner. Lastly, although the traditional approach occasionally utilizes the concept of feedback, it does so in a somewhat curious manner. More specifically, the traditional approach occasionally identifies positive feedback processes that work to hold back a nations economic development but rarely, if ever, identifies any negative feedback processes. Further, the positive feedback processes that are identified are not referred to as such, but rather as "vicious circles" or processes of "circular and cumulative causation." In sum, the overall problem with the traditional approach to teaching sustainable development is that there is no way for students to integrate the various insights put forth via the static models, data, and positive feedback processes to which they are introduced, and no mechanism for revealing the dynamic behavior inherent in the insights.

Using Powersim to Teach Sustainable Economic Development

At Worcester Polytechnic Institute, sustainable economic development is taught via system dynamics and the Powersim software package. The basic approach is to have students read traditional materials on economic development while simultaneously building a Powersim model of a developing nation. After the students have completed the model, they play a Powersim game based on the model. The students use the game as a "microworld" or "learning laboratory" for gaining insight into the dynamics of the developing nations they have been studying.

The Powersim model and game are based on a system dynamics board game originally created by Dennis Meadows called STRATAGEM-1. One of the "problems" associated with STRATAGEM-1 is that it typically takes four to eight hours to play. For obvious reasons, this makes it somewhat difficult to use in a university classroom setting (although breaking up play over a span of days or weeks is one practical way to address this issue). Meadows chose this design for STRATAGEM-1 because he feels that system dynamics games are best played by teams of individuals, seated around a table discussing game decisions as equals, with the computer and model out of their streams of consciousness.

Although Meadows position on the design of system dynamics games is compelling, as a practical matter, STRATAGEM-1s playing time makes it less attractive to use in an undergraduate development course. To compress playing time and enable STRATAGEM-1 to be played as a homework exercise, therefore, it was translated into a Powersim model and game. During this process, it was discovered that the STRATAGEM-1 model did not address some fundamental issues that are discussed in the traditional development literature. As a result, the STRATAGEM-1 model was expanded to accommodate these issues.

As with all types of gaming, briefing and debriefing sessions are vital if the players are to have a meaningful experience. WPI students are prepared to play the Powersim development game by being asked to build the underlying model, sector by sector, in class, during the course of the term. This process gives the students a detailed knowledge of the model and helps them to see how the relationships discussed in the traditional development literature are represented in the model.

The figure below presents a Powersim level-flow diagram of the simplest version of the demographic sector of the sustainable development model. This is the first model with which the students interact.

By contrast the next figure presents the sixth version of the demographic sector. It is quite clear from this figure that the students are able to progress to a fairly high level of model complexity. The demographic structure presented enables them to keep track of, among other things, the developing nations dependency ratio -- i.e., the ratio of its work force to its very old and very young citizens.

The figure below presents a copy of the playing screen for the sustainable development game. Each of the icons can be opened via double clicking to reveal on-line help, time series plots of various variables in the model economy, or Powersim "slider bars" that enable some of the models parameters to be changed during a pause in the game.

The figure below resents the foreign loan decision slider bar, accessible by double clicking on the appropriate icon in  the game interface.

During play, students can change the amount of money the developing nation borrows from international sources (e.g., the World Bank). The maximum possible loan represents 25% of the current net worth of the country. Other allocation decisions the students can make involve: 1) food -- how much for export, how much for domestic consumption; 2) goods -- how much for export, how much for domestic consumption, how much for investment in each of six types of capital (goods producing, food producing, energy producing, environmental protection, energy efficiency, social services); 3) energy -- how much for export, how much to power each of the nations capital levels, how much to save; and 4) foreign currency -- how much to spend on imports of energy, how much to spend on imports of food, how much to spend on imports of goods, how much to spend on debt retirement, how much to save.

The students step the economy through twenty simulated years. After each two year period, Powersim pauses and allows the allocation of resources to be changed by the slider bars. The students can thus test the consequences of policy options and their knowledge of the interactions in the model. Of course, if they do not like the results, they can simply play again. Indeed, Powersims user friendly interface invites the student to play again.

Conclusions

Powersim has enabled the STRATAGEM-1 game to be recast in a manner that compresses playing time and allows for the expansion and modification of the underlying system dynamics model. Student response to the game has been enthusiastic and student knowledge of the important issues and interrelationships in the area of sustainable development have been enhanced. Current research is being directed toward adding Third World urban-rural migration and a "First World" sector to the underlying system dynamics model. The latter addition will permit two students to play the game simultaneously over a LAN -- one making the decisions for the less developed sector, one making decisions for the more developed sector. This will allow the importance of the linkages between the nations of the world (e.g., environmental, trade, financial) to be powerfully illustrated.

Dr. Michael J. Radzicki is an Associate Professor of Economics at Worcester Polytechnic Institute, Worcester, Massahusetts, USA.


Feeding Your Models with Real Business Data

by Magne Myrtveit

In making models of real world problems or real world processes, the need for transfer of data between model and external files, applications or other devices becomes important. This article illustrates the use of automatic data transfer in model construction and in process control.

In a typical model construction and verification process, real data plays an important role. Once a model is made of the target system, real data is fed into the model, and the model output is compared to the output of the real system. The result of the comparison is used as a basis for refining model structure, model parameters, or both.

The Dynamic Data Exchange (DDE) object and the Archive object of Powersim may be used in a model to import and export data during simulation. This greatly reduces the amount of work involved in checking models against reality. DDE can also be used to set up a data analysis, for example, by launching a spreadsheet or a statistical program. In combination with the multiple runs feature of Powersim, a series of model structures and model parameters can be tested with real data without manual intervention.

In a research project aiming at developing a model of the biological process of fish growing in a fish farm, the above tools have allowed for extensive use of data from fish farms in the process of model construction and verification.

The basic feedback loop of a process control system, involves measurement (import of data), comparison between measured values and desired values, followed by a controlling action (output of data) aiming at closing the gap between actual and desired process state. The data transfer protocols of Powersim make it possible to implement process control systems as Powersim models, and linking the models to the physical process. A range of input/output devices for the Windows operating system supports DDE or Net-DDE, and may therefore be used directly together with Powersim.

Tools for modeling real businesses

A variety of tools are used in describing, measuring, storing, retrieving, transferring, analyzing and presenting business data.

Figure 1: Past, current and projected business data

Databases and spreadsheets are commonly used to store current and past business data. Statistics can be produced based on time series (history) of data. System behavior can be described using time graphs and time tables that may be produced easily using a variety of tools, including word processors, presentation software, spreadsheets, and database front-ends. System structure (relationships, cause and effect) is often described as static maps (organization charts, flow charts, etc.). For simple systems, differential mathematics can be used to describe system structure and infer system behavior. Using statistical methods (models), projections may be made into the future, for example by extrapolation. Even within the field of systems thinking, a variety of tools are used.

Figure 2: Transfer of data to and from simulation model

Simulators represent a valuable extension to the set of business tools. A main use of simulation models is to describe a system (for example a problem, an organization or a process), and to carry out simulations mirroring the behavior of the system. The dynamic nature of simulation models adds a new dimension business modeling.

In verifying a model, recorded history is compared to simulated output from the model. If there is a close match between model behavior and actual history, the model will most likely be a valid description of the real system.

Even valid models can fail significantly in predicting the future of a business. One reason for this is that for most business processes there will be a number of uncertain factors that will influence the system. We therefore have to make assumptions about external factors when making simulations into the future. Fed with different sets of assumptions, a simulation model can produce quite different results. This makes it possible to get answers from the model to what-if questions, and test consequences of assumptions.

A dynamic model is a virtual world

Creating a simulation model can be looked upon as creating a virtual world representing parts of the real world. We can think of modeling as a goal seeking loop where the real world is the goal, the current model is the actual value, and the modeling process is the corrective action.

The balance icon is used to denote a balancing feedback loop.

Figure 3: Balancing loop

Figure 4: Creating a virtual world

If we change the names in Figure 3 a little, we get a picture of the modeling process, as shown in Figure 4.

In determining the gap between Virtual World (model) and Real World we may use qualitative and quantitative measurements.

Qualitative comparisons between model and real world

Qualitative comparisons between model structure and relationships in the real world are of great value in the conceptualization of a problem. The field of systems thinking has developed numerous tools for analyzing a problem and developing a simulation model describing the problem and its behavior. Using causal loop diagramming, for example you may create a high-level map of any dynamic problem. Or you may try to fit your problem into one of the system archetypes that have been identified.

If you choose to use causal loops to describe your problem, studying feedback loops can shed light on important characteristics of the models behavior. And if you use archetypes to describe your problem, the typical behavior of each archetype can be used to make rough statements about basic behavior of your real world problem.

Quantitative comparisons between model and real world

A simulation model can be compared to a hypothesis about a phenomenon. By comparing model behavior to the real world we can determine the validity of our hypothesis. A model that corresponds well to the phenomenon it describes, can be used as a theory (see Figure 5).

In the range between scientifically verified theories and vague statements there is room for a broad variety of models. Based on the intended use of a model, the level of necessary accuracy will vary. As an example, a model for educational purposes can be useful even if it does not give 100% accurate output. In the business world, however, we often encounter situations where even small variations in model output are of importance.

Figure 5: Models describe hypotheses and theories (verified hypotheses)

The final adjustments of a model normally involves parameter tuning. In Figure 6 we have added labels to the arrows from Real World and Virtual World to Gap. One set of data is obtained by gathering statistics about the real world, while another set is produced as output from a simulation run.

Time	1	2	3	4
Actual (A)	5	7	3	4
Simulated (S)	4	5	2	3
Difference (D=A-S)	1	2	1	1
D*D	1	4	1	1
Figure 6: Comparing simulation output to real world measurements

The sets of measured and simulated data can be compared to compute a numerical gap between the real world and the model. The gap can be computed in different ways. A simple solution is to compute the difference between actual and simulated data. Another approach is to compute the sum of the squares of the differences between actual and simulated data. The latter approach may be useful when several variables are compared, or when time series are compared. (The term time series is used when we refer to a set of values for a variable at different times.)

In Figure 7 we have made a table with a hypothetical actual time series [5, 7, 3, 4] and a simulated series [4, 5, 2, 3]. The differences between each element of the actual and the simulated series are computed and squared. By adding together the numbers in the final row we get 7, which is a measurement for the gap between actual and simulated values.

Figure 7: Computing the gap between actual and simulated data

If the actual values are imported into the simulation model, the gap may be computed during simulation, like this:

Powersim diagram	Powersim equations
	aux Actual = ... aux Simulated = ... aux DiffSquared = (Actual-Simulated)^2 init Gap = 0 flow Gap = +dt*DiffSquared
Figure 8: Computing the gap as part of a simulation

The definitions of Actual and Simulated will vary from model to model.

Importing data into the simulation

Values of external factors (observed or assumed) influencing a model are often stored in data files. The same is true for historical business data that we may want to include in our simulation for comparison with simulated vales.

For small data sets it may be OK to type the data into the simulation model, for example as parameters to a table look-up function. In a real business situation, however, we may want to experiment with different data sets, and each set of data may be quite large. This means that typing data into the simulation model becomes inflexible, time consuming, and error prone. We should therefore look for methods of automatic data transfer between a simulation model and the environment.

Powersim includes mechanisms for accessing external data files directly, or indirectly, via communication with applications managing the data (for example spreadsheets).

Figure 9: Data transfer with files and applications

Importing data from files

Powersim can read text files directly into a simulation using the archive object. Setting up a transfer is done by creating an archive object in the model, and connecting a data file to one or more parameters (scalar variables or array elements) of the model.

Text files with data to be imported into Powersim can be created in several ways. You may, for example, use the Windows text editor Notepad or any other application that is able to store files as plain text. Most spreadsheets will allow you to choose Text as output format when storing a spreadsheet using the File Save As command. The same is the case for most word processors.

Powersim can read data either as time series or as single values. As an example, we may enter the time series Actual that was used in the previous chapter, into a text file ACTUAL.TXT. The data can be organized in the file as displayed in Figure 10.

Time	Actual
1	5
2	7
3	3
4	4
Figure 10: Text file holding time series to be imported into Powersim

A tab character is used as column separator. Options to the archive object are used to match the format of the imported data, for example choice between horizontal or vertical orientation, presence of time series row or column, presence of row or column headers, choice of column separator, numerical format.

If we want to import the data in Figure 10 into our simulation model, we define a constant variable Actual to receive the data. We then open the archive object to make a connection between the constant and the text file ACTUAL.TXT. Before simulating, we should define the time horizon for the simulation to be from 1 to 4, as this is the range for which we have data. We can now run the simulation.

In order to verify that the variable Actual takes on the values stored in the text file, we can create a time table object and make Actual a parameter of the time table. The resulting diagram is displayed in Figure 11.

Figure 11: Diagram with constant, archive and time table

Importing data from applications

Figure 12: Spreadsheet with time series

Dynamic Data Exchange (DDE) is the name of a standard protocol for data transfer between MS-Windows based applications. Most industry strength applications  including Powersim, MS-Word, MS-Excel, and Lotus 123  support DDE.

DDE is based on a client server architecture, where a client application can ask a server application for services. Powersims DDE object defines the client end of a DDE link, allowing Powersim models to transfer data to or from a DDE server application.

As an example, let us enter the data in the file ACTUAL.TXT into a spreadsheet as displayed in Figure 12.

In order to obtain data from a DDE server (for example a spreadsheet) we must inform the DDE object about:

Server  the name of the server application, for example Excel

Topic  the name of the document where the data is stored, for example ACTUAL.XLS

Item  the part of the document where the data is located, for example R1C1:R4C2

The DDE object in Powersim is almost identical to the archive object. The main difference is that File in the archive object is replaced by Server, Topic and Name in the DDE object.

Exporting data from the simulation

By changing the transfer to To File for the archive object and To Application for the DDE object, data can be transferred from a simulation to a file or another application, respectively.

It is possible to use several archive and DDE objects in one model, allowing for transfer of data in both directions. As an example, while data is read from one column of a spreadsheet, simulation output can be written back into another column.

The possibility to store simulation results in a file or into documents managed by other applications, opens for storage, transfer, analysis, and presentation of simulation output using applications of your choice.

Closing the circle of continuos improvement

Creating a micro world may serve several objectives, including;

gaining insight into the real world through the modeling process,

training people with management flight simulators based on running simulations,

designing strategies for improving the real world using experimental simulation.

Powersim is designed to support all of the above activities. In Figure 13 we display how a continuous improvement process can be implemented.

Figure 13: Simulation as a basis for continuos improvement

Each of the arrows in Figure 13 involve actions that must be carried out in order to close the loop. Powersims data transfer capabilities are important in importing measurements from the real world into a simulation. Advanced modeling capabilities like arrays and co-models help make realistic models. For creating custom interfaces to micro worlds Powersim contains authoring capabilities, and can also be integrated with custom interface applications using both DDE and Application Programming Interface (API) calls from languages like C, C++ and Visual Basic.

Using DDE to control a process

Figure 14: Connecting a model to the external world

A DDE link can be automatic ("hot") or manual ("cold"). An automatic link will transfer data whenever the source data is altered. This can be used to interact with a model during simulation. It is, for example, possible to set up a DDE connection between Powersim and Excel where a Powersim variable is updated whenever the value of a given cell is changed in the spreadsheet. The opposite connection is also possible, i.e. that a spreadsheet cell is updated continuously during a simulation based on a Powersim variable.

Input/output equipment for lab experiments or process control are often shipped with software components defining a DDE interface to the equipment. Using such interfaces Powersim models can be connected to the physical world.

Example  a virtual fish farm

The fish farming industry is important along the entire cost of Norway. The worlds largest aqua research laboratory is located here, with access to lots of research data and skilled researchers. A project was launched together with the Norwegian environmental authorities to develop a better understanding of the relationship between production, economy and wastes to the environment.

A team was put together with people from two research laboratories, a fish feed producer and myself. It soon turned out that the research communities had access to advanced knowledge in isolated areas such as influence of light, currents, temperature, oxygen feed and feed composition on fish growth. At the same time there was an obvious need for combining the fragmented knowledge into a unified whole. We therefore choose to create a virtual world aquaSIM™ portraying the fish farming system. The resulting model would be verified using existing research data. If necessary new data would be obtained from the research stations and co-operating fish farms. Finally, the model would be presented in two versions; one for research purposes and one for planning purposes.

The model was designed around the use of co-models, where two different interfaces were used; one for the research model and another for the planning version.

A micro world for planners

For pedagogical purposes the planners micro world was designed to visualize differences between alternative production methods. Each production decision was made a parameter to the aquaSIM model. By varying the parameters, different scenarios can be played out.

Figure 15: Structure of the planner's fish farm model

By interacting with slide bars, number objects and buttons in the interface model (main) the planner can set different parameters in the reference model and the alternative fish farm model (the two aquaSIM co-models in the bottom of Figure 15).

Figure 16: Giving input to two simulations (Actual and Reference) from the Main model

By running two alternative scenarios concurrently it becomes easy to compare the two simulations by displaying time series from both models in the same reports. As an example, the feed consumption, growth and pollution can be displayed in time graphs where one color (say gray) is used for the reference model and another color (say red) is used for the alternative. In Figure 17 the growth (weight) of fish is compared. The alternative co-model (labeled Actual) uses a feeding intensity of 80% of the reference co-model.

Figure 17: Comparing growth at different feeding levels

As can be seen from Figure 16 the user may choose between different productions (species of fish), locations (temperature zones) and feed compositions. The effects of these parameters on the model are controlled by parameters. The actual parameters are stored in external files, which are loaded into the simulation at simulation start-up using the archive object, described earlier.

A micro world for researchers

This application was developed in order to gain insight into the fish farming process. One key issue was to validate the model. This was set up along the lines described earlier in this paper. A simulation model was fed with research data and the simulated output compared to the real data (see Figure 6).

Figure 18: Importing model parameters from external files using archive object

A main model was used to create an interface to aquaSIM. The main model would read research data from a spreadsheet, run aquaSIM as a co-model and output simulation results alongside the real data in the spreadsheets.

Figure 19: Structure of research model and connection to real data

Since both the researchers version and the planners micro world uses aquaSIM as the core co-model, any improvement to the research model will automatically be part of the planners version.

The first stage of the aquaSIM project was completed this spring (1995). The researchers give the feedback that they now have a powerful new tool for understanding the complex nature of fish farming. The model building process has uncovered new areas for further investigation. Looking at the initial objective of the project, the simulations show that the most economic way to run a fish farm is also the way that causes the least damage to the environment. This corresponds well with research data, and can be visualized in convincing ways using the aquaSIM Powersim models. The vast amounts of that that was necessary in validating process could not have been used without access to automatic data transfers.


Powerful Modeling Using Array Variables

by Magne Myrtveit

As the field of system dynamics modeling is expanding, there is a continuous need for improvements of the available tools for developing simulation models. Lack of features like array variables often lead modelers to choose third generation languages like C when developing large, realistic models.

This article describes the array variables of the Powersim language. Comparisons are made other notations, including mathematics and DYNAMO. Index variables, array dimensions, subscripts, and functions working on arrays are described.

An important feature of Powersim is that the array notation goes well together with standard accumulator-flow diagrams (AFD) and causal loop diagrams used by system dynamists. This makes the use of array variables almost as easy and intuitive as using scalars.

The transition from single scalar values to multi-element array variables is visualized through examples. Examples include capital stock with machines and buildings, work force with inexperienced and experienced workers, delay structures programmed as arrays, etc.

The array features of Powersim have been used with success in several large-scale projects. Many modeling problems are not practically solvable without using arrays. Even models that are solvable using only scalars, sometimes become much easier to develop, explain and maintain when using arrays. In conclusion, the family of simulation problems that are best solved using a system dynamics tool has been extended a great deal through Powersim's array mechanism.

The array features of Powersim

A dynamic model is a mathematical description of a real of imaginary system. The use of accumulator-flow models makes the power of mathematical integration available in an intuitive and straight forward way, also for non-mathematicians. The use of vectors and matrixes (arrays) are powerful features of mathematics. Several approaches have been made to add array variables to dynamic modeling languages. A major weakness of the early approaches seems to be that the solutions are selected with limited focus on graphical editing of the simulation model as an AFD (Accumulator Flow Diagram).

Our goal has been to provide the power of dimensioned variables (arrays) to Powersims simulation language in a way that both the textual and the graphical representation of models are kept as simple and intuitive as possible.

The inclusion of array variables has implications on three aspects of the simulation tool; 1) the textual simulation language (the equations); 2) the graphical accumulator-flow diagram; and 3) the user interface. Each of these will be discussed below. The following terms will be (informally) defined: array, scalar, literal, range, subrange, enumeration, dimension, subscript, index, constraint, guard.

Scalar variables

Normal variables are called scalar variables, i.e., variables holding single numerical values. As an example, the definition

const	InterestRate = 5%

defines a scalar constant named InterestRate with the single value of 0.05. Scalars are displayed with a single frame in the diagram, as displayed in Figure 20-a.

a) Scalar constant	b) Array constant
Figure 20: Scalar and array constant symbols

Array variables, array elements, vectors, and array literals

An array variable maypossible to define arrays with only one element. hold several distinct values (at the same time). Each distinct value is called an array element. As an example, the definition

const	AvgTemp(1..12) = [1.4, 1.2, 3.1, 5.9, 10.4, 12.8, 15.1, 14.9, 12.1, 8.3, 5.5, 3.2]

defines a vector (one-dimensional array) with 12 elements numbered from 1 through 12, inclusive. Each element holds an average monthly temperaturein Bergen, measured in ºC.

A list of numbers enclosed in square brackets ([]) is used to define a vector literal. In the above example the expression [1.4, 1.2, 3.1, 5.9, 10.4, 12.8, 15.1, 14.9, 12.1, 8.3, 5.5, 3.2] is a vector literal with 12 elementsscalar literal, e.g. 3.14..

The dialog box for defining variables is the same both for scalars and arrays (see Figure 21). For an array, the Dimensions section is used to define each dimension of the variable. In our example, AvgTemp has one dimension, with elements 1 through 12.

Figure 21: Dialog box for defining variables

A dimension must include a range specifying the elements of the dimension. In Figure 21 the text 1..12 in the Dimensions field defines a numerical subrange from 1 to 12, inclusive. Arrays are displayed using double lines in the diagram, as in Figure 20-b. Below the array elements and values of AvgTemp are visualized.

Value	1.4	1.2	3.1	5.9	10.4	12.8	15.1	14.9	12.1	8.3	5.5	3.2
Element	1	2	3	4	5	6	7	8	9	10	11	12
Functions working on arrays

Powersim has several functions that take array arguments. As an example, the average temperature during one year may be computed using the ARRAVG function with AvgTemp as argument, like this:

aux	AvgTempYear = ARRAVG(AvgTemp)

The right hand side of the above equation may also be written either as ARRAVG(AvgTemp(*)) or as ARRAVG(AvgTemp(1..12)).

Array variables like AvgTemp, with one dimension, are also called vectors. Vectors may be used, e.g., as arguments to the GRAPH family of functions. As an example, the expected temperature at a given month may be obtained using the following definition:

aux	ExpectedTemp = GRAPHCURVE(TIME MOD 12, 0, 1, AvgTemp)

Array subscripts for accessing array elements

Individual array elements or ranges of elements may be accessed using array subscripts. As an example, the expression AvgTemp(1) will obtain the average temperature in January, i.e., 1.4ºC. Subscripts may also be used to identify sub-arrays. The expression ARRAVG(AvgTemp(6..8)) will compute the average temperature during the summer months.

Numeric subranges

Sometimes it may be useful to use named sets of elements when defining variable dimensions. One reason may be increased readability. Another, more important, reason is that changes to a named range definition will have effect on all variables that use the range. In the above example we may define the numerical subrange 1..12 as a range with the name RMonth.

range	RMonth = 1..12

This may be done in Powersim by using the Edit Define Range dialog box (see Figure 22).

Figure 22: Defining a range

To define this range

1	Open the Define Range dialog box by selecting Edit Define Range from the menus.

2	Press the Add button of the Define Range dialog box  to make a new range.

3	Type in RMonth as the name of the range.

4	Observe that Numeric Subrange is selected in the Range Type combo box (this is the default setting).

5	Enter 1 in the From text box and 12 in the To text box of the Numeric Subrange group.

6	Press OK to accept the definition of the new range.

Our definition of AvgTemp may now be changed to the following:

const	AvgTemp(RMonth) = [1.4, 1.2, 3.1, 5.9, 10.4, 12.8, 15.1, 14.9, 12.1, 8.3, 5.5, 3.2]

By expanding the Define Variable dialog box (using the More>> button) we see that RMonth is presented in the list of Ranges (lower, left hand corner).

By selecting the entire text of the Dimensions field and double-clicking on RMonth in the Ranges list box, RMonth will be pasted into the Dimensions field of the Define Variable dialog box (see Figure 21).

Enumerated ranges

Elements of a range may be given mnemonic names. As an example, let us redefine the RMonth range as an enumeration of month names. This is done by opening the Define Range dialog box, and changing the Range Type to Enumeration. Element names are entered in the Elements list box by typing in one Element Name at the time and pressing the Append button (see Figure 22). The resulting range looks like this in equations view:

range	RMonth = January, February, March, April, May, June, July, August, September, October, November, December

The temperature in January may now be expressed as AvgTemp(January), and the average temperature in the summer months is ARRAVG(AvgTemp(June..August)).

Enumeration subranges

It is also possible to define sub-ranges based on previously defined ranges. The four seasons may, as an example, be defined as sub-ranges of the RMonth range. This is done by defining a new range and setting Range Type to Enumeration Subrange in the Define Range dialog box (see  Figure 22). By entering a name of RSummer, and selecting June as From and August as To, the following range will be defined:

range	RSummer = June..August

To make the above definition

1	Open the Define Range dialog box by selecting Edit Define Range from the menus.

2	Press the Add button of the Define Range dialog box  to make a new range.

3	Type in RSummer as the name of the range.

4	Select Enumeration Subrange in the Range Type combo box.

5	Select RMonth in the Subrange of combo box.

6	Select the first summer month (June) in the From combo box.

7	Select the last summer month (August) in the To combo box..

8	Press OK to accept the definition of the new range.

Editing vectors graphically using mouse and keyboard

Vectors and the GRAPH family of functions may be edited using the Edit Graph/Vector dialog box, which is opened by clicking the Graph button of the Define Variable dialog box. In Figure 23 the definition of AvgTemp is edited graphically. In the graph window the mouse may be used to draw the graph. The list of vector elements may be edited by making selections in the Coordinates list box and typing in new values in the Y text box, inserting elements using Insert, deleting elements using Delete. Elements may also be copied or pasted via the clipboard using the copy and paste buttons (see the bottom row of the keypad present in the dialog box).

Figure 23: Editing the AvgTemp vector graphically

The average summer temperature was defined above based on the anonymous subrange June..August, like this: ARRAVG(AvgTemp(June..August)). Using the named subrange RSummer the following alternative expression may be used: ARRAVG(AvgTemp(RSummer)).

Index variables

New array variables may be defined based on anonymous ranges, named ranges, and range elements. As an example, a variable AvgSummerTemp may be defined as a vector with three elements; June, July, and August. This may be expressed either as

aux	AvgSummerTemp(m=June..August) = AvgTemp(m)

or as

aux	AvgSummerTemp(m=RSummer) = AvgTemp(m)

Observe the introduction of the index variable m, which is defined in the dimensions section of the variable and used in the subscript of the expression defining the variable. In the above examples the use an index variable is required, as AvgSummerTemp and AvgTemp have different dimensions (see below).

AvgTemp:

1.4	1.2	3.1	5.9	10.4	12.8	15.1	14.9	12.1	8.3	5.5	3.2
January	February	March	April	May	June	July	August	September	October	November	December
AvgSummerTemp:

June	July	August

Using the index variable m we specify which elements of AvgTemp are going to be used when defining AvgSummerTemp. Index names (like Month in the definition above) are local to each variable definition, and hence, the same name may be used in different variable definitions.

Implicit subscripts and indecies

When dimensions match, index variables may be omitted if elements are going to be used on a one-to-one basis. Above weve defined AvgTemp like the following:

const	AvgTemp(RMonth) = [1.4, 1.2, 3.1, 5.9, 10.4, 12.8, 15.1, 14.9, 12.1, 8.3, 5.5, 3.2]

The full form of the above definition is like this:

const	AvgTemp(Month=RMonth) = [1.4, 1.2, 3.1, 5.9, 10.4, 12.8, 15.1, 14.9, 12.1, 8.3, 5.5, 3.2](Month)

Using arrays as parameters to dynamic objects

Array elements may be used in dynamic objects (e.g., time graph, time table, bar), as displayed in Figure 24. Here a Powersim Bar object is used to display the values of the AvgTemp array elements. The labels to the left in the figure may be changed by the modeler. The bars to the right in the figure show the current values of the array elements, and may also be used to change the values using the mouse.

Figure 24: Accessing array elements from dynamic objects

Automatic display of variable values

During simulation the value of a variable may be displayed in the statusbar by pressing the right mouse button while pointing the mouse cursor at a variable. For array variables, the values of array elements will be displayed, separated by comma and enclosed in square brackets (as for array literals). An auto report of an array variable will display the first element of the variable.

Erroneous flows and edited flows

As with scalar variables, a variable definition may become invalid for various reasons (e.g., the use of unknown variables or wrong use of functions). Powersim will then display a question mark inside the variable symbol (see Figure 25-a). With the introduction of arrays, flows may also become invalid. E.g., if a flow and the connected level have different dimensions, the system may be unable to determine how the elements of the flow are going to be paired to the elements of the associated level. It is easy to come up with useful examples where the dimensions of connected flows and levels vary. Powersim therefore allows the modeler to edit the flow definition of levels. This is done by selecting the Flow radio button in the Define Variable dialog box, and editing the contents of the Definition text box. Hollow flow arrows are, by definition, used to represent conserved flows. Powersim will put a warning exclamation mark (!) on a flow if it has been changed from its default definition (see Figure 25-b). If there is an error in a flow definition, Powersim will display a question mark on the flow arrow (see Figure 25-c).

Error in definition	Edited flow	Error in flow
a	b	c
Figure 25: Errors and warnings in the diagram

The problem of validating array subscripts

It has been a major design goal for the array part of the Powersim language to provide full range check on array subscripts at the time of model construction (vs. run-time). This has two major advantages:

1	The model will run more efficiently (no time is used by the processor for range checking)

2	Simulation will never enter a state where array subscripts get out of bound.

As an illustration, let us assume that we have two vectors, A and B, with equal dimensions, and that each element of B is going to be set equal to the element after the corresponding element of A, i.e., B(i) = A(i+1). This will be OK, except for the last index i, were the subscript (i+1) will be out of bounds.

We may attempt to solve the problem by means of an IF function, i.e., B(i) = IF(i < LAST(i), A(i+1), 0). This equation will access A(i+1) only for is in the range FIRST(i) to LAST(i)-1. The only problem is that this solution will, in general, require run-time checking of array subscripts, as any expression may be used as the controlling condition of an IF function.

Constraints and guards

In designing the Powersim language, we therefore choose to construct a separate conditional statement for constraining expressions based on the values of index variables. A constrained expression is an expression followed by a constraint. A constraint is basically an index expression determining when the preceding expression is going to be evaluated. Below is an example where the problem presented above is solved using constrained expressions:

B(i) = A(i+1) WHEN i < LAST(i)POWERSIM also has a FIRST function for returning the lower limit of a range or index variable. The COUNT function may be used to compute the number of elements in a range or separate values taken on by an index variable. BUT 0 WHEN DEFAULT

Here two constrained expressions, separated by BUT are used to define B. The expressions are:

A(i+1) WHEN i < LAST(i)

and

0 WHEN DEFAULT

A boolean expression following WHEN is called a guard. DEFAULT is a guard that may be used in the last constrained expression to cover all cases that are not included in earlier guards in the constrained expression list.

The key to understanding the impact of constrained expressions on compile-time validation of array subscripts lies in the fact that only index variables, range elements, ranges, and integer numbers are allowed as operands when expressing guards, array dimensions, and array subscripts. (Note that model variables are excluded from this list.) This implies that Powersim is able to determine and verify the values of all array subscripts without having to simulate the model.

Examples of when to use arrays

Replicated structures

Models often contain many identical or almost identical structures  especially large-scale models of realistic systems. If we, as an example, want to make a business simulator involving work force, capital, production, markets, etc. it is easy to identify several duplicate structures, e.g.:

1	Different kinds of capital, e.g. buildings and machines

2	Different market segments

3	Different kinds of workers

4	Different product lines

5	Different accounts payable, e.g., marketing expenses, goods, taxes, wages, dividends, debt

If we wanted to make a model of four competing companies, say, this would involve four similar structures  the main differences being values of parameters (constants) and accumulators (levels). Once a model of one company is developed, more companies may be added just by adding a company dimension to every variable of the model.

There are two important advantages of putting similar structures into arrays:

1	Maintainability  Changes to an array structures immediately takes effect for all elements of the array.

2	Complexity  Models sometimes become significantly smaller when using arrays (see Figure 26).

A	B
Figure 26: Combining similar scalar structures into one array structure. A shows separate structures for each type of capital while b shows structure with variables of capital type dimension.

State transitions

When modeling systems involving state transitions, it is common to express this as a sequence of accumulators with interconnected flows. Some examples are:

1	Training of people, moving people from a less skilled to a more skilled state

2	Aging of people, moving people from one age group to the next

3	Production, moving goods from less finished to more finished states

4	Transport, moving goods from one place to another

5	Capital upgrade or maintenance, moving capital from one state to another

Figure 27-a displays a typical model of a production process using scalar variables. In Figure 27-b the same model is presented using vectors. The Production variable has one element less than Goods (observe the exclamation marks on the flows). Note that the structure of the array version will be unchanged, even if the number of production phases should be changed.

a) State transitions using scalar variables	b) State transitions using vectors
Figure 27: State transitions using scalars and vectors

The structure in Figure 27-b may also be used to model a N-th order material delay, if separate inflows and outflows are added. The DELAYMTR function is normally used to express material delays, but if the contents of the levels implicitly defined by the DELAYMTR function need to be accessed, an explicit structure like the one in Figure 28 may be used.

a) Diagram of material delay structure	b) Associated equations
	level InTransit(p=RPhases) = 0 +dt*(Input        |p = FIRST(p);0) +dt*(Progress(p-1)|p > FIRST(p);0) -dt*(Progress(p)  |p < LAST(p) ;0) -dt*(Output       |p = LAST(p) ;0) aux Input = PULSE(5, 5, 0) aux Output = Progress(LAST(RPhases)) aux Progress(RPhases) = InTransit/ (DelayTime/COUNT(RPhases)) const DelayTime = 10
Figure 28: Material delay structure using vectors

State information

If a system goes through discrete states, this may sometimes be modeled using a vector with the same number of elements as there are system states. Each time the system state changes, the elements of the state vector are shifted cyclically, using the SHIFTCIF function.

As an example, think of a process that may be in one of three distinct states; StateA, StateB, and StateC. Assume also that a variable NewState will be set to true whenever the system is going to be switched to the next state. Furthermore, assume that state transitions are cyclic, i.e., that StateA follows StateC.

a) Diagram of state transition	b) Associated equations
	range RState = StateA, StateB, StateC aux ChangeState = SHIFTCIF(NewState, State)  const State(RState) = [1,0,0] aux NewState = ... "Some boolean expression"
Figure 29: Discrete system states

Observe how the system states are defined as elements of an enumeration range. Initially the first state of the State vector is true (1), and the others false (0). Whenever NewState is true, the r.h.s. of the ChangeState definition will shift the elements of State one position to the right, changing the state from [1, 0, 0] to [0, 1, 0] the first time, and to [0, 0, 1] the second time, and to [1, 0, 0] the third time, etc.

Testing for a given state may be done using the following expressions:

State(StateA)  will be true whenever the system is in the first state

State(StateB)  will be true whenever the system is in the second state

State(StateC)  will be true whenever the system is in the third state

Object attributes

A modeler is sometimes interested in keeping track, not only on the number of objects, but also certain object attributes or properties. As an example, we may be working on a production model, where products have attributes like lifetime, functionality, price, etc.

In Figure 30 the scalar and array version of the attribute part of a model is presented. In Figure 30-b a range RAttribute is defined like this:

range	RAttribute = EPrice, EFunctionality, ELifetime, EInventory

The price of our product may will be available as Product(EPrice). The other attributes are accessed correspondingly.

The significance of this solution is that all attributes are moved along when the object (here product) flows through the system or is accessed via links. Addition of more attributes may be done without changing the structure of the model.

a) Separate variables for each attribute	b) Attributes aggregated in variable dimension
Figure 30: Separate and aggregate attributes

History of values

As a final example of how arrays may be useful to the modeler, let us look at the problem of keeping track of previous values of variables. Let us assume that we are making an economic model, and that we want to keep track of the income for the recent 12 months.

Structure for remembering values	Associated equations
	level MonthlyIncome(i=1..12) = 0 +dt*(Income WHEN i=1 BUT 0) aux Income = ... "Income rate" aux NewMonth = TIMECYCLE(1, 1) aux SaveIncome = SHIFTLIF(NewMonth, MonthlyIncome)
Figure 31: Model for remembering values

This model accumulates Income in the first element of the MonthlyIncome vector, which has 12 elements. Every month the elements of MonthlyIncome are shifted one position, and the first element is cleared (all this is done by the SHIFTLIF function).

Main differences between arrays in DYNAMO and Powersim

In DYNAMO index variables and ranges are combined into FOR variables. Each dimension of a variable must be defined in a separate statement. Powersims introduction of guards and constrained expressions makes it always possible to define a multi-dimensional variable in a single statement. This is important when working in a graphical environment, and also removes redundancy from the language. DYNAMO does not have array literals, and multi-dimensional array constants must be defined one dimension at the time. DYNAMO does not have functions returning arrays.

Adding arrays to scalar models

The normal way of constructing an array model, is by first making and testing a scalar version of the model. Then a set of ranges are defined, and selected variables are given dimensions based on the defined ranges. Powersim has been designed to make the transition from scalar models to array structures as smooth and easy as possible. Most scalar equations will be accepted without change also after changing a variable to an array. This is achieved through generation of default flow definitions and implicit definition of array subscripts.

Experiences from applications

The array features of Powersim have been used with success in several large-scale projects (Powersim 1993). Many modeling problems are not practically solvable without using arrays. Even models that are solvable using only scalars, sometimes become much easier to develop, explain and maintain when using arrays. In conclusion, the family of simulation problems that are best solved using a system dynamics tool has been extended a great deal through Powersim's array mechanism.