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
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

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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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")

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)
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")

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)
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")

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)
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")

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)
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")

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)
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")

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)
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")
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)
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")

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)
source