Page 116 - ExtendSim User Guide

P. 116

```
90
Concepts, Tips, and Techniques
Feedback and delays
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.
Setting the end time when delta time is 1
Assume you want a continuous simulation to run and calculate values each year for 40 years where start time is 0 and dt is 1. The value you enter for the end time depends on whether there is integration in the model.
• Ifthereisnointegrationinthemodel,settheendtimeto39.Datawillbecalculatedateach of the 40 steps, starting at step 0 and ending at step 39. Each step’s calculation would repre- sent data for the entire year, the period beginning at that step and continuing up to but not including the next step (one delta time unit). Thus the model would calculate 40 years worth of data. If you specified start time as 1 and end time as 40, the duration would also be 40 years.
• If there is integration in the model, set end time to 40. Data will be calculated (but not out- put) at each of the 41 steps, starting at step 0 and ending at step 40. Each step’s calculation would represent data at the beginning of the year, the period beginning at that step. However, blocks that integrate take their inputs at one step and output their results at the next step. Thus the model would calculate 40 years worth of data. If you specified start time as 1 and end time as 41, the duration would also be 40 years.
☞ Integration is discussed on page 91.
Setting the end time when delta time is other than 1
If you specify delta time as 0.5, the start time as 0, and the end time as 39, the simulation will run from time 0 to time 39 calculating data for 79 steps, each of which is one half time unit long.
If you specify a delta time which will not result in the duration being divided into equal seg- ments, ExtendSim will adjust the end time to a higher value. This is to insure that the segments are of equal duration, and that the simulation will end at the end time displayed in the dialog. Alternately, you can select a new end time or delta time. For instance, assuming end time is 39, you could specify the Time per step (dt) as 2 years. Data could be calculated every other year, from 0 through 38; however, the last step of the simulation (step 39) would not be calculated. In that case, rather than omit a step, ExtendSim will adjust the end time to 40. This means that model data will be calculated once every two years, starting at time 0 and ending at time 40, for a total of 21 steps.
Feedback and delays
Sometimes it is necessary to create a model that tries to compensate for, or vary itself to match, changes in its inputs. For example, a public address amplifier should output the same sound level even if the speaker's voice varies in loudness. A good technique to accomplish this involves feeding back some of the amplifier's output to control its input, so that the amplifier can effectively monitor itself.
Continuous
```