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
Print Power System Data
Print Power System Summary
Print Measurement Data
Print Constraint Data
Base Units
JuliaGrid.@base
— Macro@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)
Input Units
JuliaGrid.@power
— Macro@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:
addBus!
,updateBus!
,@bus
:active
,conductance
;addBranch!
,updateBranch!
,@branch
: iftype = 2
:minFromBus
,maxFromBus
,minToBus
,maxToBus
;addGenerator!
,updateGenerator!
,@generator
:active
,minActive
,maxActive
,lowActive
,upActive
,loadFollowing
,reserve10min
,reserve30min
;cost!
: ifactive
:piecewise
,polynomial
;addWattmeter!
,updateWattmeter!
:active
,variance
;@wattmeter
: ,varianceBus
,varianceFrom
,varianceTo
.
Changing the unit of reactive
power unit is reflected in the following quantities:
addBus!
,updateBus!
,@bus
:reactive
,susceptance
;addGenerator!
,updateGenerator!
,@generator
:reactive
,minReactive
,maxReactive
,minLowReactive
,maxLowReactive
,minUpReactive
,maxUpReactive
,reactiveRamp
;cost!
: ifreactive
:piecewise
,polynomial
;addVarmeter!
,updateVarmeter!
:reactive
,variance
;@varmeter
:varianceBus
,varianceFrom
,varianceTo
.
Changing the unit of apparent
power unit is reflected in the following quantities:
addBranch!
,updateBranch!
,@branch
: iftype = 1
:minFromBus
,maxFromBus
,minToBus
,maxToBus
.
Example
@power(MW, kVAr, VA)
JuliaGrid.@voltage
— Macro@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:
addBus!
,updateBus!
,@bus
:magnitude
,minMagnitude
,maxMagnitude
;addGenerator!
,updateGenerator!
,@generator
:magnitude
;addVoltmeter!
,updateVoltmeter!
,@voltmeter
:magnitude
,variance
;addPmu!
,updatePmu!
: ifbus
:magnitude
,varianceMagnitude
;@pmu
:varianceMagnitudeBus
.
Changing the unit of voltage angle
is reflected in the following quantities:
addBus!
,updateBus!
,@bus
:angle
;addBranch!
,updateBranch!
,@branch
:shiftAngle
,minDiffAngle
,maxDiffAngle
;addPmu!
,updatePmu!
: ifbus
:angle
,varianceAngle
;@pmu
:varianceAngleBus
.
Changing the unit prefix of voltage base
is reflected in the following quantity:
addBus!
,updateBus!
,@bus
:base
.
Example
@voltage(pu, deg, kV)
JuliaGrid.@current
— Macro@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:
addBranch!
,updateBranch!
,@branch
: iftype = 3
:minFromBus
,maxFromBus
,minToBus
,maxToBus
.addAmmeter!
,updateAmmeter!
:magnitude
,variance
;@ammeter
:varianceFrom
,varianceTo
;addPmu!
,updatePmu!
: iffrom
orto
:magnitude
,varianceMagnitude
;@pmu
:varianceMagnitudeFrom
,varianceMagnitudeTo
.
Changing the unit of current angle
is reflected in the following quantities:
addPmu!
,updatePmu!
: iffrom
orto
:angle
,varianceAngle
;@pmu
:varianceAngleFrom
,varianceAngleTo
.
Example
@current(pu, deg)
JuliaGrid.@parameter
— Macro@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:
addBranch!
,updateBranch!
,@branch
:resistance
,reactance
.
Changing the units of admittance
is reflected in the following quantities:
addBranch!
,updateBranch!
,@branch
:conductance
,susceptance
.
Example
@parameter(Ω, pu)
Label Types
JuliaGrid.@labels
— Macro@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)
Default Settings
JuliaGrid.@default
— Macro@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)
Print Power System Data
JuliaGrid.printBusData
— FunctionprintBusData(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.
The function printBusData
requires Julia 1.10 or later.
Example
system = powerSystem("case14.h5")
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)
# Print data for all buses
fmt = Dict("Power Demand" => "%.2f", "Voltage Magnitude" => "%.2f", "Label" => "%s")
show = Dict("Power Injection" => false, "Power Generation Reactive" => false)
printBusData(system, analysis; fmt, show, repeat = 10)
# Print data for specific buses
delimiter = " "
width = Dict("Voltage" => 9, "Power Injection Active" => 9)
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)
JuliaGrid.printBranchData
— FunctionprintBranchData(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.
The function printBranchData
requires Julia 1.10 or later.
Example
system = powerSystem("case14.h5")
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)
# Print data for all branches
fmt = Dict("Shunt Power" => "%.2f", "Series Power Reactive" => "%.2f")
show = Dict("From-Bus Power" => false, "To-Bus Power Reactive" => false)
printBranchData(system, analysis; fmt, show, repeat = 11, title = false)
# Print data for specific branches
delimiter = " "
width = Dict("From-Bus Power" => 9, "To-Bus Power Active" => 9)
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)
JuliaGrid.printGeneratorData
— FunctionprintGeneratorData(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.
The function printGeneratorData
requires Julia 1.10 or later.
Example
system = powerSystem("case14.h5")
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)
# Print data for all generators
fmt = Dict("Power Output Active" => "%.2f")
show = Dict("Power Output Reactive" => false)
printGeneratorData(system, analysis; fmt, show, title = false)
# Print data for specific generators
delimiter = " "
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)
Print Power System Summary
JuliaGrid.printBusSummary
— FunctionprintBusSummary(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.
The function printBusSummary
requires Julia 1.10 or later.
Example
system = powerSystem("case14.h5")
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)
show = Dict("In-Use" => false)
printBusSummary(system, analysis; show, delimiter = " ", title = false)
JuliaGrid.printBranchSummary
— FunctionprintBranchSummary(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.
The function printBranchSummary
requires Julia 1.10 or later.
Example
system = powerSystem("case14.h5")
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)
show = Dict("Total" => false)
printBranchSummary(system, analysis; show, delimiter = " ", title = false)
JuliaGrid.printGeneratorSummary
— FunctionprintGeneratorSummary(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.
The function printGeneratorSummary
requires Julia 1.10 or later.
Example
system = powerSystem("case14.h5")
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)
show = Dict("Minimum" => false)
printGeneratorSummary(system, analysis; show, delimiter = " ", title = false)
Print Measurement Data
JuliaGrid.printVoltmeterData
— FunctionprintVoltmeterData(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.
The function printBusData
requires Julia 1.10 or later.
Example
system = powerSystem("case14.h5")
device = measurement("measurement14.h5")
analysis = gaussNewton(system, device)
for iteration = 1:20
stopping = solve!(system, analysis)
if stopping < 1e-8
break
end
end
power!(system, analysis)
# Print data for all voltmeters
fmt = Dict("Voltage Magnitude" => "%.2f", "Voltage Magnitude Estimate" => "%.6f")
show = Dict("Voltage Magnitude Residual" => false)
printVoltmeterData(system, device, analysis; fmt, show, delimiter = " ", repeat = 10)
# Print data for specific voltmeters
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)
JuliaGrid.printAmmeterData
— FunctionprintAmmeterData(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.
The function printBusData
requires Julia 1.10 or later.
Example
system = powerSystem("case14.h5")
device = measurement("measurement14.h5")
analysis = gaussNewton(system, device)
for iteration = 1:20
stopping = solve!(system, analysis)
if stopping < 1e-8
break
end
end
current!(system, analysis)
# Print data for all ammeters
fmt = Dict("Current Magnitude" => "%.2f", "Current Magnitude Estimate" => "%.6f")
show = Dict("Current Magnitude Residual" => false)
printAmmeterData(system, device, analysis; fmt, show, delimiter = " ", repeat = 10)
# Print data for specific ammeters
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)
JuliaGrid.printWattmeterData
— FunctionprintWattmeterData(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.
The function printBusData
requires Julia 1.10 or later.
Example
system = powerSystem("case14.h5")
device = measurement("measurement14.h5")
analysis = gaussNewton(system, device)
for iteration = 1:20
stopping = solve!(system, analysis)
if stopping < 1e-8
break
end
end
power!(system, analysis)
# Print data for all wattmeters
fmt = Dict("Active Power" => "%.2f", "Active Power Estimate" => "%.6f")
show = Dict("Active Power Status" => false)
printWattmeterData(system, device, analysis; fmt, show, delimiter = " ", repeat = 14)
# Print data for specific wattmeters
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)
JuliaGrid.printVarmeterData
— FunctionprintVarmeterData(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.
The function printBusData
requires Julia 1.10 or later.
Example
system = powerSystem("case14.h5")
device = measurement("measurement14.h5")
analysis = gaussNewton(system, device)
for iteration = 1:20
stopping = solve!(system, analysis)
if stopping < 1e-8
break
end
end
power!(system, analysis)
# Print data for all wattmeters
fmt = Dict("Reactive Power" => "%.2f", "Reactive Power Estimate" => "%.6f")
show = Dict("Reactive Power Status" => false)
printVarmeterData(system, device, analysis; fmt, show, delimiter = " ", repeat = 14)
# Print data for specific wattmeters
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)
JuliaGrid.printPmuData
— FunctionprintPmuData(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.
The function printPmuData
requires Julia 1.10 or later.
Example
system = powerSystem("case14.h5")
device = measurement("measurement14.h5")
analysis = gaussNewton(system, device)
for iteration = 1:20
stopping = solve!(system, analysis)
if stopping < 1e-8
break
end
end
current!(system, analysis)
# Print data for all PMUs
fmt = Dict("Current Magnitude" => "%.2f", "Current Magnitude Variance" => "%.5f")
show = Dict("Current Angle" => false, "Current Magnitude Status" => false)
printPmuData(system, device, analysis; fmt, show, delimiter = " ", repeat = 10)
# Print data for specific PMUs
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)
Print Constraint Data
JuliaGrid.printBusConstraint
— FunctionprintBusConstraint(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.
The function printBusConstraint
requires Julia 1.10 or later.
Example
using Ipopt
system = powerSystem("case14.h5")
analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
solve!(system, analysis)
# Print data for all buses
fmt = Dict("Active Power Balance" => "%.2e", "Reactive Power Balance Dual" => "%.4e")
show = Dict("Voltage Magnitude" => false, "Reactive Power Balance Solution" => false)
printBusConstraint(system, analysis; fmt, show, repeat = 10)
# Print data for specific buses
delimiter = " "
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)
JuliaGrid.printBranchConstraint
— FunctionprintBranchConstraint(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.
The function printBranchConstraint
requires Julia 1.10 or later.
Example
using Ipopt
system = powerSystem("case14.h5")
updateBranch!(system; label = 3, minDiffAngle = 0.05, maxDiffAngle = 1.5)
updateBranch!(system; label = 4, minDiffAngle = 0.05, maxDiffAngle = 1.1)
updateBranch!(system; label = 4, maxFromBus = 0.4, maxToBus = 0.5)
updateBranch!(system; label = 9, minFromBus = 0.1, maxFromBus = 0.3)
analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
solve!(system, analysis)
# Print data for all branches
fmt = Dict("Voltage Angle Difference" => "%.2f")
show = Dict("To-Bus Apparent Power Flow Dual" => false)
printBranchConstraint(system, analysis; fmt, show, repeat = 2)
# Print data for specific branches
delimiter = " "
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)
JuliaGrid.printGeneratorConstraint
— FunctionprintGeneratorConstraint(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.
The function printGeneratorConstraint
requires Julia 1.10 or later.
Example
using Ipopt
system = powerSystem("case14.h5")
analysis = acOptimalPowerFlow(system, Ipopt.Optimizer)
solve!(system, analysis)
# Print data for all generators
fmt = Dict("Active Power Capability" => "%.2f")
show = Dict("Reactive Power Capability" => false, "Active Power Capability Dual" => false)
printGeneratorConstraint(system, analysis; fmt, show, repeat = 3)
# Print data for specific generators
delimiter = " "
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)