Inspecting Models#
We first import the ams
library and configure the logger level.
[1]:
import ams
import datetime
[2]:
print("Last run time:", datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
print(f'ams:{ams.__version__}')
Last run time: 2024-04-21 17:29:49
ams:0.9.6
[3]:
ams.config_logger(stream_level=20)
Load an example case.
[4]:
sp = ams.load(ams.get_case('5bus/pjm5bus_uced.xlsx'),
setup=True,
no_output=True,)
Parsing input file "/Users/jinningwang/Documents/work/mambaforge/envs/amsre/lib/python3.9/site-packages/ams/cases/5bus/pjm5bus_uced.xlsx"...
Input file parsed in 0.0897 seconds.
Zero line rates detacted in rate_b, rate_c, adjusted to 999.
System set up in 0.0019 seconds.
List all models and routines#
[5]:
print(sp.supported_models())
Supported Groups and Models
Group | Models
-------------+-------------------------------
ACLine | Line
ACTopology | Bus
Collection | Area, Region
Cost | GCost, SFRCost, VSGCost, DCost
DG | PVD1, ESD1
Horizon | TimeSlot, EDTSlot, UCTSlot
Information | Summary
RenGen | REGCA1
Reserve | SFR, SR, NSR, VSGR
StaticGen | Slack, PV
StaticLoad | PQ
StaticShunt | Shunt
Undefined | SRCost, NSRCost
VSG | REGCV1, REGCV2
Similarly, all supported routiens can be listed.
[6]:
print(sp.supported_routines())
Supported Types and Routines
Type | Routines
------+-----------------------------------------------------
ACED | ACOPF
DCED | DCOPF, ED, EDDG, EDES, RTED, RTEDDG, RTEDES, RTEDVIS
DCUC | UC, UCDG, UCES
DED | DOPF, DOPFVIS
PF | DCPF, PFlow, CPF
Check routine documentation#
To check the documentation for the routine model, use its doc()
method.
[7]:
print(sp.RTED.doc())
Routine <RTED> in Type <DCED>
DC-based real-time economic dispatch (RTED).
RTED extends DCOPF with:
- Mapping dicts to interface with ANDES
- Function ``dc2ac`` to do the AC conversion
- 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
-----
1. Formulations has been adjusted with interval ``config.t``, 5/60 [Hour] by default.
2. The tie-line flow has not been implemented in formulations.
Objective
Unit
----
$
Constraints
Name | Description
-------+----------------------------------
pglb | pg min
pgub | pg max
sbus | align slack bus angle
pb | power balance
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
Expressions
Name | Variable | Description
------+----------+----------------------
plfc | plf | plf calculation
pic | pi | dual of Constraint pb
Vars
Name | Description | Unit | Properties
------+-------------------+--------+-----------
pg | Gen active power | p.u. |
aBus | Bus voltage angle | rad |
pi | nodal price | $/p.u. |
plf | Line flow | p.u. |
pru | RegUp reserve | p.u. | nonneg
prd | RegDn reserve | p.u. | nonneg
Services
Name | Description | Type
--------+--------------------------------------+----------
ctrle | Effective Gen controllability | NumOpDual
nctrl | Effective Gen uncontrollability | NumOp
nctrle | Effective Gen uncontrollability | NumOpDual
csb | select slack bus | VarSelect
gs | Sum Gen vars vector in shape of zone | ZonalSum
ds | Sum pd vector in shape of zone | ZonalSum
pdz | zonal total load | NumOpDual
dud | zonal RegUp reserve requirement | NumOpDual
ddd | zonal RegDn reserve requirement | NumOpDual
Parameters
Name | Description | Unit
---------+-------------------------------------------+-----------
c2 | Gen cost coefficient 2 | $/(p.u.^2)
c1 | Gen cost coefficient 1 | $/(p.u.)
c0 | Gen cost coefficient 0 | $
ug | Gen connection status |
ctrl | Gen controllability |
pmax | Gen maximum active power | p.u.
pmin | Gen minimum active power | p.u.
p0 | Gen initial active power | p.u.
buss | Bus slack |
pd | active demand | p.u.
rate_a | long-term flow limit | p.u.
amax | max line angle difference |
amin | min line angle difference |
gsh | shunt conductance |
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 |
zg | Gen zone |
zd | Load zone |
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.
[8]:
sp.summary()
-> Systen size:
Base: 100 MVA; Frequency: 60 Hz
5 Buses; 7 Lines; 4 Static Generators
Active load: 10.00 p.u.; Reactive load: 3.29 p.u.
-> Data check results:
ACED: ACOPF
DCED: DCOPF, ED, RTED
DCUC: UC
DED: DOPF
PF: DCPF, PFlow, CPF