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.measurement
— Functionmeasurement(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")
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()
JuliaGrid.saveMeasurement
— FunctionsaveMeasurement(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()
acModel!(system)
analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
solve!(system, analysis)
power!(system, analysis)
addVoltmeter!(system, device, analysis)
addWattmeter!(system, device, analysis)
saveMeasurement(device; path = "D:/measurement14.h5")
JuliaGrid.status!
— Functionstatus!(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)
analysis = newtonRaphson(system)
for i = 1:10
stopping = mismatch!(system, analysis)
if all(stopping .< 1e-8)
break
end
solve!(system, analysis)
end
power!(system, analysis)
addVoltmeter!(system, device, analysis)
addWattmeter!(system, device, analysis)
status!(system, device; inservice = 30)
Creating a measurement set using redundancy:
system = powerSystem("case14.h5")
device = measurement()
acModel!(system)
analysis = newtonRaphson(system)
for i = 1:10
stopping = mismatch!(system, analysis)
if all(stopping .< 1e-8)
break
end
solve!(system, analysis)
end
power!(system, analysis)
addVoltmeter!(system, device, analysis)
addWattmeter!(system, device, analysis)
addVarmeter!(system, device, analysis)
status!(system, device; redundancy = 2.5)
Voltmeter
JuliaGrid.addVoltmeter!
— MethodaddVoltmeter!(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 thevariance
to themagnitude
,noise = false
: uses themagnitude
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()
addBus!(system; label = "Bus 1", base = 132e3)
addVoltmeter!(system, device; label = "Voltmeter 1", bus = "Bus 1", magnitude = 1.1)
Adding a voltmeter using a custom unit system:
@voltage(kV, rad, kV)
system = powerSystem()
device = measurement()
addBus!(system; label = "Bus 1", base = 132.0)
addVoltmeter!(system, device; label = "Voltmeter 1", bus = "Bus 1", magnitude = 145.2)
JuliaGrid.addVoltmeter!
— MethodaddVoltmeter!(system::PowerSystem, device::Measurement, analysis::AC;
variance, status, noise)
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
Voltmeters can be configured using:
variance
(pu or V): Measurements Variance.status
: Operating status:status = 1
: in-service,status = 0
: out-of-service.
noise
: Defines the method for generating the measurement means:noise = true
: adds white Gaussian noise to the voltage magnitudes, using the defined variance,noise = false
: uses the exact voltage magnitude values without adding noise.
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()
acModel!(system)
analysis = newtonRaphson(system)
for i = 1:10
stopping = mismatch!(system, analysis)
if all(stopping .< 1e-8)
break
end
solve!(system, analysis)
end
@voltmeter(label = "Voltmeter ?")
addVoltmeter!(system, device, analysis; variance = 1e-3, noise = true)
JuliaGrid.updateVoltmeter!
— FunctionupdateVoltmeter!(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)
JuliaGrid.statusVoltmeter!
— FunctionstatusVoltmeter!(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()
acModel!(system)
analysis = newtonRaphson(system)
for i = 1:10
stopping = mismatch!(system, analysis)
if all(stopping .< 1e-8)
break
end
solve!(system, analysis)
end
addVoltmeter!(system, device, analysis)
statusVoltmeter!(system, device; inservice = 10)
JuliaGrid.@voltmeter
— Macro@voltmeter(label, variance, status, noise)
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)
@voltmeter(label = "Voltmeter ?", variance = 1e-5)
addVoltmeter!(system, device; bus = "Bus 1", magnitude = 1.1)
Adding a voltmeter using a custom unit system:
@voltage(kV, rad, kV)
system = powerSystem()
device = measurement()
addBus!(system; label = "Bus 1", base = 132.0)
@voltmeter(label = "Voltmeter ?", variance = 0.00132)
addVoltmeter!(system, device; bus = "Bus 1", magnitude = 145.2)
Ammeter
JuliaGrid.addAmmeter!
— MethodaddAmmeter!(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 thevariance
to themagnitude
,noise = false
: uses themagnitude
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()
addBus!(system; label = "Bus 1", base = 132e3)
addBus!(system; label = "Bus 2", base = 132e3)
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)
addAmmeter!(system, device; label = "Ammeter 2", to = "Branch 1", magnitude = 1.0)
Adding ammeters using a custom unit system:
@current(A, rad)
system = powerSystem()
device = measurement()
addBus!(system; label = "Bus 1", base = 132e3)
addBus!(system; label = "Bus 2", base = 132e3)
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)
JuliaGrid.addAmmeter!
— MethodaddAmmeter!(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 magnitude values defined in the AC
type.
Keywords
Ammeters at the from-bus ends of the branches can be configured using:
varianceFrom
(pu or A): Measurement variance.statusFrom
: Operating status:statusFrom = 1
: in-service,statusFrom = 0
: out-of-service,statusFrom = -1
: not included in theMeasurement
type.
Ammeters at the to-bus ends of the branches can be configured using:
varianceTo
(pu or A): Measurement variance.statusTo
: Operating status:statusTo = 1
: in-service,statusTo = 0
: out-of-service,statusTo = -1
: not included in theMeasurement
type.
Settings for generating measurements include:
noise
: Defines the method for generating the measurement means:noise = true
: adds white Gaussian noise to the current magnitudes, using the defined variances,noise = false
: uses the exact current magnitude values without adding noise.
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()
acModel!(system)
analysis = newtonRaphson(system)
for i = 1:10
stopping = mismatch!(system, analysis)
if all(stopping .< 1e-8)
break
end
solve!(system, analysis)
end
current!(system, analysis)
@ammeter(label = "Ammeter ?")
addAmmeter!(system, device, analysis; varianceFrom = 1e-3, statusTo = 0)
JuliaGrid.updateAmmeter!
— FunctionupdateAmmeter!(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()
addBus!(system; label = "Bus 1", base = 132e3)
addBus!(system; label = "Bus 2", base = 132e3)
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)
JuliaGrid.statusAmmeter!
— FunctionstatusAmmeter!(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 can use one main keyword or two fine-tuning keywords to 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()
acModel!(system)
analysis = newtonRaphson(system)
for i = 1:10
stopping = mismatch!(system, analysis)
if all(stopping .< 1e-8)
break
end
solve!(system, analysis)
end
current!(system, analysis)
addAmmeter!(system, device, analysis)
statusAmmeter!(system, device; inserviceFrom = 5, inserviceTo = 10)
JuliaGrid.@ammeter
— Macro@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)
addBus!(system; label = "Bus 2", base = 132e3)
addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
@ammeter(label = "Ammeter ?", varianceTo = 1e-3, statusTo = 0)
addAmmeter!(system, device; to = "Branch 1", magnitude = 1.1)
Adding an ammeter using a custom unit system:
@current(A, rad)
system = powerSystem()
device = measurement()
addBus!(system; label = "Bus 1", base = 132e3)
addBus!(system; label = "Bus 2", base = 132e3)
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)
Wattmeter
JuliaGrid.addWattmeter!
— MethodaddWattmeter!(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 thevariance
to theactive
,noise = false
: uses theactive
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()
addBus!(system; label = "Bus 1")
addBus!(system; label = "Bus 2")
addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
addWattmeter!(system, device; label = "Wattmeter 1", bus = "Bus 2", active = 0.4)
addWattmeter!(system, device; label = "Wattmeter 2", from = "Branch 1", active = 0.1)
Adding wattmeters using a custom unit system:
@power(MW, pu, pu)
system = powerSystem()
device = measurement()
addBus!(system; label = "Bus 1")
addBus!(system; label = "Bus 2")
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)
JuliaGrid.addWattmeter!
— MethodaddWattmeter!(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
Wattmeters at the buses can be configured using:
varianceBus
(pu or W): Measurement variance.statusBus
: Operating status:statusBus = 1
: in-service,statusBus = 0
: out-of-service,statusBus = -1
: not included in theMeasurement
type.
Wattmeters at the from-bus ends of the branches can be configured using:
varianceFrom
(pu or W): Measurement variance.statusFrom
: Operating status:statusFrom = 1
: in-service,statusFrom = 0
: out-of-service,statusFrom = -1
: not included in theMeasurement
type.
Wattmeters at the to-bus ends of the branches can be configured using:
varianceTo
(pu or W): Measurement variance.statusTo
: Operating status:statusTo = 1
: in-service,statusTo = 0
: out-of-service,statusTo = -1
: not included in theMeasurement
type.
Settings for generating measurements include:
noise
: Defines the method for generating the measurement means:noise = true
: adds white Gaussian noise to the active power values, using the defined variances,noise = false
: uses the exact active power values without adding noise.
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()
acModel!(system)
analysis = newtonRaphson(system)
for i = 1:10
stopping = mismatch!(system, analysis)
if all(stopping .< 1e-8)
break
end
solve!(system, analysis)
end
power!(system, analysis)
@wattmeter(label = "Wattmeter ?")
addWattmeter!(system, device, analysis; varianceBus = 1e-3, statusFrom = 0)
JuliaGrid.updateWattmeter!
— FunctionupdateWattmeter!(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()
addBus!(system; label = "Bus 1", base = 132e3)
addBus!(system; label = "Bus 2", base = 132e3)
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)
JuliaGrid.statusWattmeter!
— FunctionstatusWattmeter!(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 can use one main keyword or three fine-tuning keywords to 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()
acModel!(system)
analysis = newtonRaphson(system)
for i = 1:10
stopping = mismatch!(system, analysis)
if all(stopping .< 1e-8)
break
end
solve!(system, analysis)
end
power!(system, analysis)
addWattmeter!(system, device, analysis)
statusWattmeter!(system, device; outserviceBus = 14, inserviceFrom = 10, outserviceTo = 2)
JuliaGrid.@wattmeter
— Macro@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()
addBus!(system; label = "Bus 1")
addBus!(system; label = "Bus 2")
addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
@wattmeter(label = "Wattmeter ?", varianceBus = 1e-3, varianceFrom = 1e-4)
addWattmeter!(system, device; bus = "Bus 2", active = 0.4)
addWattmeter!(system, device; from = "Branch 1", active = 0.1)
Adding wattmeters using a custom unit system:
@power(MW, pu, pu)
system = powerSystem()
device = measurement()
addBus!(system; label = "Bus 1")
addBus!(system; label = "Bus 2")
addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
@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)
Varmeter
JuliaGrid.addVarmeter!
— MethodaddVarmeter!(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 thevariance
to thereactive
,noise = false
: uses thereactive
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()
addBus!(system; label = "Bus 1")
addBus!(system; label = "Bus 2")
addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
addVarmeter!(system, device; label = "Varmeter 1", bus = "Bus 2", reactive = 0.4)
addVarmeter!(system, device; label = "Varmeter 2", from = "Branch 1", reactive = 0.1)
Adding varmeters using a custom unit system:
@power(MW, pu, pu)
system = powerSystem()
device = measurement()
addBus!(system; label = "Bus 1")
addBus!(system; label = "Bus 2")
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)
JuliaGrid.addVarmeter!
— MethodaddVarmeter!(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
Varmeters at the buses can be configured using:
varianceBus
(pu or VAr): Measurement variance.statusBus
: Operating status:statusBus = 1
: in-service,statusBus = 0
: out-of-service,statusBus = -1
: not included in theMeasurement
type.
Varmeters at the from-bus ends of the branches can be configured using:
varianceFrom
(pu or VAr): Measurement variance.statusFrom
: Operating status:statusFrom = 1
: in-service,statusFrom = 0
: out-of-service,statusFrom = -1
: not included in theMeasurement
type.
Varmeters at the to-bus ends of the branches can be configured using:
varianceTo
(pu or VAr): Measurement variance.statusTo
: Operating status:statusTo = 1
: in-service,statusTo = 0
: out-of-service,statusTo = -1
: not included in theMeasurement
type.
Settings for generating measurements include:
noise
: Defines the method for generating the measurement means:noise = true
: adds white Gaussian noise to the reactive power values, using the defined variances,noise = false
: uses the exact reactive power values without adding noise.
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()
acModel!(system)
analysis = newtonRaphson(system)
for i = 1:10
stopping = mismatch!(system, analysis)
if all(stopping .< 1e-8)
break
end
solve!(system, analysis)
end
power!(system, analysis)
@varmeter(label = "Varmeter ?")
addVarmeter!(system, device, analysis; varianceFrom = 1e-3, statusBus = 0)
JuliaGrid.updateVarmeter!
— FunctionupdateVarmeter!(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()
addBus!(system; label = "Bus 1", base = 132e3)
addBus!(system; label = "Bus 2", base = 132e3)
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)
JuliaGrid.statusVarmeter!
— FunctionstatusVarmeter!(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 can use one main keyword or three fine-tuning keywords to 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()
acModel!(system)
analysis = newtonRaphson(system)
for i = 1:10
stopping = mismatch!(system, analysis)
if all(stopping .< 1e-8)
break
end
solve!(system, analysis)
end
power!(system, analysis)
addVarmeter!(system, device, analysis)
statusVarmeter!(system, device; inserviceFrom = 20)
JuliaGrid.@varmeter
— Macro@varmeter(label, varinaceBus, statusBus, varianceFrom, statusFrom,
varianceTo, 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()
addBus!(system; label = "Bus 1")
addBus!(system; label = "Bus 2")
addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
@varmeter(label = "Varmeter ?", varianceBus = 1e-3, varianceFrom = 1e-4)
addVarmeter!(system, device; bus = "Bus 2", reactive = 0.4)
addVarmeter!(system, device; from = "Branch 1", reactive = 0.1)
Adding varmeters using a custom unit system:
@power(MW, pu, pu)
system = powerSystem()
device = measurement()
addBus!(system; label = "Bus 1")
addBus!(system; label = "Bus 2")
addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
@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)
PMU
JuliaGrid.addPmu!
— MethodaddPmu!(system::PowerSystem, device::Measurement;
label, bus, from, to,
magnitude, varianceMagnitude, angle, varianceAngle,
noise, correlated, polar, status)
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.angle
(rad or deg): Bus voltage or branch current angle value.varianceAngle
(rad or deg): Angle measurement variance.noise
: Specifies how to generate the measurement means:noise = true
: adds white Gaussian noises with variances to themagnitude
andangle
,noise = false
: uses themagnitude
andangle
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.
status
: Operating status of the phasor measurement: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 pmu
field of the Measurement
composite type.
Default Settings
Default settings for certain keywords are as follows: varianceMagnitude = 1e-5
, varianceAngle = 1e-5
, status = 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()
addBus!(system; label = "Bus 1", base = 131.8e3)
addBus!(system; label = "Bus 2", base = 131.8e3)
addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
addPmu!(system, device; label = "PMU 1", bus = "Bus 1", magnitude = 1.1, angle = -0.1)
addPmu!(system, device; label = "PMU 2", from = "Branch 1", magnitude = 1.1, angle = 0.1)
Adding PMUs using a custom unit system:
@voltage(kV, deg, kV)
@current(A, deg)
system = powerSystem()
device = measurement()
addBus!(system; label = "Bus 1", base = 131.8)
addBus!(system; label = "Bus 2", base = 131.8)
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)
JuliaGrid.addPmu!
— MethodaddPmu!(system::PowerSystem, device::Measurement, analysis::AC;
varianceMagnitudeBus, varianceAngleBus, statusBus,
varianceMagnitudeFrom, varianceAngleFrom, statusFrom,
varianceMagnitudeTo, varianceAngleTo, statusTo,
noise, correlated, polar)
The function incorporates PMUs into the Measurement
composite type for every bus and branch within the PowerSystem
type. These measurements are derived from the exact bus voltage magnitudes and angles, as well as branch current magnitudes and angles defined in the AC
type.
Keywords
PMUs at the buses can be configured using:
varianceMagnitudeBus
(pu or V): Variance of bus voltage magnitude measurements.varianceAngleBus
(rad or deg): Variance of bus voltage angle measurements.statuseBus
: Operating status:statusBus = 1
: in-service,statusBus = 0
: out-of-service,statusBus = -1
: not included in theMeasurement
type.
PMUs at the from-bus ends of the branches can be configured using:
varianceMagnitudeFrom
(pu or A): Variance of current magnitude measurements.varianceAngleFrom
(rad or deg): Variance of current angle measurements.statusFrom
: Operating status:statusFrom = 1
: in-service,statusFrom = 0
: out-of-service,statusFrom = -1
: not included in theMeasurement
type.
PMUs at the to-bus ends of the branches can be configured using:
varianceMagnitudeTo
(pu or A): Variance of current magnitude measurements.varianceAngleTo
(rad or deg): Variance of current angle measurements.statusTo
: Operating status:statusTo = 1
: in-service,statusTo = 0
: out-of-service,statusTo = -1
: not included in theMeasurement
type.
Settings for generating measurements include:
noise
: Defines the method for generating the measurement means:noise = true
: adds white Gaussian noise to the phasor values, using the defined variances,noise = false
: uses the exact phasor values without adding noise.
Settings for handling phasor measurements include:
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.
Updates
The function updates the pmu
field of the Measurement
composite type.
Default Settings
Default settings for variance keywords are established at 1e-5
, with all statuses set to 1
, polar = false
, correlated = false
, and noise = false
. Users can change these default settings using the @pmu
macro.
Units
The default units for the variance keywords are in 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.
Example
system = powerSystem("case14.h5")
device = measurement()
acModel!(system)
analysis = newtonRaphson(system)
for i = 1:10
stopping = mismatch!(system, analysis)
if all(stopping .< 1e-8)
break
end
solve!(system, analysis)
end
current!(system, analysis)
@pmu(label = "PMU ?")
addPmu!(system, device, analysis; varianceMagnitudeBus = 1e-3)
JuliaGrid.updatePmu!
— FunctionupdatePmu!(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)
JuliaGrid.statusPmu!
— FunctionstatusPmu!(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()
acModel!(system)
analysis = newtonRaphson(system)
for i = 1:10
stopping = mismatch!(system, analysis)
if all(stopping .< 1e-8)
break
end
solve!(system, analysis)
end
current!(system, analysis)
addPmu!(system, device, analysis)
statusPmu!(system, device; inserviceBus = 14)
JuliaGrid.@pmu
— Macro@pmu(label, noise, correlated, polar,
varianceMagnitudeBus, varianceAngleBus, statusBus,
varianceMagnitudeFrom, varianceAngleFrom, statusFrom,
varianceMagnitudeTo, varianceAngleTo, statusTo)
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 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.
Users have the option to set default values for magnitude and angle variances, as well as statuses. This can be done for PMUs located at the buses using the varianceMagnitudeBus
, varianceAngleBus
, and statusBus
keywords.
The same configuration can be applied at both the from-bus ends of the branches using the varianceMagnitudeFrom
, varianceAngleFrom
, and statusFrom
keywords.
For PMUs located at the to-bus ends of the branches, users can use the varianceMagnitudeTo
, varianceAngleTo
, and statusTo
keywords.
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()
device = measurement()
addBus!(system; label = "Bus 1", base = 132e3)
addBus!(system; label = "Bus 2", base = 132e3)
addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
@pmu(label = "PMU ?", varianceAngleBus = 1e-6, varianceMagnitudeFrom = 1e-4)
addPmu!(system, device; bus = "Bus 1", magnitude = 1.1, angle = -0.1)
addPmu!(system, device; from = "Branch 1", magnitude = 1.1, angle = -0.2)
Adding PMUs using a custom unit system:
@voltage(kV, deg, kV)
@current(A, deg)
system = powerSystem()
device = measurement()
addBus!(system; label = "Bus 1", base = 132.0)
addBus!(system; label = "Bus 2", base = 132.0)
addBranch!(system; label = "Branch 1", from = "Bus 1", to = "Bus 2", reactance = 0.2)
@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)