From a8de0cbbef0d6d516038966b081f8be99d695002 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Thu, 28 Nov 2024 12:11:37 +0000 Subject: [PATCH] build based on 55626fc --- dev/.documenter-siteinfo.json | 2 +- dev/api/analysis/index.html | 40 +++++++------- dev/api/measurementModel/index.html | 56 ++++++++++---------- dev/api/optimalPowerFlow/index.html | 16 +++--- dev/api/powerFlow/index.html | 22 ++++---- dev/api/powerSystemModel/index.html | 28 +++++----- dev/api/setupPrint/index.html | 30 +++++------ dev/api/stateEstimation/index.html | 28 +++++----- dev/background/bibliography/index.html | 2 +- dev/background/installation/index.html | 2 +- dev/index.html | 2 +- dev/manual/acOptimalPowerFlow/index.html | 2 +- dev/manual/acPowerFlow/index.html | 2 +- dev/manual/acStateEstimation/index.html | 2 +- dev/manual/dcOptimalPowerFlow/index.html | 2 +- dev/manual/dcPowerFlow/index.html | 2 +- dev/manual/dcStateEstimation/index.html | 2 +- dev/manual/measurementModel/index.html | 46 ++++++++-------- dev/manual/pmuStateEstimation/index.html | 2 +- dev/manual/powerSystemModel/index.html | 2 +- dev/objects.inv | Bin 5269 -> 5269 bytes dev/tutorials/acOptimalPowerFlow/index.html | 2 +- dev/tutorials/acPowerFlow/index.html | 2 +- dev/tutorials/acStateEstimation/index.html | 2 +- dev/tutorials/dcOptimalPowerFlow/index.html | 2 +- dev/tutorials/dcPowerFlow/index.html | 2 +- dev/tutorials/dcStateEstimation/index.html | 2 +- dev/tutorials/measurementModel/index.html | 10 ++-- dev/tutorials/perunit/index.html | 2 +- dev/tutorials/pmuStateEstimation/index.html | 2 +- dev/tutorials/powerSystemModel/index.html | 2 +- 31 files changed, 159 insertions(+), 159 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 19ded4a0..f5dcfde5 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-28T09:48:17","documenter_version":"1.8.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-28T12:11:28","documenter_version":"1.8.0"}} \ No newline at end of file diff --git a/dev/api/analysis/index.html b/dev/api/analysis/index.html index 2b5be7ba..e14abb86 100644 --- a/dev/api/analysis/index.html +++ b/dev/api/analysis/index.html @@ -10,7 +10,7 @@ end solve!(system, analysis) end -power!(system, analysis)source
JuliaGrid.injectionPowerMethod
injectionPower(system::PowerSystem, analysis::AC, label)

The function returns the active and reactive power injections associated with a specific bus in the AC framework. The label keyword argument must match an existing bus label.

Example

system = powerSystem("case14.h5")
+power!(system, analysis)
source
JuliaGrid.injectionPowerMethod
injectionPower(system::PowerSystem, analysis::AC, label)

The function returns the active and reactive power injections associated with a specific bus in the AC framework. The label keyword argument must match an existing bus label.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = newtonRaphson(system)
@@ -21,7 +21,7 @@
     end
     solve!(system, analysis)
 end
-active, reactive = injectionPower(system, analysis; label = 1)
source
JuliaGrid.supplyPowerMethod
supplyPower(system::PowerSystem, analysis::AC, label)

The function returns the active and reactive power injections from the generators associated with a specific bus in the AC framework. The label keyword argument must match an existing bus label.

Example

system = powerSystem("case14.h5")
+active, reactive = injectionPower(system, analysis; label = 1)
source
JuliaGrid.supplyPowerMethod
supplyPower(system::PowerSystem, analysis::AC, label)

The function returns the active and reactive power injections from the generators associated with a specific bus in the AC framework. The label keyword argument must match an existing bus label.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = newtonRaphson(system)
@@ -32,7 +32,7 @@
     end
     solve!(system, analysis)
 end
-active, reactive = supplyPower(system, analysis; label = 1)
source
JuliaGrid.shuntPowerMethod
shuntPower(system::PowerSystem, analysis::AC, label)

The function returns the active and reactive power values of the shunt element associated with a specific bus in the AC framework. The label keyword argument must match an existing bus label.

Example

system = powerSystem("case14.h5")
+active, reactive = supplyPower(system, analysis; label = 1)
source
JuliaGrid.shuntPowerMethod
shuntPower(system::PowerSystem, analysis::AC, label)

The function returns the active and reactive power values of the shunt element associated with a specific bus in the AC framework. The label keyword argument must match an existing bus label.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = newtonRaphson(system)
@@ -43,7 +43,7 @@
     end
     solve!(system, analysis)
 end
-active, reactive = shuntPower(system, analysis; label = 9)

```

source
JuliaGrid.fromPowerMethod
fromPower(system::PowerSystem, analysis::AC; label)

The function returns the active and reactive power flows at the from-bus end associated with a specific branch in the AC framework. The label keyword argument must match an existing branch label.

Example

system = powerSystem("case14.h5")
+active, reactive = shuntPower(system, analysis; label = 9)

```

source
JuliaGrid.fromPowerMethod
fromPower(system::PowerSystem, analysis::AC; label)

The function returns the active and reactive power flows at the from-bus end associated with a specific branch in the AC framework. The label keyword argument must match an existing branch label.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = newtonRaphson(system)
@@ -54,7 +54,7 @@
     end
     solve!(system, analysis)
 end
-active, reactive = fromPower(system, analysis; label = 2)
source
JuliaGrid.toPowerMethod
toPower(system::PowerSystem, analysis::AC; label)

The function returns the active and reactive power flows at the to-bus end associated with a specific branch in the AC framework. The label keyword argument must match an existing branch label.

Example

system = powerSystem("case14.h5")
+active, reactive = fromPower(system, analysis; label = 2)
source
JuliaGrid.toPowerMethod
toPower(system::PowerSystem, analysis::AC; label)

The function returns the active and reactive power flows at the to-bus end associated with a specific branch in the AC framework. The label keyword argument must match an existing branch label.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = newtonRaphson(system)
@@ -65,7 +65,7 @@
     end
     solve!(system, analysis)
 end
-active, reactive = toPower(system, analysis; label = 2)
source
JuliaGrid.seriesPowerMethod
seriesPower(system::PowerSystem, analysis::AC; label)

The function returns the active and reactive power losses across the series impedance of a specific branch within the AC framework. The label keyword argument should correspond to an existing branch label.

Example

system = powerSystem("case14.h5")
+active, reactive = toPower(system, analysis; label = 2)
source
JuliaGrid.seriesPowerMethod
seriesPower(system::PowerSystem, analysis::AC; label)

The function returns the active and reactive power losses across the series impedance of a specific branch within the AC framework. The label keyword argument should correspond to an existing branch label.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = newtonRaphson(system)
@@ -76,7 +76,7 @@
     end
     solve!(system, analysis)
 end
-active, reactive = seriesPower(system, analysis; label = 2)
source
JuliaGrid.chargingPowerMethod
chargingPower(system::PowerSystem, analysis::AC; label)

The function returns the active and reactive power values associated with the charging admittances of a specific branch in the AC framework. The label keyword argument must correspond to an existing branch label.

Example

system = powerSystem("case14.h5")
+active, reactive = seriesPower(system, analysis; label = 2)
source
JuliaGrid.chargingPowerMethod
chargingPower(system::PowerSystem, analysis::AC; label)

The function returns the active and reactive power values associated with the charging admittances of a specific branch in the AC framework. The label keyword argument must correspond to an existing branch label.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = newtonRaphson(system)
@@ -87,7 +87,7 @@
     end
     solve!(system, analysis)
 end
-active, reactive = chargingPower(system, analysis; label = 2)
source
JuliaGrid.generatorPowerMethod
generatorPower(system::PowerSystem, analysis::AC)

The function returns the active and reactive powers associated with a specific generator in the AC framework. The label keyword argument must match an existing generator label.

Example

system = powerSystem("case14.h5")
+active, reactive = chargingPower(system, analysis; label = 2)
source
JuliaGrid.generatorPowerMethod
generatorPower(system::PowerSystem, analysis::AC)

The function returns the active and reactive powers associated with a specific generator in the AC framework. The label keyword argument must match an existing generator label.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = newtonRaphson(system)
@@ -98,69 +98,69 @@
     end
     solve!(system, analysis)
 end
-active, reactive = generatorPower(system, analysis; label = 1)
source

AC Current Analysis

JuliaGrid.current!Method
current!(system::PowerSystem, analysis::AC)

The function computes the currents in the polar coordinate system associated with buses and branches in the AC framework.

Updates

This function calculates various electrical quantities in the polar coordinate system:

  • injection: Current injections at each bus.
  • from: Current flows at each from-bus end of the branch.
  • to: Current flows at each to-bus end of the branch.
  • series: Current flows through the series impedance of the branch in the direction from the from-bus end to the to-bus end of the branch.

Example

using Ipopt
+active, reactive = generatorPower(system, analysis; label = 1)
source

AC Current Analysis

JuliaGrid.current!Method
current!(system::PowerSystem, analysis::AC)

The function computes the currents in the polar coordinate system associated with buses and branches in the AC framework.

Updates

This function calculates various electrical quantities in the polar coordinate system:

  • injection: Current injections at each bus.
  • from: Current flows at each from-bus end of the branch.
  • to: Current flows at each to-bus end of the branch.
  • series: Current flows through the series impedance of the branch in the direction from the from-bus end to the to-bus end of the branch.

Example

using Ipopt
 
 system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
 solve!(system, analysis)
-current!(system, analysis)
source
JuliaGrid.injectionCurrentMethod
injectionCurrent(system::PowerSystem, analysis::AC; label)

The function returns the current injection in the polar coordinate system associated with a specific bus in the AC framework. The label keyword argument must match an existing bus label.

Example

using Ipopt
+current!(system, analysis)
source
JuliaGrid.injectionCurrentMethod
injectionCurrent(system::PowerSystem, analysis::AC; label)

The function returns the current injection in the polar coordinate system associated with a specific bus in the AC framework. The label keyword argument must match an existing bus label.

Example

using Ipopt
 
 system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
 solve!(system, analysis)
-magnitude, angle = injectionCurrent(system, analysis; label = 1)
source
JuliaGrid.fromCurrentMethod
fromCurrent(system::PowerSystem, analysis::AC; label)

The function returns the current in the polar coordinate system at the from-bus end associated with a specific branch in the AC framework. The label keyword argument must match an existing branch label.

Example

using Ipopt
+magnitude, angle = injectionCurrent(system, analysis; label = 1)
source
JuliaGrid.fromCurrentMethod
fromCurrent(system::PowerSystem, analysis::AC; label)

The function returns the current in the polar coordinate system at the from-bus end associated with a specific branch in the AC framework. The label keyword argument must match an existing branch label.

Example

using Ipopt
 
 system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
 solve!(system, analysis)
-magnitude, angle = fromCurrent(system, analysis; label = 2)
source
JuliaGrid.toCurrentMethod
toCurrent(system::PowerSystem, analysis::AC; label)

The function returns the current in the polar coordinate system at the to-bus end associated with a specific branch in the AC framework. The label keyword argument must match an existing branch label.

Example

using Ipopt
+magnitude, angle = fromCurrent(system, analysis; label = 2)
source
JuliaGrid.toCurrentMethod
toCurrent(system::PowerSystem, analysis::AC; label)

The function returns the current in the polar coordinate system at the to-bus end associated with a specific branch in the AC framework. The label keyword argument must match an existing branch label.

Example

using Ipopt
 
 system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
 solve!(system, analysis)
-magnitude, angle = toCurrent(system, analysis; label = 2)
source
JuliaGrid.seriesCurrentMethod
seriesCurrent(system::PowerSystem, analysis::AC; label)

The function returns the current in the polar coordinate system through series impedance associated with a specific branch in the direction from the from-bus end to the to-bus end of the branch within the AC framework. The label keyword argument must match an existing branch label.

Example

using Ipopt
+magnitude, angle = toCurrent(system, analysis; label = 2)
source
JuliaGrid.seriesCurrentMethod
seriesCurrent(system::PowerSystem, analysis::AC; label)

The function returns the current in the polar coordinate system through series impedance associated with a specific branch in the direction from the from-bus end to the to-bus end of the branch within the AC framework. The label keyword argument must match an existing branch label.

Example

using Ipopt
 
 system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
 solve!(system, analysis)
-magnitude, angle = seriesCurrent(system, analysis; label = 2)
source

DC Power Analysis

JuliaGrid.power!Method
power!(system::PowerSystem, analysis::DC)

The function calculates the active power values related to buses, branches, and generators within the DC analysis framework.

Updates

This function updates the power field of the DC abstract type by computing the following electrical quantities:

  • injection: Active power injections at each bus.
  • supply: Active power injections from the generators at each bus.
  • from: Active power flows at each from-bus end of the branch.
  • to: Active power flows at each to-bus end of the branch.
  • generator: Output active powers of each generator (excluding for state estimation).

Example

system = powerSystem("case14.h5")
+magnitude, angle = seriesCurrent(system, analysis; label = 2)
source

DC Power Analysis

JuliaGrid.power!Method
power!(system::PowerSystem, analysis::DC)

The function calculates the active power values related to buses, branches, and generators within the DC analysis framework.

Updates

This function updates the power field of the DC abstract type by computing the following electrical quantities:

  • injection: Active power injections at each bus.
  • supply: Active power injections from the generators at each bus.
  • from: Active power flows at each from-bus end of the branch.
  • to: Active power flows at each to-bus end of the branch.
  • generator: Output active powers of each generator (excluding for state estimation).

Example

system = powerSystem("case14.h5")
 dcModel!(system)
 
 analysis = dcPowerFlow(system)
 solve!(system, analysis)
-power!(system, analysis)
source
JuliaGrid.injectionPowerMethod
injectionPower(system::PowerSystem, analysis::DC; label)

The function returns the active power injection associated with a specific bus in the DC framework. The label keyword argument must match an existing bus label.

Example

system = powerSystem("case14.h5")
+power!(system, analysis)
source
JuliaGrid.injectionPowerMethod
injectionPower(system::PowerSystem, analysis::DC; label)

The function returns the active power injection associated with a specific bus in the DC framework. The label keyword argument must match an existing bus label.

Example

system = powerSystem("case14.h5")
 dcModel!(system)
 
 analysis = dcPowerFlow(system)
 solve!(system, analysis)
-injection = injectionPower(system, analysis; label = 2)
source
JuliaGrid.supplyPowerMethod
supplyPower(system::PowerSystem, analysis::DC; label)

The function returns the active power injection from the generators associated with a specific bus in the DC framework. The label keyword argument must match an existing bus label.

Example

system = powerSystem("case14.h5")
+injection = injectionPower(system, analysis; label = 2)
source
JuliaGrid.supplyPowerMethod
supplyPower(system::PowerSystem, analysis::DC; label)

The function returns the active power injection from the generators associated with a specific bus in the DC framework. The label keyword argument must match an existing bus label.

Example

system = powerSystem("case14.h5")
 dcModel!(system)
 
 analysis = dcPowerFlow(system)
 solve!(system, analysis)
-supply = supplyPower(system, analysis; label = 2)
source
JuliaGrid.fromPowerMethod
fromPower(system::PowerSystem, analysis::DC; label)

The function returns the active power flow at the from-bus end associated with a specific branch in the DC framework. The label keyword argument must match an existing branch label.

Example

system = powerSystem("case14.h5")
+supply = supplyPower(system, analysis; label = 2)
source
JuliaGrid.fromPowerMethod
fromPower(system::PowerSystem, analysis::DC; label)

The function returns the active power flow at the from-bus end associated with a specific branch in the DC framework. The label keyword argument must match an existing branch label.

Example

system = powerSystem("case14.h5")
 dcModel!(system)
 
 analysis = dcPowerFlow(system)
 solve!(system, analysis)
-from = fromPower(system, analysis; label = 2)
source
JuliaGrid.toPowerMethod
toPower(system::PowerSystem, analysis::DC; label)

The function returns the active power flow at the to-bus end associated with a specific branch in the DC framework. The label keyword argument must match an existing branch label.

Example

system = powerSystem("case14.h5")
+from = fromPower(system, analysis; label = 2)
source
JuliaGrid.toPowerMethod
toPower(system::PowerSystem, analysis::DC; label)

The function returns the active power flow at the to-bus end associated with a specific branch in the DC framework. The label keyword argument must match an existing branch label.

Example

system = powerSystem("case14.h5")
 dcModel!(system)
 
 analysis = dcPowerFlow(system)
 solve!(system, analysis)
-to = toPower(system, analysis; label = 2)
source
JuliaGrid.generatorPowerMethod
generatorPower(system::PowerSystem, analysis::DC; label)

This function returns the output active power associated with a specific generator in the DC framework. The label keyword argument must match an existing generator label.

Example

system = powerSystem("case14.h5")
+to = toPower(system, analysis; label = 2)
source
JuliaGrid.generatorPowerMethod
generatorPower(system::PowerSystem, analysis::DC; label)

This function returns the output active power associated with a specific generator in the DC framework. The label keyword argument must match an existing generator label.

Example

system = powerSystem("case14.h5")
 dcModel!(system)
 
 analysis = dcPowerFlow(system)
 solve!(system, analysis)
-generator = generatorPower(system, analysis; label = 1)
source
+generator = generatorPower(system, analysis; label = 1)source diff --git a/dev/api/measurementModel/index.html b/dev/api/measurementModel/index.html index cd92eaf5..cdbffd64 100644 --- a/dev/api/measurementModel/index.html +++ b/dev/api/measurementModel/index.html @@ -1,5 +1,5 @@ -Measurement Model · JuliaGrid

Measurement Model

For further information on this topic, please see the Measurement Model section of the Manual. Below, we have provided a list of functions that can be used to create, save, and manipulate with measurement devices.

To load measurement model API functionalities into the current scope, utilize the following command:

using JuliaGrid

Measurement Data
Voltmeter
Ammeter
Wattmeter
Varmeter
PMU

Measurement Data

JuliaGrid.measurementFunction
measurement(file::String)

The function builds the composite type Measurement and populates voltmeter, ammeter, wattmeter, varmeter, and pmu fields. In general, once the composite type Measurement has been created, it is possible to add new measurement devices, or modify the parameters of existing ones.

Argument

It requires a string path to the HDF5 file with the .h5 extension.

Returns

The Measurement composite type with the following fields:

  • voltmeter: Bus voltage magnitude measurements.
  • ammeter: Branch current magnitude measurements.
  • wattmeter: Active power injection and active power flow measurements.
  • varmeter: Reactive power injection and reactive power flow measurements.
  • pmu: Bus voltage and branch current phasor measurements.

Units

JuliaGrid stores all data in per-units and radians format.

Example

device = measurement("measurement14.h5")
source
measurement()

Alternatively, the Measurement composite type can be initialized by calling the function without any arguments. This allows the model to be built from scratch and modified as needed.

Example

device = measurement()
source
JuliaGrid.saveMeasurementFunction
saveMeasurement(device::Measurement; path::String, reference::String, note::String)

The function saves the measurement's data in the HDF5 file using the fields voltmeter, ammeter, wattmeter, varmeter, and pmu from the Measurement composite type.

Keywords

The location and file name of the HDF5 file is specified by the mandatory keyword path in the format of "path/name.h5". Additional information can be provided by the optional keywords reference and note, which can be saved along with the power system data.

View HDF5 File

To view the saved HDF5 file, you can use the HDFView software.

Example

using Ipopt
+Measurement Model · JuliaGrid

Measurement Model

For further information on this topic, please see the Measurement Model section of the Manual. Below, we have provided a list of functions that can be used to create, save, and manipulate with measurement devices.

To load measurement model API functionalities into the current scope, utilize the following command:

using JuliaGrid

Measurement Data
Voltmeter
Ammeter
Wattmeter
Varmeter
PMU

Measurement Data

JuliaGrid.measurementFunction
measurement(file::String)

The function builds the composite type Measurement and populates voltmeter, ammeter, wattmeter, varmeter, and pmu fields. In general, once the composite type Measurement has been created, it is possible to add new measurement devices, or modify the parameters of existing ones.

Argument

It requires a string path to the HDF5 file with the .h5 extension.

Returns

The Measurement composite type with the following fields:

  • voltmeter: Bus voltage magnitude measurements.
  • ammeter: Branch current magnitude measurements.
  • wattmeter: Active power injection and active power flow measurements.
  • varmeter: Reactive power injection and reactive power flow measurements.
  • pmu: Bus voltage and branch current phasor measurements.

Units

JuliaGrid stores all data in per-units and radians format.

Example

device = measurement("measurement14.h5")
source
measurement()

Alternatively, the Measurement composite type can be initialized by calling the function without any arguments. This allows the model to be built from scratch and modified as needed.

Example

device = measurement()
source
JuliaGrid.saveMeasurementFunction
saveMeasurement(device::Measurement; path::String, reference::String, note::String)

The function saves the measurement's data in the HDF5 file using the fields voltmeter, ammeter, wattmeter, varmeter, and pmu from the Measurement composite type.

Keywords

The location and file name of the HDF5 file is specified by the mandatory keyword path in the format of "path/name.h5". Additional information can be provided by the optional keywords reference and note, which can be saved along with the power system data.

View HDF5 File

To view the saved HDF5 file, you can use the HDFView software.

Example

using Ipopt
 
 system = powerSystem("case14.m")
 device = measurement()
@@ -12,7 +12,7 @@
 addVoltmeter!(system, device, analysis)
 addWattmeter!(system, device, analysis)
 
-saveMeasurement(device; path = "D:/measurement14.h5")
source
JuliaGrid.status!Function
status!(system::PowerSystem, device::Measurement; inservice, outservice, redundancy)

The function generates a set of measurements, assigning measurement devices randomly to either in-service or out-of-service states based on specified keywords.

Keywords

Only one of the following keywords can be used at a time to configure the measurement set:

  • inservice: Sets the number of in-service devices.
  • outservice: Sets the number of out-of-service devices.
  • redundancy: Determines in-service devices based on redundancy.

Updates

The function updates all the status fields within the Measurement type.

Examples

Creating a measurement set with a specific number of in-service devices:

system = powerSystem("case14.h5")
+saveMeasurement(device; path = "D:/measurement14.h5")
source
JuliaGrid.status!Function
status!(system::PowerSystem, device::Measurement; inservice, outservice, redundancy)

The function generates a set of measurements, assigning measurement devices randomly to either in-service or out-of-service states based on specified keywords.

Keywords

Only one of the following keywords can be used at a time to configure the measurement set:

  • inservice: Sets the number of in-service devices.
  • outservice: Sets the number of out-of-service devices.
  • redundancy: Determines in-service devices based on redundancy.

Updates

The function updates all the status fields within the Measurement type.

Examples

Creating a measurement set with a specific number of in-service devices:

system = powerSystem("case14.h5")
 device = measurement()
 
 acModel!(system)
@@ -47,7 +47,7 @@
 addWattmeter!(system, device, analysis)
 addVarmeter!(system, device, analysis)
 
-status!(system, device; redundancy = 2.5)
source

Voltmeter

JuliaGrid.addVoltmeter!Method
addVoltmeter!(system::PowerSystem, device::Measurement; label, bus, magnitude, variance,
+status!(system, device; redundancy = 2.5)
source

Voltmeter

JuliaGrid.addVoltmeter!Method
addVoltmeter!(system::PowerSystem, device::Measurement; label, bus, magnitude, variance,
     noise, status)

The function adds a new voltmeter that measures bus voltage magnitude to the Measurement type within a given PowerSystem type. The voltmeter can be added to an already defined bus.

Keywords

The voltmeter is defined with the following keywords:

  • label: Unique label for the voltmeter.
  • bus: Label of the bus to which the voltmeter is connected.
  • magnitude (pu or V): Bus voltage magnitude value.
  • variance (pu or V): Variance of the bus voltage magnitude measurement.
  • noise: Specifies how to generate the measurement mean:
    • noise = true: adds white Gaussian noise with the variance to the magnitude,
    • noise = false: uses the magnitude value only.
  • status: Operating status of the voltmeter:
    • status = 1: in-service,
    • status = 0: out-of-service.

Note that all voltage values are referenced to line-to-neutral voltages.

Updates

The function updates the voltmeter field of the Measurement composite type.

Default Settings

Default settings for certain keywords are as follows: variance = 1e-2, noise = false, status = 1, and users can modify these default settings using the @voltmeter macro.

Units

The default units for the magnitude and variance keywords are per-units (pu). However, users can choose to use volts (V) as the units by applying the @voltage macro.

Examples

Adding a voltmeter using the default unit system:

system = powerSystem()
 device = measurement()
 
@@ -59,7 +59,7 @@
 
 addBus!(system; label = "Bus 1", base = 132.0)
 
-addVoltmeter!(system, device; label = "Voltmeter 1", bus = "Bus 1", magnitude = 145.2)
source
JuliaGrid.addVoltmeter!Method
addVoltmeter!(system::PowerSystem, device::Measurement, analysis::AC; variance, noise,
+addVoltmeter!(system, device; label = "Voltmeter 1", bus = "Bus 1", magnitude = 145.2)
source
JuliaGrid.addVoltmeter!Method
addVoltmeter!(system::PowerSystem, device::Measurement, analysis::AC; variance, noise,
     status)

The function incorporates voltmeters into the Measurement composite type for every bus within the PowerSystem type. These measurements are derived from the exact bus voltage magnitudes defined in the AC type.

Keywords

Users have the option to configure the following keywords:

  • variance (pu or V): Variance of bus voltage magnitude measurements.
  • noise: Specifies how to generate the measurement mean:
    • noise = true: adds white Gaussian noise with the variance to the voltage magnitudes,
    • noise = false: uses the exact voltage magnitude values.
  • status: Operating status of the voltmeters:
    • status = 1: in-service,
    • status = 0: out-of-service.

Updates

The function updates the voltmeter field of the Measurement composite type.

Default Settings

Default settings for keywords are as follows: variance = 1e-2, noise = false, and status = 1, and users can modify these default settings using the @voltmeter macro.

Units

By default, the unit for variance is per-unit (pu). However, users can choose to use volts (V) as the units by applying the @voltage macro.

Example

system = powerSystem("case14.h5")
 device = measurement()
 
@@ -74,14 +74,14 @@
 end
 
 @voltmeter(label = "Voltmeter ?")
-addVoltmeter!(system, device, analysis; variance = 1e-3, noise = true)
source
JuliaGrid.updateVoltmeter!Function
updateVoltmeter!(system::PowerSystem, device::Measurement, [analysis::Analysis];
+addVoltmeter!(system, device, analysis; variance = 1e-3, noise = true)
source
JuliaGrid.updateVoltmeter!Function
updateVoltmeter!(system::PowerSystem, device::Measurement, [analysis::Analysis];
     kwargs...)

The function allows for the alteration of parameters for a voltmeter.

Arguments

If the Analysis type is omitted, the function applies changes to the Measurement composite type only. However, when including the Analysis type, it updates both the Measurement and Analysis types. This streamlined process avoids the need to completely rebuild vectors and matrices when adjusting these parameters.

Keywords

To update a specific voltmeter, provide the necessary kwargs input arguments in accordance with the keywords specified in the addVoltmeter! function, along with their respective values. Ensure that the label keyword matches the label of the existing voltmeter you want to modify. If any keywords are omitted, their corresponding values will remain unchanged.

Updates

The function updates the voltmeter field within the Measurement composite type. Furthermore, it guarantees that any modifications to the parameters are transmitted to the Analysis type.

Units

Units for input parameters can be changed using the same method as described for the addVoltmeter! function.

Example

system = powerSystem()
 device = measurement()
 
 addBus!(system; label = "Bus 1", base = 132e3)
 
 addVoltmeter!(system, device; label = "Voltmeter 1", bus = "Bus 1", magnitude = 1.1)
-updateVoltmeter!(system, device; label = "Voltmeter 1", magnitude = 0.9)
source
JuliaGrid.statusVoltmeter!Function
statusVoltmeter!(system::PowerSystem, device::Measurement; inservice, outservice,
+updateVoltmeter!(system, device; label = "Voltmeter 1", magnitude = 0.9)
source
JuliaGrid.statusVoltmeter!Function
statusVoltmeter!(system::PowerSystem, device::Measurement; inservice, outservice,
     redundancy)

The function generates a set of voltmeters, assigning voltmeters randomly to either in-service or out-of-service states based on specified keywords.

Keywords

Only one of the following keywords can be used at a time to configure the measurement set:

  • inservice: Sets the number of in-service voltmeters.
  • outservice: Sets the number of out-of-service voltmeters.
  • redundancy: Determines in-service voltmeters based on redundancy.

Updates

The function updates the status field within the Voltmeter type.

Example

system = powerSystem("case14.h5")
 device = measurement()
 
@@ -96,7 +96,7 @@
 end
 
 addVoltmeter!(system, device, analysis)
-statusVoltmeter!(system, device; inservice = 10)
source
JuliaGrid.@voltmeterMacro
@voltmeter(label, variance, noise, status)

The macro generates a template for a voltmeter, which can be utilized to define a voltmeter using the addVoltmeter! function.

Keywords

To establish the voltmeter template, users can specify default values for the variance, noise, and status keywords, along with pattern for labels using the label keyword.

Units

By default, the unit for variance is per-unit (pu). However, users can choose to use volts (V) as the units by applying the @voltage macro.

Examples

Adding a voltmeter using the default unit system:

system = powerSystem()
+statusVoltmeter!(system, device; inservice = 10)
source
JuliaGrid.@voltmeterMacro
@voltmeter(label, variance, noise, status)

The macro generates a template for a voltmeter, which can be utilized to define a voltmeter using the addVoltmeter! function.

Keywords

To establish the voltmeter template, users can specify default values for the variance, noise, and status keywords, along with pattern for labels using the label keyword.

Units

By default, the unit for variance is per-unit (pu). However, users can choose to use volts (V) as the units by applying the @voltage macro.

Examples

Adding a voltmeter using the default unit system:

system = powerSystem()
 device = measurement()
 
 addBus!(system; label = "Bus 1", base = 132e3)
@@ -109,7 +109,7 @@
 addBus!(system; label = "Bus 1", base = 132.0)
 
 @voltmeter(label = "Voltmeter ?", variance = 0.00132)
-addVoltmeter!(system, device; bus = "Bus 1", magnitude = 145.2)
source

Ammeter

JuliaGrid.addAmmeter!Method
addAmmeter!(system::PowerSystem, device::Measurement; label, from, to, magnitude,
+addVoltmeter!(system, device; bus = "Bus 1", magnitude = 145.2)
source

Ammeter

JuliaGrid.addAmmeter!Method
addAmmeter!(system::PowerSystem, device::Measurement; label, from, to, magnitude,
     variance, noise, status)

The function adds a new ammeter that measures branch current magnitude to the Measurement type within a given PowerSystem type. The ammeter can be added to an already defined branch.

Keywords

The ammeter is defined with the following keywords:

  • label: Unique label for the ammeter.
  • from: Label of the branch if the ammeter is located at the from-bus end.
  • to: Label of the branch if the ammeter is located at the to-bus end.
  • magnitude (pu or A): Branch current magnitude value.
  • variance (pu or A): Variance of the branch current magnitude measurement.
  • noise: Specifies how to generate the measurement mean:
    • noise = true: adds white Gaussian noise with the variance to the magnitude,
    • noise = false: uses the magnitude value only.
  • status: Operating status of the ammeter:
    • status = 1: in-service,
    • status = 0: out-of-service.

Updates

The function updates the ammeter field of the Measurement composite type.

Default Settings

Default settings for certain keywords are as follows: variance = 1e-2, noise = false, status = 1, which apply to ammeters located at both the from-bus and to-bus ends. Users can fine-tune these settings by explicitly specifying the variance and status for ammeters positioned on either the from-bus or to-bus ends of branches using the @ammeter macro.

Units

The default units for the magnitude and variance keywords are per-units (pu). However, users can choose to use amperes (A) as the units by applying the @current macro.

Examples

Adding ammeters using the default unit system:

system = powerSystem()
 device = measurement()
 
@@ -127,7 +127,7 @@
 addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
 
 addAmmeter!(system, device; label = "Ammeter 1", from = "Branch 1", magnitude = 481.125)
-addAmmeter!(system, device; label = "Ammeter 2", to = "Branch 1", magnitude = 437.386)
source
JuliaGrid.addAmmeter!Method
addAmmeter!(system::PowerSystem, device::Measurement, analysis::AC; varianceFrom,
+addAmmeter!(system, device; label = "Ammeter 2", to = "Branch 1", magnitude = 437.386)
source
JuliaGrid.addAmmeter!Method
addAmmeter!(system::PowerSystem, device::Measurement, analysis::AC; varianceFrom,
     statusFrom, varianceTo, statusTo, noise)

The function incorporates ammeters into the Measurement type for every branch within the PowerSystem type. These measurements are derived from the exact branch current magnitudes defined in the AC type.

Keywords

Users have the option to configure the following keywords:

  • varianceFrom (pu or A): Measurement variance for ammeters at the from-bus ends.
  • statusFrom: Operating status of the ammeters at the from-bus ends:
    • statusFrom = 1: in-service,
    • statusFrom = 0: out-of-service.
  • varianceTo (pu or A): Measurement variance for ammeters at the to-bus ends.
  • statusTo: Operating status of the ammeters at the to-bus ends:
    • statusTo = 1: in-service,
    • statusTo = 0: out-of-service.
  • noise: Specifies how to generate the measurement mean:
    • noise = true: adds white Gaussian noise with the variance to the current magnitudes,
    • noise = false: uses the exact current magnitude values.

Updates

The function updates the ammeter field of the Measurement composite type.

Default Settings

Default settings for keywords are as follows: varianceFrom = 1e-2, statusFrom = 1, varianceTo = 1e-2, statusTo = 1, and noise = false. Users can change these default settings using the @ammeter macro.

Units

The default units for the varianceFrom and varianceTo keywords are per-units (pu). However, users can choose to use amperes (A) as the units by applying the @current macro.

Example

system = powerSystem("case14.h5")
 device = measurement()
 
@@ -143,7 +143,7 @@
 current!(system, analysis)
 
 @ammeter(label = "Ammeter ?")
-addAmmeter!(system, device, analysis; varianceFrom = 1e-3, statusTo = 0)
source
JuliaGrid.updateAmmeter!Function
updateAmmeter!(system::PowerSystem, device::Measurement, [analysis::Analysis];
+addAmmeter!(system, device, analysis; varianceFrom = 1e-3, statusTo = 0)
source
JuliaGrid.updateAmmeter!Function
updateAmmeter!(system::PowerSystem, device::Measurement, [analysis::Analysis];
     kwargs...)

The function allows for the alteration of parameters for an ammeter.

Arguments

If the Analysis type is omitted, the function applies changes to the Measurement composite type only. However, when including the Analysis type, it updates both the Measurement and Analysis types. This streamlined process avoids the need to completely rebuild vectors and matrices when adjusting these parameters.

Keywords

To update a specific ammeter, provide the necessary kwargs input arguments in accordance with the keywords specified in the addAmmeter! function, along with their respective values. Ensure that the label keyword matches the label of the existing ammeter you want to modify. If any keywords are omitted, their corresponding values will remain unchanged.

Updates

The function updates the ammeter field within the Measurement composite type. Furthermore, it guarantees that any modifications to the parameters are transmitted to the Analysis type.

Units

Units for input parameters can be changed using the same method as described for the addAmmeter! function.

Example

system = powerSystem()
 device = measurement()
 
@@ -152,7 +152,7 @@
 addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
 
 addAmmeter!(system, device; label = "Ammeter 1", from = "Branch 1", magnitude = 1.1)
-updateAmmeter!(system, device; label = "Ammeter 1", magnitude = 1.2, variance = 1e-4)
source
JuliaGrid.statusAmmeter!Function
statusAmmeter!(system::PowerSystem, ammeter::Ammeter; inservice, inserviceFrom,
+updateAmmeter!(system, device; label = "Ammeter 1", magnitude = 1.2, variance = 1e-4)
source
JuliaGrid.statusAmmeter!Function
statusAmmeter!(system::PowerSystem, ammeter::Ammeter; inservice, inserviceFrom,
     inserviceTo, outservice, outserviceFrom, outserviceTo, redundancy, redundancyFrom,
     redundancyTo)

The function generates a set of ammeters, assigning ammeters randomly to either in-service or out-of-service states based on specified keywords.

Keywords

Users may use either one main keyword or two fine-tuning keywords that specify distinct locations per function call:

  • inservice: Sets the number of in-service ammeters or allows fine-tuning:
    • inserviceFrom: sets only ammeters loacted at the from-bus end,
    • inserviceTo: sets only ammeters loacted at the to-bus end.
  • outservice: Sets the number of out-of-service ammeters or allows fine-tuning:
    • outserviceFrom: sets only ammeters loacted at the from-bus end,
    • outserviceTo: sets only ammeters loacted at the to-bus end.
  • redundancy: Determines in-service ammeters based on redundancy or allows fine-tuning:
    • redundancyFrom: determines only ammeters loacted at the from-bus end,
    • redundancyTo: determines only ammeters loacted at the to-bus end.

Updates

The function updates the status field within the Ammeter type.

Example

system = powerSystem("case14.h5")
 device = measurement()
@@ -169,7 +169,7 @@
 current!(system, analysis)
 
 addAmmeter!(system, device, analysis)
-statusAmmeter!(system, device; inserviceFrom = 5, inserviceTo = 10)
source
JuliaGrid.@ammeterMacro
@ammeter(label, varianceFrom, statusFrom, varianceTo, statusTo, noise)

The macro generates a template for an ammeter, which can be utilized to define an ammeter using the addAmmeter! function.

Keywords

To establish the ammeter template, users can set default variance and status values for ammeters at both the from-bus and to-bus ends of branches, using varianceFrom and statusFrom for the former and varianceTo and statusTo for the latter. Users can also configure label patterns with the label keyword, as well as specify the noise type.

Units

The default units for the varianceFrom and varianceTo keywords are per-units (pu). However, users can choose to use amperes (A) as the units by applying the @current macro.

Examples

Adding an ammeter using the default unit system:

system = powerSystem()
+statusAmmeter!(system, device; inserviceFrom = 5, inserviceTo = 10)
source
JuliaGrid.@ammeterMacro
@ammeter(label, varianceFrom, statusFrom, varianceTo, statusTo, noise)

The macro generates a template for an ammeter, which can be utilized to define an ammeter using the addAmmeter! function.

Keywords

To establish the ammeter template, users can set default variance and status values for ammeters at both the from-bus and to-bus ends of branches, using varianceFrom and statusFrom for the former and varianceTo and statusTo for the latter. Users can also configure label patterns with the label keyword, as well as specify the noise type.

Units

The default units for the varianceFrom and varianceTo keywords are per-units (pu). However, users can choose to use amperes (A) as the units by applying the @current macro.

Examples

Adding an ammeter using the default unit system:

system = powerSystem()
 device = measurement()
 
 addBus!(system; label = "Bus 1", base = 132e3)
@@ -186,7 +186,7 @@
 addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
 
 @ammeter(label = "Ammeter ?", varianceTo = 0.004374, statusTo = 0)
-addAmmeter!(system, device; label = "Ammeter 1", to = "Branch 1", magnitude = 481.125)
source

Wattmeter

JuliaGrid.addWattmeter!Method
addWattmeter!(system::PowerSystem, device::Measurement; label, bus, from, to, active,
+addAmmeter!(system, device; label = "Ammeter 1", to = "Branch 1", magnitude = 481.125)
source

Wattmeter

JuliaGrid.addWattmeter!Method
addWattmeter!(system::PowerSystem, device::Measurement; label, bus, from, to, active,
     variance, noise, status)

The function adds a new wattmeter that measures active power injection or active power flow to the Measurement type within a given PowerSystem type. The wattmeter can be added to an already defined bus or branch.

Keywords

The wattmeter is defined with the following keywords:

  • label: Unique label for the wattmeter.
  • bus: Label of the bus if the wattmeter is located at the bus.
  • from: Label of the branch if the wattmeter is located at the from-bus end.
  • to: Label of the branch if the wattmeter is located at the to-bus end.
  • active (pu or W): Active power value.
  • variance (pu or W): Variance of the active power measurement.
  • noise: Specifies how to generate the measurement mean:
    • noise = true: adds white Gaussian noise with the variance to the active,
    • noise = false: uses the active value only.
  • status: Operating status of the wattmeter:
    • status = 1: in-service,
    • status = 0: out-of-service.

Note that when powers are given in SI units, they correspond to three-phase power.

Updates

The function updates the wattmeter field of the Measurement composite type.

Default Settings

Default settings for certain keywords are as follows: variance = 1e-2, noise = false, and status = 1, which apply to wattmeters located at the bus, as well as at both the from-bus and to-bus ends. Users can fine-tune these settings by explicitly specifying the variance and status for wattmeters positioned at the buses, from-bus ends, or to-bus ends of branches using the @wattmeter macro.

Units

The default units for the active and variance keywords are per-units (pu). However, users can choose to use watts (W) as the units by applying the @power macro.

Examples

Adding wattmeters using the default unit system:

system = powerSystem()
 device = measurement()
 
@@ -204,7 +204,7 @@
 addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
 
 addWattmeter!(system, device; label = "Wattmeter 1", bus = "Bus 2", active = 40.0)
-addWattmeter!(system, device; label = "Wattmeter 2", from = "Branch 1", active = 10.0)
source
JuliaGrid.addWattmeter!Method
addWattmeter!(system::PowerSystem, device::Measurement, analysis::AC;
+addWattmeter!(system, device; label = "Wattmeter 2", from = "Branch 1", active = 10.0)
source
JuliaGrid.addWattmeter!Method
addWattmeter!(system::PowerSystem, device::Measurement, analysis::AC;
     varianceBus, statusBus, varianceFrom, statusFrom, varianceTo, statusTo, noise)

The function incorporates wattmeters into the Measurement composite type for every bus and branch within the PowerSystem type. These measurements are derived from the exact active power injections at buses and active power flows in branches defined in the AC type.

Keywords

Users have the option to configure the following keywords:

  • varianceBus (pu or W): Measurement variance for wattmeters at the buses.
  • statusBus: Operating status of the wattmeters at the buses:
    • statusBus = 1: in-service,
    • statusBus = 0: out-of-service.
  • varianceFrom (pu or W): Measurement variance for wattmeters at the from-bus ends.
  • statusFrom: Operating status of the wattmeters at the from-bus ends:
    • statusFrom = 1: in-service,
    • statusFrom = 0: out-of-service.
  • varianceTo (pu or W): Measurement variance for wattmeters at the to-bus ends.
  • statusTo: Operating status of the wattmeters at the to-bus ends:
    • statusTo = 1: in-service,
    • statusTo = 0: out-of-service.
  • noise: Specifies how to generate the measurement mean:
    • noise = true: adds white Gaussian noise with the variance to the active powers,
    • noise = false: uses the exact active power values.

Updates

The function updates the wattmeter field of the Measurement composite type.

Default Settings

Default settings for keywords are as follows: varianceBus = 1e-2, statusBus = 1, varianceFrom = 1e-2, statusFrom = 1, varianceTo = 1e-2, statusTo = 1, and noise = false. Users can change these default settings using the @wattmeter macro.

Units

The default units for the varianceBus, varianceFrom, and varianceTo keywords are per-units (pu). However, users can choose to use watts (W) as the units by applying the @power macro.

Example

system = powerSystem("case14.h5")
 device = measurement()
 
@@ -220,7 +220,7 @@
 power!(system, analysis)
 
 @wattmeter(label = "Wattmeter ?")
-addWattmeter!(system, device, analysis; varianceBus = 1e-3, statusFrom = 0)
source
JuliaGrid.updateWattmeter!Function
updateWattmeter!(system::PowerSystem, device::Measurement, [analysis::Analysis];
+addWattmeter!(system, device, analysis; varianceBus = 1e-3, statusFrom = 0)
source
JuliaGrid.updateWattmeter!Function
updateWattmeter!(system::PowerSystem, device::Measurement, [analysis::Analysis];
     kwargs...)

The function allows for the alteration of parameters for a wattmeter.

Arguments

If the Analysis type is omitted, the function applies changes to the Measurement composite type only. However, when including the Analysis type, it updates both the Measurement and Analysis types. This streamlined process avoids the need to completely rebuild vectors and matrices when adjusting these parameters.

Keywords

To update a specific wattmeter, provide the necessary kwargs input arguments in accordance with the keywords specified in the addWattmeter! function, along with their respective values. Ensure that the label keyword matches the label of the existing wattmeter you want to modify. If any keywords are omitted, their corresponding values will remain unchanged.

Updates

The function updates the wattmeter field within the Measurement composite type. Furthermore, it guarantees that any modifications to the parameters are transmitted to the Analysis type.

Units

Units for input parameters can be changed using the same method as described for the addWattmeter! function.

Example

system = powerSystem()
 device = measurement()
 
@@ -229,7 +229,7 @@
 addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
 
 addWattmeter!(system, device; label = "Wattmeter 1", from = "Branch 1", active = 1.1)
-updateWattmeter!(system, device; label = "Wattmeter 1", active = 1.2, variance = 1e-4)
source
JuliaGrid.statusWattmeter!Function
statusWattmeter!(system::PowerSystem, device::Measurement; inservice, inserviceBus,
+updateWattmeter!(system, device; label = "Wattmeter 1", active = 1.2, variance = 1e-4)
source
JuliaGrid.statusWattmeter!Function
statusWattmeter!(system::PowerSystem, device::Measurement; inservice, inserviceBus,
     inserviceFrom, inserviceTo, outservice, outserviceBus outserviceFrom, outserviceTo,
     redundancy, redundancyBus, redundancyFrom, redundancyTo)

The function generates a set of wattmeters, assigning wattmeters randomly to either in-service or out-of-service states based on specified keywords.

Keywords

Users may use either one main keyword or three fine-tuning keywords that specify distinct locations per function call:

  • inservice: Sets the number of in-service wattmeters or allows fine-tuning:
    • inserviceBus: sets only wattmeters loacted at the bus,
    • inserviceFrom: sets only wattmeters loacted at the from-bus end,
    • inserviceTo: sets only wattmeters loacted at the to-bus end.
  • outservice: Sets the number of out-of-service wattmeters or allows fine-tuning:
    • outserviceBus: sets only wattmeters loacted at the bus,
    • outserviceFrom: sets only wattmeters loacted at the from-bus end,
    • outserviceTo: sets only wattmeters loacted at the to-bus end.
  • redundancy: Determines in-service wattmeters based on redundancy or allows fine-tuning:
    • redundancyBus: determines only wattmeters loacted at the bus,
    • redundancyFrom: determines only wattmeters loacted at the from-bus end,
    • redundancyTo: determines only wattmeters loacted at the to-bus end.

Updates

The function updates the status field within the Wattmeter type.

Example

system = powerSystem("case14.h5")
 device = measurement()
@@ -246,7 +246,7 @@
 power!(system, analysis)
 
 addWattmeter!(system, device, analysis)
-statusWattmeter!(system, device; outserviceBus = 14, inserviceFrom = 10, outserviceTo = 2)
source
JuliaGrid.@wattmeterMacro
@wattmeter(label, varianceBus, statusBus, varianceFrom, statusFrom, varianceTo, statusTo,
+statusWattmeter!(system, device; outserviceBus = 14, inserviceFrom = 10, outserviceTo = 2)
source
JuliaGrid.@wattmeterMacro
@wattmeter(label, varianceBus, statusBus, varianceFrom, statusFrom, varianceTo, statusTo,
     noise)

The macro generates a template for a wattmeter, which can be utilized to define a wattmeter using the addWattmeter! function.

Keywords

To establish the wattmeter template, users can set default variance and status values for wattmeters at buses using varianceBus and statusBus, and at both the from-bus and to-bus ends of branches using varianceFrom and statusFrom for the former and varianceTo and statusTo for the latter. Users can also configure label patterns with the label keyword, as well as specify the noise type.

Units

The default units for the varianceBus, varianceFrom, and varianceTo keywords are per-units (pu). However, users can choose to use watts (W) as the units by applying the @power macro.

Examples

Adding wattmeters using the default unit system:

system = powerSystem()
 device = measurement()
 
@@ -266,7 +266,7 @@
 
 @wattmeter(label = "Wattmeter ?", varianceBus = 1e-1, varianceFrom = 1e-2)
 addWattmeter!(system, device; bus = "Bus 2", active = 40.0)
-addWattmeter!(system, device; from = "Branch 1", active = 10.0)
source

Varmeter

JuliaGrid.addVarmeter!Method
addVarmeter!(system::PowerSystem, device::Measurement; label, bus, from, to, reactive,
+addWattmeter!(system, device; from = "Branch 1", active = 10.0)
source

Varmeter

JuliaGrid.addVarmeter!Method
addVarmeter!(system::PowerSystem, device::Measurement; label, bus, from, to, reactive,
     variance, noise, status)

The function adds a new varmeter that measures reactive power injection or reactive power flow to the Measurement type within a given PowerSystem type. The varmeter can be added to an already defined bus or branch.

Keywords

The varmeter is defined with the following keywords:

  • label: Unique label for the varmeter.
  • bus: Label of the bus if the varmeter is located at the bus.
  • from: Label of the branch if the varmeter is located at the from-bus end.
  • to: Label of the branch if the varmeter is located at the to-bus end.
  • reactive (pu or VAr): Reactive power value.
  • variance (pu or VAr): Variance of the reactive power measurement.
  • noise: Specifies how to generate the measurement mean:
    • noise = true: adds white Gaussian noise with the variance to the reactive,
    • noise = false: uses the reactive value only.
  • status: Operating status of the varmeter:
    • status = 1: in-service,
    • status = 0: out-of-service.

Note that when powers are given in SI units, they correspond to three-phase power.

Updates

The function updates the varmeter field of the Measurement composite type.

Default Settings

Default settings for certain keywords are as follows: variance = 1e-2, noise = false, and status = 1, which apply to varmeters located at the bus, as well as at both the from-bus and to-bus ends. Users can fine-tune these settings by explicitly specifying the variance and status for varmeters positioned at the buses, from-bus ends, or to-bus ends of branches using the @varmeter macro.

Units

The default units for the reactive and variance keywords are per-units (pu). However, users can choose to use volt-amperes reactive (VAr) as the units by applying the @power macro.

Examples

Adding varmeters using the default unit system:

system = powerSystem()
 device = measurement()
 
@@ -284,7 +284,7 @@
 addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
 
 addVarmeter!(system, device; label = "Varmeter 1", bus = "Bus 2", reactive = 40.0)
-addVarmeter!(system, device; label = "Varmeter 2", from = "Branch 1", reactive = 10.0)
source
JuliaGrid.addVarmeter!Method
addVarmeter!(system::PowerSystem, device::Measurement, analysis::AC;
+addVarmeter!(system, device; label = "Varmeter 2", from = "Branch 1", reactive = 10.0)
source
JuliaGrid.addVarmeter!Method
addVarmeter!(system::PowerSystem, device::Measurement, analysis::AC;
     varianceBus, statusBus, varianceFrom, statusFrom, varianceTo, statusTo, noise)

The function incorporates varmeters into the Measurement composite type for every bus and branch within the PowerSystem type. These measurements are derived from the exact reactive power injections at buses and reactive power flows in branches defined in the AC type.

Keywords

  • varianceBus (pu or VAr): Measurement variance for varmeters at the buses.
  • statusBus: Operating status of the varmeters at the buses:
    • statusBus = 1: in-service,
    • statusBus = 0: out-of-service.
  • varianceFrom (pu or VAr): Measurement variance for varmeters at the from-bus ends.
  • statusFrom: Operating status of the varmeters at the from-bus ends:
    • statusFrom = 1: in-service,
    • statusFrom = 0: out-of-service.
  • varianceTo (pu or VAr): Measurement variance for varmeters at the to-bus ends.
  • statusTo: Operating status of the varmeters at the to-bus ends:
    • statusTo = 1: in-service,
    • statusTo = 0: out-of-service.
  • noise: Specifies how to generate the measurement mean:
    • noise = true: adds white Gaussian noise with the variance to the reactive powers,
    • noise = false: uses the exact reactive power values.

Updates

The function updates the varmeter field of the Measurement composite type.

Default Settings

Default settings for keywords are as follows: varianceBus = 1e-2, statusBus = 1, varianceFrom = 1e-2, statusFrom = 1, varianceTo = 1e-2, statusTo = 1, and noise = false. Users can change these default settings using the @varmeter macro.

Units

The default units for the varianceBus, varianceFrom, and varianceTo keywords are per-units (pu). However, users can choose to use volt-amperes reactive (VAr) as the units by applying the @power macro.

Example

system = powerSystem("case14.h5")
 device = measurement()
 
@@ -300,7 +300,7 @@
 power!(system, analysis)
 
 @varmeter(label = "Varmeter ?")
-addVarmeter!(system, device, analysis; varianceFrom = 1e-3, statusBus = 0)
source
JuliaGrid.updateVarmeter!Function
updateVarmeter!(system::PowerSystem, device::Measurement, [analysis::Analysis];
+addVarmeter!(system, device, analysis; varianceFrom = 1e-3, statusBus = 0)
source
JuliaGrid.updateVarmeter!Function
updateVarmeter!(system::PowerSystem, device::Measurement, [analysis::Analysis];
     kwargs...)

The function allows for the alteration of parameters for a varmeter.

Arguments

If the Analysis type is omitted, the function applies changes to the Measurement composite type only. However, when including the Analysis type, it updates both the Measurement and Analysis types. This streamlined process avoids the need to completely rebuild vectors and matrices when adjusting these parameters.

Keywords

To update a specific varmeter, provide the necessary kwargs input arguments in accordance with the keywords specified in the addVarmeter! function, along with their respective values. Ensure that the label keyword matches the label of the existing varmeter you want to modify. If any keywords are omitted, their corresponding values will remain unchanged.

Updates

The function updates the varmeter field within the Measurement composite type. Furthermore, it guarantees that any modifications to the parameters are transmitted to the Analysis type.

Units

Units for input parameters can be changed using the same method as described for the addVarmeter! function.

Example

system = powerSystem()
 device = measurement()
 
@@ -309,7 +309,7 @@
 addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
 
 addVarmeter!(system, device; label = "Varmeter 1", from = "Branch 1", reactive = 1.1)
-updateVarmeter!(system, device; label = "Varmeter 1", reactive = 1.2, variance = 1e-4)
source
JuliaGrid.statusVarmeter!Function
statusVarmeter!(system::PowerSystem, device::Measurement; inservice, inserviceBus,
+updateVarmeter!(system, device; label = "Varmeter 1", reactive = 1.2, variance = 1e-4)
source
JuliaGrid.statusVarmeter!Function
statusVarmeter!(system::PowerSystem, device::Measurement; inservice, inserviceBus,
     inserviceFrom, inserviceTo, outservice, outserviceBus outserviceFrom, outserviceTo,
     redundancy, redundancyBus, redundancyFrom, redundancyTo)

The function generates a set of varmeters, assigning varmeters randomly to either in-service or out-of-service states based on specified keywords.

Keywords

Users may use either one main keyword or three fine-tuning keywords that specify distinct locations per function call:

  • inservice: Sets the number of in-service varmeters or allows fine-tuning:
    • inserviceBus: sets only varmeters loacted at the bus,
    • inserviceFrom: sets only varmeters loacted at the from-bus end,
    • inserviceTo: sets only varmeters loacted at the to-bus end.
  • outservice: Sets the number of out-of-service varmeters or allows fine-tuning:
    • outserviceBus: sets only varmeters loacted at the bus,
    • outserviceFrom: sets only varmeters loacted at the from-bus end,
    • outserviceTo: sets only varmeters loacted at the to-bus end.
  • redundancy: Determines in-service varmeters based on redundancy or allows fine-tuning:
    • redundancyBus: determines only varmeters loacted at the bus,
    • redundancyFrom: determines only varmeters loacted at the from-bus end,
    • redundancyTo: determines only varmeters loacted at the to-bus end.

Updates

The function updates the status field within the Varmeter type.

Example

system = powerSystem("case14.h5")
 device = measurement()
@@ -326,7 +326,7 @@
 power!(system, analysis)
 
 addVarmeter!(system, device, analysis)
-statusVarmeter!(system, device; inserviceFrom = 20)
source
JuliaGrid.@varmeterMacro
@varmeter(label, varinaceBus, varianceFrom, varianceTo, statusBus, statusFrom, statusTo,
+statusVarmeter!(system, device; inserviceFrom = 20)
source
JuliaGrid.@varmeterMacro
@varmeter(label, varinaceBus, varianceFrom, varianceTo, statusBus, statusFrom, statusTo,
     noise)

The macro generates a template for a varmeter, which can be utilized to define a varmeter using the addVarmeter! function.

Keywords

To establish the varmeter template, users can set default variance and status values for varmeters at buses using varianceBus and statusBus, and at both the from-bus and to-bus ends of branches using varianceFrom and statusFrom for the former and varianceTo and statusTo for the latter. Users can also configure label patterns with the label keyword, as well as specify the noise type.

Units

The default units for the varianceBus, varianceFrom, and varianceTo keywords are per-units (pu). However, users can choose to usevolt-amperes reactive (VAr) as the units by applying the @power macro.

Examples

Adding varmeters using the default unit system:

system = powerSystem()
 device = measurement()
 
@@ -346,7 +346,7 @@
 
 @varmeter(label = "Varmeter ?", varianceBus = 1e-1, varianceFrom = 1e-2)
 addVarmeter!(system, device; bus = "Bus 2", reactive = 40.0)
-addVarmeter!(system, device; from = "Branch 1", reactive = 10.0)
source

PMU

JuliaGrid.addPmu!Method
addPmu!(system::PowerSystem, device::Measurement; label, bus, from, to, magnitude,
+addVarmeter!(system, device; from = "Branch 1", reactive = 10.0)
source

PMU

JuliaGrid.addPmu!Method
addPmu!(system::PowerSystem, device::Measurement; label, bus, from, to, magnitude,
     varianceMagnitude, statusMagnitude, angle, varianceAngle, statusAngle,
     noise, correlated, polar)

The function adds a new PMU to the Measurement type within a given PowerSystem type. The PMU can be added to an already defined bus or branch. When defining the PMU, it is essential to provide the bus voltage magnitude and angle if the PMU is located at a bus or the branch current magnitude and angle if the PMU is located at a branch.

Keywords

The PMU is defined with the following keywords:

  • label: Unique label for the PMU.
  • bus: Label of the bus if the PMU is located at the bus.
  • from: Label of the branch if the PMU is located at the from-bus end.
  • to: Label of the branch if the PMU is located at the to-bus end.
  • magnitude (pu or V, A): Bus voltage or branch current magnitude value.
  • varianceMagnitude (pu or V, A): Magnitude measurement variance.
  • statusMagnitude: Operating status of the magnitude measurement:
    • statusMagnitude = 1: in-service,
    • statusMagnitude = 0: out-of-service.
  • angle (rad or deg): Bus voltage or branch current angle value.
  • varianceAngle (rad or deg): Angle measurement variance.
  • statusAngle: Operating status of the angle measurement:
    • statusAngle = 1: in-service,
    • statusAngle = 0: out-of-service.
  • noise: Specifies how to generate the measurement means:
    • noise = true: adds white Gaussian noises with variances to the magnitude and angle,
    • noise = false: uses the magnitude and angle values only.
  • correlated: Specifies error correlation for PMUs for algorithms utilizing rectangular coordinates:
    • correlated = true: considers correlated errors,
    • correlated = false: disregards correlations between errors.
  • polar: Chooses the coordinate system for including phasor measurements in AC state estimation:
    • polar = true: adopts the polar coordinate system,
    • polar = false: adopts the rectangular coordinate system.

Note that all voltage values are referenced to line-to-neutral voltages.

Updates

The function updates the pmu field of the Measurement composite type.

Default Settings

Default settings for certain keywords are as follows: varianceMagnitude = 1e-5, statusMagnitude = 1, varianceAngle = 1e-5, statusAngle = 1, noise = false, correlated = false, and polar = false, which apply to PMUs located at the bus, as well as at both the from-bus and to-bus ends. Users can fine-tune these settings by explicitly specifying the variance and status for PMUs positioned at the buses, from-bus ends, or to-bus ends of branches using the @pmu macro.

Units

The default units for the magnitude, varianceMagnitude, and angle, varianceAngle keywords are per-units (pu) and radians (rad). However, users have the option to switch to volts (V) and degrees (deg) when the PMU is located at a bus using the @voltage macro, or amperes (A) and degrees (deg) when the PMU is located at a branch through the use of the @current macro.

Examples

Adding PMUs using the default unit system:

system = powerSystem()
 device = measurement()
@@ -366,7 +366,7 @@
 addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
 
 addPmu!(system, device; label = "PMU 1", bus = "Bus 1", magnitude = 145, angle = -5.7)
-addPmu!(system, device; label = "PMU 2", from = "Branch 1", magnitude = 481, angle = 5.7)
source
JuliaGrid.addPmu!Method
addPmu!(system::PowerSystem, device::Measurement, analysis::AC;
+addPmu!(system, device; label = "PMU 2", from = "Branch 1", magnitude = 481, angle = 5.7)
source
JuliaGrid.addPmu!Method
addPmu!(system::PowerSystem, device::Measurement, analysis::AC;
     varianceMagnitudeBus, statusMagnitudeBus, varianceAngleBus, statusAngleBus,
     varianceMagnitudeFrom, statusMagnitudeFrom, varianceAngleFrom, statusAngleFrom,
     varianceMagnitudeTo, statusMagnitudeTo, varianceAngleTo, statusAngleTo,
@@ -385,14 +385,14 @@
 current!(system, analysis)
 
 @pmu(label = "PMU ?")
-addPmu!(system, device, analysis; varianceMagnitudeBus = 1e-3)
source
JuliaGrid.updatePmu!Function
updatePmu!(system::PowerSystem, device::Measurement, [analysis::Analysis];
+addPmu!(system, device, analysis; varianceMagnitudeBus = 1e-3)
source
JuliaGrid.updatePmu!Function
updatePmu!(system::PowerSystem, device::Measurement, [analysis::Analysis];
     kwargs...)

The function allows for the alteration of parameters for a PMU.

Arguments

If the Analysis type is omitted, the function applies changes to the Measurement composite type only. However, when including the Analysis type, it updates both the Measurement and Analysis types. This streamlined process avoids the need to completely rebuild vectors and matrices when adjusting these parameters.

Keywords

To update a specific PMU, provide the necessary kwargs input arguments in accordance with the keywords specified in the addPmu! function, along with their respective values. Ensure that the label keyword matches the label of the existing PMU you want to modify. If any keywords are omitted, their corresponding values will remain unchanged.

Updates

The function updates the pmu field within the Measurement composite type. Furthermore, it guarantees that any modifications to the parameters are transmitted to the Analysis type.

Units

Units for input parameters can be changed using the same method as described for the addPmu! function.

Example

system = powerSystem()
 device = measurement()
 
 addBus!(system; label = "Bus 1", base = 132e3)
 
 addPmu!(system, device; label = "PMU 1", bus = "Bus 1", magnitude = 1.1, angle = -0.1)
-updatePmu!(system, device; label = "PMU 1", magnitude = 1.05)
source
JuliaGrid.statusPmu!Function
statusPmu!(system::PowerSystem, device::Measurement; inservice, inserviceBus,
+updatePmu!(system, device; label = "PMU 1", magnitude = 1.05)
source
JuliaGrid.statusPmu!Function
statusPmu!(system::PowerSystem, device::Measurement; inservice, inserviceBus,
     inserviceFrom, inserviceTo, outservice, outserviceBus outserviceFrom, outserviceTo,
     redundancy, redundancyBus, redundancyFrom, redundancyTo)

The function generates a set of PMUs, assigning PMUs randomly to either in-service or out-of-service states based on specified keywords. It is important to note that when we refer to PMU, we encompass both magnitude and angle measurements.

Keywords

Users may use either one main keyword or three fine-tuning keywords that specify distinct locations per function call:

  • inservice: Sets the number of in-service PMUs or allows fine-tuning:
    • inserviceBus: sets only PMUs loacted at the bus,
    • inserviceFrom: sets only PMUs loacted at the from-bus end,
    • inserviceTo: sets only PMUs loacted at the to-bus end.
  • outservice: Sets the number of out-of-service PMUs or allows fine-tuning:
    • outserviceBus: sets only PMUs loacted at the bus,
    • outserviceFrom: sets only PMUs loacted at the from-bus end,
    • outserviceTo: sets only PMUs loacted at the to-bus end.
  • redundancy: Determines in-service PMUs based on redundancy or allows fine-tuning:
    • redundancyBus: determines only PMUs loacted at the bus,
    • redundancyFrom: determines only PMUs loacted at the from-bus end,
    • redundancyTo: determines only PMUs loacted at the to-bus end.

Updates

The function updates the status fields within the PMU type.

Example

system = powerSystem("case14.h5")
 device = measurement()
@@ -409,7 +409,7 @@
 current!(system, analysis)
 
 addPmu!(system, device, analysis)
-statusPmu!(system, device; inserviceBus = 14)
source
JuliaGrid.@pmuMacro
@pmu(label, varianceMagnitudeBus, statusMagnitudeBus, varianceAngleBus, statusAngleBus,
+statusPmu!(system, device; inserviceBus = 14)
source
JuliaGrid.@pmuMacro
@pmu(label, varianceMagnitudeBus, statusMagnitudeBus, varianceAngleBus, statusAngleBus,
     varianceMagnitudeFrom, statusMagnitudeFrom, varianceAngleFrom, statusAngleFrom,
     varianceMagnitudeTo, statusMagnitudeTo, varianceAngleTo, statusAngleTo, noise,
     correlated, polar)

The macro generates a template for a PMU, which can be utilized to define a PMU using the addPmu! function.

Keywords

To establish the PMU template, users have the option to set default values for magnitude and angle variances, as well as statuses for each component of the phasor. This can be done for PMUs located at the buses using the varianceMagnitudeBus, varianceAngleBus, statusMagnitudeBus, and statusAngleBus keywords.

The same configuration can be applied at both the from-bus ends of the branches using the varianceMagnitudeFrom, varianceAngleFrom, statusMagnitudeFrom, and statusAngleFrom keywords.

For PMUs located at the to-bus ends of the branches, users can use the varianceMagnitudeTo, varianceAngleTo, statusMagnitudeTo, and statusAngleTo keywords.

Additionally, users can configure the pattern for labels using the label keyword, specify the type of noise, and indicate the correlated and polar system utilized for managing phasors during state estimation.

Units

By default, the units for variances are per-units (pu) and radians (rad). However, users have the option to switch to volts (V) and degrees (deg) as the units for PMUs located at the buses by using the @voltage macro, or they can switch to amperes (A) and degrees (deg) as the units for PMUs located at the branches by using the @current macro.

Examples

Adding PMUs using the default unit system:

system = powerSystem()
@@ -432,4 +432,4 @@
 
 @pmu(label = "PMU ?", varianceAngleBus = 5.73e-5, varianceMagnitudeFrom = 0.0481)
 addPmu!(system, device; bus = "Bus 1", magnitude = 145.2, angle = -5.73)
-addPmu!(system, device; from = "Branch 1", magnitude = 481.125, angle = -11.46)
source
+addPmu!(system, device; from = "Branch 1", magnitude = 481.125, angle = -11.46)
source
diff --git a/dev/api/optimalPowerFlow/index.html b/dev/api/optimalPowerFlow/index.html index 5f393c51..024201a7 100644 --- a/dev/api/optimalPowerFlow/index.html +++ b/dev/api/optimalPowerFlow/index.html @@ -3,11 +3,11 @@ magnitude, angle, active, reactive)

The function sets up the optimization model for solving the AC optimal power flow problem.

Arguments

The function requires the PowerSystem composite type to establish the framework. Next, the optimizer argument is also required to create and solve the optimization problem. Specifically, JuliaGrid constructs the AC optimal power flow using the JuMP package and provides support for commonly employed solvers. For more detailed information, please consult the JuMP documentation.

Updates

If the AC model has not been created, the function automatically initiates an update within the ac field of the PowerSystem type.

Keywords

JuliaGrid offers the ability to manipulate the jump model based on the guidelines provided in the JuMP documentation. However, certain configurations may require different method calls, such as:

Additionally, users can modify variable names used for printing and writing through the keywords magnitude, angle, active, and reactive. For instance, users can choose magnitude = "V" and angle = "θ" to display equations in a more readable format.

Returns

The function returns an instance of the ACOptimalPowerFlow type, which includes the following fields:

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
-analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
source
JuliaGrid.solve!Method
solve!(system::PowerSystem, analysis::ACOptimalPowerFlow)

The function solves the AC optimal power flow model, computing the active and reactive power outputs of the generators, as well as the bus voltage magnitudes and angles.

Updates

The calculated active and reactive powers, as well as voltage magnitudes and angles, are stored in the power.generator and voltage fields of the ACOptimalPowerFlow type.

Example

system = powerSystem("case14.h5")
+analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
source
JuliaGrid.solve!Method
solve!(system::PowerSystem, analysis::ACOptimalPowerFlow)

The function solves the AC optimal power flow model, computing the active and reactive power outputs of the generators, as well as the bus voltage magnitudes and angles.

Updates

The calculated active and reactive powers, as well as voltage magnitudes and angles, are stored in the power.generator and voltage fields of the ACOptimalPowerFlow type.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
-solve!(system, analysis)
source
JuliaGrid.startingPrimal!Method
startingPrimal!(system::PowerSystem, analysis::ACOptimalPowerFlow)

The function retrieves the active and reactive power outputs of the generators, as well as the voltage magnitudes and angles from the PowerSystem composite type. It then assigns these values to the ACOptimalPowerFlow type, allowing users to initialize starting primal values as needed.

Updates

This function only updates the voltage and generator fields of the ACOptimalPowerFlow type.

Example

system = powerSystem("case14.h5")
+solve!(system, analysis)
source
JuliaGrid.startingPrimal!Method
startingPrimal!(system::PowerSystem, analysis::ACOptimalPowerFlow)

The function retrieves the active and reactive power outputs of the generators, as well as the voltage magnitudes and angles from the PowerSystem composite type. It then assigns these values to the ACOptimalPowerFlow type, allowing users to initialize starting primal values as needed.

Updates

This function only updates the voltage and generator fields of the ACOptimalPowerFlow type.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
@@ -16,7 +16,7 @@
 updateBus!(system, analysis; label = 14, reactive = 0.13, magnitude = 1.2, angle = -0.17)
 
 startingPrimal!(system, analysis)
-solve!(system, analysis)
source
JuliaGrid.startingDual!Method
startingDual!(system::PowerSystem, analysis::ACOptimalPowerFlow)

The function removes all values of the dual variables.

Updates

This function only updates the dual field of the ACOptimalPowerFlow type.

Example

system = powerSystem("case14.h5")
+solve!(system, analysis)
source
JuliaGrid.startingDual!Method
startingDual!(system::PowerSystem, analysis::ACOptimalPowerFlow)

The function removes all values of the dual variables.

Updates

This function only updates the dual field of the ACOptimalPowerFlow type.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
@@ -25,14 +25,14 @@
 updateBus!(system, analysis; label = 14, reactive = 0.13, magnitude = 1.2, angle = -0.17)
 
 startingDual!(system, analysis)
-solve!(system, analysis)
source

DC Optimal Power Flow

JuliaGrid.dcOptimalPowerFlowFunction
dcOptimalPowerFlow(system::PowerSystem, optimizer; bridge, name, angle, active)

The function sets up the optimization model for solving the DC optimal power flow problem.

Arguments

The function requires the PowerSystem composite type to establish the framework. Next, the optimizer argument is also required to create and solve the optimization problem. Specifically, JuliaGrid constructs the DC optimal power flow using the JuMP package and provides support for commonly employed solvers. For more detailed information, please consult the JuMP documentation.

Updates

If the DC model has not been created, the function automatically initiates an update within the dc field of the PowerSystem type.

Keywords

JuliaGrid offers the ability to manipulate the jump model based on the guidelines provided in the JuMP documentation. However, certain configurations may require different method calls, such as:

  • bridge: manage the bridging mechanism (default: false),
  • name: manage the creation of string names (default: true).

Additionally, users can modify variable names used for printing and writing through the keywords angle and active. For instance, users can choose angle = "θ" to display equations in a more readable format.

Returns

The function returns an instance of the DCOptimalPowerFlow type, which includes the following fields:

  • voltage: The variable allocated to store the bus voltage angle,
  • power: The variable allocated to store the active powers,
  • method: The JuMP model, references to the variables, constraints, and objective.

Example

system = powerSystem("case14.h5")
+solve!(system, analysis)
source

DC Optimal Power Flow

JuliaGrid.dcOptimalPowerFlowFunction
dcOptimalPowerFlow(system::PowerSystem, optimizer; bridge, name, angle, active)

The function sets up the optimization model for solving the DC optimal power flow problem.

Arguments

The function requires the PowerSystem composite type to establish the framework. Next, the optimizer argument is also required to create and solve the optimization problem. Specifically, JuliaGrid constructs the DC optimal power flow using the JuMP package and provides support for commonly employed solvers. For more detailed information, please consult the JuMP documentation.

Updates

If the DC model has not been created, the function automatically initiates an update within the dc field of the PowerSystem type.

Keywords

JuliaGrid offers the ability to manipulate the jump model based on the guidelines provided in the JuMP documentation. However, certain configurations may require different method calls, such as:

  • bridge: manage the bridging mechanism (default: false),
  • name: manage the creation of string names (default: true).

Additionally, users can modify variable names used for printing and writing through the keywords angle and active. For instance, users can choose angle = "θ" to display equations in a more readable format.

Returns

The function returns an instance of the DCOptimalPowerFlow type, which includes the following fields:

  • voltage: The variable allocated to store the bus voltage angle,
  • power: The variable allocated to store the active powers,
  • method: The JuMP model, references to the variables, constraints, and objective.

Example

system = powerSystem("case14.h5")
 dcModel!(system)
 
-analysis = dcOptimalPowerFlow(system, HiGHS.Optimizer)
source
JuliaGrid.solve!Method
solve!(system::PowerSystem, analysis::DCOptimalPowerFlow)

The function solves the DC optimal power flow model, computing the active power outputs of the generators, as well as the bus voltage angles.

Updates

The calculated active powers, as well as voltage angles, are stored in the power.generator and voltage fields of the DCOptimalPowerFlow type.

Example

system = powerSystem("case14.h5")
+analysis = dcOptimalPowerFlow(system, HiGHS.Optimizer)
source
JuliaGrid.solve!Method
solve!(system::PowerSystem, analysis::DCOptimalPowerFlow)

The function solves the DC optimal power flow model, computing the active power outputs of the generators, as well as the bus voltage angles.

Updates

The calculated active powers, as well as voltage angles, are stored in the power.generator and voltage fields of the DCOptimalPowerFlow type.

Example

system = powerSystem("case14.h5")
 dcModel!(system)
 
 analysis = dcOptimalPowerFlow(system, HiGHS.Optimizer)
-solve!(system, analysis)
source
JuliaGrid.startingPrimal!Method
startingPrimal!(system::PowerSystem, analysis::DCOptimalPowerFlow)

The function retrieves the active power outputs of the generators and the bus voltage angles from the PowerSystem composite type. These values are then assigned to the DCOptimalPowerFlow type, enabling users to initialize starting primal values according to their requirements.

Updates

This function only updates the voltage and generator fields of the DCOptimalPowerFlow type.

Example

system = powerSystem("case14.h5")
+solve!(system, analysis)
source
JuliaGrid.startingPrimal!Method
startingPrimal!(system::PowerSystem, analysis::DCOptimalPowerFlow)

The function retrieves the active power outputs of the generators and the bus voltage angles from the PowerSystem composite type. These values are then assigned to the DCOptimalPowerFlow type, enabling users to initialize starting primal values according to their requirements.

Updates

This function only updates the voltage and generator fields of the DCOptimalPowerFlow type.

Example

system = powerSystem("case14.h5")
 dcModel!(system)
 
 analysis = dcOptimalPowerFlow(system, HiGHS.Optimizer)
@@ -41,7 +41,7 @@
 updateBus!(system, analysis; label = 14, active = 0.1, angle = -0.17)
 
 startingPrimal!(system, analysis)
-solve!(system, analysis)
source
JuliaGrid.startingDual!Method
startingDual!(system::PowerSystem, analysis::DCOptimalPowerFlow)

The function removes all values of the dual variables.

Updates

This function only updates the dual field of the DCOptimalPowerFlow type.

Example

system = powerSystem("case14.h5")
+solve!(system, analysis)
source
JuliaGrid.startingDual!Method
startingDual!(system::PowerSystem, analysis::DCOptimalPowerFlow)

The function removes all values of the dual variables.

Updates

This function only updates the dual field of the DCOptimalPowerFlow type.

Example

system = powerSystem("case14.h5")
 dcModel!(system)
 
 analysis = dcOptimalPowerFlow(system, HiGHS.Optimizer)
@@ -50,4 +50,4 @@
 updateBus!(system, analysis; label = 14, active = 0.1, angle = -0.17)
 
 startingDual!(system, analysis)
-solve!(system, analysis)
source
+solve!(system, analysis)source diff --git a/dev/api/powerFlow/index.html b/dev/api/powerFlow/index.html index 2a42af7d..09d9660c 100644 --- a/dev/api/powerFlow/index.html +++ b/dev/api/powerFlow/index.html @@ -5,26 +5,26 @@ analysis = newtonRaphson(system)

Set up the Newton-Raphson method utilizing QR factorization:

system = powerSystem("case14.h5")
 acModel!(system)
 
-analysis = newtonRaphson(system, QR)
source
JuliaGrid.fastNewtonRaphsonBXFunction
fastNewtonRaphsonBX(system::PowerSystem, [factorization::Factorization = LU])

The function sets up the fast Newton-Raphson method of version BX to solve the AC power flow.

Arguments

The function requires the PowerSystem composite type to establish the framework. Next, the Factorization argument, while optional, determines the method used to solve the linear system of equations within each iteration. It can take one of the following values:

  • LU: utilizes LU factorization (default),
  • QR: utilizes QR factorization.

Updates

If the AC model has not been created, the function automatically initiates an update within the ac field of the PowerSystem type. It also performs a check on bus types and rectifies any mistakes present.

Returns

The function returns an instance of the ACPowerFlow type, which includes the following fields:

  • voltage: The bus voltage magnitudes and angles.
  • power: The variable allocated to store the active and reactive powers.
  • current: The variable allocated to store the currents.
  • method: The Jacobian matrices, their factorizations, mismatches, increments, and indices.

Examples

Set up the fast Newton-Raphson method utilizing LU factorization:

system = powerSystem("case14.h5")
+analysis = newtonRaphson(system, QR)
source
JuliaGrid.fastNewtonRaphsonBXFunction
fastNewtonRaphsonBX(system::PowerSystem, [factorization::Factorization = LU])

The function sets up the fast Newton-Raphson method of version BX to solve the AC power flow.

Arguments

The function requires the PowerSystem composite type to establish the framework. Next, the Factorization argument, while optional, determines the method used to solve the linear system of equations within each iteration. It can take one of the following values:

  • LU: utilizes LU factorization (default),
  • QR: utilizes QR factorization.

Updates

If the AC model has not been created, the function automatically initiates an update within the ac field of the PowerSystem type. It also performs a check on bus types and rectifies any mistakes present.

Returns

The function returns an instance of the ACPowerFlow type, which includes the following fields:

  • voltage: The bus voltage magnitudes and angles.
  • power: The variable allocated to store the active and reactive powers.
  • current: The variable allocated to store the currents.
  • method: The Jacobian matrices, their factorizations, mismatches, increments, and indices.

Examples

Set up the fast Newton-Raphson method utilizing LU factorization:

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = fastNewtonRaphsonBX(system)

Set up the fast Newton-Raphson method utilizing QR factorization:

system = powerSystem("case14.h5")
 acModel!(system)
 
-analysis = fastNewtonRaphsonBX(system, QR)
source
JuliaGrid.fastNewtonRaphsonXBFunction
fastNewtonRaphsonXB(system::PowerSystem, [factorization::Factorization = LU])

The function sets up the fast Newton-Raphson method of version XB to solve the AC power flow.

Arguments

The function requires the PowerSystem composite type to establish the framework. Next, the Factorization argument, while optional, determines the method used to solve the linear system of equations within each iteration. It can take one of the following values:

  • LU: utilizes LU factorization (default),
  • QR: utilizes QR factorization.

Updates

If the AC model has not been created, the function automatically initiates an update within the ac field of the PowerSystem type. It also performs a check on bus types and rectifies any mistakes present.

Returns

The function returns an instance of the ACPowerFlow type, which includes the following fields:

  • voltage: The bus voltage magnitudes and angles.
  • power: The variable allocated to store the active and reactive powers.
  • current: The variable allocated to store the currents.
  • method: The Jacobian matrices, their factorizations, mismatches, increments, and indices.

Examples

Set up the fast Newton-Raphson method utilizing LU factorization:

system = powerSystem("case14.h5")
+analysis = fastNewtonRaphsonBX(system, QR)
source
JuliaGrid.fastNewtonRaphsonXBFunction
fastNewtonRaphsonXB(system::PowerSystem, [factorization::Factorization = LU])

The function sets up the fast Newton-Raphson method of version XB to solve the AC power flow.

Arguments

The function requires the PowerSystem composite type to establish the framework. Next, the Factorization argument, while optional, determines the method used to solve the linear system of equations within each iteration. It can take one of the following values:

  • LU: utilizes LU factorization (default),
  • QR: utilizes QR factorization.

Updates

If the AC model has not been created, the function automatically initiates an update within the ac field of the PowerSystem type. It also performs a check on bus types and rectifies any mistakes present.

Returns

The function returns an instance of the ACPowerFlow type, which includes the following fields:

  • voltage: The bus voltage magnitudes and angles.
  • power: The variable allocated to store the active and reactive powers.
  • current: The variable allocated to store the currents.
  • method: The Jacobian matrices, their factorizations, mismatches, increments, and indices.

Examples

Set up the fast Newton-Raphson method utilizing LU factorization:

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = fastNewtonRaphsonXB(system)

Set up the fast Newton-Raphson method utilizing QR factorization:

system = powerSystem("case14.h5")
 acModel!(system)
 
-analysis = fastNewtonRaphsonXB(system, QR)
source
JuliaGrid.gaussSeidelFunction
gaussSeidel(system::PowerSystem)

The function sets up the Gauss-Seidel method to solve the AC power flow.

Arguments

The function requires the PowerSystem composite type to establish the framework.

Updates

If the AC model has not been created, the function automatically initiates an update within the ac field of the PowerSystem type. It also performs a check on bus types and rectifies any mistakes present.

Returns

The function returns an instance of the ACPowerFlow type, which includes the following fields:

  • voltage: The bus voltage magnitudes and angles.
  • power: The variable allocated to store the active and reactive powers.
  • current: The variable allocated to store the currents.
  • method: The bus complex voltages and indices.

Example

system = powerSystem("case14.h5")
+analysis = fastNewtonRaphsonXB(system, QR)
source
JuliaGrid.gaussSeidelFunction
gaussSeidel(system::PowerSystem)

The function sets up the Gauss-Seidel method to solve the AC power flow.

Arguments

The function requires the PowerSystem composite type to establish the framework.

Updates

If the AC model has not been created, the function automatically initiates an update within the ac field of the PowerSystem type. It also performs a check on bus types and rectifies any mistakes present.

Returns

The function returns an instance of the ACPowerFlow type, which includes the following fields:

  • voltage: The bus voltage magnitudes and angles.
  • power: The variable allocated to store the active and reactive powers.
  • current: The variable allocated to store the currents.
  • method: The bus complex voltages and indices.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
-analysis = gaussSeidel(system)
source
JuliaGrid.mismatch!Method
mismatch!(system::PowerSystem, analysis::ACPowerFlow)

The function calculates both active and reactive power injection mismatches.

Updates

This function updates the mismatch variables in the Newton-Raphson and fast Newton-Raphson methods. It should be employed during the iteration loop before invoking the solve! function.

Returns

The function returns maximum absolute values of the active and reactive power injection mismatches, which can be utilized to terminate the iteration loop of the Newton-Raphson, fast Newton-Raphson, or Gauss-Seidel methods employed to solve the AC power flow problem.

Example

system = powerSystem("case14.h5")
+analysis = gaussSeidel(system)
source
JuliaGrid.mismatch!Method
mismatch!(system::PowerSystem, analysis::ACPowerFlow)

The function calculates both active and reactive power injection mismatches.

Updates

This function updates the mismatch variables in the Newton-Raphson and fast Newton-Raphson methods. It should be employed during the iteration loop before invoking the solve! function.

Returns

The function returns maximum absolute values of the active and reactive power injection mismatches, which can be utilized to terminate the iteration loop of the Newton-Raphson, fast Newton-Raphson, or Gauss-Seidel methods employed to solve the AC power flow problem.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = newtonRaphson(system)
-mismatch!(system, analysis)
source
JuliaGrid.solve!Method
solve!(system::PowerSystem, analysis::ACPowerFlow)

The function employs the Newton-Raphson, fast Newton-Raphson, or Gauss-Seidel method to solve the AC power flow model and calculate bus voltage magnitudes and angles.

After the mismatch! function is called, this function should be executed to perform a single iteration of the method.

Updates

The calculated voltages are stored in the voltage field of the ACPowerFlow type.

Example

system = powerSystem("case14.h5")
+mismatch!(system, analysis)
source
JuliaGrid.solve!Method
solve!(system::PowerSystem, analysis::ACPowerFlow)

The function employs the Newton-Raphson, fast Newton-Raphson, or Gauss-Seidel method to solve the AC power flow model and calculate bus voltage magnitudes and angles.

After the mismatch! function is called, this function should be executed to perform a single iteration of the method.

Updates

The calculated voltages are stored in the voltage field of the ACPowerFlow type.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = newtonRaphson(system)
@@ -34,7 +34,7 @@
         break
     end
     solve!(system, analysis)
-end
source
JuliaGrid.startingVoltage!Function
startingVoltage!(system::PowerSystem, analysis::ACPowerFlow)

The function extracts bus voltage magnitudes and angles from the PowerSystem composite type and assigns them to the ACPowerFlow type, enabling users to initialize voltage values as required.

Updates

This function only updates the voltage field of the ACPowerFlow type.

Example

system = powerSystem("case14.h5")
+end
source
JuliaGrid.startingVoltage!Function
startingVoltage!(system::PowerSystem, analysis::ACPowerFlow)

The function extracts bus voltage magnitudes and angles from the PowerSystem composite type and assigns them to the ACPowerFlow type, enabling users to initialize voltage values as required.

Updates

This function only updates the voltage field of the ACPowerFlow type.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = newtonRaphson(system)
@@ -55,7 +55,7 @@
         break
     end
     solve!(system, analysis)
-end
source
JuliaGrid.reactiveLimit!Function
reactiveLimit!(system::PowerSystem, analysis::ACPowerFlow)

The function verifies whether the generators in a power system exceed their reactive power limits. This is done by setting the reactive power of the generators to within the limits if they are violated after determining the bus voltage magnitudes and angles. If the limits are violated, the corresponding generator buses or the slack bus are converted to demand buses.

Updates

The function assigns values to the generator.output.active and bus.supply.active variables of the PowerSystem type.

Additionally, it examines the reactive powers of the generators and adjusts them to their maximum or minimum values if they exceed the specified threshold. This results in the modification of the variable generator.output.reactive of the PowerSystem type accordingly.

As a result of this adjustment, the bus.supply.reactive variable is also updated, and the bus types specified in bus.layout.type are modified. If the slack bus is converted, the bus.layout.slack field is correspondingly adjusted.

Returns

The function returns the variable to indicate which buses violate the limits, with -1 indicating a violation of the minimum limits and 1 indicating a violation of the maximum limits.

Example

system = powerSystem("case14.h5")
+end
source
JuliaGrid.reactiveLimit!Function
reactiveLimit!(system::PowerSystem, analysis::ACPowerFlow)

The function verifies whether the generators in a power system exceed their reactive power limits. This is done by setting the reactive power of the generators to within the limits if they are violated after determining the bus voltage magnitudes and angles. If the limits are violated, the corresponding generator buses or the slack bus are converted to demand buses.

Updates

The function assigns values to the generator.output.active and bus.supply.active variables of the PowerSystem type.

Additionally, it examines the reactive powers of the generators and adjusts them to their maximum or minimum values if they exceed the specified threshold. This results in the modification of the variable generator.output.reactive of the PowerSystem type accordingly.

As a result of this adjustment, the bus.supply.reactive variable is also updated, and the bus types specified in bus.layout.type are modified. If the slack bus is converted, the bus.layout.slack field is correspondingly adjusted.

Returns

The function returns the variable to indicate which buses violate the limits, with -1 indicating a violation of the minimum limits and 1 indicating a violation of the maximum limits.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = newtonRaphson(system)
@@ -76,7 +76,7 @@
         break
     end
     solve!(system, analysis)
-end
source
JuliaGrid.adjustAngle!Function
adjustAngle!(system::PowerSystem, analysis::ACPowerFlow; slack)

The function modifies the bus voltage angles based on a different slack bus than the one identified by the bus.layout.slack field.

For instance, if the reactive power of the generator exceeds the limit on the slack bus, the reactiveLimit! function will change that bus to the demand bus and designate the first generator bus in the sequence as the new slack bus. After obtaining the updated AC power flow solution based on the new slack bus, it is possible to adjust the voltage angles to align with the angle of the original slack bus.

Keyword

The slack keyword specifies the bus label for which we want to adjust voltage angles.

Updates

This function only updates the voltage.angle variable of the ACPowerFlow type.

Example

system = powerSystem("case14.h5")
+end
source
JuliaGrid.adjustAngle!Function
adjustAngle!(system::PowerSystem, analysis::ACPowerFlow; slack)

The function modifies the bus voltage angles based on a different slack bus than the one identified by the bus.layout.slack field.

For instance, if the reactive power of the generator exceeds the limit on the slack bus, the reactiveLimit! function will change that bus to the demand bus and designate the first generator bus in the sequence as the new slack bus. After obtaining the updated AC power flow solution based on the new slack bus, it is possible to adjust the voltage angles to align with the angle of the original slack bus.

Keyword

The slack keyword specifies the bus label for which we want to adjust voltage angles.

Updates

This function only updates the voltage.angle variable of the ACPowerFlow type.

Example

system = powerSystem("case14.h5")
 acModel!(system)
 
 analysis = newtonRaphson(system)
@@ -99,14 +99,14 @@
     solve!(system, analysis)
 end
 
-adjustAngle!(system, analysis; slack = 1)
source

DC Power Flow

JuliaGrid.dcPowerFlowFunction
dcPowerFlow(system::PowerSystem, [factorization::Factorization = LU])

The function sets up the framework to solve the DC power flow.

Arguments

The function requires the PowerSystem composite type to establish the framework. Next, the Factorization argument, while optional, determines the method used to solve the linear system of equations. It can take one of the following values:

  • LU: utilizes LU factorization (default),
  • LDLt: utilizes LDLt factorization,
  • QR: utilizes QR factorization.

Updates

If the DC model was not created, the function will automatically initiate an update of the dc field within the PowerSystem composite type. Additionally, if the slack bus lacks an in-service generator, JuliaGrid considers it a mistake and defines a new slack bus as the first generator bus with an in-service generator in the bus type list.

Returns

The function returns an instance of the DCPowerFlow type, which includes the following fields:

  • voltage: The variable allocated to store the bus voltage angles.
  • power: The variable allocated to store the active powers.
  • method: The factorized nodal matrix.

Examples

Set up the DC power flow utilizing LU factorization:

system = powerSystem("case14.h5")
+adjustAngle!(system, analysis; slack = 1)
source

DC Power Flow

JuliaGrid.dcPowerFlowFunction
dcPowerFlow(system::PowerSystem, [factorization::Factorization = LU])

The function sets up the framework to solve the DC power flow.

Arguments

The function requires the PowerSystem composite type to establish the framework. Next, the Factorization argument, while optional, determines the method used to solve the linear system of equations. It can take one of the following values:

  • LU: utilizes LU factorization (default),
  • LDLt: utilizes LDLt factorization,
  • QR: utilizes QR factorization.

Updates

If the DC model was not created, the function will automatically initiate an update of the dc field within the PowerSystem composite type. Additionally, if the slack bus lacks an in-service generator, JuliaGrid considers it a mistake and defines a new slack bus as the first generator bus with an in-service generator in the bus type list.

Returns

The function returns an instance of the DCPowerFlow type, which includes the following fields:

  • voltage: The variable allocated to store the bus voltage angles.
  • power: The variable allocated to store the active powers.
  • method: The factorized nodal matrix.

Examples

Set up the DC power flow utilizing LU factorization:

system = powerSystem("case14.h5")
 dcModel!(system)
 
 analysis = dcPowerFlow(system)

Set up the DC power flow utilizing QR factorization:

system = powerSystem("case14.h5")
 dcModel!(system)
 
-analysis = dcPowerFlow(system, QR)
source
JuliaGrid.solve!Method
solve!(system::PowerSystem, analysis::DCPowerFlow)

The function solves the DC power flow model and calculates bus voltage angles.

Updates

The calculated voltage angles are stored in the voltage field of the DCPowerFlow type.

Example

system = powerSystem("case14.h5")
+analysis = dcPowerFlow(system, QR)
source
JuliaGrid.solve!Method
solve!(system::PowerSystem, analysis::DCPowerFlow)

The function solves the DC power flow model and calculates bus voltage angles.

Updates

The calculated voltage angles are stored in the voltage field of the DCPowerFlow type.

Example

system = powerSystem("case14.h5")
 dcModel!(system)
 
 analysis = dcPowerFlow(system)
-solve!(system, analysis)
source
+solve!(system, analysis)source diff --git a/dev/api/powerSystemModel/index.html b/dev/api/powerSystemModel/index.html index c886c17b..abe36cee 100644 --- a/dev/api/powerSystemModel/index.html +++ b/dev/api/powerSystemModel/index.html @@ -1,18 +1,18 @@ -Power System Model · JuliaGrid

Power System Model

For further information on this topic, please see the Power System Model section of the Manual. Below, we have provided a list of functions that can be used to create, save, and manipulate power system structures, as well as to build AC and DC models of power systems.

To load power system model API functionalities into the current scope, utilize the following command:

using JuliaGrid

Power System
Bus
Branch
Generator

Power System

JuliaGrid.powerSystemFunction
powerSystem(file::String)

The function builds the composite type PowerSystem and populates bus, branch, generator and base fields. Once the composite type PowerSystem has been created, it is possible to add new buses, branches, or generators, or modify the parameters of existing ones.

Argument

It requires a string path to:

  • the HDF5 file with the .h5 extension,
  • the Matpower file with the .m extension.

Returns

The PowerSystem composite type with the following fields:

  • bus: Data related to buses.
  • branch: Data related to branches.
  • generator: Data related to generators.
  • base: Base power and base voltages.
  • model: Data associated with AC and DC analyses.

Units

JuliaGrid stores all data in per-units and radians format which are fixed, the exceptions are base values in volt-amperes and volts. The prefixes for these base values can be changed using the @base macro.

Example

system = powerSystem("case14.h5")
source
powerSystem()

Alternatively, the PowerSystem composite type can be initialized by calling the function without any arguments. This allows the model to be built from scratch and modified as needed. This generates an empty PowerSystem type, with only the base power initialized to 1.0e8 volt-amperes (VA).

Example

system = powerSystem()
source
JuliaGrid.savePowerSystemFunction
savePowerSystem(system::PowerSystem; path::String, reference::String, note::String)

The function saves the power system's data in the HDF5 file using the fields bus, branch, generator, and base from the PowerSystem composite type.

Keywords

The location and file name of the HDF5 file is specified by the mandatory keyword path in the format of "path/name.h5". Additional information can be provided by the optional keywords reference and note, which can be saved along with the power system data.

View HDF5 File

To view the saved HDF5 file, you can use the HDFView software.

Example

system = powerSystem("case14.m")
-savePowerSystem(system; path = "D:/case14.h5")
source
JuliaGrid.acModel!Function
acModel!(system::PowerSystem)

The function generates vectors and matrices based on the power system topology and parameters associated with AC analyses.

Updates

The function updates the model.ac field within the PowerSystem composite type, populating the following variables:

  • nodalMatrix: The nodal matrix.
  • nodalMatrixTranspose: The transpose of the nodal matrix.
  • nodalFromFrom: The Y-parameters of the two-port branches.
  • nodalFromTo: The Y-parameters of the two-port branches.
  • nodalToTo: The Y-parameters of the two-port branches.
  • nodalToFrom: The Y-parameters of the two-port branches.
  • admittance: The branch admittances.

Example

system = powerSystem("case14.h5")
-acModel!(system)
source
JuliaGrid.dcModel!Function
dcModel!(system::PowerSystem)

The function generates vectors and matrices based on the power system topology and parameters associated with DC analyses.

Updates

The function updates the model.dc field within the PowerSystem composite type, populating the following variables:

  • nodalMatrix: The nodal matrix.
  • admittance: The branch admittances.
  • shiftPower: The active powers related to phase-shifting transformers.

Example

system = powerSystem("case14.h5")
-dcModel!(system)
source

Bus

JuliaGrid.addBus!Function
addBus!(system::PowerSystem; label, type, active, reactive, conductance, susceptance,
+Power System Model · JuliaGrid

Power System Model

For further information on this topic, please see the Power System Model section of the Manual. Below, we have provided a list of functions that can be used to create, save, and manipulate power system structures, as well as to build AC and DC models of power systems.

To load power system model API functionalities into the current scope, utilize the following command:

using JuliaGrid

Power System
Bus
Branch
Generator

Power System

JuliaGrid.powerSystemFunction
powerSystem(file::String)

The function builds the composite type PowerSystem and populates bus, branch, generator and base fields. Once the composite type PowerSystem has been created, it is possible to add new buses, branches, or generators, or modify the parameters of existing ones.

Argument

It requires a string path to:

  • the HDF5 file with the .h5 extension,
  • the Matpower file with the .m extension.

Returns

The PowerSystem composite type with the following fields:

  • bus: Data related to buses.
  • branch: Data related to branches.
  • generator: Data related to generators.
  • base: Base power and base voltages.
  • model: Data associated with AC and DC analyses.

Units

JuliaGrid stores all data in per-units and radians format which are fixed, the exceptions are base values in volt-amperes and volts. The prefixes for these base values can be changed using the @base macro.

Example

system = powerSystem("case14.h5")
source
powerSystem()

Alternatively, the PowerSystem composite type can be initialized by calling the function without any arguments. This allows the model to be built from scratch and modified as needed. This generates an empty PowerSystem type, with only the base power initialized to 1.0e8 volt-amperes (VA).

Example

system = powerSystem()
source
JuliaGrid.savePowerSystemFunction
savePowerSystem(system::PowerSystem; path::String, reference::String, note::String)

The function saves the power system's data in the HDF5 file using the fields bus, branch, generator, and base from the PowerSystem composite type.

Keywords

The location and file name of the HDF5 file is specified by the mandatory keyword path in the format of "path/name.h5". Additional information can be provided by the optional keywords reference and note, which can be saved along with the power system data.

View HDF5 File

To view the saved HDF5 file, you can use the HDFView software.

Example

system = powerSystem("case14.m")
+savePowerSystem(system; path = "D:/case14.h5")
source
JuliaGrid.acModel!Function
acModel!(system::PowerSystem)

The function generates vectors and matrices based on the power system topology and parameters associated with AC analyses.

Updates

The function updates the model.ac field within the PowerSystem composite type, populating the following variables:

  • nodalMatrix: The nodal matrix.
  • nodalMatrixTranspose: The transpose of the nodal matrix.
  • nodalFromFrom: The Y-parameters of the two-port branches.
  • nodalFromTo: The Y-parameters of the two-port branches.
  • nodalToTo: The Y-parameters of the two-port branches.
  • nodalToFrom: The Y-parameters of the two-port branches.
  • admittance: The branch admittances.

Example

system = powerSystem("case14.h5")
+acModel!(system)
source
JuliaGrid.dcModel!Function
dcModel!(system::PowerSystem)

The function generates vectors and matrices based on the power system topology and parameters associated with DC analyses.

Updates

The function updates the model.dc field within the PowerSystem composite type, populating the following variables:

  • nodalMatrix: The nodal matrix.
  • admittance: The branch admittances.
  • shiftPower: The active powers related to phase-shifting transformers.

Example

system = powerSystem("case14.h5")
+dcModel!(system)
source

Bus

JuliaGrid.addBus!Function
addBus!(system::PowerSystem; label, type, active, reactive, conductance, susceptance,
     magnitude, angle, minMagnitude, maxMagnitude, base, area, lossZone)

The function adds a new bus to the PowerSystem composite type.

Keywords

The bus is defined with the following keywords:

  • label: Unique label for the bus.
  • type: Bus type:
    • type = 1: demand bus (PQ),
    • type = 2: generator bus (PV),
    • type = 3: slack bus (Vθ).
  • active (pu or W): Active power demand at the bus.
  • reactive (pu or VAr): Reactive power demand at the bus.
  • conductance (pu or W): Active power demanded of the shunt element.
  • susceptance (pu or VAr): Reactive power injected/demanded of the shunt element.
  • magnitude (pu or V): Initial value of the bus voltage magnitude.
  • angle (rad or deg): Initial value of the bus voltage angle.
  • minMagnitude (pu or V): Minimum bus voltage magnitude value.
  • maxMagnitude (pu or V): Maximum bus voltage magnitude value.
  • base (V): Line-to-line voltage base value.
  • area: Area number.
  • lossZone: Loss zone.

Note that all voltage values, except for base voltages, are referenced to line-to-neutral voltages, while powers, when given in SI units, correspond to three-phase power.

Updates

The function updates the bus field of the PowerSystem composite type.

Default Settings

The default settings for certain keywords are as follows: type = 1, magnitude = 1.0, minMagnitude = 0.9, maxMagnitude = 1.1, and base = 138e3. The rest of the keywords are initialized with a value of zero. However, the user can modify these default settings by utilizing the @bus macro.

Units

By default, the keyword parameters use per-units (pu) and radians (rad) as units, with the exception of the base keyword argument, which is in volts (V). However, users have the option to use other units instead of per-units and radians, or to specify prefixes for base voltage by using the @power and @voltage macros.

Examples

Adding a bus using the default unit system:

system = powerSystem()
 
 addBus!(system; label = "Bus 1", active = 0.25, angle = 0.175, base = 132e3)

Adding a bus using a custom unit system:

@power(MW, MVAr, MVA)
 @voltage(pu, deg, kV)
 system = powerSystem()
 
-addBus!(system; label = "Bus 1", active = 25.0, angle = 10.026, base = 132.0)
source
JuliaGrid.updateBus!Function
updateBus!(system::PowerSystem, [analysis::Analysis]; kwargs...)

The function allows for the alteration of parameters for an existing bus.

Arguments

If the Analysis type is omitted, the function applies changes to the PowerSystem composite type only. However, when including the Analysis type, it updates both the PowerSystem and Analysis types. This streamlined process avoids the need to completely rebuild vectors and matrices when adjusting these parameters.

Keywords

To update a specific bus, provide the necessary kwargs input arguments in accordance with the keywords specified in the addBus! function, along with their respective values. Ensure that the label keyword matches the label of the existing bus you want to modify. If any keywords are omitted, their corresponding values will remain unchanged.

Updates

The function updates the bus field within the PowerSystem composite type, and in cases where parameters impact variables in the ac field, it automatically adjusts the field. Furthermore, it guarantees that any modifications to the parameters are transmitted to the Analysis type.

Units

Units for input parameters can be changed using the same method as described for the addBus! function.

Example

system = powerSystem()
+addBus!(system; label = "Bus 1", active = 25.0, angle = 10.026, base = 132.0)
source
JuliaGrid.updateBus!Function
updateBus!(system::PowerSystem, [analysis::Analysis]; kwargs...)

The function allows for the alteration of parameters for an existing bus.

Arguments

If the Analysis type is omitted, the function applies changes to the PowerSystem composite type only. However, when including the Analysis type, it updates both the PowerSystem and Analysis types. This streamlined process avoids the need to completely rebuild vectors and matrices when adjusting these parameters.

Keywords

To update a specific bus, provide the necessary kwargs input arguments in accordance with the keywords specified in the addBus! function, along with their respective values. Ensure that the label keyword matches the label of the existing bus you want to modify. If any keywords are omitted, their corresponding values will remain unchanged.

Updates

The function updates the bus field within the PowerSystem composite type, and in cases where parameters impact variables in the ac field, it automatically adjusts the field. Furthermore, it guarantees that any modifications to the parameters are transmitted to the Analysis type.

Units

Units for input parameters can be changed using the same method as described for the addBus! function.

Example

system = powerSystem()
 
 addBus!(system; label = "Bus 1", type = 3, active = 0.25, reactive = -0.04)
-updateBus!(system; label = "Bus 1", active = 0.15, susceptance = 0.15)
source
JuliaGrid.@busMacro
@bus(kwargs...)

The macro generates a template for a bus, which can be utilized to define a bus using the addBus! function.

Keywords

To define the bus template, the kwargs input arguments must be provided in accordance with the keywords specified within the addBus! function, along with their corresponding values.

Units

By default, the keyword parameters use per-units (pu) and radians (rad) as units, with the exception of the base keyword argument, which is in volts (V). However, users have the option to use other units instead of per-units and radians, or to specify prefixes for base voltage by using the @power and @voltage macros.

Examples

Adding a bus template using the default unit system:

system = powerSystem()
+updateBus!(system; label = "Bus 1", active = 0.15, susceptance = 0.15)
source
JuliaGrid.@busMacro
@bus(kwargs...)

The macro generates a template for a bus, which can be utilized to define a bus using the addBus! function.

Keywords

To define the bus template, the kwargs input arguments must be provided in accordance with the keywords specified within the addBus! function, along with their corresponding values.

Units

By default, the keyword parameters use per-units (pu) and radians (rad) as units, with the exception of the base keyword argument, which is in volts (V). However, users have the option to use other units instead of per-units and radians, or to specify prefixes for base voltage by using the @power and @voltage macros.

Examples

Adding a bus template using the default unit system:

system = powerSystem()
 
 @bus(type = 2, active = 0.25, angle = 0.1745)
 addBus!(system; label = "Bus 1", reactive = -0.04, base = 132e3)

Adding a bus template using a custom unit system:

@power(MW, MVAr, MVA)
@@ -20,7 +20,7 @@
 system = powerSystem()
 
 @bus(type = 2, active = 25.0, angle = 10.0, base = 132.0)
-addBus!(system; label = "Bus 1", reactive = -4.0)
source

Branch

JuliaGrid.addBranch!Function
addBranch!(system::PowerSystem, [analysis::Analysis]; label, from, to, status,
+addBus!(system; label = "Bus 1", reactive = -4.0)
source

Branch

JuliaGrid.addBranch!Function
addBranch!(system::PowerSystem, [analysis::Analysis]; label, from, to, status,
     resistance, reactance, conductance, susceptance, turnsRatio, shiftAngle,
     minDiffAngle, maxDiffAngle, minFromBus, maxFromBus, minToBus, maxToBus, type)

The function adds a new branch to the PowerSystem composite type. A branch can be added between already defined buses.

Arguments

If the Analysis type is omitted, the function applies changes to the PowerSystem composite type only. However, when including the Analysis type, it updates both the PowerSystem and Analysis types. This streamlined approach circumvents the necessity for completely reconstructing vectors and matrices when adding a new branch.

Keywords

The branch is defined with the following keywords:

  • label: Unique label for the branch.
  • from: From-bus label, corresponds to the bus label.
  • to: To-bus label, corresponds to the bus label.
  • status: Operating status of the branch:
    • status = 1: in-service,
    • status = 0: out-of-service.
  • resistance (pu or Ω): Series resistance.
  • reactance (pu or Ω): Series reactance.
  • conductance (pu or S): Total shunt conductance.
  • susceptance (pu or S): Total shunt susceptance.
  • turnsRatio: Transformer off-nominal turns ratio, equal to one for a line.
  • shiftAngle (rad or deg): Transformer phase shift angle, where positive value defines delay.
  • minDiffAngle (rad or deg): Minimum voltage angle difference value between from-bus and to-bus ends.
  • maxDiffAngle (rad or deg): Maximum voltage angle difference value between from-bus and to-bus ends.
  • minFromBus (pu, VA, W, or A): Minimum branch flow rating at the from-bus end.
  • maxFromBus (pu, VA, W, or A): Maximum branch flow rating at the from-bus end.
  • minToBus (pu, VA, W, or A): Minimum branch flow rating at the to-bus end.
  • maxToBus (pu, VA, W, or A): Maximum branch flow rating at the to-bus end.
  • type: Types of minFromBus, maxFromBus, minToBus, and maxToBus branch flow ratings:
    • type = 1: active power flow (pu or W),
    • type = 2: apparent power flow (pu or VA),
    • type = 3: apparent power flow (pu or VA) with a squared inequality constraint,
    • type = 4: current magnitude flow (pu or A),
    • type = 5: current magnitude flow (pu or A) with a squared inequality constraint.

Note that when powers are given in SI units, they correspond to three-phase power.

Updates

The function updates the branch field within the PowerSystem composite type, and in cases where parameters impact variables in the ac and dc fields, it automatically adjusts the fields. Furthermore, it guarantees that any modifications to the parameters are transmitted to the Analysis type.

Default Settings

By default, certain keywords are assigned default values: status = 1, turnsRatio = 1.0, type = 3, minDiffAngle = -2pi, and maxDiffAngle = 2pi. The rest of the keywords are initialized with a value of zero. However, the user can modify these default settings by utilizing the @branch macro.

Units

The default units for the keyword parameters are per-units (pu) and radians (rad). However, the user can choose to use other units besides per-units and radians by utilizing macros such as @power, @voltage, @current, and @parameter.

Examples

Adding a branch using the default unit system:

system = powerSystem()
 
@@ -33,13 +33,13 @@
 addBus!(system; label = "Bus 1", type = 3, active = 0.25, reactive = -0.04)
 addBus!(system; label = "Bus 2", type = 1, active = 0.15, reactive = 0.08)
 
-addBranch!(system; from = "Bus 1", to = "Bus 2", reactance = 0.12, shiftAngle = 10)
source
JuliaGrid.updateBranch!Function
updateBranch!(system::PowerSystem, [analysis::Analysis]; kwargs...)

The function allows for the alteration of parameters for an existing branch.

Arguments

If the Analysis type is omitted, the function applies changes to the PowerSystem composite type only. However, when including the Analysis type, it updates both the PowerSystem and Analysis types. This streamlined process avoids the need to completely rebuild vectors and matrices when adjusting these parameter

Keywords

To update a specific branch, provide the necessary kwargs input arguments in accordance with the keywords specified in the addBranch! function, along with their respective values. Ensure that the label keyword matches the label of the existing branch you want to modify. If any keywords are omitted, their corresponding values will remain unchanged.

Updates

The function updates the branch field within the PowerSystem composite type, and in cases where parameters impact variables in the ac and dc fields, it automatically adjusts the fields. Furthermore, it guarantees that any modifications to the parameters are transmitted to the Analysis type.

Units

Units for input parameters can be changed using the same method as described for the addBranch! function.

Example

system = powerSystem()
+addBranch!(system; from = "Bus 1", to = "Bus 2", reactance = 0.12, shiftAngle = 10)
source
JuliaGrid.updateBranch!Function
updateBranch!(system::PowerSystem, [analysis::Analysis]; kwargs...)

The function allows for the alteration of parameters for an existing branch.

Arguments

If the Analysis type is omitted, the function applies changes to the PowerSystem composite type only. However, when including the Analysis type, it updates both the PowerSystem and Analysis types. This streamlined process avoids the need to completely rebuild vectors and matrices when adjusting these parameter

Keywords

To update a specific branch, provide the necessary kwargs input arguments in accordance with the keywords specified in the addBranch! function, along with their respective values. Ensure that the label keyword matches the label of the existing branch you want to modify. If any keywords are omitted, their corresponding values will remain unchanged.

Updates

The function updates the branch field within the PowerSystem composite type, and in cases where parameters impact variables in the ac and dc fields, it automatically adjusts the fields. Furthermore, it guarantees that any modifications to the parameters are transmitted to the Analysis type.

Units

Units for input parameters can be changed using the same method as described for the addBranch! function.

Example

system = powerSystem()
 
 addBus!(system; label = "Bus 1", type = 3, active = 0.25, reactive = -0.04)
 addBus!(system; label = "Bus 2", type = 1, active = 0.15, reactive = 0.08)
 
 addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.12)
-updateBranch!(system; label = "Branch 1", reactance = 0.02, susceptance = 0.062)
source
JuliaGrid.@branchMacro
@branch(kwargs...)

The macro generates a template for a branch, which can be utilized to define a branch using the addBranch! function.

Keywords

To define the branch template, the kwargs input arguments must be provided in accordance with the keywords specified within the addBranch! function, along with their corresponding values.

Units

The default units for the keyword parameters are per-units and radians. However, the user can choose to use other units besides per-units and radians by utilizing macros such as @power, @voltage, and @parameter.

Examples

Adding a branch template using the default unit system:

system = powerSystem()
+updateBranch!(system; label = "Branch 1", reactance = 0.02, susceptance = 0.062)
source
JuliaGrid.@branchMacro
@branch(kwargs...)

The macro generates a template for a branch, which can be utilized to define a branch using the addBranch! function.

Keywords

To define the branch template, the kwargs input arguments must be provided in accordance with the keywords specified within the addBranch! function, along with their corresponding values.

Units

The default units for the keyword parameters are per-units and radians. However, the user can choose to use other units besides per-units and radians by utilizing macros such as @power, @voltage, and @parameter.

Examples

Adding a branch template using the default unit system:

system = powerSystem()
 
 addBus!(system; label = "Bus 1", type = 3, active = 0.25, reactive = -0.04)
 addBus!(system; label = "Bus 2", type = 1, active = 0.15, reactive = 0.08)
@@ -52,7 +52,7 @@
 addBus!(system; label = "Bus 2", type = 1,  active = 0.15, reactive = 0.08)
 
 @branch(shiftAngle = 10)
-addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.12)
source

Generator

JuliaGrid.addGenerator!Function
addGenerator!(system::PowerSystem, [analysis::Analysis]; label, bus, status,
+addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.12)
source

Generator

JuliaGrid.addGenerator!Function
addGenerator!(system::PowerSystem, [analysis::Analysis]; label, bus, status,
     active, reactive, magnitude, minActive, maxActive, minReactive, maxReactive,
     lowActive, minLowReactive, maxLowReactive, upActive, minUpReactive, maxUpReactive,
     loadFollowing, reactiveRamp, reserve10min, reserve30min, area)

The function adds a new generator to the PowerSystem composite type. The generator can be added to an already defined bus.

Arguments

If the Analysis type is omitted, the function applies changes to the PowerSystem composite type only. However, when including the Analysis type, it updates both the PowerSystem and Analysis types. This streamlined approach circumvents the necessity for completely reconstructing vectors and matrices when adding a new generator.

Keywords

The generator is defined with the following keywords:

  • label: Unique label for the generator.
  • bus: Label of the bus to which the generator is connected.
  • status: Operating status of the generator:
    • status = 1: in-service,
    • status = 0: out-of-service.
  • active (pu or W): Output active power.
  • reactive (pu or VAr): Output reactive power.
  • magnitude (pu or V): Voltage magnitude setpoint.
  • minActive (pu or W): Minimum allowed output active power value.
  • maxActive (pu or W): Maximum allowed output active power value.
  • minReactive (pu or VAr): Minimum allowed output reactive power value.
  • maxReactive (pu or VAr): Maximum allowed output reactive power value.
  • lowActive (pu or W): Lower allowed active power output value of PQ capability curve.
  • minLowReactive (pu or VAr): Minimum allowed reactive power output value at lowActive value.
  • maxLowReactive (pu or VAr): Maximum allowed reactive power output value at lowActive value.
  • upActive (pu or W): Upper allowed active power output value of PQ capability curve.
  • minUpReactive (pu or VAr): Minimum allowed reactive power output value at upActive value.
  • maxUpReactive (pu or VAr): Maximum allowed reactive power output value at upActive value.
  • loadFollowing (pu/min or W/min): Ramp rate for load following/AG.
  • reserve10min (pu or W): Ramp rate for 10-minute reserves.
  • reserve30min (pu or W): Ramp rate for 30-minute reserves.
  • reactiveRamp (pu/min or VAr/min): Ramp rate for reactive power, two seconds timescale.
  • area: Area participation factor.

Note that voltage magnitude values are referenced to line-to-neutral voltages, while powers, when given in SI units, correspond to three-phase power.

Updates

The function updates the generator field within the PowerSystem composite type, and in cases where parameters impact variables in the bus field, it automatically adjusts the field. Furthermore, it guarantees that any modifications to the parameters are transmitted to the Analysis type.

Default Settings

By default, certain keywords are assigned default values: status = 1 and magnitude = 1.0 per-unit. The rest of the keywords are initialized with a value of zero. However, the user can modify these default settings by utilizing the @generator macro.

Units

By default, the input units are associated with per-units (pu) as shown. However, users have the option to use other units instead of per-units using the @power and @voltage macros.

Examples

Adding a generator using the default unit system:

system = powerSystem()
@@ -65,12 +65,12 @@
 
 addBus!(system; label = "Bus 1", type = 2, active = 20, base = 132)
 
-addGenerator!(system; bus = "Bus 1", active = 50, magnitude = 145.2)
source
JuliaGrid.updateGenerator!Function
updateGenerator!(system::PowerSystem, [analysis::Analysis]; kwargs...)

The function allows for the alteration of parameters for an existing generator.

Arguments

If the Analysis type is omitted, the function applies changes to the PowerSystem composite type only. However, when including the Analysis type, it updates both the PowerSystem and Analysis types. This streamlined process avoids the need to completely rebuild vectors and matrices when adjusting these parameter

Keywords

To update a specific generator, provide the necessary kwargs input arguments in accordance with the keywords specified in the addGenerator! function, along with their respective values. Ensure that the label keyword matches the label of the existing generator you want to modify. If any keywords are omitted, their corresponding values will remain unchanged.

Updates

The function updates the generator field within the PowerSystem composite type, and in cases where parameters impact variables in the bus field, it automatically adjusts the field. Furthermore, it guarantees that any modifications to the parameters are transmitted to the Analysis type.

Units

Units for input parameters can be changed using the same method as described for the addBranch! function.

Example

system = powerSystem()
+addGenerator!(system; bus = "Bus 1", active = 50, magnitude = 145.2)
source
JuliaGrid.updateGenerator!Function
updateGenerator!(system::PowerSystem, [analysis::Analysis]; kwargs...)

The function allows for the alteration of parameters for an existing generator.

Arguments

If the Analysis type is omitted, the function applies changes to the PowerSystem composite type only. However, when including the Analysis type, it updates both the PowerSystem and Analysis types. This streamlined process avoids the need to completely rebuild vectors and matrices when adjusting these parameter

Keywords

To update a specific generator, provide the necessary kwargs input arguments in accordance with the keywords specified in the addGenerator! function, along with their respective values. Ensure that the label keyword matches the label of the existing generator you want to modify. If any keywords are omitted, their corresponding values will remain unchanged.

Updates

The function updates the generator field within the PowerSystem composite type, and in cases where parameters impact variables in the bus field, it automatically adjusts the field. Furthermore, it guarantees that any modifications to the parameters are transmitted to the Analysis type.

Units

Units for input parameters can be changed using the same method as described for the addBranch! function.

Example

system = powerSystem()
 
 addBus!(system; label = "Bus 1", type = 2, active = 0.2, base = 132e3)
 
 addGenerator!(system; label = "Generator 1", bus = "Bus 1", active = 0.5)
-updateGenerator!(system; label = "Generator 1", active = 0.6, reactive = 0.2)
source
JuliaGrid.cost!Function
cost!(system::PowerSystem, [analysis::Analysis]; label, active, reactive,
+updateGenerator!(system; label = "Generator 1", active = 0.6, reactive = 0.2)
source
JuliaGrid.cost!Function
cost!(system::PowerSystem, [analysis::Analysis]; label, active, reactive,
     piecewise, polynomial)

The function either adds a new cost or modifies an existing one for the active or reactive power generated by the corresponding generator within the PowerSystem composite type. It has the capability to append a cost to an already defined generator.

Arguments

If the Analysis type is omitted, the function applies changes to the PowerSystem composite type only. However, when including the Analysis type, it updates both the PowerSystem and Analysis types. This streamlined approach circumvents the necessity for completely reconstructing vectors and matrices when adding a new branch.

Keywords

The function accepts five keywords:

  • label: Corresponds to the already defined generator label.
  • active: Active power cost model:
    • active = 1: adding or updating cost, and piecewise linear is being used,
    • active = 2: adding or updating cost, and polynomial is being used.
  • reactive: Reactive power cost model:
    • reactive = 1: adding or updating cost, and piecewise linear is being used,
    • reactive = 2: adding or updating cost, and polynomial is being used.
  • piecewise: Cost model defined by input-output points given as Matrix{Float64}:
    • first column (pu, W or VAr): active or reactive power output of the generator,
    • second column (€/hr): cost for the specified active or reactive power output.
  • polynomial: The n-th degree polynomial coefficients given as Vector{Float64}:
    • first element (€/puⁿ-hr, €/Wⁿhr or €/VArⁿ-hr): coefficient of the n-th degree term, ....,
    • penultimate element (€/pu-hr, €/W-hr or €/VAr-hr): coefficient of the first degree term,
    • last element (€/hr): constant coefficient.

Updates

The function updates the generator.cost field within the PowerSystem composite type. Furthermore, it guarantees that any modifications to the parameters are transmitted to the Analysis type.

Units

By default, the input units related with active powers are per-units (pu), but they can be modified using the macro @power.

Examples

Adding a cost using the default unit system:

system = powerSystem()
 
 addBus!(system; label = "Bus 1", active = 0.25, reactive = -0.04, base = 132e3)
@@ -82,7 +82,7 @@
 addBus!(system; label = "Bus 1", active = 25, reactive = -4, base = 132e3)
 
 addGenerator!(system; label = "Generator 1", bus = "Bus 1", active = 50, reactive = 10)
-cost!(system; label = "Generator 1", active = 2, polynomial = [0.11; 5.0; 150.0])
source
JuliaGrid.@generatorMacro
@generator(kwargs...)

The macro generates a template for a generator, which can be utilized to define a generator using the addGenerator! function.

Keywords

To define the generator template, the kwargs input arguments must be provided in accordance with the keywords specified within the addGenerator! function, along with their corresponding values.

Units

By default, the input units are associated with per-units (pu) as shown. However, users have the option to use other units instead of per-units using the @power and @voltage macros.

Examples

Adding a generator using the default unit system:

system = powerSystem()
+cost!(system; label = "Generator 1", active = 2, polynomial = [0.11; 5.0; 150.0])
source
JuliaGrid.@generatorMacro
@generator(kwargs...)

The macro generates a template for a generator, which can be utilized to define a generator using the addGenerator! function.

Keywords

To define the generator template, the kwargs input arguments must be provided in accordance with the keywords specified within the addGenerator! function, along with their corresponding values.

Units

By default, the input units are associated with per-units (pu) as shown. However, users have the option to use other units instead of per-units using the @power and @voltage macros.

Examples

Adding a generator using the default unit system:

system = powerSystem()
 
 addBus!(system; label = "Bus 1", type = 2, active = 0.25, reactive = -0.04, base = 132e3)
 
@@ -94,4 +94,4 @@
 addBus!(system; label = "Bus 1", type = 2, active = 25, reactive = -4, base = 132)
 
 @generator(magnitude = 145.2)
-addGenerator!(system; label = "Generator 1", bus = "Bus 1", active = 50, reactive = 10)
source
+addGenerator!(system; label = "Generator 1", bus = "Bus 1", active = 50, reactive = 10)
source
diff --git a/dev/api/setupPrint/index.html b/dev/api/setupPrint/index.html index 8e2c70ae..266ec4e0 100644 --- a/dev/api/setupPrint/index.html +++ b/dev/api/setupPrint/index.html @@ -1,6 +1,6 @@ Setup and Print · JuliaGrid

Setup and Print

For further information on this topic, please see the Power System Model or Measurement Model sections of the Manual. Please note that when using macros, they modify variables within the current scope. Print functions can be used to print results to the REPL, or users can redirect the output to print results to a text file, for example.

To load power system model API functionalities into the current scope, utilize the following command:

using JuliaGrid

Base Units
Input Units
Label Types
Default Settings

Base Units

JuliaGrid.@baseMacro
@base(system::PowerSystem, power, voltage)

By default, the units for base power and base voltages are set to volt-ampere (VA) and volt (V), but you can modify the prefixes using the macro.

Prefixes must be specified according to the SI prefixes and should be included with the unit of power (VA) or unit of voltage (V). Keep in mind that the macro must be used after creating the composite type PowerSystem.

Example

system = powerSystem("case14.h5")
-@base(system, MVA, kV)
source

Input Units

JuliaGrid.@powerMacro
@power(active, reactive, apparent)

JuliaGrid stores all data related with powers in per-units, and these cannot be altered. However, the power units of the built-in functions used to add or modified power system elements can be modified using the macro.

Prefixes must be specified according to the SI prefixes and should be included with the unit of active power (W), reactive power (VAr), or apparent power (VA). Also, it is a possible to combine SI units with/without prefixes with per-units (pu).

Changing the unit of active power is reflected in the following quantities:

Changing the unit of reactive power unit is reflected in the following quantities:

Changing the unit of apparent power unit is reflected in the following quantities:

Example

@power(MW, kVAr, VA)
source
JuliaGrid.@voltageMacro
@voltage(magnitude, angle, base)

JuliaGrid stores all data related with voltages in per-units and radians, and these cannot be altered. However, the voltage magnitude and angle units of the built-in functions used to add or modified power system elements can be modified using the macro.

The prefixes must adhere to the SI prefixes and should be specified along with the unit of voltage, either magnitude (V) or base (V). Alternatively, the unit of voltage magnitude can be expressed in per-unit (pu). The unit of voltage angle should be in radians (rad) or degrees (deg).

Changing the unit of voltage magnitude is reflected in the following quantities:

Changing the unit of voltage angle is reflected in the following quantities:

Changing the unit prefix of voltage base is reflected in the following quantity:

Example

@voltage(pu, deg, kV)
source
JuliaGrid.@currentMacro
@current(magnitude, angle)

JuliaGrid stores all data related with currents in per-units and radians, and these cannot be altered. However, the current magnitude and angle units of the built-in functions used to add or modified measurement devices can be modified using the macro.

The prefixes must adhere to the SI prefixes and should be specified along with the unit of current magnitude (V). Alternatively, the unit of current magnitude can be expressed in per-unit (pu). The unit of current angle should be in radians (rad) or degrees (deg).

Changing the unit of current magnitude is reflected in the following quantities:

Changing the unit of current angle is reflected in the following quantities:

Example

@current(pu, deg)
source
JuliaGrid.@parameterMacro
@parameter(impedance, admittance)

JuliaGrid stores all data related with impedances and admittancies in per-units, and these cannot be altered. However, units of impedance and admittance of the built-in functions used to add or modified power system elements can be modified using the macro.

Prefixes must be specified according to the SI prefixes and should be included with the unit of impedance (Ω) or unit of admittance (S). The second option is to define the units in per-unit (pu).

In the case where impedance and admittance are being used in SI units (Ω and S) and these units are related to the transformer, the assignment must be based on the primary side of the transformer.

Changing the units of impedance is reflected in the following quantities in specific functions:

Changing the units of admittance is reflected in the following quantities:

Example

@parameter(Ω, pu)
source

Label Types

JuliaGrid.@labelsMacro
@labels(type)

JuliaGrid keeps all labels in ordered dictionaries as Strings. Users have the option to use Integers instead, which can be a more efficient way to store labels, particularly for large-scale systems.

Example

@labels(Integer)
source

Default Settings

JuliaGrid.@defaultMacro
@default(mode)

The macro is designed to reset various settings to their default values.

The mode argument can take on the following values:

  • unit: Resets all units to their default settings.
  • power: Sets active, reactive, and apparent power to per-units.
  • voltage: Sets voltage magnitude to per-unit and voltage angle to radian.
  • parameter: Sets impedance and admittance to per-units.
  • template: Resets bus, branch, generator, voltmeter, ammeter, wattmeter, varmeter, and pmu templates to their default settings.
  • bus: Resets the bus template to its default settings.
  • branch: Resets the branch template to its default settings.
  • generator: Resets the generator template to its default settings.
  • voltmeter: Resets the voltmeter template to its default settings.
  • ammeter: Resets the ammeter template to its default settings.
  • wattmeter: Resets the wattmeter template to its default settings.
  • varmeter: Resets the varmeter template to its default settings.
  • pmu: Resets the pmu template to its default settings.

Example

@default(unit)
source

Print Power System Data


Input Units

JuliaGrid.@powerMacro
@power(active, reactive, apparent)

JuliaGrid stores all data related with powers in per-units, and these cannot be altered. However, the power units of the built-in functions used to add or modified power system elements can be modified using the macro.

Prefixes must be specified according to the SI prefixes and should be included with the unit of active power (W), reactive power (VAr), or apparent power (VA). Also, it is a possible to combine SI units with/without prefixes with per-units (pu).

Changing the unit of active power is reflected in the following quantities:

Changing the unit of reactive power unit is reflected in the following quantities:

Changing the unit of apparent power unit is reflected in the following quantities:

Example

@power(MW, kVAr, VA)
source
JuliaGrid.@voltageMacro
@voltage(magnitude, angle, base)

JuliaGrid stores all data related with voltages in per-units and radians, and these cannot be altered. However, the voltage magnitude and angle units of the built-in functions used to add or modified power system elements can be modified using the macro.

The prefixes must adhere to the SI prefixes and should be specified along with the unit of voltage, either magnitude (V) or base (V). Alternatively, the unit of voltage magnitude can be expressed in per-unit (pu). The unit of voltage angle should be in radians (rad) or degrees (deg).

Changing the unit of voltage magnitude is reflected in the following quantities:

Changing the unit of voltage angle is reflected in the following quantities:

Changing the unit prefix of voltage base is reflected in the following quantity:

Example

@voltage(pu, deg, kV)
source
JuliaGrid.@currentMacro
@current(magnitude, angle)

JuliaGrid stores all data related with currents in per-units and radians, and these cannot be altered. However, the current magnitude and angle units of the built-in functions used to add or modified measurement devices can be modified using the macro.

The prefixes must adhere to the SI prefixes and should be specified along with the unit of current magnitude (V). Alternatively, the unit of current magnitude can be expressed in per-unit (pu). The unit of current angle should be in radians (rad) or degrees (deg).

Changing the unit of current magnitude is reflected in the following quantities:

Changing the unit of current angle is reflected in the following quantities:

Example

@current(pu, deg)
source
JuliaGrid.@parameterMacro
@parameter(impedance, admittance)

JuliaGrid stores all data related with impedances and admittancies in per-units, and these cannot be altered. However, units of impedance and admittance of the built-in functions used to add or modified power system elements can be modified using the macro.

Prefixes must be specified according to the SI prefixes and should be included with the unit of impedance (Ω) or unit of admittance (S). The second option is to define the units in per-unit (pu).

In the case where impedance and admittance are being used in SI units (Ω and S) and these units are related to the transformer, the assignment must be based on the primary side of the transformer.

Changing the units of impedance is reflected in the following quantities in specific functions:

Changing the units of admittance is reflected in the following quantities:

Example

@parameter(Ω, pu)
source

Label Types

JuliaGrid.@labelsMacro
@labels(type)

JuliaGrid keeps all labels in ordered dictionaries as Strings. Users have the option to use Integers instead, which can be a more efficient way to store labels, particularly for large-scale systems.

Example

@labels(Integer)
source

Default Settings

JuliaGrid.@defaultMacro
@default(mode)

The macro is designed to reset various settings to their default values.

The mode argument can take on the following values:

  • unit: Resets all units to their default settings.
  • power: Sets active, reactive, and apparent power to per-units.
  • voltage: Sets voltage magnitude to per-unit and voltage angle to radian.
  • parameter: Sets impedance and admittance to per-units.
  • template: Resets bus, branch, generator, voltmeter, ammeter, wattmeter, varmeter, and pmu templates to their default settings.
  • bus: Resets the bus template to its default settings.
  • branch: Resets the branch template to its default settings.
  • generator: Resets the generator template to its default settings.
  • voltmeter: Resets the voltmeter template to its default settings.
  • ammeter: Resets the ammeter template to its default settings.
  • wattmeter: Resets the wattmeter template to its default settings.
  • varmeter: Resets the varmeter template to its default settings.
  • pmu: Resets the pmu template to its default settings.

Example

@default(unit)
source

Print Power System Data

JuliaGrid.printBusDataFunction
printBusData(system::PowerSystem, analysis::Analysis, [io::IO];
     label, fmt, width, show, delimiter, title, header, footer, repeat, style)

The function prints voltages, powers, and currents related to buses. Optionally, an IO may be passed as the last argument to redirect the output.

Keywords

The following keywords control the printed data:

  • label: Prints only the data for the corresponding bus.
  • fmt: Specifies the preferred numeric formats or alignments for the columns.
  • width: Specifies the preferred widths for the columns.
  • show: Toggles the printing of the columns.
  • delimiter: Sets the column delimiter.
  • title: Toggles the printing of the table title.
  • header: Toggles the printing of the header.
  • footer: Toggles the printing of the footer.
  • repeat: Prints the header again after a specified number of lines have been printed.
  • style: Prints either a stylish table or a simple table suitable for easy export.
Julia 1.10

The function printBusData requires Julia 1.10 or later.

Example

system = powerSystem("case14.h5")
 
 analysis = newtonRaphson(system)
@@ -24,7 +24,7 @@
 printBusData(system, analysis; label = 2, delimiter, width, title = true, header = true)
 printBusData(system, analysis; label = 10, delimiter, width)
 printBusData(system, analysis; label = 12, delimiter, width)
-printBusData(system, analysis; label = 14, delimiter, width, footer = true)
source
JuliaGrid.printBranchDataFunction
printBranchData(system::PowerSystem, analysis::Analysis, [io::IO];
+printBusData(system, analysis; label = 14, delimiter, width, footer = true)
source
JuliaGrid.printBranchDataFunction
printBranchData(system::PowerSystem, analysis::Analysis, [io::IO];
     label, fmt, width, show, delimiter, title, header, footer, repeat, style)

The function prints powers and currents related to branches. Optionally, an IO may be passed as the last argument to redirect the output.

Keywords

The following keywords control the printed data:

  • label: Prints only the data for the corresponding branch.
  • fmt: Specifies the preferred numeric formats or alignments for the columns.
  • width: Specifies the preferred widths for the columns.
  • show: Toggles the printing of the columns.
  • delimiter: Sets the column delimiter.
  • title: Toggles the printing of the table title.
  • header: Toggles the printing of the header.
  • footer: Toggles the printing of the footer.
  • repeat: Prints the header again after a specified number of lines have been printed.
  • style: Prints either a stylish table or a simple table suitable for easy export.
Julia 1.10

The function printBranchData requires Julia 1.10 or later.

Example

system = powerSystem("case14.h5")
 
 analysis = newtonRaphson(system)
@@ -48,7 +48,7 @@
 printBranchData(system, analysis; label = 2, delimiter, width, header = true)
 printBranchData(system, analysis; label = 10, delimiter, width)
 printBranchData(system, analysis; label = 12, delimiter, width)
-printBranchData(system, analysis; label = 14, delimiter, width, footer = true)
source
JuliaGrid.printGeneratorDataFunction
printGeneratorData(system::PowerSystem, analysis::Analysis, [io::IO];
+printBranchData(system, analysis; label = 14, delimiter, width, footer = true)
source
JuliaGrid.printGeneratorDataFunction
printGeneratorData(system::PowerSystem, analysis::Analysis, [io::IO];
     label, fmt, width, show, delimiter, title, header, footer, repeat, style)

The function prints powers related to generators. Optionally, an IO may be passed as the last argument to redirect the output.

Keywords

The following keywords control the printed data:

  • label: Prints only the data for the corresponding generator.
  • fmt: Specifies the preferred numeric formats or alignments for the columns.
  • width: Specifies the preferred widths for the columns.
  • show: Toggles the printing of the columns.
  • delimiter: Sets the column delimiter.
  • title: Toggles the printing of the table title.
  • header: Toggles the printing of the header.
  • footer: Toggles the printing of the footer.
  • repeat: Prints the header again after a specified number of lines have been printed.
  • style: Prints either a stylish table or a simple table suitable for easy export.
Julia 1.10

The function printGeneratorData requires Julia 1.10 or later.

Example

system = powerSystem("case14.h5")
 
 analysis = newtonRaphson(system)
@@ -71,7 +71,7 @@
 width = Dict("Power Output Active" => 7)
 printGeneratorData(system, analysis; label = 1, delimiter, width, header = true)
 printGeneratorData(system, analysis; label = 4, delimiter, width)
-printGeneratorData(system, analysis; label = 5, delimiter, width, footer = true)
source

Print Power System Summary

JuliaGrid.printBusSummaryFunction
printBusSummary(system::PowerSystem, analysis::Analysis, [io::IO];
+printGeneratorData(system, analysis; label = 5, delimiter, width, footer = true)
source

Print Power System Summary

JuliaGrid.printBusSummaryFunction
printBusSummary(system::PowerSystem, analysis::Analysis, [io::IO];
     fmt, width, show, delimiter, title, header, footer, style)

The function prints a summary of the electrical quantities related to buses. Optionally, an IO may be passed as the last argument to redirect the output.

Keywords

The following keywords control the printed data:

  • fmt: Specifies the preferred numeric formats or alignments for the columns.
  • width: Specifies the preferred widths for the columns.
  • show: Toggles the printing of the columns.
  • delimiter: Sets the column delimiter.
  • title: Toggles the printing of the table title.
  • header: Toggles the printing of the header.
  • footer: Toggles the printing of the footer.
  • style: Prints either a stylish table or a simple table suitable for easy export.
Julia 1.10

The function printBusSummary requires Julia 1.10 or later.

Example

system = powerSystem("case14.h5")
 
 analysis = newtonRaphson(system)
@@ -85,7 +85,7 @@
 power!(system, analysis)
 
 show = Dict("In-Use" => false)
-printBusSummary(system, analysis; show, delimiter = " ", title = false)
source
JuliaGrid.printBranchSummaryFunction
printBranchSummary(system::PowerSystem, analysis::Analysis, [io::IO];
+printBusSummary(system, analysis; show, delimiter = " ", title = false)
source
JuliaGrid.printBranchSummaryFunction
printBranchSummary(system::PowerSystem, analysis::Analysis, [io::IO];
     fmt, width, show, delimiter, title, header, footer, style))

The function prints a summary of the electrical quantities related to branches. Optionally, an IO may be passed as the last argument to redirect the output.

Keywords

The following keywords control the printed data:

  • fmt: Specifies the preferred numeric formats or alignments for the columns.
  • width: Specifies the preferred widths for the columns.
  • show: Toggles the printing of the columns.
  • delimiter: Sets the column delimiter.
  • title: Toggles the printing of the table title.
  • header: Toggles the printing of the header.
  • footer: Toggles the printing of the footer.
  • style: Prints either a stylish table or a simple table suitable for easy export.
Julia 1.10

The function printBranchSummary requires Julia 1.10 or later.

Example

system = powerSystem("case14.h5")
 
 analysis = newtonRaphson(system)
@@ -99,7 +99,7 @@
 power!(system, analysis)
 
 show = Dict("Total" => false)
-printBranchSummary(system, analysis; show, delimiter = " ", title = false)
source
JuliaGrid.printGeneratorSummaryFunction
printGeneratorSummary(system::PowerSystem, analysis::Analysis, [io::IO];
+printBranchSummary(system, analysis; show, delimiter = " ", title = false)
source
JuliaGrid.printGeneratorSummaryFunction
printGeneratorSummary(system::PowerSystem, analysis::Analysis, [io::IO];
     fmt, width, show, delimiter, title, header, footer, style)

The function prints a summary of the electrical quantities related to generators. Optionally, an IO may be passed as the last argument to redirect the output.

Keywords

The following keywords control the printed data:

  • fmt: Specifies the preferred numeric formats or alignments for the columns.
  • width: Specifies the preferred widths for the columns.
  • show: Toggles the printing of the columns.
  • delimiter: Sets the column delimiter.
  • title: Toggles the printing of the table title.
  • header: Toggles the printing of the header.
  • footer: Toggles the printing of the footer.
  • style: Prints either a stylish table or a simple table suitable for easy export.
Julia 1.10

The function printGeneratorSummary requires Julia 1.10 or later.

Example

system = powerSystem("case14.h5")
 
 analysis = newtonRaphson(system)
@@ -113,7 +113,7 @@
 power!(system, analysis)
 
 show = Dict("Minimum" => false)
-printGeneratorSummary(system, analysis; show, delimiter = " ", title = false)
source

JuliaGrid.printVoltmeterDataFunction
printVoltmeterData(system::PowerSystem, device::Measurement, [analysis::Analysis],
+printGeneratorSummary(system, analysis; show, delimiter = " ", title = false)
source

JuliaGrid.printVoltmeterDataFunction
printVoltmeterData(system::PowerSystem, device::Measurement, [analysis::Analysis],
     [io::IO]; label, fmt, width, show, delimiter, title, header, footer, repeat, style)

The function prints data related to voltmeters. Optionally, an IO may be passed as the last argument to redirect the output. Users can also omit the Analysis type to print only data related to the Measurement type.

Keywords

The following keywords control the printed data:

  • label: Prints only the data for the corresponding voltmeter.
  • fmt: Specifies the preferred numeric formats or alignments for the columns.
  • width: Specifies the preferred widths for the columns.
  • show: Toggles the printing of the columns.
  • delimiter: Sets the column delimiter.
  • title: Toggles the printing of the table title.
  • header: Toggles the printing of the header.
  • footer: Toggles the printing of the footer.
  • repeat: Prints the header again after a specified number of lines have been printed.
  • style: Prints either a stylish table or a simple table suitable for easy export.
Julia 1.10

The function printBusData requires Julia 1.10 or later.

Example

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
@@ -135,7 +135,7 @@
 width = Dict("Voltage Magnitude Estimate" => 11)
 printVoltmeterData(system, device, analysis; label = 1, width, header = true)
 printVoltmeterData(system, device, analysis; label = 6, width)
-printVoltmeterData(system, device, analysis; label = 8, width, footer = true)
source
JuliaGrid.printAmmeterDataFunction
printAmmeterData(system::PowerSystem, device::Measurement, [analysis::Analysis],
+printVoltmeterData(system, device, analysis; label = 8, width, footer = true)
source
JuliaGrid.printAmmeterDataFunction
printAmmeterData(system::PowerSystem, device::Measurement, [analysis::Analysis],
     [io::IO]; label, fmt, width, show, delimiter, title, header, footer, repeat, style)

The function prints data related to ammeters. Optionally, an IO may be passed as the last argument to redirect the output. Users can also omit the Analysis type to print only data related to the Measurement type.

Keywords

The following keywords control the printed data:

  • label: Prints only the data for the corresponding ammeter.
  • fmt: Specifies the preferred numeric formats or alignments for the columns.
  • width: Specifies the preferred widths for the columns.
  • show: Toggles the printing of the columns.
  • delimiter: Sets the column delimiter.
  • title: Toggles the printing of the table title.
  • header: Toggles the printing of the header.
  • footer: Toggles the printing of the footer.
  • repeat: Prints the header again after a specified number of lines have been printed.
  • style: Prints either a stylish table or a simple table suitable for easy export.
Julia 1.10

The function printBusData requires Julia 1.10 or later.

Example

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
@@ -157,7 +157,7 @@
 width = Dict("Current Magnitude" => 10)
 printAmmeterData(system, device, analysis; label = "From 1", width, header = true)
 printAmmeterData(system, device, analysis; label = "From 4", width)
-printAmmeterData(system, device, analysis; label = "From 6", width, footer = true)
source
JuliaGrid.printWattmeterDataFunction
printWattmeterData(system::PowerSystem, device::Measurement, [analysis::Analysis],
+printAmmeterData(system, device, analysis; label = "From 6", width, footer = true)
source
JuliaGrid.printWattmeterDataFunction
printWattmeterData(system::PowerSystem, device::Measurement, [analysis::Analysis],
     [io::IO]; label, fmt, width, show, delimiter, title, header, footer, repeat, style)

The function prints data related to wattmeters. Optionally, an IO may be passed as the last argument to redirect the output. Users can also omit the Analysis type to print only data related to the Measurement type.

Keywords

The following keywords control the printed data:

  • label: Prints only the data for the corresponding wattmeter.
  • fmt: Specifies the preferred numeric formats or alignments for the columns.
  • width: Specifies the preferred widths for the columns.
  • show: Toggles the printing of the columns.
  • delimiter: Sets the column delimiter.
  • title: Toggles the printing of the table title.
  • header: Toggles the printing of the header.
  • footer: Toggles the printing of the footer.
  • repeat: Prints the header again after a specified number of lines have been printed.
  • style: Prints either a stylish table or a simple table suitable for easy export.
Julia 1.10

The function printBusData requires Julia 1.10 or later.

Example

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
@@ -179,7 +179,7 @@
 width = Dict("Active Power Residual" => 11)
 printWattmeterData(system, device, analysis; label = 2, width, header = true)
 printWattmeterData(system, device, analysis; label = 5, width)
-printWattmeterData(system, device, analysis; label = 9, width, footer = true)
source
JuliaGrid.printVarmeterDataFunction
printVarmeterData(system::PowerSystem, device::Measurement, [analysis::Analysis],
+printWattmeterData(system, device, analysis; label = 9, width, footer = true)
source
JuliaGrid.printVarmeterDataFunction
printVarmeterData(system::PowerSystem, device::Measurement, [analysis::Analysis],
     [io::IO]; label, fmt, width, show, delimiter, title, header, footer, repeat, style)

The function prints data related to varmeters. Optionally, an IO may be passed as the last argument to redirect the output. Users can also omit the Analysis type to print only data related to the Measurement type.

Keywords

The following keywords control the printed data:

  • label: Prints only the data for the corresponding varmeter.
  • fmt: Specifies the preferred numeric formats or alignments for the columns.
  • width: Specifies the preferred widths for the columns.
  • show: Toggles the printing of the columns.
  • delimiter: Sets the column delimiter.
  • title: Toggles the printing of the table title.
  • header: Toggles the printing of the header.
  • footer: Toggles the printing of the footer.
  • repeat: Prints the header again after a specified number of lines have been printed.
  • style: Prints either a stylish table or a simple table suitable for easy export.
Julia 1.10

The function printBusData requires Julia 1.10 or later.

Example

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
@@ -201,7 +201,7 @@
 width = Dict("Reactive Power Residual" => 11)
 printVarmeterData(system, device, analysis; label = 2, width, header = true)
 printVarmeterData(system, device, analysis; label = 5, width)
-printVarmeterData(system, device, analysis; label = 9, width, footer = true)
source
JuliaGrid.printPmuDataFunction
printPmuData(system::PowerSystem, device::Measurement, [analysis::Analysis],
+printVarmeterData(system, device, analysis; label = 9, width, footer = true)
source
JuliaGrid.printPmuDataFunction
printPmuData(system::PowerSystem, device::Measurement, [analysis::Analysis],
     [io::IO]; label, fmt, width, show, delimiter, title, header, footer, repeat, style)

The function prints data related to PMUs. Optionally, an IO may be passed as the last argument to redirect the output. Users can also omit the Analysis type to print only data related to the Measurement type.

Keywords

The following keywords control the printed data:

  • label: Prints only the data for the corresponding PMU.
  • fmt: Specifies the preferred numeric formats or alignments for the columns.
  • width: Specifies the preferred widths for the columns.
  • show: Toggles the printing of the columns.
  • delimiter: Sets the column delimiter.
  • title: Toggles the printing of the table title.
  • header: Toggles the printing of the header.
  • footer: Toggles the printing of the footer.
  • repeat: Prints the header again after a specified number of lines have been printed.
  • style: Prints either a stylish table or a simple table suitable for easy export.
Julia 1.10

The function printPmuData requires Julia 1.10 or later.

Example

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
@@ -223,7 +223,7 @@
 width = Dict("Current Magnitude" => 10, "Current Angle Status" => 8)
 printPmuData(system, device, analysis; label = "From 1", width, header = true)
 printPmuData(system, device, analysis; label = "From 4", width)
-printPmuData(system, device, analysis; label = "From 6", width, footer = true)
source

Print Constraint Data

JuliaGrid.printBusConstraintFunction
printBusConstraint(system::PowerSystem, analysis::OptimalPowerFlow, [io::IO];
+printPmuData(system, device, analysis; label = "From 6", width, footer = true)
source

Print Constraint Data

JuliaGrid.printBusConstraintFunction
printBusConstraint(system::PowerSystem, analysis::OptimalPowerFlow, [io::IO];
     label, fmt, width, show, delimiter, title, header, footer, repeat, style)

The function prints constraint data related to buses. Optionally, an IO may be passed as the last argument to redirect the output.

Keywords

The following keywords control the printed data:

  • label: Prints only the data for the corresponding bus.
  • fmt: Specifies the preferred numeric formats or alignments for the columns.
  • width: Specifies the preferred widths for the columns.
  • show: Toggles the printing of the columns.
  • delimiter: Sets the column delimiter.
  • title: Toggles the printing of the table title.
  • header: Toggles the printing of the header.
  • footer: Toggles the printing of the footer.
  • repeat: Prints the header again after a specified number of lines have been printed.
  • style: Prints either a stylish table or a simple table suitable for easy export.
Julia 1.10

The function printBusConstraint requires Julia 1.10 or later.

Example

using Ipopt
 
 system = powerSystem("case14.h5")
@@ -241,7 +241,7 @@
 width = Dict("Voltage Magnitude" => 8, "Active Power Balance Solution" => 12)
 printBusConstraint(system, analysis; label = 2, delimiter, width, header = true)
 printBusConstraint(system, analysis; label = 10, delimiter, width)
-printBusConstraint(system, analysis; label = 14, delimiter, width, footer = true)
source
JuliaGrid.printBranchConstraintFunction
printBranchConstraint(system::PowerSystem, analysis::OptimalPowerFlow, [io::IO];
+printBusConstraint(system, analysis; label = 14, delimiter, width, footer = true)
source
JuliaGrid.printBranchConstraintFunction
printBranchConstraint(system::PowerSystem, analysis::OptimalPowerFlow, [io::IO];
     label, fmt, width, show, delimiter, title, header, footer, repeat, style)

The function prints constraint data related to branches. Optionally, an IO may be passed as the last argument to redirect the output.

Keywords

The following keywords control the printed data:

  • label: Prints only the data for the corresponding branch.
  • fmt: Specifies the preferred numeric formats or alignments for the columns.
  • width: Specifies the preferred widths for the columns.
  • show: Toggles the printing of the columns.
  • delimiter: Sets the column delimiter.
  • title: Toggles the printing of the table title.
  • header: Toggles the printing of the header.
  • footer: Toggles the printing of the footer.
  • repeat: Prints the header again after a specified number of lines have been printed.
  • style: Prints either a stylish table or a simple table suitable for easy export.
Julia 1.10

The function printBranchConstraint requires Julia 1.10 or later.

Example

using Ipopt
 
 system = powerSystem("case14.h5")
@@ -263,7 +263,7 @@
 width = Dict("From-Bus Apparent Power Flow" => 13, "Voltage Angle Difference Dual" => 12)
 printBranchConstraint(system, analysis; label = 3, delimiter, width, header = true)
 printBranchConstraint(system, analysis; label = 4, delimiter, width)
-printBranchConstraint(system, analysis; label = 9, delimiter, width, footer = true)
source
JuliaGrid.printGeneratorConstraintFunction
printGeneratorConstraint(system::PowerSystem, analysis::OptimalPowerFlow, [io::IO];
+printBranchConstraint(system, analysis; label = 9, delimiter, width, footer = true)
source
JuliaGrid.printGeneratorConstraintFunction
printGeneratorConstraint(system::PowerSystem, analysis::OptimalPowerFlow, [io::IO];
     label, fmt, width, show, delimiter, title, header, footer, repeat, style)

The function prints constraint data related to generators. Optionally, an IO may be passed as the last argument to redirect the output.

Keywords

The following keywords control the printed data:

  • label: Prints only the data for the corresponding generator.
  • fmt: Specifies the preferred numeric formats or alignments for the columns.
  • width: Specifies the preferred widths for the columns.
  • show: Toggles the printing of the columns.
  • delimiter: Sets the column delimiter.
  • title: Toggles the printing of the table title.
  • header: Toggles the printing of the header.
  • footer: Toggles the printing of the footer.
  • repeat: Prints the header again after a specified number of lines have been printed.
  • style: Prints either a stylish table or a simple table suitable for easy export.
Julia 1.10

The function printGeneratorConstraint requires Julia 1.10 or later.

Example

using Ipopt
 
 system = powerSystem("case14.h5")
@@ -281,4 +281,4 @@
 width = Dict("Active Power Capability" => 11, "Reactive Power Capability Dual" => 10)
 printGeneratorConstraint(system, analysis; label = 2, delimiter, width, header = true)
 printGeneratorConstraint(system, analysis; label = 3, delimiter, width)
-printGeneratorConstraint(system, analysis; label = 5, delimiter, width, footer = true)
source
+printGeneratorConstraint(system, analysis; label = 5, delimiter, width, footer = true)source diff --git a/dev/api/stateEstimation/index.html b/dev/api/stateEstimation/index.html index 1517112f..0339927a 100644 --- a/dev/api/stateEstimation/index.html +++ b/dev/api/stateEstimation/index.html @@ -5,13 +5,13 @@ statusWattmeter!(system, device; inservice = 15) device.varmeter.reactive.status = copy(device.wattmeter.active.status) -islands = islandTopologicalFlow(system, device)source
JuliaGrid.islandTopologicalMethod
islandTopological(system::PowerSystem, meter::Measurement)

The function employs a topological method to identify maximal observable islands. Specifically, it employs active power measurements to pinpoint flow observable islands. Subsequently, these islands are merged based on the available injection measurements.

It is assumed that active and reactive power measurements are paired, indicating a standard observability analysis. In this analysis, islands formed by active power measurements correspond to those formed by reactive power measurements.

Arguments

To define flow observable islands, this function necessitates the composite types PowerSystem and Measurement.

Returns

The function returns an Island type, containing information about the islands:

  • island: List enumerating observable islands with indices of buses.
  • bus: Positions of buses in relation to each island.
  • tie: Tie data associated with buses and branches.

Example

system = powerSystem("case14.h5")
+islands = islandTopologicalFlow(system, device)
source
JuliaGrid.islandTopologicalMethod
islandTopological(system::PowerSystem, meter::Measurement)

The function employs a topological method to identify maximal observable islands. Specifically, it employs active power measurements to pinpoint flow observable islands. Subsequently, these islands are merged based on the available injection measurements.

It is assumed that active and reactive power measurements are paired, indicating a standard observability analysis. In this analysis, islands formed by active power measurements correspond to those formed by reactive power measurements.

Arguments

To define flow observable islands, this function necessitates the composite types PowerSystem and Measurement.

Returns

The function returns an Island type, containing information about the islands:

  • island: List enumerating observable islands with indices of buses.
  • bus: Positions of buses in relation to each island.
  • tie: Tie data associated with buses and branches.

Example

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
 statusWattmeter!(system, device; inservice = 15)
 device.varmeter.reactive.status = copy(device.wattmeter.active.status)
 
-islands = islandTopological(system, device)
source
JuliaGrid.restorationGram!Method
restorationGram!(system::PowerSystem, device::Measurement, pseudo::Measurement,
+islands = islandTopological(system, device)
source
JuliaGrid.restorationGram!Method
restorationGram!(system::PowerSystem, device::Measurement, pseudo::Measurement,
     islands::Island; threshold)

Upon identifying the islands, the function incorporates measurements from the available pseudo-measurements in the pseudo variable into the device variable to reinstate observability. This method relies on reduced coefficient matrices and the Gram matrix.

It is important to note that the device labels in the device and pseudo variables must be different to enable the function to successfully incorporate measurements from pseudo into the device set of measurements.

Keyword

The keyword threshold defines the zero pivot threshold value, with a default value of 1e-5. More precisely, all computed pivots less than this value will be treated as zero pivots.

Updates

The function updates the device variable of the Measurement composite type.

Example

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 pseudo = measurement("pseudomeasurement14.h5")
@@ -19,18 +19,18 @@
 statusWattmeter!(system, device; inservice = 10)
 islands = islandTopological(system, device)
 
-restorationGram!(system, device, pseudo, islands)
source

AC State Estimation

JuliaGrid.gaussNewtonFunction
gaussNewton(system::PowerSystem, device::Measurement, [method = LU])

The function sets up the Gauss-Newton method to solve the nonlinear or AC state estimation model, where the vector of state variables is given in polar coordinates. The Gauss-Newton method throughout iterations provided WLS estimator.

Arguments

This function requires the PowerSystem and Measurement composite types to establish the nonlinear WLS state estimation framework.

Moreover, the presence of the method parameter is not mandatory. To address the WLS state estimation method, users can opt to utilize factorization techniques to decompose the gain matrix, such as LU, QR, or LDLt especially when the gain matrix is symmetric. Opting for the Orthogonal method is advisable for a more robust solution in scenarios involving ill-conditioned data, particularly when substantial variations in variances are present.

If the user does not provide the method, the default method for solving the estimation model will be LU factorization.

Updates

If the AC model has not been created, the function will automatically trigger an update of the ac field within the PowerSystem composite type.

Returns

The function returns an instance of the ACStateEstimation type, which includes the following fields:

  • voltage: The variable allocated to store the bus voltage magnitudes and angles.
  • power: The variable allocated to store the active and reactive powers.
  • method: The system model vectors and matrices.

Examples

Set up the AC state estimation model to be solved using the default LU factorization:

system = powerSystem("case14.h5")
+restorationGram!(system, device, pseudo, islands)
source

AC State Estimation

JuliaGrid.gaussNewtonFunction
gaussNewton(system::PowerSystem, device::Measurement, [method = LU])

The function sets up the Gauss-Newton method to solve the nonlinear or AC state estimation model, where the vector of state variables is given in polar coordinates. The Gauss-Newton method throughout iterations provided WLS estimator.

Arguments

This function requires the PowerSystem and Measurement composite types to establish the nonlinear WLS state estimation framework.

Moreover, the presence of the method parameter is not mandatory. To address the WLS state estimation method, users can opt to utilize factorization techniques to decompose the gain matrix, such as LU, QR, or LDLt especially when the gain matrix is symmetric. Opting for the Orthogonal method is advisable for a more robust solution in scenarios involving ill-conditioned data, particularly when substantial variations in variances are present.

If the user does not provide the method, the default method for solving the estimation model will be LU factorization.

Updates

If the AC model has not been created, the function will automatically trigger an update of the ac field within the PowerSystem composite type.

Returns

The function returns an instance of the ACStateEstimation type, which includes the following fields:

  • voltage: The variable allocated to store the bus voltage magnitudes and angles.
  • power: The variable allocated to store the active and reactive powers.
  • method: The system model vectors and matrices.

Examples

Set up the AC state estimation model to be solved using the default LU factorization:

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
 analysis = gaussNewton(system, device)

Set up the AC state estimation model to be solved using the orthogonal method:

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
-analysis = gaussNewton(system, device, Orthogonal)
source
JuliaGrid.acLavStateEstimationFunction
acLavStateEstimation(system::PowerSystem, device::Measurement, optimizer)

The function sets up the LAV method to solve the nonlinear or AC state estimation model, where the vector of state variables is given in polar coordinates.

Arguments

This function requires the PowerSystem and Measurement composite types to establish the LAV state estimation model. The LAV method offers increased robustness compared to WLS, ensuring unbiasedness even in the presence of various measurement errors and outliers.

Users can employ the LAV method to find an estimator by choosing one of the available optimization solvers. Typically, Ipopt.Optimizer suffices for most scenarios.

Updates

If the AC model has not been created, the function will automatically trigger an update of the ac field within the PowerSystem composite type.

Returns

The function returns an instance of the ACStateEstimation type, which includes the following fields:

  • voltage: The variable allocated to store the bus voltage magnitudes and angles.
  • power: The variable allocated to store the active and reactive powers.
  • method: The optimization model.

Example

using Ipopt
+analysis = gaussNewton(system, device, Orthogonal)
source
JuliaGrid.acLavStateEstimationFunction
acLavStateEstimation(system::PowerSystem, device::Measurement, optimizer)

The function sets up the LAV method to solve the nonlinear or AC state estimation model, where the vector of state variables is given in polar coordinates.

Arguments

This function requires the PowerSystem and Measurement composite types to establish the LAV state estimation model. The LAV method offers increased robustness compared to WLS, ensuring unbiasedness even in the presence of various measurement errors and outliers.

Users can employ the LAV method to find an estimator by choosing one of the available optimization solvers. Typically, Ipopt.Optimizer suffices for most scenarios.

Updates

If the AC model has not been created, the function will automatically trigger an update of the ac field within the PowerSystem composite type.

Returns

The function returns an instance of the ACStateEstimation type, which includes the following fields:

  • voltage: The variable allocated to store the bus voltage magnitudes and angles.
  • power: The variable allocated to store the active and reactive powers.
  • method: The optimization model.

Example

using Ipopt
 
 system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
-analysis = acLavStateEstimation(system, device, Ipopt.Optimizer)
source
JuliaGrid.solve!Method
solve!(system::PowerSystem, analysis::ACStateEstimation)

By computing the bus voltage magnitudes and angles, the function solves the AC state estimation model.

Updates

The resulting bus voltage magnitudes and angles are stored in the voltage field of the ACStateEstimation type.

Examples

Solving the AC state estimation model and obtaining the WLS estimator:

system = powerSystem("case14.h5")
+analysis = acLavStateEstimation(system, device, Ipopt.Optimizer)
source
JuliaGrid.solve!Method
solve!(system::PowerSystem, analysis::ACStateEstimation)

By computing the bus voltage magnitudes and angles, the function solves the AC state estimation model.

Updates

The resulting bus voltage magnitudes and angles are stored in the voltage field of the ACStateEstimation type.

Examples

Solving the AC state estimation model and obtaining the WLS estimator:

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
 analysis = gaussNewton(system, device)
@@ -45,7 +45,7 @@
 device = measurement("measurement14.h5")
 
 analysis = acLavStateEstimation(system, device, Ipopt.Optimizer)
-solve!(system, analysis)
source

PMU State Estimation

JuliaGrid.pmuPlacementFunction
pmuPlacement(system::PowerSystem, optimizer; bridge)

The function determines the optimal placement of PMUs through integer linear programming. Specifically, it identifies the minimum set of PMU locations required for effective power system state estimation, ensuring observability with the least number of PMUs.

The function accepts a PowerSystem composite type as input to establish the framework for finding the optimal PMU placement. If the ac field within the PowerSystem composite type is not yet created, the function automatically initiates an update process.

Additionally, the optimizer argument is a crucial component for formulating and solving the optimization problem. Typically, using the GLPK or HiGHS solver is sufficient. For more detailed information, please refer to the JuMP documenatation.

Keyword

The bridge keyword enables users to manage the bridging mechanism within the JuMP package.

Returns

The function returns an instance of the PlacementPMU type, containing variables such as:

  • bus: Bus labels with indices marking the positions of PMUs at buses.
  • from: Branch labels with indices marking the positions of PMUs at from-bus ends.
  • to: Branch labels with indices marking the positions of PMUs at to-bus ends.

Note that if the conventional understanding of a PMU involves a device measuring the bus voltage phasor and all branch current phasors incident to the bus, the result is saved only in the bus variable. However, if we consider that a PMU measures individual phasors, each described with magnitude and angle, then measurements are needed at each bus in the bus variable, and each branch with positions given according to from and to variables.

Example

using GLPK, Ipopt
+solve!(system, analysis)
source

PMU State Estimation

JuliaGrid.pmuPlacementFunction
pmuPlacement(system::PowerSystem, optimizer; bridge)

The function determines the optimal placement of PMUs through integer linear programming. Specifically, it identifies the minimum set of PMU locations required for effective power system state estimation, ensuring observability with the least number of PMUs.

The function accepts a PowerSystem composite type as input to establish the framework for finding the optimal PMU placement. If the ac field within the PowerSystem composite type is not yet created, the function automatically initiates an update process.

Additionally, the optimizer argument is a crucial component for formulating and solving the optimization problem. Typically, using the GLPK or HiGHS solver is sufficient. For more detailed information, please refer to the JuMP documenatation.

Keyword

The bridge keyword enables users to manage the bridging mechanism within the JuMP package.

Returns

The function returns an instance of the PlacementPMU type, containing variables such as:

  • bus: Bus labels with indices marking the positions of PMUs at buses.
  • from: Branch labels with indices marking the positions of PMUs at from-bus ends.
  • to: Branch labels with indices marking the positions of PMUs at to-bus ends.

Note that if the conventional understanding of a PMU involves a device measuring the bus voltage phasor and all branch current phasors incident to the bus, the result is saved only in the bus variable. However, if we consider that a PMU measures individual phasors, each described with magnitude and angle, then measurements are needed at each bus in the bus variable, and each branch with positions given according to from and to variables.

Example

using GLPK, Ipopt
 
 system = powerSystem("case14.h5")
 device = measurement()
@@ -68,18 +68,18 @@
 for branch in keys(placement.to)
     Iji, ψji = toCurrent(system, analysis; label = branch)
     addPmu!(system, device; to = branch, magnitude = Iji, angle = ψji)
-end
source
JuliaGrid.pmuStateEstimationFunction
pmuStateEstimation(system::PowerSystem, device::Measurement, [method = LU])

The function establishes the linear WLS model for state estimation with PMUs only. In this model, the vector of state variables contains bus voltages, given in rectangular coordinates.

Arguments

This function requires the PowerSystem and Measurement composite types to establish the WLS state estimation model.

Moreover, the presence of the method parameter is not mandatory. To address the WLS state estimation method, users can opt to utilize factorization techniques to decompose the gain matrix, such as LU, QR, or LDLt especially when the gain matrix is symmetric. Opting for the Orthogonal method is advisable for a more robust solution in scenarios involving ill-conditioned data, particularly when substantial variations in variances are present.

If the user does not provide the method, the default method for solving the estimation model will be LU factorization.

Updates

If the AC model has not been created, the function will automatically trigger an update of the ac field within the PowerSystem composite type.

Returns

The function returns an instance of the PMUStateEstimation abstract type, which includes the following fields:

  • voltage: The variable allocated to store the bus voltage magnitudes and angles.
  • power: The variable allocated to store the active and reactive powers.
  • method: The system model vectors and matrices.

Examples

Set up the PMU state estimation model to be solved using the default LU factorization:

system = powerSystem("case14.h5")
+end
source
JuliaGrid.pmuStateEstimationFunction
pmuStateEstimation(system::PowerSystem, device::Measurement, [method = LU])

The function establishes the linear WLS model for state estimation with PMUs only. In this model, the vector of state variables contains bus voltages, given in rectangular coordinates.

Arguments

This function requires the PowerSystem and Measurement composite types to establish the WLS state estimation model.

Moreover, the presence of the method parameter is not mandatory. To address the WLS state estimation method, users can opt to utilize factorization techniques to decompose the gain matrix, such as LU, QR, or LDLt especially when the gain matrix is symmetric. Opting for the Orthogonal method is advisable for a more robust solution in scenarios involving ill-conditioned data, particularly when substantial variations in variances are present.

If the user does not provide the method, the default method for solving the estimation model will be LU factorization.

Updates

If the AC model has not been created, the function will automatically trigger an update of the ac field within the PowerSystem composite type.

Returns

The function returns an instance of the PMUStateEstimation abstract type, which includes the following fields:

  • voltage: The variable allocated to store the bus voltage magnitudes and angles.
  • power: The variable allocated to store the active and reactive powers.
  • method: The system model vectors and matrices.

Examples

Set up the PMU state estimation model to be solved using the default LU factorization:

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
 analysis = pmuStateEstimation(system, device)

Set up the PMU state estimation model to be solved using the orthogonal method:

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
-analysis = pmuStateEstimation(system, device, Orthogonal)
source
JuliaGrid.pmuLavStateEstimationFunction
pmuLavStateEstimation(system::PowerSystem, device::Measurement, optimizer)

The function establishes the LAV model for state estimation with PMUs only. In this model, the vector of state variables contains bus voltages, given in rectangular coordinates.

Arguments

This function requires the PowerSystem and Measurement composite types to establish the LAV state estimation model. The LAV method offers increased robustness compared to WLS, ensuring unbiasedness even in the presence of various measurement errors and outliers.

Users can employ the LAV method to find an estimator by choosing one of the available optimization solvers. Typically, Ipopt.Optimizer suffices for most scenarios.

Updates

If the AC model has not been created, the function will automatically trigger an update of the ac field within the PowerSystem composite type.

Returns

The function returns an instance of the PMUStateEstimation abstract type, which includes the following fields:

  • voltage: The variable allocated to store the bus voltage magnitudes and angles.
  • power: The variable allocated to store the active and reactive powers.
  • method: The optimization model.

Example

using Ipopt
+analysis = pmuStateEstimation(system, device, Orthogonal)
source
JuliaGrid.pmuLavStateEstimationFunction
pmuLavStateEstimation(system::PowerSystem, device::Measurement, optimizer)

The function establishes the LAV model for state estimation with PMUs only. In this model, the vector of state variables contains bus voltages, given in rectangular coordinates.

Arguments

This function requires the PowerSystem and Measurement composite types to establish the LAV state estimation model. The LAV method offers increased robustness compared to WLS, ensuring unbiasedness even in the presence of various measurement errors and outliers.

Users can employ the LAV method to find an estimator by choosing one of the available optimization solvers. Typically, Ipopt.Optimizer suffices for most scenarios.

Updates

If the AC model has not been created, the function will automatically trigger an update of the ac field within the PowerSystem composite type.

Returns

The function returns an instance of the PMUStateEstimation abstract type, which includes the following fields:

  • voltage: The variable allocated to store the bus voltage magnitudes and angles.
  • power: The variable allocated to store the active and reactive powers.
  • method: The optimization model.

Example

using Ipopt
 
 system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
-analysis = pmuLavStateEstimation(system, device, Ipopt.Optimizer)
source
JuliaGrid.solve!Method
solve!(system::PowerSystem, analysis::PMUStateEstimation)

By computing the bus voltage magnitudes and angles, the function solves the PMU state estimation model.

Updates

The resulting bus voltage magnitudes and angles are stored in the voltage field of the PMUStateEstimation type.

Examples

Solving the PMU state estimation model and obtaining the WLS estimator:

system = powerSystem("case14.h5")
+analysis = pmuLavStateEstimation(system, device, Ipopt.Optimizer)
source
JuliaGrid.solve!Method
solve!(system::PowerSystem, analysis::PMUStateEstimation)

By computing the bus voltage magnitudes and angles, the function solves the PMU state estimation model.

Updates

The resulting bus voltage magnitudes and angles are stored in the voltage field of the PMUStateEstimation type.

Examples

Solving the PMU state estimation model and obtaining the WLS estimator:

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
 analysis = pmuStateEstimation(system, device)
@@ -89,18 +89,18 @@
 device = measurement("measurement14.h5")
 
 analysis = pmuLavStateEstimation(system, device, Ipopt.Optimizer)
-solve!(system, analysis)
source

DC State Estimation

JuliaGrid.dcStateEstimationFunction
dcStateEstimation(system::PowerSystem, device::Measurement, [method = LU])

The function establishes the WLS model for DC state estimation, where the vector of state variables contains only bus voltage angles.

Arguments

This function requires the PowerSystem and Measurement composite types to establish the WLS state estimation model.

Moreover, the presence of the method parameter is not mandatory. To address the WLS state estimation method, users can opt to utilize factorization techniques to decompose the gain matrix, such as LU, QR, or LDLt especially when the gain matrix is symmetric. Opting for the Orthogonal method is advisable for a more robust solution in scenarios involving ill-conditioned data, particularly when substantial variations in variances are present.

If the user does not provide the method, the default method for solving the estimation model will be LU factorization.

Updates

If the DC model was not created, the function will automatically initiate an update of the dc field within the PowerSystem composite type. Additionally, if the slack bus lacks an in-service generator, JuliaGrid considers it a mistake and defines a new slack bus as the first generator bus with an in-service generator in the bus type list.

Returns

The function returns an instance of the DCStateEstimation type, which includes the following fields:

  • voltage: The variable allocated to store the bus voltage angles.
  • power: The variable allocated to store the active powers.
  • method: The system model vectors and matrices.

Examples

Set up the DC state estimation model to be solved using the default LU factorization:

system = powerSystem("case14.h5")
+solve!(system, analysis)
source

DC State Estimation

JuliaGrid.dcStateEstimationFunction
dcStateEstimation(system::PowerSystem, device::Measurement, [method = LU])

The function establishes the WLS model for DC state estimation, where the vector of state variables contains only bus voltage angles.

Arguments

This function requires the PowerSystem and Measurement composite types to establish the WLS state estimation model.

Moreover, the presence of the method parameter is not mandatory. To address the WLS state estimation method, users can opt to utilize factorization techniques to decompose the gain matrix, such as LU, QR, or LDLt especially when the gain matrix is symmetric. Opting for the Orthogonal method is advisable for a more robust solution in scenarios involving ill-conditioned data, particularly when substantial variations in variances are present.

If the user does not provide the method, the default method for solving the estimation model will be LU factorization.

Updates

If the DC model was not created, the function will automatically initiate an update of the dc field within the PowerSystem composite type. Additionally, if the slack bus lacks an in-service generator, JuliaGrid considers it a mistake and defines a new slack bus as the first generator bus with an in-service generator in the bus type list.

Returns

The function returns an instance of the DCStateEstimation type, which includes the following fields:

  • voltage: The variable allocated to store the bus voltage angles.
  • power: The variable allocated to store the active powers.
  • method: The system model vectors and matrices.

Examples

Set up the DC state estimation model to be solved using the default LU factorization:

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
 analysis = dcStateEstimation(system, device)

Set up the DC state estimation model to be solved using the orthogonal method:

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
-analysis = dcStateEstimation(system, device, Orthogonal)
source
JuliaGrid.dcLavStateEstimationFunction
dcLavStateEstimation(system::PowerSystem, device::Measurement, optimizer)

The function establishes the LAV model for DC state estimation, where the vector of state variables contains only bus voltage angles.

Arguments

This function requires the PowerSystem and Measurement composite types to establish the LAV state estimation model. The LAV method offers increased robustness compared to WLS, ensuring unbiasedness even in the presence of various measurement errors and outliers.

Users can employ the LAV method to find an estimator by choosing one of the available optimization solvers. Typically, Ipopt.Optimizer suffices for most scenarios.

Updates

If the DC model was not created, the function will automatically initiate an update of the dc field within the PowerSystem composite type. Additionally, if the slack bus lacks an in-service generator, JuliaGrid considers it a mistake and defines a new slack bus as the first generator bus with an in-service generator in the bus type list.

Returns

The function returns an instance of the DCStateEstimation abstract type, which includes the following fields:

  • voltage: The variable allocated to store the bus voltage angles.
  • power: The variable allocated to store the active powers.
  • method: The optimization model.

Example

using Ipopt
+analysis = dcStateEstimation(system, device, Orthogonal)
source
JuliaGrid.dcLavStateEstimationFunction
dcLavStateEstimation(system::PowerSystem, device::Measurement, optimizer)

The function establishes the LAV model for DC state estimation, where the vector of state variables contains only bus voltage angles.

Arguments

This function requires the PowerSystem and Measurement composite types to establish the LAV state estimation model. The LAV method offers increased robustness compared to WLS, ensuring unbiasedness even in the presence of various measurement errors and outliers.

Users can employ the LAV method to find an estimator by choosing one of the available optimization solvers. Typically, Ipopt.Optimizer suffices for most scenarios.

Updates

If the DC model was not created, the function will automatically initiate an update of the dc field within the PowerSystem composite type. Additionally, if the slack bus lacks an in-service generator, JuliaGrid considers it a mistake and defines a new slack bus as the first generator bus with an in-service generator in the bus type list.

Returns

The function returns an instance of the DCStateEstimation abstract type, which includes the following fields:

  • voltage: The variable allocated to store the bus voltage angles.
  • power: The variable allocated to store the active powers.
  • method: The optimization model.

Example

using Ipopt
 
 system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
-analysis = dcLavStateEstimation(system, device, Ipopt.Optimizer)
source
JuliaGrid.solve!Method
solve!(system::PowerSystem, analysis::DCStateEstimation)

By computing the bus voltage angles, the function solves the DC state estimation model.

Updates

The resulting bus voltage angles are stored in the voltage field of the DCStateEstimation type.

Examples

Solving the DC state estimation model and obtaining the WLS estimator:

system = powerSystem("case14.h5")
+analysis = dcLavStateEstimation(system, device, Ipopt.Optimizer)
source
JuliaGrid.solve!Method
solve!(system::PowerSystem, analysis::DCStateEstimation)

By computing the bus voltage angles, the function solves the DC state estimation model.

Updates

The resulting bus voltage angles are stored in the voltage field of the DCStateEstimation type.

Examples

Solving the DC state estimation model and obtaining the WLS estimator:

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
 analysis = dcStateEstimation(system, device)
@@ -110,7 +110,7 @@
 device = measurement("measurement14.h5")
 
 analysis = dcLavStateEstimation(system, device, Ipopt.Optimizer)
-solve!(system, analysis)
source

Bad Data Analysis

JuliaGrid.residualTest!Function
residualTest!(system::PowerSystem, device::Measurement, analysis::StateEstimation;
+solve!(system, analysis)
source

Bad Data Analysis

JuliaGrid.residualTest!Function
residualTest!(system::PowerSystem, device::Measurement, analysis::StateEstimation;
     threshold)

The function conducts bad data detection and identification using the largest normalized residual test, subsequently removing measurement outliers from the measurement set. It can be executed after obtaining WLS estimator.

Arguments

This function requires the types PowerSystem, Measurement, and StateEstimation. The abstract type StateEstimation can have the following subtypes:

  • ACStateEstimation: Conducts bad data analysis within AC state estimation.
  • PMUStateEstimation: Conducts bad data analysis within PMU state estimation.
  • DCStateEstimation: Conducts bad data analysis within DC state estimation.

Keyword

The keyword threshold establishes the identification threshold. If the largest normalized residual surpasses this threshold, the measurement is flagged as bad data. The default threshold value is set to threshold = 3.0.

Updates

If bad data is detected, the function flags the corresponding measurement within the Measurement type as out-of-service.

Moreover, for DCStateEstimation and PMUStateEstimation types, the function removes the corresponding measurement from the coefficient matrix and mean vector. This facilitates direct progress to the function that solves the state estimation problem.

Returns

The function returns an instance of the BadData type, which includes:

  • detect: Returns true after the function's execution if bad data is detected.
  • maxNormalizedResidual: Denotes the value of the largest normalized residual.
  • label: Signifies the label of the bad data.
  • index: Represents the index of the bad data.

Example

system = powerSystem("case14.h5")
 device = measurement("measurement14.h5")
 
@@ -118,4 +118,4 @@
 solve!(system, analysis)
 
 outlier = residualTest!(system, device, analysis; threshold = 4.0)
-solve!(system, analysis)
source
+solve!(system, analysis)source diff --git a/dev/background/bibliography/index.html b/dev/background/bibliography/index.html index f368fcba..edf62016 100644 --- a/dev/background/bibliography/index.html +++ b/dev/background/bibliography/index.html @@ -1,2 +1,2 @@ -Bibliography · JuliaGrid

Bibliography

[1]
A. Gomez-Exposito, A. Abur, P. Rousseaux, A. de la Villa Jaen and C. Gomez-Quiles. On the use of PMUs in power system state estimation. In: 17th power system computation conference (2011).
[2]
G. N. Korres. Observability analysis based on Echelon form of a reduced dimensional Jacobian matrix. IEEE Transactions on Power Systems 26, 2572–2573 (2011).
[3]
M. Zhou, V. A. Centeno, J. S. Thorp and A. G. Phadke. An alternative for including phasor measurements in state estimators. IEEE transactions on power systems 21, 1930–1937 (2006).
[4]
G. Korres and N. Manousakis. State estimation and observability analysis for phasor measurement unit measured systems. IET generation, transmission & distribution 6, 902–913 (2012).
[5]
A. Abur and A. G. Exposito. Power system state estimation: theory and implementation (CRC press, 2004).
[6]
G. Andersson. Power system analysis. EEH-Power Systems Laboratory, ETH Zurich, Lecture Notes, 227–0526 (2012).
[7]
J. J. Grainger and W. D. Stevenson. Power system analysis (McGraw-Hill, 1994).
[8]
R. D. Zimmerman and C. E. Murillo-Sánchez. Matpower 6.0 users manual. Power Systems Engineering Research Center 9 (2016).
[9]
A. J. Wood, B. F. Wollenberg and G. B. Sheblé. Power generation, operation, and control (John Wiley & Sons, 2013).
[10]
R. A. Van Amerongen. A general-purpose version of the fast decoupled load flow. IEEE Transactions on Power Systems 4, 760–770 (1989).
[11]
D. P. Chassin, P. R. Armstrong, D. G. Chavarrı́a-Miranda and R. T. Guttromson. Gauss-Seidel accelerated: implementing flow solvers on field programmable gate arrays. In: 2006 IEEE Power Engineering Society General Meeting (IEEE, 2006); p. 5–pp.
[12]
F. C. Schweppe and D. B. Rom. Power system static-state estimation, Part II: Approximate model. IEEE Transactions on Power Apparatus and Systems, 125–130 (1970).
[13]
A. Monticelli. State estimation in electric power systems: a generalized approach (Springer Science & Business Media, 2012).
[14]
A. G. Phadke and J. S. Thorp. Synchronized phasor measurements and their applications. Vol. 1 no. 2017 (Springer, 2008).
[15]
D. Barber. Bayesian reasoning and machine learning (Cambridge University Press, 2012).
[16]
I. ISO. and B. OIML. Guide to the Expression of Uncertainty in Measurement (Aenor, 1993).
[17]
Y. Weng, Q. Li, R. Negi and M. Ilić. Semidefinite programming for power system state estimation. In: 2012 IEEE Power and Energy Society General Meeting (IEEE, 2012); pp. 1–8.
[18]
P. C. Hansen, V. Pereyra and G. Scherer. Least squares data fitting with applications (JHU Press, 2013).
[19]
G. N. Korres. A distributed multiarea state estimation. IEEE Transactions on Power Systems 26, 73–84 (2010).
[20]
M. Cosovic, M. Delalic, D. Raca and D. Vukobratovic. Observability analysis for large-scale power systems using factor graphs. IEEE Transactions on Power Systems 36, 4791–4799 (2021).
[21]
H. Horisberger. Observability analysis for power systems with measurement deficiencies. IFAC Proceedings Volumes 18, 51–58 (1985).
[22]
N. M. Manousakis and G. N. Korres. Observability analysis for power systems including conventional and phasor measurements. IET Conference Proceedings, 158-158(1) (2010).
[23]
B. Gou. Optimal placement of PMUs by integer linear programming. IEEE Transactions on power systems 23, 1525–1526 (2008).
[24]
B. Xu and A. Abur. Observability analysis and measurement placement for systems with PMUs. In: IEEE PES Power Systems Conference and Exposition, 2004. (IEEE, 2004); pp. 943–946.
+Bibliography · JuliaGrid

Bibliography

[1]
A. Gomez-Exposito, A. Abur, P. Rousseaux, A. de la Villa Jaen and C. Gomez-Quiles. On the use of PMUs in power system state estimation. In: 17th power system computation conference (2011).
[2]
G. N. Korres. Observability analysis based on Echelon form of a reduced dimensional Jacobian matrix. IEEE Transactions on Power Systems 26, 2572–2573 (2011).
[3]
M. Zhou, V. A. Centeno, J. S. Thorp and A. G. Phadke. An alternative for including phasor measurements in state estimators. IEEE transactions on power systems 21, 1930–1937 (2006).
[4]
G. Korres and N. Manousakis. State estimation and observability analysis for phasor measurement unit measured systems. IET generation, transmission & distribution 6, 902–913 (2012).
[5]
A. Abur and A. G. Exposito. Power system state estimation: theory and implementation (CRC press, 2004).
[6]
G. Andersson. Power system analysis. EEH-Power Systems Laboratory, ETH Zurich, Lecture Notes, 227–0526 (2012).
[7]
J. J. Grainger and W. D. Stevenson. Power system analysis (McGraw-Hill, 1994).
[8]
R. D. Zimmerman and C. E. Murillo-Sánchez. Matpower 6.0 users manual. Power Systems Engineering Research Center 9 (2016).
[9]
A. J. Wood, B. F. Wollenberg and G. B. Sheblé. Power generation, operation, and control (John Wiley & Sons, 2013).
[10]
R. A. Van Amerongen. A general-purpose version of the fast decoupled load flow. IEEE Transactions on Power Systems 4, 760–770 (1989).
[11]
D. P. Chassin, P. R. Armstrong, D. G. Chavarrı́a-Miranda and R. T. Guttromson. Gauss-Seidel accelerated: implementing flow solvers on field programmable gate arrays. In: 2006 IEEE Power Engineering Society General Meeting (IEEE, 2006); p. 5–pp.
[12]
F. C. Schweppe and D. B. Rom. Power system static-state estimation, Part II: Approximate model. IEEE Transactions on Power Apparatus and Systems, 125–130 (1970).
[13]
A. Monticelli. State estimation in electric power systems: a generalized approach (Springer Science & Business Media, 2012).
[14]
A. G. Phadke and J. S. Thorp. Synchronized phasor measurements and their applications. Vol. 1 no. 2017 (Springer, 2008).
[15]
D. Barber. Bayesian reasoning and machine learning (Cambridge University Press, 2012).
[16]
I. ISO. and B. OIML. Guide to the Expression of Uncertainty in Measurement (Aenor, 1993).
[17]
Y. Weng, Q. Li, R. Negi and M. Ilić. Semidefinite programming for power system state estimation. In: 2012 IEEE Power and Energy Society General Meeting (IEEE, 2012); pp. 1–8.
[18]
P. C. Hansen, V. Pereyra and G. Scherer. Least squares data fitting with applications (JHU Press, 2013).
[19]
G. N. Korres. A distributed multiarea state estimation. IEEE Transactions on Power Systems 26, 73–84 (2010).
[20]
M. Cosovic, M. Delalic, D. Raca and D. Vukobratovic. Observability analysis for large-scale power systems using factor graphs. IEEE Transactions on Power Systems 36, 4791–4799 (2021).
[21]
H. Horisberger. Observability analysis for power systems with measurement deficiencies. IFAC Proceedings Volumes 18, 51–58 (1985).
[22]
N. M. Manousakis and G. N. Korres. Observability analysis for power systems including conventional and phasor measurements. IET Conference Proceedings, 158-158(1) (2010).
[23]
B. Gou. Optimal placement of PMUs by integer linear programming. IEEE Transactions on power systems 23, 1525–1526 (2008).
[24]
B. Xu and A. Abur. Observability analysis and measurement placement for systems with PMUs. In: IEEE PES Power Systems Conference and Exposition, 2004. (IEEE, 2004); pp. 943–946.
diff --git a/dev/background/installation/index.html b/dev/background/installation/index.html index 04eab420..d3be3fa0 100644 --- a/dev/background/installation/index.html +++ b/dev/background/installation/index.html @@ -1,4 +1,4 @@ Installation Guide · JuliaGrid

Installation Guide

JuliaGrid is compatible with Julia version 1.9 and later. To get started with JuliaGrid, users should first install Julia and consider using a code editor for a smoother coding experience.


Install Julia

Begin by downloading and installing Julia. We can choose either the Current Stable Release or the Long-term Support Release.

The Current Stable Release is the most recent version of Julia, providing access to the latest features and typically offering better performance. For most users, we recommend installing the Current Stable Release. The Long-term Support Release is an older version of Julia that has continued to receive bug and security fixes. However, it may not have the latest features or performance improvements.


Install Code Editor

For a smoother development experience, we recommend using a code editor. While you can write Julia code in any text editor, using an integrated development environment (IDE) makes coding easier and more efficient. We suggest installing Visual Studio Code, which provides excellent support for Julia through its dedicated Julia extension. Visual Studio Code offers features like syntax highlighting, debugging, and autocompletion, making it an ideal choice for both beginners and experienced users.

The Julia extension for Visual Studio Code includes built-in dynamic autocompletion, inline results, plot pane, integrated REPL, variable view, code navigation, and many other advanced language features. For a step-by-step guide on how to use Julia in Visual Studio Code, you can follow the tutorial available here.


Install JuliaGrid

To get the JuliaGrid package installed, execute the following Julia command:

import Pkg
 Pkg.add("JuliaGrid")

When a new version of JuliaGrid is released, you can update it with the following command:

import Pkg
-Pkg.update("JuliaGrid")
+Pkg.update("JuliaGrid") diff --git a/dev/index.html b/dev/index.html index a18ef02a..25535954 100644 --- a/dev/index.html +++ b/dev/index.html @@ -88,4 +88,4 @@ solve!(system, analysis) # Compute estimate of voltage angles residualTest!(system, device, analysis) # Perform bad data analysis and remove outlier -solve!(system, analysis) # Recompute voltage angles with the updated model

Contributors

+solve!(system, analysis) # Recompute voltage angles with the updated model

Contributors

diff --git a/dev/manual/acOptimalPowerFlow/index.html b/dev/manual/acOptimalPowerFlow/index.html index df1fbdd2..99b9b2c6 100644 --- a/dev/manual/acOptimalPowerFlow/index.html +++ b/dev/manual/acOptimalPowerFlow/index.html @@ -138,4 +138,4 @@ | Bus 1 | 0.9280 | 9.7403 | 0.0000 | 0.0000 | -0.0000 | 3.0806 | 0.0000 | -0.0000 | | Bus 2 | 0.9140 | 11.6479 | 10.0000 | 1.0000 | 8.5166 | -3.2874 | 3.3417 | -0.0000 | | Bus 3 | 0.9000 | 9.1613 | 5.0000 | 2.0000 | -5.0000 | -2.0000 | 0.0000 | -0.0000 | -|-------------------------------------------------------------------------------------------|
Active and Reactive Power Injection

To calculate the active and reactive power injection associated with a specific bus, the function can be used:

julia> active, reactive = injectionPower(system, analysis; label = "Bus 1")(-9.612864106285646e-9, 0.030805631272862018)

Active and Reactive Power Injection from Generators

To calculate the active and reactive power injection from the generators at a specific bus, the function can be used:

julia> active, reactive = supplyPower(system, analysis; label = "Bus 2")(0.18516606807837058, -0.022874155704311887)

Active and Reactive Power at Shunt Element

To calculate the active and reactive power associated with shunt element at a specific bus, the function can be used:

julia> active, reactive = shuntPower(system, analysis; label = "Bus 2")(0.033417015994749506, -0.0)

Active and Reactive Power Flow

Similarly, we can compute the active and reactive power flow at both the from-bus and to-bus ends of the specific branch by utilizing the provided functions below:

julia> active, reactive = fromPower(system, analysis; label = "Branch 2")(0.0171841141656561, 0.013096900696542745)
julia> active, reactive = toPower(system, analysis; label = "Branch 2")(-0.016754104690082913, -0.02075951689659613)

Active and Reactive Power at Charging Admittances

To calculate the total active and reactive power linked with branch charging admittances of the particular branch, the function can be used:

julia> active, reactive = chargingPower(system, analysis; label = "Branch 1")(8.48258844904104e-5, -0.00848258844904104)

Active powers indicate active losses within the branch's charging admittances. Moreover, charging admittances injected reactive powers into the power system due to their capacitive nature, as denoted by a negative sign.


Active and Reactive Power at Series Impedance

To calculate the active and reactive power across the series impedance of the branch, the function can be used:

julia> active, reactive = seriesPower(system, analysis; label = "Branch 2")(0.000346454228992816, 0.0006929084579856317)

The active power also considers active losses originating from the series resistance of the branch, while the reactive power represents reactive losses resulting from the impedance's inductive characteristics.


Current Injection

To calculate the current injection associated with a specific bus, the function can be used:

julia> magnitude, angle = injectionCurrent(system, analysis; label = "Bus 1")(0.03319749105151072, -1.400796638843821)

Current Flow

We can compute the current flow at both the from-bus and to-bus ends of the specific branch by using:

julia> magnitude, angle = fromCurrent(system, analysis; label = "Branch 2")(0.023283650969243567, -0.48123290193360435)
julia> magnitude, angle = toCurrent(system, analysis; label = "Branch 2")(0.0296407806140337, 2.409719424706662)

Current Through Series Impedance

To calculate the current passing through the series impedance of the branch in the direction from the from-bus end to the to-bus end, we can use the following function:

julia> magnitude, angle = seriesCurrent(system, analysis; label = "Branch 2")(0.026323154407966228, -0.6229624867446706)
+|-------------------------------------------------------------------------------------------|
Active and Reactive Power Injection

To calculate the active and reactive power injection associated with a specific bus, the function can be used:

julia> active, reactive = injectionPower(system, analysis; label = "Bus 1")(-9.612864106285646e-9, 0.030805631272862018)

Active and Reactive Power Injection from Generators

To calculate the active and reactive power injection from the generators at a specific bus, the function can be used:

julia> active, reactive = supplyPower(system, analysis; label = "Bus 2")(0.18516606807837058, -0.022874155704311887)

Active and Reactive Power at Shunt Element

To calculate the active and reactive power associated with shunt element at a specific bus, the function can be used:

julia> active, reactive = shuntPower(system, analysis; label = "Bus 2")(0.033417015994749506, -0.0)

Active and Reactive Power Flow

Similarly, we can compute the active and reactive power flow at both the from-bus and to-bus ends of the specific branch by utilizing the provided functions below:

julia> active, reactive = fromPower(system, analysis; label = "Branch 2")(0.0171841141656561, 0.013096900696542745)
julia> active, reactive = toPower(system, analysis; label = "Branch 2")(-0.016754104690082913, -0.02075951689659613)

Active and Reactive Power at Charging Admittances

To calculate the total active and reactive power linked with branch charging admittances of the particular branch, the function can be used:

julia> active, reactive = chargingPower(system, analysis; label = "Branch 1")(8.48258844904104e-5, -0.00848258844904104)

Active powers indicate active losses within the branch's charging admittances. Moreover, charging admittances injected reactive powers into the power system due to their capacitive nature, as denoted by a negative sign.


Active and Reactive Power at Series Impedance

To calculate the active and reactive power across the series impedance of the branch, the function can be used:

julia> active, reactive = seriesPower(system, analysis; label = "Branch 2")(0.000346454228992816, 0.0006929084579856317)

The active power also considers active losses originating from the series resistance of the branch, while the reactive power represents reactive losses resulting from the impedance's inductive characteristics.


Current Injection

To calculate the current injection associated with a specific bus, the function can be used:

julia> magnitude, angle = injectionCurrent(system, analysis; label = "Bus 1")(0.03319749105151072, -1.400796638843821)

Current Flow

We can compute the current flow at both the from-bus and to-bus ends of the specific branch by using:

julia> magnitude, angle = fromCurrent(system, analysis; label = "Branch 2")(0.023283650969243567, -0.48123290193360435)
julia> magnitude, angle = toCurrent(system, analysis; label = "Branch 2")(0.0296407806140337, 2.409719424706662)

Current Through Series Impedance

To calculate the current passing through the series impedance of the branch in the direction from the from-bus end to the to-bus end, we can use the following function:

julia> magnitude, angle = seriesCurrent(system, analysis; label = "Branch 2")(0.026323154407966228, -0.6229624867446706)
diff --git a/dev/manual/acPowerFlow/index.html b/dev/manual/acPowerFlow/index.html index f5648b9e..2e4fdc57 100644 --- a/dev/manual/acPowerFlow/index.html +++ b/dev/manual/acPowerFlow/index.html @@ -334,4 +334,4 @@ Bus 4: 0.0

We can observe that the angles have been calculated based on the new slack bus. JuliaGrid offers the function to adjust these angles to match the original slack bus as follows:

adjustAngle!(system, analysis; slack = "Bus 1")

After executing the above code, the updated results can be viewed:

julia> print(system.bus.label, analysis.voltage.angle)Bus 1: 0.0
 Bus 2: -0.013015872071430158
 Bus 3: -0.0028853575840858334
-Bus 4: -0.013581064245677444
+Bus 4: -0.013581064245677444 diff --git a/dev/manual/acStateEstimation/index.html b/dev/manual/acStateEstimation/index.html index 0a3ba3ed..7f644b55 100644 --- a/dev/manual/acStateEstimation/index.html +++ b/dev/manual/acStateEstimation/index.html @@ -330,4 +330,4 @@ io = IOBuffer() printWattmeterData(system, device, analysis, io; style = false) -CSV.write("bus.csv", CSV.File(take!(io); delim = "|"))
Active and Reactive Power Injection

To calculate the active and reactive power injection associated with a specific bus, the function can be used:

julia> active, reactive = injectionPower(system, analysis; label = "Bus 1")(2.6951392445386304, 0.3132044957940553)

Active and Reactive Power Injection from Generators

To calculate the active and reactive power injection from the generators at a specific bus, the function can be used:

julia> active, reactive = supplyPower(system, analysis; label = "Bus 1")(2.6951392445386304, 0.3132044957940553)

Active and Reactive Power at Shunt Element

To calculate the active and reactive power associated with shunt element at a specific bus, the function can be used:

julia> active, reactive = shuntPower(system, analysis; label = "Bus 1")(0.0, -0.0020066379525219783)

Active and Reactive Power Flow

Similarly, we can compute the active and reactive power flow at both the from-bus and to-bus ends of the specific branch by utilizing the provided functions below:

julia> active, reactive = fromPower(system, analysis; label = "Branch 2")(1.6491130561317449, 0.2562114962034585)
julia> active, reactive = toPower(system, analysis; label = "Branch 2")(-1.5932872079562321, -0.15530958620622967)

Active and Reactive Power at Charging Admittances

To calculate the active and reactive power linked with branch charging admittances of the particular branch, the function can be used:

julia> active, reactive = chargingPower(system, analysis; label = "Branch 1")(9.800363372293906e-5, -0.03920145348917562)

Active powers indicate active losses within the branch's charging admittances. Moreover, charging admittances injected reactive powers into the power system due to their capacitive nature, as denoted by a negative sign.


Active and Reactive Power at Series Impedance

To calculate the active and reactive power across the series impedance of the branch, the function can be used:

julia> active, reactive = seriesPower(system, analysis; label = "Branch 2")(0.05572979175205785, 0.13932447938014464)

The active power also considers active losses originating from the series resistance of the branch, while the reactive power represents reactive losses resulting from the impedance's inductive characteristics.


Current Injection

To calculate the current injection associated with a specific bus, the function can be used:

julia> magnitude, angle = injectionCurrent(system, analysis; label = "Bus 1")(2.708785622827216, -0.11569193435017798)

Current Flow

We can compute the current flow at both the from-bus and to-bus ends of the specific branch by utilizing the provided functions below:

julia> magnitude, angle = fromCurrent(system, analysis; label = "Branch 2")(1.6661346611128287, -0.1541309681169004)
julia> magnitude, angle = toCurrent(system, analysis; label = "Branch 2")(1.6709804057015962, 2.9641707920912417)

Current Through Series Impedance

To calculate the current passing through the series impedance of the branch in the direction from the from-bus end to the to-bus end, we can use the following function:

julia> magnitude, angle = seriesCurrent(system, analysis; label = "Branch 2")(1.6692781636392697, -0.16599467621735334)
+CSV.write("bus.csv", CSV.File(take!(io); delim = "|"))
Active and Reactive Power Injection

To calculate the active and reactive power injection associated with a specific bus, the function can be used:

julia> active, reactive = injectionPower(system, analysis; label = "Bus 1")(2.6951392445386304, 0.3132044957940553)

Active and Reactive Power Injection from Generators

To calculate the active and reactive power injection from the generators at a specific bus, the function can be used:

julia> active, reactive = supplyPower(system, analysis; label = "Bus 1")(2.6951392445386304, 0.3132044957940553)

Active and Reactive Power at Shunt Element

To calculate the active and reactive power associated with shunt element at a specific bus, the function can be used:

julia> active, reactive = shuntPower(system, analysis; label = "Bus 1")(0.0, -0.0020066379525219783)

Active and Reactive Power Flow

Similarly, we can compute the active and reactive power flow at both the from-bus and to-bus ends of the specific branch by utilizing the provided functions below:

julia> active, reactive = fromPower(system, analysis; label = "Branch 2")(1.6491130561317449, 0.2562114962034585)
julia> active, reactive = toPower(system, analysis; label = "Branch 2")(-1.5932872079562321, -0.15530958620622967)

Active and Reactive Power at Charging Admittances

To calculate the active and reactive power linked with branch charging admittances of the particular branch, the function can be used:

julia> active, reactive = chargingPower(system, analysis; label = "Branch 1")(9.800363372293906e-5, -0.03920145348917562)

Active powers indicate active losses within the branch's charging admittances. Moreover, charging admittances injected reactive powers into the power system due to their capacitive nature, as denoted by a negative sign.


Active and Reactive Power at Series Impedance

To calculate the active and reactive power across the series impedance of the branch, the function can be used:

julia> active, reactive = seriesPower(system, analysis; label = "Branch 2")(0.05572979175205785, 0.13932447938014464)

The active power also considers active losses originating from the series resistance of the branch, while the reactive power represents reactive losses resulting from the impedance's inductive characteristics.


Current Injection

To calculate the current injection associated with a specific bus, the function can be used:

julia> magnitude, angle = injectionCurrent(system, analysis; label = "Bus 1")(2.708785622827216, -0.11569193435017798)

Current Flow

We can compute the current flow at both the from-bus and to-bus ends of the specific branch by utilizing the provided functions below:

julia> magnitude, angle = fromCurrent(system, analysis; label = "Branch 2")(1.6661346611128287, -0.1541309681169004)
julia> magnitude, angle = toCurrent(system, analysis; label = "Branch 2")(1.6709804057015962, 2.9641707920912417)

Current Through Series Impedance

To calculate the current passing through the series impedance of the branch in the direction from the from-bus end to the to-bus end, we can use the following function:

julia> magnitude, angle = seriesCurrent(system, analysis; label = "Branch 2")(1.6692781636392697, -0.16599467621735334)
diff --git a/dev/manual/dcOptimalPowerFlow/index.html b/dev/manual/dcOptimalPowerFlow/index.html index af23e058..dee639f0 100644 --- a/dev/manual/dcOptimalPowerFlow/index.html +++ b/dev/manual/dcOptimalPowerFlow/index.html @@ -140,4 +140,4 @@ | Bus 1 | 9.7403 | 0.0000 | 0.0000 | 0.0000 | | Bus 2 | 9.7405 | 0.1900 | 0.1000 | 0.0900 | | Bus 3 | 9.7402 | 0.0000 | 0.0500 | -0.0500 | -|---------------------------------------------------------------------|
Active Power Injection

To calculate active power injection associated with a specific bus, the function can be used:

julia> active = injectionPower(system, analysis; label = "Bus 2")0.0008999999999991246

Active Power Injection from Generators

To calculate active power injection from the generators at a specific bus, the function can be used:

julia> active = supplyPower(system, analysis; label = "Bus 2")0.0018999999999991246

Active Power Flow

Similarly, we can compute the active power flow at both the from-bus and to-bus ends of the specific branch by utilizing the provided functions below:

julia> active = fromPower(system, analysis; label = "Branch 2")7.142857142983239e-5
julia> active = toPower(system, analysis; label = "Branch 2")-7.142857142983239e-5
+|---------------------------------------------------------------------|
Active Power Injection

To calculate active power injection associated with a specific bus, the function can be used:

julia> active = injectionPower(system, analysis; label = "Bus 2")0.0008999999999991246

Active Power Injection from Generators

To calculate active power injection from the generators at a specific bus, the function can be used:

julia> active = supplyPower(system, analysis; label = "Bus 2")0.0018999999999991246

Active Power Flow

Similarly, we can compute the active power flow at both the from-bus and to-bus ends of the specific branch by utilizing the provided functions below:

julia> active = fromPower(system, analysis; label = "Branch 2")7.142857142983239e-5
julia> active = toPower(system, analysis; label = "Branch 2")-7.142857142983239e-5
diff --git a/dev/manual/dcPowerFlow/index.html b/dev/manual/dcPowerFlow/index.html index b092673f..29cb11b9 100644 --- a/dev/manual/dcPowerFlow/index.html +++ b/dev/manual/dcPowerFlow/index.html @@ -127,4 +127,4 @@ | Branch 1 | Bus 1 | Bus 2 | 3.5714 | -3.5714 | 1 | | Branch 2 | Bus 1 | Bus 3 | 11.4286 | -11.4286 | 1 | | Branch 3 | Bus 2 | Bus 3 | -6.4286 | 6.4286 | 1 | -|-----------------------------------------------------------------------|
Active Power Injection

To calculate active power injection associated with a specific bus, the function can be used:

julia> active = injectionPower(system, analysis; label = "Bus 1")0.15000000000000002

Active Power Injection from Generators

To calculate active power injection from the generators at a specific bus, the function can be used:

julia> active = supplyPower(system, analysis; label = "Bus 1")0.15000000000000002

Active Power Flow

Similarly, we can compute the active power flow at both the from-bus and to-bus ends of the specific branch by utilizing the provided functions below:

julia> active = fromPower(system, analysis; label = "Branch 2")0.1142857142857143
julia> active = toPower(system, analysis; label = "Branch 2")-0.1142857142857143

Generator Active Power Output

Finally, we can compute the active power output of a particular generator using the function:

julia> active = generatorPower(system, analysis; label = "Generator 1")0.15000000000000002
+|-----------------------------------------------------------------------|
Active Power Injection

To calculate active power injection associated with a specific bus, the function can be used:

julia> active = injectionPower(system, analysis; label = "Bus 1")0.15000000000000002

Active Power Injection from Generators

To calculate active power injection from the generators at a specific bus, the function can be used:

julia> active = supplyPower(system, analysis; label = "Bus 1")0.15000000000000002

Active Power Flow

Similarly, we can compute the active power flow at both the from-bus and to-bus ends of the specific branch by utilizing the provided functions below:

julia> active = fromPower(system, analysis; label = "Branch 2")0.1142857142857143
julia> active = toPower(system, analysis; label = "Branch 2")-0.1142857142857143

Generator Active Power Output

Finally, we can compute the active power output of a particular generator using the function:

julia> active = generatorPower(system, analysis; label = "Generator 1")0.15000000000000002
diff --git a/dev/manual/dcStateEstimation/index.html b/dev/manual/dcStateEstimation/index.html index 6210085a..2ac88795 100644 --- a/dev/manual/dcStateEstimation/index.html +++ b/dev/manual/dcStateEstimation/index.html @@ -139,4 +139,4 @@ io = IOBuffer() printWattmeterData(system, device, analysis, io; style = false) -CSV.write("bus.csv", CSV.File(take!(io); delim = "|"))
Active Power Injection

To calculate active power injection associated with a specific bus, the function can be used:

julia> active = injectionPower(system, analysis; label = "Bus 1")0.6008333333333332

Active Power Injection from Generators

To calculate active power injection from the generators at a specific bus, the function can be used:

julia> active = supplyPower(system, analysis; label = "Bus 1")0.6008333333333332

Active Power Flow

Similarly, we can compute the active power flow at both the from-bus and to-bus ends of the specific branch by utilizing the provided functions below:

julia> active = fromPower(system, analysis; label = "Branch 1")0.17991666666666667
julia> active = toPower(system, analysis; label = "Branch 1")-0.17991666666666667
+CSV.write("bus.csv", CSV.File(take!(io); delim = "|"))
Active Power Injection

To calculate active power injection associated with a specific bus, the function can be used:

julia> active = injectionPower(system, analysis; label = "Bus 1")0.6008333333333332

Active Power Injection from Generators

To calculate active power injection from the generators at a specific bus, the function can be used:

julia> active = supplyPower(system, analysis; label = "Bus 1")0.6008333333333332

Active Power Flow

Similarly, we can compute the active power flow at both the from-bus and to-bus ends of the specific branch by utilizing the provided functions below:

julia> active = fromPower(system, analysis; label = "Branch 1")0.17991666666666667
julia> active = toPower(system, analysis; label = "Branch 1")-0.17991666666666667
diff --git a/dev/manual/measurementModel/index.html b/dev/manual/measurementModel/index.html index f9d554b3..a8aeac65 100644 --- a/dev/manual/measurementModel/index.html +++ b/dev/manual/measurementModel/index.html @@ -9,15 +9,15 @@ addVoltmeter!(system, device; bus = "Bus 1", magnitude = 1.0, variance = 1e-3) addWattmeter!(system, device; from = "Branch 1", active = 0.2, variance = 1e-4, noise = true)

In this context, we have created the voltmeter responsible for measuring the bus voltage magnitude at Bus 1, with associated mean and variance values expressed in per-units:

julia> [device.voltmeter.magnitude.mean device.voltmeter.magnitude.variance]1×2 Matrix{Float64}:
  1.0  0.001

Furthermore, we have established the wattmeter to measure the active power flow at the from-bus end of Branch 1, with corresponding mean and variance values also expressed in per-units:

julia> [device.wattmeter.active.mean device.wattmeter.active.variance]1×2 Matrix{Float64}:
- 0.203582  0.0001
Tip

The measurement values (i.e., means) can be generated by adding white Gaussian noise with specified variance values to perturb the original values. This can be achieved by setting noise = true within the functions used for adding devices.


Save Model

Once the Measurement type has been created using one of the methods outlined in Build Model, the current data can be stored in the HDF5 file by using saveMeasurement function:

saveMeasurement(device; path = "C:/hdf5/measurement.h5")

All electrical quantities saved in the HDF5 file are in per-units and radians.


Add Voltmeter

We have the option to add voltmeters to a loaded measurement type or to one created from scratch. As an example, we can initiate the Measurement type and then incorporate voltmeters by utilizing the addVoltmeter! function:

system = powerSystem()
+ 0.183734  0.0001
Tip

The measurement values (i.e., means) can be generated by adding white Gaussian noise with specified variance values to perturb the original values. This can be achieved by setting noise = true within the functions used for adding devices.


Save Model

Once the Measurement type has been created using one of the methods outlined in Build Model, the current data can be stored in the HDF5 file by using saveMeasurement function:

saveMeasurement(device; path = "C:/hdf5/measurement.h5")

All electrical quantities saved in the HDF5 file are in per-units and radians.


Add Voltmeter

We have the option to add voltmeters to a loaded measurement type or to one created from scratch. As an example, we can initiate the Measurement type and then incorporate voltmeters by utilizing the addVoltmeter! function:

system = powerSystem()
 device = measurement()
 
 addBus!(system; label = "Bus 1")
 
 addVoltmeter!(system, device; bus = "Bus 1", magnitude = 0.9, variance = 1e-4)
 addVoltmeter!(system, device; bus = "Bus 1", magnitude = 1.0, variance = 1e-3, noise = true)

In this example, we have established two voltmeters designed to measure the bus voltage magnitude at Bus 1. In the case of the second voltmeter, the measurement value is generated internally by introducing white Gaussian noise with the variance added to the magnitude value. As a result, we obtain the following data:

julia> [device.voltmeter.magnitude.mean device.voltmeter.magnitude.variance]2×2 Matrix{Float64}:
- 0.9       0.0001
- 0.935872  0.001
Info

We recommend reading the documentation for the addVoltmeter! function, where we have provided a list of the keywords that can be used.


Customizing Input Units for Keywords

By default, the magnitude and variance keywords are expected to be provided in per-units (pu). However, users have the flexibility to specify these values in volts (V) if they prefer. For instance, consider the following example:

@voltage(kV, rad, V)
+ 0.9      0.0001
+ 1.01096  0.001
Info

We recommend reading the documentation for the addVoltmeter! function, where we have provided a list of the keywords that can be used.


Customizing Input Units for Keywords

By default, the magnitude and variance keywords are expected to be provided in per-units (pu). However, users have the flexibility to specify these values in volts (V) if they prefer. For instance, consider the following example:

@voltage(kV, rad, V)
 
 system = powerSystem()
 device = measurement()
@@ -27,7 +27,7 @@
 addVoltmeter!(system, device; bus = "Bus 1", magnitude = 121.5, variance = 0.0135)
 addVoltmeter!(system, device; bus = "Bus 1", magnitude = 135, variance = 0.135, noise = true)

In this example, we have chosen to specify magnitude and variance in kilovolts (kV). It is important to note that even though we have used kilovolts as the input units, these keywords will still be stored in the per-units:

julia> [device.voltmeter.magnitude.mean device.voltmeter.magnitude.variance]2×2 Matrix{Float64}:
  0.9       0.0001
- 0.949319  0.001
Info

When users choose to input data in volts, measurement values and variances are related to line-to-neutral voltages, while the base values are defined for line-to-line voltages. Therefore, a conversion using $\sqrt{3}$ is necessary. For more information, refer to the Per-Unit System section.


Users have the option to print the voltmeter data in the REPL using any units that have been configured:

printVoltmeterData(system, device)
|-----------------------------------------|
+ 0.968414  0.001
Info

When users choose to input data in volts, measurement values and variances are related to line-to-neutral voltages, while the base values are defined for line-to-line voltages. Therefore, a conversion using $\sqrt{3}$ is necessary. For more information, refer to the Per-Unit System section.


Users have the option to print the voltmeter data in the REPL using any units that have been configured:

printVoltmeterData(system, device)
|-----------------------------------------|
 | Voltmeter Data                          |
 |-----------------------------------------|
 | Label |        Voltage Magnitude        |
@@ -36,7 +36,7 @@
 |       |        [kV] |     [kV] |        |
 |-------|-------------|----------|--------|
 | 1     |    121.5000 | 1.35e-02 |      1 |
-| 2     |    128.1580 | 1.35e-01 |      1 |
+| 2     |    130.7358 | 1.35e-01 |      1 |
 |-----------------------------------------|

Add Ammeter

Users can introduce ammeters into either an existing measurement type or one that they create from the ground up by making use of the addAmmeter! function, as demonstrated in the following example:

system = powerSystem()
 device = measurement()
 
@@ -46,8 +46,8 @@
 
 addAmmeter!(system, device; from = "Branch 1", magnitude = 0.8, variance = 1e-3)
 addAmmeter!(system, device; to = "Branch 1", magnitude = 0.9, variance = 1e-1, noise = true)

In this scenario, we have established one ammeter to measure the branch current magnitude at the from-bus end of Branch 1, as indicated by the use of the from keyword. Similarly, we have added an ammeter to measure the branch current magnitude at the to-bus end of the branch by utilizing the to keyword.

For the first ammeter, we assume that the measurement value is already known, defined by the magnitude. In contrast, for the second ammeter, the measurement value is generated by adding white Gaussian noise with the variance to the magnitude value. These actions result in the following outcomes:

julia> [device.ammeter.magnitude.mean device.ammeter.magnitude.variance]2×2 Matrix{Float64}:
- 0.8       0.001
- 0.842405  0.1
Info

We recommend reading the documentation for the addAmmeter! function, where we have provided a list of the keywords that can be used.


Customizing Input Units for Keywords

By default, the magnitude and variance keywords are expected to be provided in per-unit (pu). However, users have the flexibility to express these values in amperes (A) if they prefer. Take a look at the following example:

@current(A, rad)
+ 0.8      0.001
+ 1.12129  0.1
Info

We recommend reading the documentation for the addAmmeter! function, where we have provided a list of the keywords that can be used.


Customizing Input Units for Keywords

By default, the magnitude and variance keywords are expected to be provided in per-unit (pu). However, users have the flexibility to express these values in amperes (A) if they prefer. Take a look at the following example:

@current(A, rad)
 
 system = powerSystem()
 device = measurement()
@@ -59,7 +59,7 @@
 addAmmeter!(system, device; from = "Branch 1", magnitude = 342.13, variance = 0.428)
 addAmmeter!(system, device; to = "Branch 1", magnitude = 385, variance = 42.8, noise = true)

In this example, we have opted to specify the magnitude and variance in amperes (A). It is worth noting that, despite using amperes as the input units, these keywords will still be stored in the per-unit system:

julia> [device.ammeter.magnitude.mean device.ammeter.magnitude.variance]2×2 Matrix{Float64}:
  0.799992  0.00100078
- 0.669995  0.100078

Users have the option to print the ammeter data in the REPL using any units that have been configured:

printAmmeterData(system, device)
|-----------------------------------------|
+ 1.37437   0.100078

Users have the option to print the ammeter data in the REPL using any units that have been configured:

printAmmeterData(system, device)
|-----------------------------------------|
 | Ammeter Data                            |
 |-----------------------------------------|
 | Label |        Current Magnitude        |
@@ -68,7 +68,7 @@
 |       |         [A] |      [A] |        |
 |-------|-------------|----------|--------|
 | 1     |    342.1300 | 4.28e-01 |      1 |
-| 2     |    286.5345 | 4.28e+01 |      1 |
+| 2     |    587.7708 | 4.28e+01 |      1 |
 |-----------------------------------------|

Add Wattmeter

Users can include wattmeters in either an existing measurement type or one that they create from scratch by utilizing the addWattmeter! function, as demonstrated in the following example:

system = powerSystem()
 device = measurement()
 
@@ -81,7 +81,7 @@
 addWattmeter!(system, device; to = "Branch 1", active = 0.1, variance = 1e-3, noise = true)

In this scenario, one wattmeter has been added to measure the active power injection at Bus 1, as indicated by the use of the bus keyword. Additionally, two wattmeters have been introduced to measure the active power flow on both sides of Branch 1 using the from and to keywords.

For the first and second wattmeters, we assume that the measurement values are already known, defined by the active. In contrast, for the third wattmeter, the measurement value is generated by adding white Gaussian noise with the variance to the active value. As a result, the measurement data is as follows:

julia> [device.wattmeter.active.mean device.wattmeter.active.variance]3×2 Matrix{Float64}:
  0.6       0.001
  0.3       0.01
- 0.120745  0.001
Info

We recommend reading the documentation for the addWattmeter! function, where we have provided a list of the keywords that can be used.


Customizing Input Units for Keywords

By default, the active and variance keywords are expected to be provided in per-unit (pu) values. However, users have the option to express these values in watts (W) if they prefer, as demonstrated in the following example:

@power(MW, pu, pu)
+ 0.149964  0.001
Info

We recommend reading the documentation for the addWattmeter! function, where we have provided a list of the keywords that can be used.


Customizing Input Units for Keywords

By default, the active and variance keywords are expected to be provided in per-unit (pu) values. However, users have the option to express these values in watts (W) if they prefer, as demonstrated in the following example:

@power(MW, pu, pu)
 
 system = powerSystem()
 device = measurement()
@@ -95,7 +95,7 @@
 addWattmeter!(system, device; to = "Branch 1", active = 10, variance = 1e-1, noise = true)

In this example, we have chosen to specify the active and variance in megawatts (MW), but even though we have used megawatts as the input units, these keywords will still be stored in the per-unit system:

julia> [device.wattmeter.active.mean device.wattmeter.active.variance]3×2 Matrix{Float64}:
  0.6       0.001
  0.3       0.01
- 0.105573  0.001

Users have the option to print the wattmeter data in the REPL using any units that have been configured:

printWattmeterData(system, device)
|-----------------------------------------|
+ 0.108772  0.001

Users have the option to print the wattmeter data in the REPL using any units that have been configured:

printWattmeterData(system, device)
|-----------------------------------------|
 | Wattmeter Data                          |
 |-----------------------------------------|
 | Label |          Active Power           |
@@ -105,7 +105,7 @@
 |-------|-------------|----------|--------|
 | 1     |     60.0000 | 1.00e-01 |      1 |
 | 2     |     30.0000 | 1.00e+00 |      1 |
-| 3     |     10.5573 | 1.00e-01 |      1 |
+| 3     |     10.8772 | 1.00e-01 |      1 |
 |-----------------------------------------|

Add Varmeter

To include varmeters, the same approach as described in the Add Wattmeter section can be applied, but here, we make use of the addVarmeter! function, as demonstrated in the following example:

system = powerSystem()
 device = measurement()
 
@@ -118,7 +118,7 @@
 addVarmeter!(system, device; to = "Branch 1", reactive = 0.05, variance = 1e-3, noise = true)

In this context, one varmeter has been added to measure the reactive power injection at Bus 1, as indicated by the use of the bus keyword. Additionally, two varmeters have been introduced to measure the reactive power flow on both sides of Branch 1 using the from and to keywords. As a result, the following outcomes are observed:

julia> [device.varmeter.reactive.mean device.varmeter.reactive.variance]3×2 Matrix{Float64}:
  0.2        0.001
  0.1        0.01
- 0.0511655  0.001
Info

We recommend reading the documentation for the addVarmeter! function, where we have provided a list of the keywords that can be used.


Customizing Input Units for Keywords

Just as we explained for the previous device, users have the flexibility to select units different from per-units. In this case, they can opt for megavolt-ampere reactive (MVAr), as illustrated in the following example:

@power(pu, MVAr, pu)
+ 0.0687125  0.001
Info

We recommend reading the documentation for the addVarmeter! function, where we have provided a list of the keywords that can be used.


Customizing Input Units for Keywords

Just as we explained for the previous device, users have the flexibility to select units different from per-units. In this case, they can opt for megavolt-ampere reactive (MVAr), as illustrated in the following example:

@power(pu, MVAr, pu)
 
 system = powerSystem()
 device = measurement()
@@ -132,7 +132,7 @@
 addVarmeter!(system, device; to = "Branch 1", reactive = 5, variance = 1e-1, noise = true)

JuliaGrid will still store the values in the per-unit system:

julia> [device.varmeter.reactive.mean device.varmeter.reactive.variance]3×2 Matrix{Float64}:
  0.2        0.001
  0.1        0.01
- 0.0279379  0.001

Users have the option to print the varmeter data in the REPL using any units that have been configured:

printVarmeterData(system, device)
|-----------------------------------------|
+ 0.0416266  0.001

Users have the option to print the varmeter data in the REPL using any units that have been configured:

printVarmeterData(system, device)
|-----------------------------------------|
 | Varmeter Data                           |
 |-----------------------------------------|
 | Label |         Reactive Power          |
@@ -142,7 +142,7 @@
 |-------|-------------|----------|--------|
 | 1     |     20.0000 | 1.00e-01 |      1 |
 | 2     |     10.0000 | 1.00e+00 |      1 |
-| 3     |      2.7938 | 1.00e-01 |      1 |
+| 3     |      4.1627 | 1.00e-01 |      1 |
 |-----------------------------------------|

Add PMU

Users have the capability to incorporate PMUs into either an existing measurement type or create one from scratch by utilizing the addPmu! function, as demonstrated in the following example:

system = powerSystem()
 device = measurement()
 
@@ -153,11 +153,11 @@
 addPmu!(system, device; bus = "Bus 1", magnitude = 1.1, angle = 0.1, varianceMagnitude = 0.1)
 addPmu!(system, device; from = "Branch 1", magnitude = 1.0, angle = -0.2, noise = true)
 addPmu!(system, device; to = "Branch 1", magnitude = 0.9, angle = 0.0, varianceAngle = 0.001)
Info

While the typical understanding of a PMU encompasses a device that measures the bus voltage phasor and all branch current phasors incident to the bus, we have chosen to deconstruct this concept to offer users increased flexibility. As a result, our approach yields PMUs that measure individual phasors, each described with magnitude and angle, along with corresponding variances, all presented in the polar coordinate system.

In this context, one PMU has been added to measure the bus voltage phasor at Bus 1, as indicated by the use of the bus keyword. Additionally, two PMUs have been introduced to measure the branch current phasors on both sides of Branch 1 using the from and to keywords.

For the first and third PMUs, we assume that the measurement values are already known, defined by the magnitude and angle keywords. However, for the second PMU, we generate the measurement value by adding white Gaussian noise with varianceMagnitude and varianceAngle to the magnitude and angle values, respectively. It is important to note that when we omit specifying variance values, we rely on their default settings, both of which are equal to 1e-5. As a result, we observe the following outcomes:

julia> [device.pmu.magnitude.mean device.pmu.magnitude.variance]3×2 Matrix{Float64}:
- 1.1       0.1
- 0.998524  1.0e-5
- 0.9       1.0e-5
julia> [device.pmu.angle.mean device.pmu.angle.variance]3×2 Matrix{Float64}: + 1.1 0.1 + 1.00501 1.0e-5 + 0.9 1.0e-5
julia> [device.pmu.angle.mean device.pmu.angle.variance]3×2 Matrix{Float64}: 0.1 1.0e-5 - -0.204363 1.0e-5 + -0.199908 1.0e-5 0.0 0.001
Info

We recommend reading the documentation for the addPmu! function, where we have provided a list of the keywords that can be used.


Coordinate Systems and Correlated Measurement Errors

When users add PMUs, the incorporation of these measurements into the state estimation model is always in the rectangular coordinate system. In this scenario, the real and imaginary components of the phasor measurements become correlated, although typically these correlations are disregarded [1]. However, if users want to consider these error correlations, the keyword correlated = true is provided for support.

Further, in the AC state estimation model, users have the flexibility to integrate PMU outputs in the polar coordinate system by specifying polar = true.

For example, let us add PMUs:

addPmu!(system, device; bus = "Bus 2", magnitude = 0.9, angle = 0, correlated = true)
 addPmu!(system, device; bus = "Bus 2", magnitude = 0.9, angle = 0, polar = true)

In the case of linear state estimation using PMUs only, both PMUs will be integrated into the rectangular coordinate system because the polar keyword is only related to AC state estimation. The treatment of the first PMU assumes error correlation between the real and imaginary parts. Conversely, the treatment of the second PMU assumes no correlation, as it defaults to correlated = false.

Next, in AC state estimation, the first PMU measurement will be integrated into the rectangular coordinate system where correlation between the real and imaginary parts exists. The second PMU will be integrated in the polar coordinate system.

Tip

It is noteworthy that expressing current phasor measurements in polar coordinates can lead to ill-conditioned problems due to small current magnitudes, whereas using rectangular representation can resolve this issue.


Customizing Input Units for Keywords

By default, the magnitude and varianceMagnitude keywords are expected to be provided in per-unit (pu), while the angle and varianceAngle keywords are expected to be provided in radians (rad). However, users have the flexibility to express these values in different units, such as volts (V) and degrees (deg) if the PMU is set to a bus, or amperes (A) and degrees (deg) if the PMU is set to a branch. This flexibility is demonstrated in the following:

@voltage(kV, deg, V)
 @current(A, deg)
@@ -173,10 +173,10 @@
 addPmu!(system, device; from = "Branch 1", magnitude = 427.67, angle = -11.46, noise = true)
 addPmu!(system, device; to = "Branch 1", magnitude = 384.91, angle = 0.0)

In this example, we have opted to specify kilovolts (kV) and degrees (deg) for the PMU located at Bus 1, and amperes (A) and degrees (deg) for the PMUs located at Branch 1. It is important to note that regardless of the units used, the values will still be stored in per-units and radians:

julia> [device.pmu.magnitude.mean device.pmu.magnitude.variance]3×2 Matrix{Float64}:
  1.10004   1.0e-5
- 0.99934   1.0e-5
+ 0.999929  1.0e-5
  0.900023  1.0e-5
julia> [device.pmu.angle.mean device.pmu.angle.variance]3×2 Matrix{Float64}: 0.100007 0.0010472 - -0.199742 1.0e-5 + -0.197577 1.0e-5 0.0 1.0e-5

Users have the option to print the PMU data in the REPL using any units that have been configured:

printPmuData(system, device)
|---------------------------------------------------------------------------|
 | PMU Data                                                                  |
 |---------------------------------------------------------------------------|
@@ -195,7 +195,7 @@
 |       | Measurement | Variance | Status | Measurement | Variance | Status |
 |       |         [A] |      [A] |        |       [deg] |    [deg] |        |
 |-------|-------------|----------|--------|-------------|----------|--------|
-| 2     |    427.3846 | 4.28e-03 |      1 |    -11.4444 | 5.73e-04 |      1 |
+| 2     |    427.6364 | 4.28e-03 |      1 |    -11.3203 | 5.73e-04 |      1 |
 | 3     |    384.9100 | 4.28e-03 |      1 |      0.0000 | 5.73e-04 |      1 |
 |---------------------------------------------------------------------------|

Add Templates

The functions addVoltmeter!, addAmmeter!, addWattmeter!, addVarmeter!, and addPmu! are employed to introduce measurement devices. In cases where specific keywords are not explicitly defined, default values are automatically assigned to certain parameters.


Default Keyword Values

When utilizing the addVoltmeter! function, the default variance is set to variance = 1e-2 per-unit, and the voltmeter's operational status is automatically assumed to be in-service, as indicated by the setting of status = 1.

Similarly, for the addAmmeter! function, the default variances are established at variance = 1e-2 per-unit, and the operational statuses are configured to status = 1. This means that if a user places an ammeter at either the from-bus or to-bus end of a branch, the default settings are identical. However, as we will explain in the following subsection, users have the flexibility to fine-tune these default values, differentiating between the two locations.

In alignment with ammeters, the addWattmeter! and addVarmeter! functions feature default variances set at variance = 1e-2 per-unit, and statuses are automatically assigned as status = 1, regardless of whether the wattmeter or varmeter is placed at the bus, the from-bus end, or the to-bus end. Users have the ability to customize these default values, making distinctions between the three positions of the measurement devices.

For the addPmu! function, variances for both magnitude and angle measurements are standardized to varianceMagnitude = 1e-5 and varianceAngle = 1e-5 in per-units. Likewise, operational statuses are uniformly set to statusMagnitude = 1 and statusAngle = 1, regardless of whether the PMU is positioned on the bus, the from-bus end, or the to-bus end. Once more, users retain the option to tailor these default values to their specific needs, allowing for distinctions between these three locations of the measurement devices. Additionally, the coordinate system utilized for AC state estimation is consistently configured with polar = false, while correlation in the rectangular system is disabled with correlated = false.

Across all measurement devices, the method for generating measurement means is established as noise = false.


Change Default Keyword Values

In JuliaGrid, users have the flexibility to customize default values and assign personalized settings using the @voltmeter, @ammeter, @wattmeter, @varmeter, and @pmu macros. These macros create voltmeter, ammeter, wattmeter, varmeter, and pmu templates that are employed each time functions for adding measurement devices are called. Here is an example of creating these templates with tailored default values:

system = powerSystem()
 device = measurement()
@@ -380,4 +380,4 @@
 
 addVoltmeter!(system, device, analysis)
 addAmmeter!(system, device, analysis)
-addPmu!(system, device, analysis)

Activating Devices

As a starting point, we create the measurement set where all devices are set to in-service mode based on default settings. In this instance, we generate the measurement set comprising 3 voltmeters, 6 ammeters, and 9 PMUs.

Subsequently, we offer users the ability to manipulate the status of in-service devices using the status! function. For example, within this set, if we wish to have only 12 out of the total 18 devices in-service while the rest are out-of-service, we can accomplish this as follows:

status!(system, device; inservice = 12)

Upon executing this function, 12 devices will be randomly selected to be in-service, while the remaining 6 will be set to out-of-service.

Furthermore, users can fine-tune the manipulation of specific measurements. Let us say we want to activate only 2 ammeters while deactivating the remaining ammeters:

statusAmmeter!(system, device; inservice = 2)

This action will result in 2 ammeters being in-service and 4 being out-of-service.

Users also have the option to further refine these actions by specifying devices at particular locations within the power system. For instance, we can enable 3 PMUs at buses to measure bus voltage phasors while deactivating all PMUs at branches that measure current phasors:

statusPmu!(system, device; inserviceBus = 3, inserviceFrom = 0, inserviceTo = 0)

The outcome will be that 3 PMUs are set to in-service at buses for voltage phasor measurements, while all PMUs at branches measuring current phasors will be in out-of-service mode.


Deactivating Devices

Likewise, we empower users to specify the number of devices to be set as out-of-service rather than defining the number of in-service devices. For instance, if the intention is to deactivate just 2 devices from the total measurement set, it can be achieved as follows:

status!(system, device; outservice = 2)

In this scenario 2 devices will be randomly deactivated, while the rest will remain in in-service status. Similar to the previous approach, users can apply this to specific devices or employ fine-tuning as needed.


Activating Devices Using Redundancy

Furthermore, users can take advantage of redundancy, which represents the ratio between measurement devices and state variables. For example, if we wish to have the number of measurement devices be 1.2 times greater than the number of state variables, we can utilize the following command:

status!(system, device; redundancy = 1.2)

Considering that the number of state variables is 5 (excluding the voltage angle related to the slack bus), using a redundancy value of 1.2 will result in 6 devices being set to in-service, while the remainder will be deactivated. As before, users can target specific devices or adjust settings as needed.

+addPmu!(system, device, analysis)
Activating Devices

As a starting point, we create the measurement set where all devices are set to in-service mode based on default settings. In this instance, we generate the measurement set comprising 3 voltmeters, 6 ammeters, and 9 PMUs.

Subsequently, we offer users the ability to manipulate the status of in-service devices using the status! function. For example, within this set, if we wish to have only 12 out of the total 18 devices in-service while the rest are out-of-service, we can accomplish this as follows:

status!(system, device; inservice = 12)

Upon executing this function, 12 devices will be randomly selected to be in-service, while the remaining 6 will be set to out-of-service.

Furthermore, users can fine-tune the manipulation of specific measurements. Let us say we want to activate only 2 ammeters while deactivating the remaining ammeters:

statusAmmeter!(system, device; inservice = 2)

This action will result in 2 ammeters being in-service and 4 being out-of-service.

Users also have the option to further refine these actions by specifying devices at particular locations within the power system. For instance, we can enable 3 PMUs at buses to measure bus voltage phasors while deactivating all PMUs at branches that measure current phasors:

statusPmu!(system, device; inserviceBus = 3, inserviceFrom = 0, inserviceTo = 0)

The outcome will be that 3 PMUs are set to in-service at buses for voltage phasor measurements, while all PMUs at branches measuring current phasors will be in out-of-service mode.


Deactivating Devices

Likewise, we empower users to specify the number of devices to be set as out-of-service rather than defining the number of in-service devices. For instance, if the intention is to deactivate just 2 devices from the total measurement set, it can be achieved as follows:

status!(system, device; outservice = 2)

In this scenario 2 devices will be randomly deactivated, while the rest will remain in in-service status. Similar to the previous approach, users can apply this to specific devices or employ fine-tuning as needed.


Activating Devices Using Redundancy

Furthermore, users can take advantage of redundancy, which represents the ratio between measurement devices and state variables. For example, if we wish to have the number of measurement devices be 1.2 times greater than the number of state variables, we can utilize the following command:

status!(system, device; redundancy = 1.2)

Considering that the number of state variables is 5 (excluding the voltage angle related to the slack bus), using a redundancy value of 1.2 will result in 6 devices being set to in-service, while the remainder will be deactivated. As before, users can target specific devices or adjust settings as needed.

diff --git a/dev/manual/pmuStateEstimation/index.html b/dev/manual/pmuStateEstimation/index.html index 1a4fac60..a93b1c40 100644 --- a/dev/manual/pmuStateEstimation/index.html +++ b/dev/manual/pmuStateEstimation/index.html @@ -218,4 +218,4 @@ io = IOBuffer() printPmuData(system, device, analysis, io; style = false) -CSV.write("bus.csv", CSV.File(take!(io); delim = "|"))
Active and Reactive Power Injection

To calculate the active and reactive power injection associated with a specific bus, the function can be used:

julia> active, reactive = injectionPower(system, analysis; label = "Bus 1")(2.7128789695754727, 0.43288460463326406)

Active and Reactive Power Injection from Generators

To calculate the active and reactive power injection from the generators at a specific bus, the function can be used:

julia> active, reactive = supplyPower(system, analysis; label = "Bus 1")(2.7128789695754727, 0.43288460463326406)

Active and Reactive Power at Shunt Element

To calculate the active and reactive power associated with shunt element at a specific bus, the function can be used:

julia> active, reactive = shuntPower(system, analysis; label = "Bus 1")(0.0, -0.002000424255767445)

Active and Reactive Power Flow

Similarly, we can compute the active and reactive power flow at both the from-bus and to-bus ends of the specific branch by utilizing the provided functions below:

julia> active, reactive = fromPower(system, analysis; label = "Branch 2")(1.6429108157162793, 0.255391331637058)
julia> active, reactive = toPower(system, analysis; label = "Branch 2")(-1.5873301378903089, -0.1549833506018255)

Active and Reactive Power at Charging Admittances

To calculate the active and reactive power linked with branch charging admittances of the particular branch, the function can be used:

julia> active, reactive = chargingPower(system, analysis; label = "Branch 1")(9.705560639418611e-5, -0.03882224255767445)

Active powers indicate active losses within the branch's charging admittances. Moreover, charging admittances injected reactive powers into the power system due to their capacitive nature, as denoted by a negative sign.


Active and Reactive Power at Series Impedance

To calculate the active and reactive power across the series impedance of the branch, the function can be used:

julia> active, reactive = seriesPower(system, analysis; label = "Branch 2")(0.05548491704701527, 0.13871229261753815)

The active power also considers active losses originating from the series resistance of the branch, while the reactive power represents reactive losses resulting from the impedance's inductive characteristics.


Current Injection

To calculate the current injection associated with a specific bus, the function can be used:

julia> magnitude, angle = injectionCurrent(system, analysis; label = "Bus 1")(2.7469074926874932, -0.15817873160622747)

Current Flow

We can compute the current flow at both the from-bus and to-bus ends of the specific branch by utilizing the provided functions below:

julia> magnitude, angle = fromCurrent(system, analysis; label = "Branch 2")(1.662466361408605, -0.1541623914297243)
julia> magnitude, angle = toCurrent(system, analysis; label = "Branch 2")(1.6673093443308729, 2.964124299788863)

Current Through Series Impedance

To calculate the current passing through the series impedance of the branch in the direction from the from-bus end to the to-bus end, we can use the following function:

julia> magnitude, angle = seriesCurrent(system, analysis; label = "Branch 2")(1.6656067520128401, -0.1660336726001753)
+CSV.write("bus.csv", CSV.File(take!(io); delim = "|"))
Active and Reactive Power Injection

To calculate the active and reactive power injection associated with a specific bus, the function can be used:

julia> active, reactive = injectionPower(system, analysis; label = "Bus 1")(2.7128789695754727, 0.43288460463326406)

Active and Reactive Power Injection from Generators

To calculate the active and reactive power injection from the generators at a specific bus, the function can be used:

julia> active, reactive = supplyPower(system, analysis; label = "Bus 1")(2.7128789695754727, 0.43288460463326406)

Active and Reactive Power at Shunt Element

To calculate the active and reactive power associated with shunt element at a specific bus, the function can be used:

julia> active, reactive = shuntPower(system, analysis; label = "Bus 1")(0.0, -0.002000424255767445)

Active and Reactive Power Flow

Similarly, we can compute the active and reactive power flow at both the from-bus and to-bus ends of the specific branch by utilizing the provided functions below:

julia> active, reactive = fromPower(system, analysis; label = "Branch 2")(1.6429108157162793, 0.255391331637058)
julia> active, reactive = toPower(system, analysis; label = "Branch 2")(-1.5873301378903089, -0.1549833506018255)

Active and Reactive Power at Charging Admittances

To calculate the active and reactive power linked with branch charging admittances of the particular branch, the function can be used:

julia> active, reactive = chargingPower(system, analysis; label = "Branch 1")(9.705560639418611e-5, -0.03882224255767445)

Active powers indicate active losses within the branch's charging admittances. Moreover, charging admittances injected reactive powers into the power system due to their capacitive nature, as denoted by a negative sign.


Active and Reactive Power at Series Impedance

To calculate the active and reactive power across the series impedance of the branch, the function can be used:

julia> active, reactive = seriesPower(system, analysis; label = "Branch 2")(0.05548491704701527, 0.13871229261753815)

The active power also considers active losses originating from the series resistance of the branch, while the reactive power represents reactive losses resulting from the impedance's inductive characteristics.


Current Injection

To calculate the current injection associated with a specific bus, the function can be used:

julia> magnitude, angle = injectionCurrent(system, analysis; label = "Bus 1")(2.7469074926874932, -0.15817873160622747)

Current Flow

We can compute the current flow at both the from-bus and to-bus ends of the specific branch by utilizing the provided functions below:

julia> magnitude, angle = fromCurrent(system, analysis; label = "Branch 2")(1.662466361408605, -0.1541623914297243)
julia> magnitude, angle = toCurrent(system, analysis; label = "Branch 2")(1.6673093443308729, 2.964124299788863)

Current Through Series Impedance

To calculate the current passing through the series impedance of the branch in the direction from the from-bus end to the to-bus end, we can use the following function:

julia> magnitude, angle = seriesCurrent(system, analysis; label = "Branch 2")(1.6656067520128401, -0.1660336726001753)
diff --git a/dev/manual/powerSystemModel/index.html b/dev/manual/powerSystemModel/index.html index 37c05c39..f0dafa0a 100644 --- a/dev/manual/powerSystemModel/index.html +++ b/dev/manual/powerSystemModel/index.html @@ -196,4 +196,4 @@ 500.0 150.0

Similarly, we can define the linear piecewise cost using megavolt-amperes reactive:

cost!(system; label = "Generator 1", reactive = 1, piecewise = [11.0 12.3; 15.0 16.8])

Upon inspection, we can see that the stored data is the same as before:

julia> system.generator.cost.reactive.piecewise[1]2×2 Matrix{Float64}:
  0.11  12.3
- 0.15  16.8
Tip

The cost! function not only adds costs but also allows users to update previously defined cost functions. This functionality is particularly valuable in optimal power flow analyses, as it allows users to modify generator power costs without the need to recreate models from scratch.

+ 0.15 16.8
Tip

The cost! function not only adds costs but also allows users to update previously defined cost functions. This functionality is particularly valuable in optimal power flow analyses, as it allows users to modify generator power costs without the need to recreate models from scratch.

diff --git a/dev/objects.inv b/dev/objects.inv index 83f61a242e3ccd3fe4737716becaf5c2127893dd..5bc305141ee88e6d8eea12399df51db7d8dac0d3 100644 GIT binary patch delta 12 TcmbQLIaPClBcstqr(h8P8<_*! delta 12 TcmbQLIaPClBctI)r(h8P8
julia> 𝛙ⱼ = analysis.current.to.angle1-element Vector{Float64}: -1.6707962111927632
Current at Branch Series Elements

To obtain the vectors of magnitudes $\mathbf{I}_{\text{l}} = [I_{\text{l}ij}]$ and angles $\bm{\psi}_{\text{l}} = [\psi_{\text{l}ij}]$ of the resulting complex current flows, one can use the following code:

julia> 𝐈ₗ = analysis.current.series.magnitude1-element Vector{Float64}:
  0.08571441475064301
julia> 𝛙ₗ = analysis.current.series.angle1-element Vector{Float64}: - 1.4707964423970301
+ 1.4707964423970301 diff --git a/dev/tutorials/acPowerFlow/index.html b/dev/tutorials/acPowerFlow/index.html index 7a342ffa..ae4fdc9a 100644 --- a/dev/tutorials/acPowerFlow/index.html +++ b/dev/tutorials/acPowerFlow/index.html @@ -454,4 +454,4 @@ 1.0533688181418344 1.798915816381931 2.1060717428167246 - 1.3809084790963575 + 1.3809084790963575 diff --git a/dev/tutorials/acStateEstimation/index.html b/dev/tutorials/acStateEstimation/index.html index 5f6d74c6..0dd25219 100644 --- a/dev/tutorials/acStateEstimation/index.html +++ b/dev/tutorials/acStateEstimation/index.html @@ -558,4 +558,4 @@ 0.7891003404573693 0.0969541517042328 -1.2553086990431555 - -0.16797520542382388 + -0.16797520542382388 diff --git a/dev/tutorials/dcOptimalPowerFlow/index.html b/dev/tutorials/dcOptimalPowerFlow/index.html index bfd7039b..56d08713 100644 --- a/dev/tutorials/dcOptimalPowerFlow/index.html +++ b/dev/tutorials/dcOptimalPowerFlow/index.html @@ -96,4 +96,4 @@ 0.025000000000002798

Similarly, the resulting to-bus active power flows are stored as the vector $\mathbf{P}_{\text{j}} = [P_{ji}]$, which can be retrieved using:

julia> 𝐏ⱼ = analysis.power.to.active3-element Vector{Float64}:
   5.551115123125783e-16
  -0.025000000000000022
- -0.025000000000002798
+ -0.025000000000002798 diff --git a/dev/tutorials/dcPowerFlow/index.html b/dev/tutorials/dcPowerFlow/index.html index 69f843f0..bb3d504d 100644 --- a/dev/tutorials/dcPowerFlow/index.html +++ b/dev/tutorials/dcPowerFlow/index.html @@ -46,4 +46,4 @@ 0.09337060504410487
Generators Power Outputs

The output active power of each generator located at bus $i \in \mathcal{N}_{\text{pv}} \cup \mathcal{N}_{\text{pq}}$ is equal to the active power specified in the input data. If there are multiple generators, their output active powers are also equal to the active powers specified in the input data. However, the output active power of a generator located at the slack bus will be:

\[ P_{\text{g}i} = P_i + P_{\text{d}i},\;\;\; i \in \mathcal{N}_{\text{sb}}.\]

In the case of multiple generators connected to the slack bus, the first generator in the input data is assigned the obtained value of $P_{\text{g}i}$. Then, this amount of power is reduced by the output active power of the other generators.

To retrieve the vector of active power outputs of generators, denoted as $\mathbf{P}_{\text{g}} = [P_{\text{g}i}]$, $i \in \mathcal{S}$, where the set $\mathcal{S}$ represents the set of generators, users can utilize the following command:

julia> 𝐏ₒ = analysis.power.generator.active3-element Vector{Float64}:
  0.12769999999999998
  0.04
- 0.05
+ 0.05 diff --git a/dev/tutorials/dcStateEstimation/index.html b/dev/tutorials/dcStateEstimation/index.html index b6f9824a..058a05a9 100644 --- a/dev/tutorials/dcStateEstimation/index.html +++ b/dev/tutorials/dcStateEstimation/index.html @@ -97,4 +97,4 @@ 0.18500000000007344

Similarly, the resulting active power flows are stored as the vector $\mathbf{P}_{\text{j}} = [P_{ji}]$, which can be retrieved using:

julia> 𝐏ⱼ = analysis.power.to.active3-element Vector{Float64}:
  -0.2799999999995778
  -1.1149999999993758
- -0.18500000000007344
+ -0.18500000000007344 diff --git a/dev/tutorials/measurementModel/index.html b/dev/tutorials/measurementModel/index.html index db75beb1..6caa25b1 100644 --- a/dev/tutorials/measurementModel/index.html +++ b/dev/tutorials/measurementModel/index.html @@ -21,7 +21,7 @@ "V₁" "V₃"

This set of voltmeters defines vectors of measurement values denoted as $\mathbf{z}_\mathcal{V} = [z_i]$ and variances denoted as $\mathbf{v}_\mathcal{V} = [v_i]$, where $i \in \mathcal{V}$, and can be accessed through the following variables:

julia> 𝐳ᵥ = device.voltmeter.magnitude.mean2-element Vector{Float64}:
  1.1
- 0.7800996493995384
julia> 𝐯ᵥ = device.voltmeter.magnitude.variance2-element Vector{Float64}: + 1.0959864562849255
julia> 𝐯ᵥ = device.voltmeter.magnitude.variance2-element Vector{Float64}: 0.001 0.01

Ammeters

An ammeter $I_{ij} \in \mathcal{I}$ measures the magnitude of branch current at the from-bus end of the branch $(i,j) \in \mathcal{E}$. Let us add this type of ammeter at the first branch between buses 1 and 2:

addAmmeter!(system, device; label = "I₁₂", from = 1, magnitude = 0.3, variance = 1e-3)

Additionally, an ammeter can measure the branch current magnitude at the to-bus end of the branch $(i,j) \in \mathcal{E}$, denoted as $I_{ji} \in \mathcal{I}$. For example, we can include this type of ammeter at the same branch:

addAmmeter!(system, device; label = "I₂₁", to = 1, magnitude = 0.2, variance = 1e-3)

Consequently, we establish the set of ammeters $\mathcal{I} \subset \mathcal{M}$:

julia> ℐ = collect(keys(device.ammeter.label))2-element Vector{String}:
  "I₁₂"
@@ -44,15 +44,15 @@
  "Q₂₁"

This set of varmeters defines vectors of measurement values denoted as $\mathbf{z}_\mathcal{Q} = [z_i]$ and variances denoted as $\mathbf{v}_\mathcal{Q} = [v_i]$, where $i \in \mathcal{Q}$, and can be accessed through the following variables:

julia> 𝐳ₒ = device.varmeter.reactive.mean3-element Vector{Float64}:
  0.01
  0.02
- 0.07534544746191636
julia> 𝐯ₒ = device.varmeter.reactive.variance3-element Vector{Float64}: + 0.12822116157570013
julia> 𝐯ₒ = device.varmeter.reactive.variance3-element Vector{Float64}: 0.01 0.001 0.01

PMUs

PMUs measure voltage and current phasors in the polar coordinate system, thus each PMU output is represented by magnitude and angle along with corresponding variances [14, Sec. 5.6]. When installed on buses, they measure bus voltage phasors, while on branches, they measure current phasors.

A PMU $(V_i, \theta_i) \in \bar{\mathcal{P}}$ measures the voltage phasor at bus $i \in \mathcal{N}$. Let us integrate this type of PMU at the first bus:

addPmu!(system, device; label = "V₁, θ₁", bus = 1, magnitude = 1, angle = 0, noise = true)

Next, a PMU $(I_{ij}, \psi_{ij}) \in \bar{\mathcal{P}}$ measures the branch current magnitude at the from-bus end of the branch $(i,j) \in \mathcal{E}$. Let us add this type of PMU at the first branch:

addPmu!(system, device; label = "I₁₂, ψ₁₂", from = 1, magnitude = 0.2, angle = -0.1)

Moreover, a PMU can measure the branch current magnitude at the to-bus end of the branch $(i,j) \in \mathcal{E}$, denoted as $(I_{ji}, \psi_{ji}) \in \bar{\mathcal{P}}$. For example, let us include this type of PMU at the same branch:

addPmu!(system, device; label = "I₂₁, ψ₂₁", to = 1, magnitude = 0.3, angle = -0.2)

Consequently, we establish the set of PMUs $\bar{\mathcal{P}} \subset \mathcal{M}$:

julia> 𝒫̄ = collect(keys(device.pmu.label))3-element Vector{String}:
  "V₁, θ₁"
  "I₁₂, ψ₁₂"
  "I₂₁, ψ₂₁"

This set of PMUs establishes vectors representing measurement magnitudes and angles $\mathbf{z}_{\bar{\mathcal{P}}} = [z_i, z_j]$, along with their corresponding variances $\mathbf{v}_{\bar{\mathcal{P}}} = [v_i, v_j]$, where $(i, j) \in \bar{\mathcal{P}}$. These values can be accessed as:

julia> pmu = device.pmu;
julia> 𝐳ₚ = collect(Iterators.flatten(zip(pmu.magnitude.mean, pmu.angle.mean)))6-element Vector{Float64}: - 0.9969198694648722 - -0.0005133400667576896 + 1.0047164010278062 + -0.005922004170562744 0.2 -0.1 0.3 @@ -64,4 +64,4 @@ 1.0e-5 1.0e-5
Info

PMUs can be handled in state estimation algorithms according to our definition in polar coordinate systems. However, they can also be processed in rectangular coordinates, where we observe the real and imaginary parts of the phasor measurements rather than magnitude and angle. Further details can be found in tutorials that describe specific state estimation analyses.


State Estimation

After establishing the measurement model, which includes specifying measurement values, variances, the locations of measurement devices, and known power system network parameters, the subsequent step involves the process of state estimation. State estimation is a component of energy management systems and typically encompasses network topology processing, observability analysis, state estimation algorithms, and bad data analysis.

The primary goal of state estimation algorithms is to determine state variables, often associated with bus voltages. Therefore, by representing the vector of state variables as $\mathbf{x}$ and the vector of noisy measurement values as $\mathbf{z}$, we can effectively describe the state estimation problem using the following conditional probability equation:

\[ p(\mathbf{x}|\mathbf{z})= \cfrac{p(\mathbf{z}|\mathbf{x})p(\mathbf{x})}{p(\mathbf{z})}.\]

If we assume that the prior probability distribution $p(\mathbf{x})$ is uniform and that $p(\mathbf{z})$ does not depend on $\mathbf{x}$, the maximum a posteriori solution simplifies to the maximum likelihood solution, as shown below [15]:

\[ \hat{\mathbf{x}} = \mathrm{arg}\max_{\mathbf{x}}p(\mathbf{x}|\mathbf{z}) = \mathrm{arg}\max_{\mathbf{x}}p(\mathbf{z}|\mathbf{x}) = \mathrm{arg}\max_{\mathbf{x}}\mathcal{L}(\mathbf{z}|\mathbf{x}).\]

We can find this solution by maximizing the likelihood function $\mathcal{L}(\mathbf{z}|\mathbf{x})$, which is defined based on the likelihoods of $k$ independent measurements:

\[ \hat{\mathbf x} = \mathrm{arg} \max_{\mathbf{x}}\mathcal{L}(\mathbf{z}|\mathbf{x})= - \mathrm{arg} \max_{\mathbf{x}} \prod_{i=1}^k \mathcal{N}(z_i|\mathbf{x},v_i).\]

It can be demonstrated that the solution to the maximum a posteriori problem can be obtained by solving the following optimization problem, commonly referred to as the weighted least-squares problem [9, Sec. 9.3]:

\[ \hat{\mathbf x} = \mathrm{arg}\min_{\mathbf{x}} \sum_{i=1}^k\cfrac{[z_i-h_i(\mathbf x)]^2}{v_i}.\]

The state estimate, denoted as $\hat{\mathbf x}$, resulting from the solution to the above optimization problem, is known as the weighted least-squares estimator. Both the maximum likelihood and weighted least-squares estimators are equivalent to the maximum a posteriori solution [15, Sec. 8.6].

+ \mathrm{arg} \max_{\mathbf{x}} \prod_{i=1}^k \mathcal{N}(z_i|\mathbf{x},v_i).\]

It can be demonstrated that the solution to the maximum a posteriori problem can be obtained by solving the following optimization problem, commonly referred to as the weighted least-squares problem [9, Sec. 9.3]:

\[ \hat{\mathbf x} = \mathrm{arg}\min_{\mathbf{x}} \sum_{i=1}^k\cfrac{[z_i-h_i(\mathbf x)]^2}{v_i}.\]

The state estimate, denoted as $\hat{\mathbf x}$, resulting from the solution to the above optimization problem, is known as the weighted least-squares estimator. Both the maximum likelihood and weighted least-squares estimators are equivalent to the maximum a posteriori solution [15, Sec. 8.6].

diff --git a/dev/tutorials/perunit/index.html b/dev/tutorials/perunit/index.html index df8ba852..28a99ce0 100644 --- a/dev/tutorials/perunit/index.html +++ b/dev/tutorials/perunit/index.html @@ -75,4 +75,4 @@ | Bus 1 | 1.0000 | 0.0000 | 0.0000 | 0.0000 | 1.2000 | 1.4048 | | Bus 2 | 0.9797 | -0.0360 | 0.0000 | 0.0000 | -0.0000 | 0.0000 | | Bus 3 | 0.8538 | -0.1800 | 1.2000 | 1.0000 | -1.2000 | -1.0000 | -|----------------------------------------------------------------------|

Here, the voltage magnitudes in per-units represent line-to-neutral voltages for each bus, while the powers are independent of whether they are three-phase or single-phase, since they are expressed in per-units.

+|----------------------------------------------------------------------|

Here, the voltage magnitudes in per-units represent line-to-neutral voltages for each bus, while the powers are independent of whether they are three-phase or single-phase, since they are expressed in per-units.

diff --git a/dev/tutorials/pmuStateEstimation/index.html b/dev/tutorials/pmuStateEstimation/index.html index e3177e9f..a87adf1b 100644 --- a/dev/tutorials/pmuStateEstimation/index.html +++ b/dev/tutorials/pmuStateEstimation/index.html @@ -286,4 +286,4 @@ 0.2850121792157389
julia> 𝛙ₗ = analysis.current.series.angle3-element Vector{Float64}: -0.75841409129973 -0.7631714293392173 - 0.31577645020972367 + 0.31577645020972367 diff --git a/dev/tutorials/powerSystemModel/index.html b/dev/tutorials/powerSystemModel/index.html index 227defed..f1dc52b7 100644 --- a/dev/tutorials/powerSystemModel/index.html +++ b/dev/tutorials/powerSystemModel/index.html @@ -201,4 +201,4 @@ \end{aligned}\]

The sparse nodal matrix $\mathbf{B}$ is stored in the dc field, and we can access it using:

julia> 𝐁 = system.model.dc.nodalMatrix3×3 SparseArrays.SparseMatrixCSC{Float64, Int64} with 7 stored entries:
   16.6667  -16.6667     ⋅
  -16.6667   21.5258   -4.85909
-    ⋅       -4.85909   4.85909

Bus Injection

From the previous analysis, the calculation of active power injection at each bus is expressed by:

\[ P_i = \sum_{j = 1}^n {B}_{ij} \theta_j + P_{\text{tr}i} + P_{\text{sh}i}, \;\;\; i \in \mathcal{N}.\]

+ ⋅ -4.85909 4.85909
Bus Injection

From the previous analysis, the calculation of active power injection at each bus is expressed by:

\[ P_i = \sum_{j = 1}^n {B}_{ij} \theta_j + P_{\text{tr}i} + P_{\text{sh}i}, \;\;\; i \in \mathcal{N}.\]