Skip to content

Commit 3a6845d

Browse files
committed
updated documentation
1 parent 0dd1fda commit 3a6845d

3 files changed

Lines changed: 16 additions & 18 deletions

File tree

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
# General information about the project.
6161
project = 'PFNET'
62-
copyright = '2018, Tomas Tinoco De Rubira'
62+
copyright = '2019, Tomas Tinoco De Rubira'
6363
author = 'Tomas Tinoco De Rubira'
6464

6565
# The version info for the project you're documenting, acts as replacement for

docs/networks.rst

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -431,24 +431,22 @@ As explained above, once the network variables have been set, a vector with the
431431
Outages and Contingencies
432432
=========================
433433

434-
PFNET provides a way to specify outages of certain components and analyze network contingencies. In particular, branches and generators can be set to be on outage. This can be done by setting their :data:`outage <pfnet.Generator.outage>` attribute to ``True``, as the next example shows::
434+
PFNET provides a way to set components out of service and analyze network contingencies. This can be done by setting the ``in_service`` attribute to ``False``, as the next example shows::
435435

436436
>>> net = pfnet.PyParserMAT().parse('ieee14.m')
437437

438-
>>> net.clear_outages()
439-
440438
>>> gen = net.get_generator(3)
441439
>>> branch = net.get_branch(2)
442440

443-
>>> gen.outage = True
444-
>>> branch.outage = True
441+
>>> gen.in_service = False
442+
>>> branch.in_service = False
445443

446-
>>> print net.get_num_generators_on_outage(), net.get_num_branches_on_outage()
444+
>>> print net.get_num_generators_out_of_service(), net.get_num_branches_out_of_service()
447445
1 1
448446

449447
A contingency is represented by an object of type :class:`Contingency <pfnet.Contingency>`, and is characterized by one or more :class:`generator <pfnet.Generator>` or :class:`branch <pfnet.Branch>` outages. The lists of generator and branch outages of a contingency can be specified at construction, or by using the class methods :func:`add_generator_outage() <pfnet.Contingency.add_generator_outage>` and :func:`add_branch_outage() <pfnet.Contingency.add_branch_outage>`, respectively. The following example shows how to construct a contingency::
450448

451-
>>> net.clear_outages()
449+
>>> net.make_all_in_service()
452450
453451
>>> gen = net.get_generator(3)
454452
>>> branch = net.get_branch(2)
@@ -463,18 +461,18 @@ A contingency is represented by an object of type :class:`Contingency <pfnet.Con
463461

464462
Once a contingency has been constructed, it can be applied and later cleared. This is done using the class methods :func:`apply() <pfnet.Contingency.apply>` and :func:`clear() <pfnet.Contingency.clear>`. The :func:`apply() <pfnet.Contingency.apply>` method sets the specified generator and branches on outage. The :func:`clear() <pfnet.Contingency.clear>` method undoes the changes made by the :func:`apply() <pfnet.Contingency.apply>` method. The following example shows how to apply and clear contingencies, and illustrates some of the side effects::
465463

466-
>>> print gen.is_on_outage(), branch.is_on_outage()
467-
False False
464+
>>> print gen.is_in_service(), branch.is_in_service()
465+
True True
468466
469467
>>> c1.apply(net)
470468

471-
>>> print gen.is_on_outage(), branch.is_on_outage()
472-
True True
469+
>>> print gen.is_in_service(), branch.is_in_service()
470+
False False
473471

474472
>>> c1.clear(net)
475473

476-
>>> print gen.is_on_outage(), branch.is_on_outage()
477-
False False
474+
>>> print gen.is_in_service(), branch.is_in_service()
475+
True True
478476

479477
More information about network contingencies can be found in the :ref:`API reference <ref_cont>`.
480478

@@ -575,4 +573,4 @@ It is also possible to add and remove components to a network. This can be done
575573
>>> print len(bus.generators), len(bus.loads)
576574
1 1
577575
578-
.. warning:: Making |Network| modifications programmatically is not yet guaranteed to be safe. One can easily leave out components with no bus connections, which could lead to errors in the underlying PFNET C library. Also, when adding or removing components from the network, the underlying PFNET C library copies existing data to new memory locations and hence any existing PFNET Python network components can point to invalid C memory locations. It is therefore recommended not to use existing PFNET Python network components adding or removing components of the same type from the network, but instead re-extract them from the updated network using :func:`get_bus() <pfnet.Network.get_bus>`, :func:`get_generator() <pfnet.Network.get_generator>`, etc.
576+
.. warning:: Making |Network| modifications programmatically is not yet guaranteed to be safe. One can easily leave out components with no bus connections, which could lead to errors in the underlying PFNET C library. Also, when adding or removing components from the network, the underlying PFNET C library copies existing data to new memory locations and hence any existing PFNET Python network components can point to invalid C memory locations. It is therefore recommended not to use existing PFNET Python network components after adding or removing components of the same type from the network, but instead re-extract them from the updated network using :func:`get_bus() <pfnet.Network.get_bus>`, :func:`get_generator() <pfnet.Network.get_generator>`, etc.

docs/problems.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ The matrices and vectors associated with the linear constraints can be extracted
288288
0.042
289289
290290
>>> bus = net.get_bus(5)
291-
>>> Hi = constr.get_H_single(bus.index_P)
291+
>>> Hi = constr.get_H_single(bus.dP_index)
292292

293293
>>> print type(Hi), Hi.shape, Hi.nnz
294294
<class 'scipy.sparse.coo.coo_matrix'> (28, 28) 27
@@ -322,7 +322,7 @@ This constraint is associated with the string ``"AC power balance"``. It enforce
322322
323323
where :math:`t` are time periods, :math:`P^g` and :math:`Q^g` are generator active and reactive powers, :math:`P^l` and :math:`Q^l` are load active and reactive powers, :math:`S^{sh}` are apparent powers flowing out of buses through shunt devices, :math:`S` are apparent powers flowing out of buses through branches, :math:`n` is the number of buses, :math:`T` is the number of time periods, and :math:`[n] := \{1,\ldots,n\}`.
324324

325-
The :class:`Bus <pfnet.Bus>` class attributes :data:`index_P <pfnet.Bus.index_P>` and :data:`index_Q <pfnet.Bus.index_Q>` can be used to obtain the row indices of the constraint function :data:`f <pfnet.ConstraintBase.f>` and Jacobian :data:`J <pfnet.ConstraintBase.J>` that are associated with the active and reactive power mismatches of a specific bus.
325+
The :class:`Bus <pfnet.Bus>` class attributes :data:`dP_index <pfnet.Bus.dP_index>` and :data:`dQ_index <pfnet.Bus.dQ_index>` can be used to obtain the row indices of the constraint function :data:`f <pfnet.ConstraintBase.f>` and Jacobian :data:`J <pfnet.ConstraintBase.J>` that are associated with the active and reactive power mismatches of a specific bus.
326326

327327
.. _prob_constr_DCPF:
328328

@@ -337,7 +337,7 @@ This constraint is associated with the string ``"DC power balance"``. It enforce
337337
338338
where :math:`t` are time periods, :math:`P^g` are generator active powers, :math:`P^l` are load active powers, :math:`b_{km}` are branch susceptances, :math:`\theta_k` are bus voltage angles, :math:`\phi_{km}` are phase shifts of phase-shifting transformers, :math:`n` is the number of buses, :math:`T` is the number of time periods, and :math:`[n] := \{1,\ldots,n\}`.
339339

340-
The :class:`Bus <pfnet.Bus>` class attribute :data:`index_P <pfnet.Bus.index_P>` can be used to obtain the row indices of the constraint matrix :data:`A <pfnet.ConstraintBase.A>` and right-hand-side :data:`b <pfnet.ConstraintBase.b>` that are associated with the active (DC) power mismatches of a specific bus.
340+
The :class:`Bus <pfnet.Bus>` class attribute :data:`dP_index <pfnet.Bus.dP_index>` can be used to obtain the row indices of the constraint matrix :data:`A <pfnet.ConstraintBase.A>` and right-hand-side :data:`b <pfnet.ConstraintBase.b>` that are associated with the active (DC) power mismatches of a specific bus.
341341

342342
.. _prob_constr_LINPF:
343343

0 commit comments

Comments
 (0)