Functions Reference
These helper functions live in FUNCTIONS_IN_MODELS.f90 and are available inside
any CODEGEN model without being declared.
The following functions can be used in any mathematical expression within CODEGEN model definitions.
Signature: double precision function equal(var1, var2)
Arguments: double precision :: var1, var2
Description: Returns 1.0 if var1 differs from var2 by less than , and 0.0 otherwise.
Notes: General-purpose; available in all model types.
equalstr
Section titled “equalstr”Signature: double precision function equalstr(var1, var2)
Arguments: character :: var1, var2
Description: Returns 1.0 if the non-blank portions of var1 and var2 are identical strings, and 0.0 otherwise.
Notes: General-purpose; available in all model types.
ppower
Section titled “ppower”Signature: double precision ppower([vx], [vy], [ix], [iy])
Description: Returns the active power injected into the network.
Model type: inj only.
Computation:
qpower
Section titled “qpower”Signature: double precision qpower([vx], [vy], [ix], [iy])
Description: Returns the reactive power injected into the network.
Model type: inj only.
Computation:
vrectif
Section titled “vrectif”Signature: double precision function vrectif([if], [vin], {kc})
Arguments: double precision :: kc
Description: Models the voltage drop in a rectifier. Returns the output voltage as a function of output current and input voltage . Used in IEEE standard excitation models with .
Model type: exc only.
Computation:
in = kc * if / max(vin, 1e-3)
if in <= 0: vrectif = vinelse if in <= 0.433: vrectif = vin - 0.577 * kc * ifelse if in <= 0.75: vrectif = sqrt(0.75 * vin^2 - (kc * if)^2)else if in <= 1.00: vrectif = 1.732 * (vin - kc * if)else: vrectif = 0vinrectif
Section titled “vinrectif”Signature: double precision function vinrectif([if], [vrectif], {kc})
Arguments: double precision :: kc
Description: Inverse of vrectif. Given the field current and rectifier output voltage , returns the rectifier input voltage . Intended for use at initialization. The computation is iterative because the operating segment of the piecewise characteristic is not known a priori. Does not work when (indeterminate input).
Model type: exc only.
Computation:
nbtries = 1vinest = vrectif + 0.577 * kc * if
loop: in = kc * if / max(vinest, 1e-3)
if in <= 0: vinrectif = vrectif else if in <= 0.433: vinrectif = vrectif + 0.577 * kc * if else if in <= 0.75: vinrectif = sqrt(vrectif^2 + (kc * if)^2) / 0.75 else: vinrectif = (vrectif / 1.732) + kc * if
if vinrectif == vinest or nbtries > 5: exit loop nbtries = nbtries + 1 vinest = vinrectifSignature: double precision function vcomp([v], [p], [q], {Kv}, {Rc}, {Xc})
Arguments: double precision :: Kv, Rc, Xc
Description: Returns the magnitude of a combination of terminal voltage and current of a synchronous machine. Appears in IEEE standard excitation models.
Model type: exc only.
Computation:
Signature: double precision function satur([ve], {ve1}, {se1}, {ve2}, {se2})
Arguments: double precision :: ve1, se1, ve2, se2
Description: Returns the increment of field current needed to obtain a given output voltage, accounting for magnetic saturation. Appears in IEEE excitation system models.
Model type: exc only.
Computation:
where:
Exception. Returns if any of the following conditions holds:
See Also
Section titled “See Also”- Block Index, all CODEGEN blocks by category
- URAMSES, building models against the RAMSES source