System#

Overview#

System is the top-level class for organizing power system dispatch models and routines. The full API reference of System is found at ams.system.System.

Dynamic Imports#

System dynamically imports groups, models, and routines at creation. To add new models, groups or routines, edit the corresponding file by adding entries following examples.

ams.system.System.import_models(self)

Import and instantiate models as System member attributes.

Models defined in models/__init__.py will be instantiated sequentially as attributes with the same name as the class name. In addition, all models will be stored in dictionary System.models with model names as keys and the corresponding instances as values.

Examples

system.Bus stores the Bus object, and system.PV stores the PV generator object.

system.models['Bus'] points the same instance as system.Bus.

ams.system.System.import_groups(self)

Import all groups classes defined in models/group.py.

Groups will be stored as instances with the name as class names. All groups will be stored to dictionary System.groups.

ams.system.System.import_routines(self)

Import routines as defined in routines/__init__.py.

Routines will be stored as instances with the name as class names. All routines will be stored to dictionary System.routines.

Examples

System.PFlow is the power flow routine instance.

ams.system.System.import_types(self)

Import all types classes defined in routines/type.py.

Types will be stored as instances with the name as class names. All types will be stored to dictionary System.types.

Device-level Models#

AMS follows a similar device-level model organization of ANDES with a few differences.

Routine-level Models#

In AMS, routines are responsible for collecting data, defining optimization problems, and solving them.

Optimization#

Within the Routine, the descriptive formulation are translated into CVXPY optimization problem with Vars, Constraints, and Objective. The full API reference of them can be found in ams.opt.Var, ams.opt.Constraint, and ams.opt.Objective.

class ams.opt.omodel.OModel(routine)[source]

Base class for optimization models.

Parameters:
routine: Routine

Routine that to be modeled.

Attributes:
prob: cvxpy.Problem

Optimization model.

exprs: OrderedDict

Expressions registry.

params: OrderedDict

Parameters registry.

vars: OrderedDict

Decision variables registry.

constrs: OrderedDict

Constraints registry.

obj: Objective

Objective function.

initialized: bool

Flag indicating if the model is initialized.

parsed: bool

Flag indicating if the model is parsed.

evaluated: bool

Flag indicating if the model is evaluated.

finalized: bool

Flag indicating if the model is finalized.