MaxIntegral
MAXINTEGRAL returns either a) the maximum value of an integrated variable in the Integral table or b) the value of the independent variable (in the first column of the Integral table) when the maximum value of the integrated variable occurs.
The format of this function is:
MaxV = MAXINTEGRAL('TableName', 'VarName', [RowStart, RowStop]) {to return the maximum value of the integrated quantity Varname}
or
MaxVTime = MAXINTEGRAL('TableName', '!VarName', [RowStart, RowStop]) {to return the value of the independent variable when the maximum (VarName) occurs - note the use of the '!' before the variable name}
'TableName' is a string constant or string variable that contains the name of the Integral table. The name of the Integral table is shown on the tab at the top of the table. It is usually 'Main'
'VarName' is string constant or string variable the contains the name of the integrated variable. Note that quotes must surround the name if a string constant is used.
RowStart and RowStop are integers or EES variables specifying the starting and stopping rows for which the maximum will be found. These parameters are optional.
Notes:
1. An integral table must exist in order to use this function. Use the $IntegralTable directive to create the integral table
2. The use of this function must be placed within a $DoLast ... $EndDoLast directive
3. This function is available in EES version 12.301 or newer.
Example:
"A fountain for dogs works in the following way. After pressing the button, water pours into the 1.4 liter bowl at a rate of 2.3 liter/min. The inlet rate decreases linearly to 0 after 90 sec. The drain in the bowl removes water at a rate of 0.92*sqrt(V) in liters/min where V is the number of liters of water in the bowl. Determine the maximum volume of water in the bowl."
InletRate_o=2.3 [liter/min]
t_shutoff=90 [sec]*Convert(sec,min)
Step=1 [sec]*Convert(sec,min)
t_max= 5 [min]
InletRate=Max(0,InletRate_o-InletRate_o/1.5 [min]*t)
InletTot=Integral(InletRate,t,0,t_max,Step)
DrainRate=0.92 [1/min-liter^-0.5]*Sqrt(V)
V=Max(1e-9,Integral(inletRate-DrainRate, t, 0, t_max, Step)) {avoid sqrt of 0}
t_maxV=MaxIntegral('Main','!V') "value of t at which the maximum V occurs}
$IntegralTable t V inletTot InletRate,DrainRate
$DoLast
$VarInfo V_max units='liter'
V_max=MaxIntegral('Main','V')
t_maxV=MaxIntegral('Main','!V')
$enddoLast
{Solution:
t_maxV=0.95 [min]
V_max=0.848 [liter]}
See also: MinIntegral