First of all, import andes
and configure the logger.
If logger if not configured, information will not be shown correctly.
import andes
andes.main.config_logger(stream_level=30)
Create an empty andes.System
object and call prepare()
to generate the equations.
This operation may take a moment.
ss = andes.System()
ss.prepare()
Code generation for TestLagAWFreeze (45/45).
print(ss.supported_models())
Supported Groups and Models Group | Models -------------------+------------------------------------------- ACLine | Line ACTopology | Bus Calculation | ACE, COI Collection | Area DCLink | Ground, R, L, C, RCp, RCs, RLs, RLCs, RLCp DCTopology | Node Exciter | EXDC2, IEEEX1, ESDC2A, EXST1, ESST3A, SEXS Experimental | PI2, TestDB1, TestPI, TestLagAWFreeze FreqMeasurement | BusFreq, BusROCOF PSS | IEEEST, ST2CUT PhasorMeasurement | PMU RenExciter | REECA1 RenGen | REGCA1 RenPlant | REPCA1 StaticACDC | VSCShunt StaticGen | PV, Slack StaticLoad | PQ StaticShunt | Shunt SynGen | GENCLS, GENROU TimedEvent | Toggler, Fault TurbineGov | TG2, TGOV1, IEEEG1
To check the documentation for the model, print the return of doc()
for the model instance.
For example, the documentation for GENCLS
can be printed with
print(ss.GENCLS.doc())
Model <GENCLS> in Group <SynGen> Parameters Name | Description | Default | Unit | Type | Properties --------+------------------------+---------+------+-----------+--------------- idx | unique device idx | | | DataParam | u | connection status | 1 | bool | NumParam | name | device name | | | DataParam | bus | interface bus id | | | IdxParam | mandatory gen | static generator index | | | IdxParam | mandatory coi | center of inertia | | | IdxParam | | index | | | | Sn | Power rating | 100 | | NumParam | Vn | AC voltage rating | 110 | | NumParam | fn | rated frequency | 60 | | NumParam | D | Damping coefficient | 0 | | NumParam | power M | machine start up time | 6 | | NumParam | non_zero,power | (2H) | | | | ra | armature resistance | 0 | | NumParam | z xl | leakage reactance | 0 | | NumParam | z xd1 | d-axis transient | 0.302 | | NumParam | z | reactance | | | | kp | active power feedback | 0 | | NumParam | | gain | | | | kw | speed feedback gain | 0 | | NumParam | S10 | first saturation | 0 | | NumParam | | factor | | | | S12 | second saturation | 1 | | NumParam | | factor | | | | subidx | Generator idx in | 0 | | ExtParam | | plant; only used by | | | | | PSS/E data | | | | Variables Name | Initial Value | Description | Unit | Properties --------+---------------+------------------------------+----------+----------- delta | delta0 | rotor angle | rad | v_str omega | u | rotor speed | pu (Hz) | v_str Id | Id0 | d-axis current | | v_str Iq | Iq0 | q-axis current | | v_str vd | vd0 | d-axis voltage | | v_str vq | vq0 | q-axis voltage | | v_str tm | tm0 | mechanical torque | | v_str te | u * p0 | electric torque | | v_str vf | vf0 | excitation voltage | pu | v_str XadIfd | vf0 | d-axis armature excitation | p.u (kV) | v_str | | current | | psid | psid0 | d-axis flux | | v_str psiq | psiq0 | q-axis flux | | v_str a | | Bus voltage phase angle | | v | | Bus voltage magnitude | | Differential Equations Name | Type | RHS of Equation "T x' = f(x, y)" | T (LHS) -------+-------+---------------------------------------+-------- delta | State | u * (2 * pi * fn) * (omega - 1) | omega | State | (u / M) * (tm - te - D * (omega - 1)) | Algebraic Equations Name | Type | RHS of Equation "0 = g(x, y)" --------+----------+--------------------------------- Id | Algeb | + xq * Id - vf+ psid Iq | Algeb | + xq * Iq+ psiq vd | Algeb | u * v * sin(delta - a) - vd vq | Algeb | u * v * cos(delta - a) - vq tm | Algeb | tm0 - tm te | Algeb | u * (psid * Iq - psiq * Id) - te vf | Algeb | vf0 - vf XadIfd | Algeb | vf0 - XadIfd psid | Algeb | u * (ra*Iq + vq) - psid psiq | Algeb | u * (ra*Id + vd) + psiq a | ExtAlgeb | -u * (vd * Id + vq * Iq) v | ExtAlgeb | -u * (vq * Id - vd * Iq) Services Name | Equation | Type ---------+------------------------------------------------------+------------- _V | v * exp(1j * a) | ConstService _S | p0 - 1j * q0 | ConstService _I | _S / conj(_V) | ConstService _E | _V + _I * (ra + 1j * xq) | ConstService _deltac | log(_E / abs(_E)) | ConstService delta0 | u * im(_deltac) | ConstService vdq | u * (_V * exp(1j * 0.5 * pi - _deltac)) | ConstService Idq | u * (_I * exp(1j * 0.5 * pi - _deltac)) | ConstService Id0 | re(Idq) | ConstService Iq0 | im(Idq) | ConstService vd0 | re(vdq) | ConstService vq0 | im(vdq) | ConstService tm0 | u * ((vq0 + ra * Iq0) * Iq0 + (vd0 + ra * Id0) * | ConstService | Id0) | psid0 | u * (ra * Iq0) + vq0 | ConstService psiq0 | -u * (ra * Id0) - vd0 | ConstService vf0 | (vq0 + ra * Iq0) + xq * Id0 | ConstService Config Fields in [GENCLS] Option | Value | Info | Acceptable values ----------+-------+----------------------------+------------------ vf_lower | 1 | lower limit for vf warning | vf_upper | 5 | upper limit for vf warning |
All symbols are stored in the attributes of Model.syms
. For example,
ss.GENCLS.syms.xy
Differential variables comes before algebraic variables.
ss.GENCLS.states
OrderedDict([('delta', State, GENCLS.delta[]), ('omega', State, GENCLS.omega[])])
ss.GENCLS.algebs
OrderedDict([('Id', Algeb, GENCLS.Id[]), ('Iq', Algeb, GENCLS.Iq[]), ('vd', Algeb, GENCLS.vd[]), ('vq', Algeb, GENCLS.vq[]), ('tm', Algeb, GENCLS.tm[]), ('te', Algeb, GENCLS.te[]), ('vf', Algeb, GENCLS.vf[]), ('XadIfd', Algeb, GENCLS.XadIfd[]), ('psid', Algeb, GENCLS.psid[]), ('psiq', Algeb, GENCLS.psiq[])])
Formatted equations are stored in each model. The following attributes of Model.syms
are available for equation printing.
ss.GENCLS.syms.f
ss.GENCLS.syms.g
ss.GENCLS.syms.df
ss.GENCLS.syms.dg
The list of services is in services
.
ss.GENCLS.services
OrderedDict([('_V', <andes.core.service.ConstService at 0x7ff28d452c18>), ('_S', <andes.core.service.ConstService at 0x7ff28d452c50>), ('_I', <andes.core.service.ConstService at 0x7ff28d452c88>), ('_E', <andes.core.service.ConstService at 0x7ff28d452cc0>), ('_deltac', <andes.core.service.ConstService at 0x7ff28d452cf8>), ('delta0', <andes.core.service.ConstService at 0x7ff28d452d30>), ('vdq', <andes.core.service.ConstService at 0x7ff28d452d68>), ('Idq', <andes.core.service.ConstService at 0x7ff28d452da0>), ('Id0', <andes.core.service.ConstService at 0x7ff28d452dd8>), ('Iq0', <andes.core.service.ConstService at 0x7ff28d452e10>), ('vd0', <andes.core.service.ConstService at 0x7ff28d452e48>), ('vq0', <andes.core.service.ConstService at 0x7ff28d452e80>), ('tm0', <andes.core.service.ConstService at 0x7ff28d452eb8>), ('psid0', <andes.core.service.ConstService at 0x7ff28d452ef0>), ('psiq0', <andes.core.service.ConstService at 0x7ff28d452f28>), ('vf0', <andes.core.service.ConstService at 0x7ff28d452f60>)])
Service equations are in Model.syms.s
For example, services of GENCLS
is in
ss.GENCLS.syms.s