Function DoPF( ByVal nSlkBusHnd&, ByRef vdPFSettings() as double, _
ByRef vnPFOpt() as double, ByVal nMethod As Long ) As Long
Function DoPF10( ByVal nSlkBusHnd&, ByRef vdPFSettings() as double, _
ByRef vnPFOpt() as double, ByVal sAreas$, _
ByVal nMethod As Long ) As Long
Function DoPF11( ByVal nSlkBusHnd&, ByRef vdPFSettings() as double, _
ByRef vnPFOpt() as double, ByVal sAreas$, _
ByVal nMethod As Long ) As Long
Purpose: Perform a power flow study.
Works in: Power Flow only.
Parameters:
nSlkBusHnd [in] Handle of the system slack bus. If nSlkBusHnd = -9999: use slack bus selection from previous power flow run.
vdPFSettings [in]
Power Flow settings
vdPFCriteria(1) –
Maximum number of iterations
vdPFCriteria(2) – MW
tolerance
vdPFCriteria(3) – MVAR
tolerance
vdPFCriteria(4) – MW
adjustment threshold
vdPFCriteria(5) – MVAR adjustment threshold
vnPFOpt
[in] Power Flow options 1 – set; 0 – reset;
vnPFOpt(1)
– Start from last solution
vnPFOpt(2)
– Enforce generator VAR limit
vnPFOpt(3)
– Enforce transformer tap
vnPFOpt(4)
– Enforce area interchange
vnPFOpt(5)
– Enable generator remote voltage control
vnPFOpt(6)
– Enable switched shunt
simulation
vnPFOpt(7)
– Enable phase shifter simulation
vnPFOpt(8) – Reset LTC taps
vnPFOpt(9)
– Enable solution monitor
vnPFOpt[10] – (DoPF11 only) Start with dc line communication transformer tap at 1.0
vnPFOpt[11] – (DoPF11 only) Stagger automatic control adjustments
vnPFOpt[12] – (DoPF11 only) Move LTC tap to nearest step after convergence
sAreas [in] List of areas where automatic controls are enforced.
nMethod [in] Power flow solution method
0 – Newton-Raphson
1 – Fast decoupled
Return value:
1 success
0 failure
Remarks: Use DoPF10 and DoPF11 to take advantage of additional power flow solution options available in Power Flow versions 10 and 11 respectively. DoPF is provided for backward compatibility purposes.
Example:
Dim vnPFOption(10) As Long
Dim vdPFCriteria(5) As Double
' Various PF settings
vdPFCriteria(1) = 20 ' Max iterations
vdPFCriteria(2) = 1 ' MW tolerance
vdPFCriteria(3) = 1 ' MVAR tolerance
vdPFCriteria(4) = 10 ' MW adj. threshold
vdPFCriteria(5) = 10 ' MVAR adj. threshold
' Set PF options
vnPFOption(1) = 1 ' Use previous result
vnPFOption(2) = 0 ' Ignore Gen var limit
vnPFOption(3) = 1 ' Enforce Xfmr tap
vnPFOption(4) = 0 ' Ignore Area interchange
vnPFOption(5) = 0 ' Ignore Gen remove V control
vnPFOption(6) = 0 ' Ignore SVD
vnPFOption(7) = 1 ' Phase shifter
vnPFOption(8) = 0 ' Reset LTC
vnPFOption(9) = 0 ' Disable solution monitor
' PF method
nMethod = 1 ' Newton-Raphson
' Do the power flow
If DoPF( nSlackBus, vdPFCriteria, vnPFOption, nMethod ) = 0 Then GoTo HasError