Page 114 - ExtendSim User Guide
P. 114

Concepts, Tips, and Techniques
Simulation timing
This chapter discusses some concepts specific to continuous modeling and provides tips to keep in mind when building continuous models. The areas discussed are:
• Simulationtiming
• Settingdeltatimetodeterminethegranularityofcalculations
• Feedbackanddelaysincontinuousmodels
• Choosing between integration and summation
• Determiningtheorderinwhichblocksexecute
• Mixinglibrarieswithinamodel
• Connectingtomultipleinputs
• Usingplottersasinputsforotherblocks
• Using a plot line as reference by comparing new runs to a baseline • Techniquestounclutteryourmodels
☞ Concepts applicable to all types of models, such as deciding whether a model should have ran- dom elements, are discussed in the chapter “Simulation Concepts” that starts on page 43. The following topics are specific to continuous modeling.
Simulation timing
Most simulations run for a specified time. ExtendSim determines the duration of a simulation run based on the values entered in the Run > Simulation Setup > Setup tab; the duration is the period from the start time to the end time.
In continuous simulations, the duration is divided into intervals or steps of equal length, where start time is the first step and end time is the last step. The length of time, in time units, for each step is known as delta time or dt. The delta time setting determines how frequently model data is recalculated.
As the simulation runs, simulation time advances from start time to end time at delta time per step, calculating model data at each step. At the first step, ExtendSim calculates what the status of the model is initially. Then it calculates the changes that take place over the next time step and determines a new set of data points. Model data is generated as a string of successive points corresponding to the steps in time. Notice that, for each step, data is calculated for the entire period from that step up to, but not including, the next step.
Continuous simulations require that either the number of steps or the time per step be speci- fied. As discussed below, in most cases a delta time of 1 is adequate. However, for model accu- racy it may be necessary to set a different delta time.
Delta time
Delta time (dt or t) literally means the change in time. It is defined as the length of the time interval between the present time and one time interval later. When you select a delta time, you are selecting how finely the total simulation time will be sliced up, i.e. how short the intervals between calculations will be and thus how frequently the computations will take place. Delta time is set in the Run > Simulation Setup > Continuous tab.
For the simulation results to be correct, the delta time for a continuous model needs to be small enough to accurately reflect changes that occur in different parts of the model. In many cases, the default delta time of 1 is adequate. However, for simulation speed or model accuracy it may be necessary to set a delta time other than 1.

   112   113   114   115   116