Inspecting Models#

We first import the ams library and configure the logger level.

[1]:
import ams
[2]:
ams.config_logger(stream_level=20)

Load an example case.

[3]:
sp = ams.load(ams.get_case('5bus/pjm5bus_demo.xlsx'),
              setup=True,
              no_output=True,)
Parsing input file "/Users/jinningwang/work/ams/ams/cases/5bus/pjm5bus_demo.xlsx"...
Input file parsed in 0.0709 seconds.
Zero Line parameters detected, adjusted to default values: rate_b, rate_c.
All bus type are PQ, adjusted given load and generator connection status.
System set up in 0.0021 seconds.

List all models and routines#

[4]:
print(sp.supported_models())
Supported Groups and Models

   Group     |                     Models
-------------+------------------------------------------------
 ACLine      | Line
 ACShort     | Jumper
 ACTopology  | Bus
 Collection  | Area, Zone
 Cost        | GCost, SFRCost, SRCost, NSRCost, VSGCost, DCost
 DG          | PVD1, ESD1, EV1, EV2
 Horizon     | EDTSlot, UCTSlot
 Information | Summary
 RenGen      | REGCA1
 Reserve     | SFR, SR, NSR, VSGR
 StaticGen   | Slack, PV
 StaticLoad  | PQ
 StaticShunt | Shunt
 VSG         | REGCV1, REGCV2


Similarly, all supported routiens can be listed.

[5]:
print(sp.supported_routines())
Supported Types and Routines

Type  |                                Routines
------+-----------------------------------------------------------------------
 ACED | ACOPF, ACOPF1, OPF
 DCED | DCOPF, DCOPF2, RTED, RTEDDG, RTEDESP, RTEDES, RTEDVIS, RTED2, RTED2DG,
      | RTED2ES, ED, EDDG, EDES, ED2, ED2DG, ED2ES, DCOPF1
 DCUC | UC, UCDG, UCES, UC2, UC2DG, UC2ES
 DED  | DOPF, DOPFVIS
 PF   | DCPF, PFlow, DCPF1, PFlow1


Check routine documentation#

To check the documentation for the routine model, use its doc() method.

[6]:
print(sp.RTED.doc())
Routine <RTED> in Type <DCED>
DC-based real-time economic dispatch (RTED).

RTED extends DCOPF with:

- Vars for SFR reserve: ``pru`` and ``prd``
- Param for linear SFR cost: ``cru`` and ``crd``
- Param for SFR requirement: ``du`` and ``dd``
- Param for ramping: start point ``pg0`` and ramping limit ``R10``
- Param ``pg0``, which can be retrieved from dynamic simulation results.

The function ``dc2ac`` sets the ``vBus`` value from solved ACOPF.
Without this conversion, dynamic simulation might fail due to the gap between
DC-based dispatch results and AC-based dynamic initialization.

Notes
-----
- Formulations have been adjusted with interval ``config.t``, 5/60 [Hour] by default.
- The tie-line flow related constraints are omitted in this formulation.
- Power generation is balanced for the entire system.
- SFR is balanced for each area.

Objective

Unit
----
 $

Expressions

 Name  |  Description   | Unit
-------+----------------+-----
 plf   | Line flow      | p.u.
 pmaxe | Effective pmax | p.u.
 pmine | Effective pmin | p.u.

Constraints

 Name  |            Description
-------+----------------------------------
 pb    | power balance
 sbus  | align slack bus angle
 pglb  | pg min
 pgub  | pg max
 plflb | line flow lower bound
 plfub | line flow upper bound
 alflb | line angle difference lower bound
 alfub | line angle difference upper bound
 rbu   | RegUp reserve balance
 rbd   | RegDn reserve balance
 rru   | RegUp reserve source
 rrd   | RegDn reserve source
 rgu   | Gen ramping up
 rgd   | Gen ramping down

Vars

Name  |            Description             | Unit | Properties
------+------------------------------------+------+-----------
 pg   | Gen active power                   | p.u. |
 vBus | Bus voltage magnitude, placeholder | p.u. |
 aBus | Bus voltage angle                  | rad  |
 pru  | RegUp reserve                      | p.u. | nonneg
 prd  | RegDn reserve                      | p.u. | nonneg

ExpressionCalcs

Name |              Description              |  Unit
-----+---------------------------------------+-------
 pi  | LMP, dual of <pb>                     | $/p.u.
 mu1 | Lagrange multipliers, dual of <plflb> | $/p.u.
 mu2 | Lagrange multipliers, dual of <plfub> | $/p.u.

Services

 Name   |             Description              |   Type
--------+--------------------------------------+----------
 pd     | effective active demand              | NumOpDual
 isb    | Index slack bus from all buses       | VarSelect
 ctrle  | Effective Gen controllability        | NumOpDual
 nctrl  | Effective Gen uncontrollability      | NumOp
 nctrle | Effective Gen uncontrollability      | NumOpDual
 gs     | Sum Gen vars vector in shape of area | ZonalSum
 ds     | Sum pd vector in shape of area       | ZonalSum
 pdz    | zonal total load                     | NumOpDual
 dud    | zonal RegUp reserve requirement      | NumOpDual
 ddd    | zonal RegDn reserve requirement      | NumOpDual

Parameters

  Name   |                Description                |    Unit
---------+-------------------------------------------+-----------
 ug      | Gen connection status                     |
 pg0     | Gen initial active power                  | p.u.
 gsh     | shunt conductance                         |
 buss    | Bus slack                                 |
 ud      | Load connection status                    |
 pd0     | active demand                             | p.u.
 Cg      | Gen connection matrix                     |
 Cl      | Load connection matrix                    |
 CftT    | Transpose of line connection matrix       |
 Csh     | Shunt connection matrix                   |
 Bbus    | Bus admittance matrix                     |
 Bf      | Bf matrix                                 |
 Pbusinj | Bus power injection vector                |
 Pfinj   | Line power injection vector               |
 c2      | Gen cost coefficient 2                    | $/(p.u.^2)
 c1      | Gen cost coefficient 1                    | $/(p.u.)
 c0      | Gen cost coefficient 0                    | $
 ctrl    | Gen controllability                       |
 pmax    | Gen maximum active power                  | p.u.
 pmin    | Gen minimum active power                  | p.u.
 ul      | Line connection status                    |
 rate_a  | long-term flow limit                      | p.u.
 amax    | max line angle difference                 |
 amin    | min line angle difference                 |
 zg      | Gen area                                  |
 zd      | Load area                                 |
 R10     | 10-min ramp rate                          | p.u./h
 cru     | RegUp reserve coefficient                 | $/(p.u.)
 crd     | RegDown reserve coefficient               | $/(p.u.)
 du      | RegUp reserve requirement in percentage   | %
 dd      | RegDown reserve requirement in percentage | %


Config Fields in [RTED]

Option | Value |          Info          | Acceptable values
-------+-------+------------------------+------------------
 t     | 0.083 | time interval in hours |


Data Check#

The summary() method gives a brief summary of the system and routiens that passed the data check.

[7]:
sp.summary()
PTDF is not available, build it now
Building system matrices
Parameters c2, c1 are set to 0 as they are associated with ESD1 for following GCost: GCost_5
-> Systen size:
Base: 100 MVA; Frequency: 60 Hz
5 Buses; 7 Lines; 5 Static Generators
Active load: 10.00 p.u.; Reactive load: 3.29 p.u.
-> Data check results:
DCED: DCOPF, DCOPF2, RTED, RTEDDG, RTEDESP, RTEDES, RTEDVIS, RTED2, RTED2DG, RTED2ES, ED, EDDG, EDES, ED2, ED2DG, ED2ES
DCUC: UC, UCDG, UCES, UC2, UC2DG, UC2ES
DED: DOPF, DOPFVIS
PF: DCPF, PFlow