- •Disclaimer
- •Contact information
- •Version information
- •Changes in version 3.00
- •Changes in version 2.20
- •Changes in version 2.10
- •Introduction
- •Typing convention
- •Terms used in this document
- •System structure
- •Creating a simple model
- •SetupProblem
- •ModelEquations
- •EndCalc
- •Compiling
- •Simulation
- •Model file format
- •Common parameters and datatypes
- •SetupProblem
- •SetupModel
- •SetupState
- •SetTimeFactor
- •SolverSettings
- •Dynamic variables
- •States
- •Static variables
- •Parameter pages
- •Initial Parameters
- •Floating point parameters
- •Integer parameters
- •Boolean parameters
- •List parameters
- •Enumerated parameters
- •Enumerated choice parameters
- •Explicit variables
- •Action buttons
- •Info Labels
- •HideSampleTime
- •Model help file
- •PreCalc
- •SetStartState
- •AddExplicitVar
- •SetSampleTime
- •ModelEquations
- •StateShift
- •OnStateChange
- •OnSolution
- •OnSample
- •EndCalc
- •OnQuit
- •OnUIValueChange
- •Running simulations from the model
- •OnSaveSettings
- •OnLoadSettings
- •Using Initial parameters
- •SetInitial
- •SetGuess
- •AddDynVar
- •AddStatVar
- •Mathematical text
- •Debugging
- •Common problems
- •Using refrigerant equations
- •WinDali Model Editor
- •Compiler Options
- •Environment Options
- •WinDali Simulation Interface
- •Menu commands
- •Online parameters
- •Varying parameters
- •Dali solver
- •Using Profiles in models
- •Generating profiles
- •Using profiles in a model
- •Using Post Process
- •Distributing models
- •References
6 Model file format |
53 |
Example implementation var
T : array [1..10] of TFloat; P : TFloat;
procedure PreCalc; begin
P := 1;
T[1] := 10;
T[2] := 10;
…
AddDynVar(T[1],10,'T1','Temperature 1'); AddDynVar(T[2],10,'T2','Temperature 2');
…
AddDynVar(P,1,'P','Pressure'); end;
6.14.4 AddStatVar
AddStatVar is used to add static variables just before the simulation begins (i.e. after the user starts the simulation, but before ModelEquations is called the first time). AddStatVar is normally called in PreCalc.
Heading
function AddStatVar(State : TInteger; var Variable : TFloat; InitalGuess : TFloat; Name,LongName : PChar) : TInteger;
function AddStatVarExt(State : TInteger; var Variable : TFloat; InitalGuess : TFloat; Name,LongName : PChar; Min,Max : TFloat; DoPlot : TBoolean; ALabel : PChar) : TInteger;
Parameters |
|
State |
The state the static variable belongs to. |
Variable |
The declared pascal variable, which represents the variable in the model. |
InitialGuess |
The default guess on the static variable. |
Name |
Short name that appears on plots. |
LongName |
Long name, appears on the Guesses page in the Solver & Model settings |
Min |
window in the Simulation program. |
Minimum value the user can set the variable to (and limit for the static |
|
Max |
equation solver). |
Maximum value the user can set the variable to (and limit for the static |
|
|
equation solver). |
DoPlot |
If Min = Max = 0 then no limits are set. |
True: Plot/save is available to the user for this variable |
|
Return value |
False: Plot/save is not available to the user for this variable. |
|
The number assigned to the static variable. Can be used to identify the variable in calls to
SetGuess.
WinDali |
Morten Juel Skovrup |