We first import the ams
library and configure the logger level.
import ams
import datetime
print("Last run time:", datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
print(f'ams:{ams.__version__}')
Last run time: 2024-02-24 17:29:03 ams:0.8.5.post62.dev0+gf6ed683
ams.config_logger(stream_level=20)
Load an example case.
sp = ams.load(ams.get_case('5bus/pjm5bus_uced.xlsx'),
setup=True,
no_output=True,)
Parsing input file "/Users/jinningwang/Documents/work/ams/ams/cases/5bus/pjm5bus_uced.xlsx"... Input file parsed in 0.1415 seconds. Zero line rates detacted in rate_a, rate_b, rate_c, adjusted to 999. If expect a line outage, please set 'u' to 0. System set up in 0.0022 seconds.
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 | PV, Slack StaticLoad | PQ StaticShunt | Shunt Undefined | SRCost, NSRCost VSG | REGCV1, REGCV2
Similarly, all supported routiens can be listed.
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
To check the documentation for the routine model, use its doc()
method.
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 Name | Unit | Description -----+------+---------------------------------- obj | $ | total generation and reserve cost Constraints Name | Description -------+---------------------------------- pglb | pg min pgub | pg max 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 Vars Name | Description | Unit | Properties ------+-------------------+------+----------- pg | Gen active power | p.u. | aBus | Bus voltage angle | rad | 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 amax | max line angle difference | NumOp 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. pd | active demand | p.u. rate_a | long-term flow limit | MVA 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 | %
The summary()
method gives a brief summary of the system and routiens that passed the data check.
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