Basic HTML Version
Page 40 - Continuous Process Modeling Quick Start Guide
P. 40

``````36
Continuous Process Quick Start Guide
Delta time and step size
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 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.
• Differential equation models (those with integrators in feedback loops) may need to have a 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 on page 39.
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 simulation run) so that the model calculates values once for each step, and each step would be one time unit long. A default value for delta time is automatically calculated based on the num- ber of steps you enter; it is computed as (EndTime-StartTime)/(NumSteps - 1). You can see this by choosing the Time per step (dt) radio button after changing the Number of steps.

``````
 38   39   40   41   42