Basic HTML Version
Page 115 - ExtendSim User Guide
P. 115

Delta times other than 1
Although 1 is the default setting in the Continuous tab, delta time can be set to any number. For example, to cause the model to run faster and perform calculations less frequently, delta time could be set to 2 or any other number larger than 1.
A delta time less than 1 reduces the step size, causing calculations to be made more frequently. It also results in more steps, so that the simulation takes longer to run in real time for the same simulation run time.
If delta time is not 1, it is most common that it would be less than 1. There are many reasons why delta time would need to be less than 1. Feedback loops and stiff equations in the blocks can require a smaller delta time to ensure that all calculations are reflected in the graph. Simu- lations that are run with too large of a delta time often show values jumping from very high to very low. This is known as instability or artificial chaos. Examples of models where a delta time of less than 1 may be required are:
• Signal processing models need to have their specific time per step (dt) either entered in the Simulation Setup dialog, or have it calculated by blocks in the model. For example, the Filter blocks calculate the stepsize based on their entered parameters.
• Differentialequationmodels(modelswithintegratorsinfeedbackloops)mayneedtohavea time per step (dt) or number of steps other than 1.
• Ifyouarebuildingcustomblocksinprocesscontrolmodels,youmightsetuptheblocksso that they have a Stepsize message handler that can calculate the value for the DeltaTime variable, automating this process. See the Electronics library for some examples of blocks that do this.
☞ If a model contains the Holding Tank block (Value library) and delta time is not exactly 1, you may need to change the Holding Tank to integrate its inputs, as discussed in “Integration vs. summation in the Holding Tank block” on page 709.
Determining which dt to use
To determine what delta time setting is reasonable, first run the simulation with a delta time of 1 (the default setting). Then run the simulation with a delta time of 0.5 (one half of the original setting). If there is no significant difference between the two graphs, then delta time of 1 is appropriate. If there is a significant difference, reduce the delta time to 0.2 and run the simula- tion again. Continue halving delta time until you determine a delta time which results in no sig- nificant differences compared to the smaller delta time. The main idea is to use the largest delta time that will give accurate results without slowing down the simulation unnecessarily.
Specifying dt or the number of steps
Extendsim requires that either the time per step (delta time) or the number of steps be specified in the Run > Simulation Setup > Continuous tab. You can enter delta time directly in the dialog or you can enter the number of steps and ExtendSim will calculate the delta time for you.
A value for the number of steps is automatically calculated based on the setting entered for Time per step (dt). It is computed as: floor(((EndTime-StartTime)/DeltaTime) + 1.5). You can see this by choosing the Number of steps radio button after changing the Time per step (dt).
You can also determine the granularity of the simulation run by manually entering a value for Number of steps. In most cases, this would be a number equal to the duration (length of the
Concepts, Tips, and Techniques 89
Delta time
Continuous

 113   114   115   116   117