Figure 8-4 shows the sequence diagram for the Start Simulation use case. As shown in this figure, the sequence diagram presents all the elements of the system that participate in the simulation. Messages are numbered to show the order in which they are sent. The process starts with the user sending the message simulate to Simulator. Messages number 2 through 14 show what the Simulator should do in order to fulfill the received request. Simulator is responsible for the creation of all needed objects and for sending to each of them the right message at the right time.
Messages 2, 3, and 4 show that Simulator needs to create instances plant, soil, and weather of the corresponding classes Plant, Soil, and Weather. Messages 5, 6, and 7 initialize each of the instances created in the previous steps. During the initialization process, each of the instances will be populated with initial values, part of which is provided by the user. As an example, the value for the planting date for object plant is provided by the user before starting the simulation process. Similarly, initial values for soil depth and wilting point in percent, needed for populating an object soil, are provided by the user.
Messages 8 to 14 are part of the iteration over the weather data. These messages will be repeated a certain number of times until the condition plant is mature is satisfied. At the beginning of each iteration, Simulator sends to object plant the message calculateRate. In order to calculate the rate object, plant needs soil and weather data. Therefore, object plant sends the message getWaterStress to object soil and the message getWeatherData to object weather.
The next step in the simulation process is the integration of the values obtained during the rate calculation. Thus, the simulator sends the message integrate to both plant and soil objects. Message number 15, getSimulationResults, returns to the user the results of the simulation process.
The sequence diagram for the use case Start Simulation shows all the messages sent in a timely manner to different objects to perform a simulation process. This detailed diagram presents the interaction between objects to achieve the required functionality.
Was this article helpful?