PowerSimulationsDynamics
PowerSimulationsDynamics.BranchImpedanceChange
— Typemutable struct BranchImpedanceChange <: Perturbation
time::Float64
branch_type::Type{<:PSY.ACBranch}
branch_name::String
multiplier::Float64
end
A BranchImpedanceChange change the impedance of a branch by a user defined multiplier. Currently there is only support for static branches disconnection, PowerSystems.Line
and PowerSystems.Transformer2W
. Future releases will provide support for a Dynamic Line disconnection.
Arguments:
time::Float64
: Defines when the Branch Impedance Change will happen. This time should be inside the time span considered in the Simulationbranch_tipe::Type{<:PowerSystems.ACBranch}
: Type of branch modifiedbranch_name::String
: User defined name for identifying the branchmultiplier::Float64
: User defined value for impedance multiplier.
PowerSimulationsDynamics.BranchTrip
— Typemutable struct BranchTrip <: Perturbation
time::Float64
branch_type::Type{<:PowerSystems.ACBranch}
branch_name::String
end
A BranchTrip completely disconnects a branch from the system. Currently there is only support for static branches disconnection, PowerSystems.Line
and PowerSystems.Transformer2W
. Future releases will provide support for a Dynamic Line disconnection. Note: Islanding is currently not supported in PowerSimulationsDynamics.jl
. If a BranchTrip
isolates a generation unit, the system may diverge due to the isolated generator.
Arguments:
time::Float64
: Defines when the Branch Trip will happen. This time should be inside the time span considered in the Simulationbranch_tipe::Type{<:PowerSystems.ACBranch}
: Type of branch disconnectedbranch_name::String
: User defined name for identifying the branch
PowerSimulationsDynamics.ControlReferenceChange
— Typemutable struct ControlReferenceChange <: Perturbation
time::Float64
device::PowerSystems.DynamicInjection
signal::Symbol
ref_value::Float64
end
A ControlReferenceChange allows to change the reference setpoint provided by a generator/inverter.
Arguments:
time::Float64
: Defines when the Control Reference Change will happen. This time should be inside the time span considered in the Simulationdevice::Type{<:PowerSystems.DynamicInjection}
: Dynamic device modifiedsignal::Symbol
: determines which reference setpoint will be modified. The accepted signals are::P_ref
: Modifies the active power reference setpoint.:V_ref
: Modifies the voltage magnitude reference setpoint (if used).:Q_ref
: Modifies the reactive power reference setpoint (if used).:ω_ref
: Modifies the frequency setpoint.
ref_value::Float64
: User defined value for setpoint reference.
PowerSimulationsDynamics.GeneratorTrip
— Typemutable struct GeneratorTrip <: Perturbation
time::Float64
device::PowerSystems.DynamicInjection
end
A GeneratorTrip
allows to disconnect a Dynamic Generation unit from the system at a specified time.
Arguments:
time::Float64
: Defines when the Generator Trip will happen. This time should be inside the time span considered in the Simulationdevice::Type{<:PowerSystems.DynamicInjection}
: Device to be disconnected
PowerSimulationsDynamics.LoadChange
— Typemutable struct LoadChange <: Perturbation
time::Float64
device::PowerSystems.ElectricLoad
signal::Symbol
ref_value::Float64
end
A LoadChange allows to change the active or reactive power setpoint from a load.
Arguments:
time::Float64
: Defines when the Load Change will happen. This time should be inside the time span considered in the Simulationdevice::Type{<:PowerSystems.ElectricLoad}
: Dynamic device modifiedsignal::Symbol
: determines which reference setpoint will be modified. The accepted signals are::P_ref
: Modifies the active power reference setpoint.:Q_ref
: Modifies the reactive power reference setpoint.
ref_value::Float64
: User defined value for setpoint reference.
PowerSimulationsDynamics.LoadTrip
— Typemutable struct LoadTrip <: Perturbation
time::Float64
device::PowerSystems.ElectricLoad
end
A LoadTrip
allows the user to disconnect a load from the system.
Arguments:
time::Float64
: Defines when the Generator Trip will happen. This time should be inside the time span considered in the Simulationdevice::Type{<:PowerSystems.ElectricLoad}
: Device to be disconnected
PowerSimulationsDynamics.MassMatrixModel
— MethodInstantiate a MassMatrixModel for ODE inputs.
PowerSimulationsDynamics.MassMatrixModel
— MethodInstantiate a MassMatrixModel for ForwardDiff calculations
PowerSimulationsDynamics.NetworkSwitch
— Typefunction NetworkSwitch(
time::Float64,
ybus::SparseArrays.SparseMatrixCSC{Complex{Float64}, Int},
)
Allows to modify directly the admittance matrix, Ybus, used in the Simulation. This allows the user to perform branch modifications, three phase faults (with impedance larger than zero) or branch trips, as long as the new Ybus provided captures that perturbation.
Arguments:
time::Float64
: Defines when the Network Switch will happen. This time should be inside the time span considered in the Simulationybus::SparseArrays.SparseMatrixCSC{Complex{Float64}, Int}
: Complex admittance matrix
PowerSimulationsDynamics.PerturbState
— Typefunction PerturbState(
time::Float64,
index::Int,
value::Float64,
)
Allows the user to modify the state index
by adding value
. The user should modify dynamic states only, since algebraic state may require to do a reinitialization.
Arguments:
time::Float64
: Defines when the modification of the state will happen. This time should be inside the time span considered in the Simulation.index::Int
: Defines which state index you want to modifyvalue::Float64
: Defines how much the state will increase in value
PowerSimulationsDynamics.ResidualModel
— MethodInstantiate an ResidualModel for ODE inputs.
PowerSimulationsDynamics.ResidualModel
— MethodInstantiate an ResidualModel for ForwardDiff calculations
PowerSimulationsDynamics.Simulation
— Methodfunction Simulation
::SimulationModel
system::PowerSystems.System
simulation_folder::String
tspan::NTuple{2, Float64},
perturbations::Vector{<:Perturbation} = Vector{Perturbation}();
kwargs...,
end
Builds the simulation object and conducts the indexing process. The original system is not modified and a copy its created and stored in the Simulation.
Arguments:
::SimulationModel
: Type of Simulation Model.ResidualModel
orMassMatrixModel
. See Models Section for more detailssystem::PowerSystems.System
: System datasimulation_folder::String
: Folder directorytspan::NTuple{2, Float64}
: Time span for simulationperturbations::Vector{<:Perturbation}
: Vector of Perturbations for the Simulation. Default: No Perturbationsinitialize_simulation::Bool
: Runs the initialization routine. If false, simulation runs based on the operation point stored in Systeminitial_conditions::Vector{Float64}
: Allows the user to pass a vector with the initial condition values desired in the simulation. If initialize_simulation = true, these values are used as a first guess and overwritten.frequency_reference
: DefaultReferenceBus
. Determines which frequency model is used for the network. Currently there are two options available:ConstantFrequency
assumes that the network frequency is 1.0 per unit at all times.ReferenceBus
will use the frequency state of a Dynamic Generator (rotor speed) or Dynamic Inverter (virtual speed) connected to the Reference Bus (defined in the Power Flow data) as the network frequency. If multiple devices are connected to such bus, the device with larger base power will be used as a reference. If a Voltage Source is connected to the Reference Bus, then aConstantFrequency
model will be used.
system_to_file::Bool
: Defaultfalse
. Serializes the initialized systemconsole_level::Logging
: DefaultLogging.Warn
. Sets the level of logging output to the console. Can be set toLogging.Error
,Logging.Warn
,Logging.Info
orLogging.Debug
file_level::Logging
: DefaultLogging.Info
. Sets the level of logging output to file. Can be set toLogging.Error
,Logging.Warn
,Logging.Info
orLogging.Debug
disable_timer_outputs::Bool
: Defaultfalse
. Allows the user to display timer information about the construction and initilization of the Simulation.
PowerSimulationsDynamics.SourceBusVoltageChange
— Typemutable struct SourceBusVoltageChange <: Perturbation
time::Float64
device::PSY.Source
signal::Symbol
ref_value::Float64
end
A SourceBusVoltageChange
allows to change the reference setpoint provided by a voltage source.
Arguments:
time::Float64
: Defines when the Control Reference Change will happen. This time should be inside the time span considered in the Simulationdevice::Type{<:PowerSystems.Source}
: Device modifiedsignal::Symbol
: determines which reference setpoint will be modified. The accepted signals are:- :V_ref Modifies the internal voltage magnitude reference setpoint.
- :θ_ref Modifies the internal voltage angle reference setpoint.
ref_value::Float64
: User defined value for setpoint reference.
PowerSimulationsDynamics.Simulation!
— Methodfunction Simulation!
::SimulationModel
system::PowerSystems.System
simulation_folder::String
tspan::NTuple{2, Float64},
perturbations::Vector{<:Perturbation} = Vector{Perturbation}();
kwargs...,
end
Builds the simulation object and conducts the indexing process. The initial conditions are stored in the system.
Arguments:
::SimulationModel
: Type of Simulation Model.ResidualModel
orMassMatrixModel
. See Models Section for more detailssystem::PowerSystems.System
: System datasimulation_folder::String
: Folder directorytspan::NTuple{2, Float64}
: Time span for simulationperturbations::Vector{<:Perturbation}
: Vector of Perturbations for the Simulation. Default: No Perturbationsinitialize_simulation::Bool
: Runs the initialization routine. If false, simulation runs based on the operation point stored in Systeminitial_conditions::Vector{Float64}
: Allows the user to pass a vector with the initial condition values desired in the simulation. If initialize_simulation = true, these values are used as a first guess and overwritten.frequency_reference
: DefaultReferenceBus
. Determines which frequency model is used for the network. Currently there are two options available:ConstantFrequency
assumes that the network frequency is 1.0 per unit at all times.ReferenceBus
will use the frequency state of a Dynamic Generator (rotor speed) or Dynamic Inverter (virtual speed) connected to the Reference Bus (defined in the Power Flow data) as the network frequency. If multiple devices are connected to such bus, the device with larger base power will be used as a reference. If a Voltage Source is connected to the Reference Bus, then aConstantFrequency
model will be used.
system_to_file::Bool
: Defaultfalse
. Serializes the initialized systemconsole_level::Logging
: DefaultLogging.Warn
. Sets the level of logging output to the console. Can be set toLogging.Error
,Logging.Warn
,Logging.Info
orLogging.Debug
file_level::Logging
: DefaultLogging.Info
. Sets the level of logging output to file. Can be set toLogging.Error
,Logging.Warn
,Logging.Info
orLogging.Debug
disable_timer_outputs::Bool
: Defaultfalse
. Allows the user to display timer information about the construction and initilization of the Simulation.
PowerSimulationsDynamics.execute!
— Methodexecute!(
sim::Simulation,
solver;
kwargs...
)
Solves the time-domain dynamic simulation model.
Arguments
sim::Simulation
: Initialized simulation objectsolver
: Solver used for numerical integration. Must be passed correctly depending on the Type of Simulation Modelenable_progress_bar::Bool
: Default:true
. Enables progress bar for the integration routine.- Additional solver keyword arguments can be included. See Common Solver Options in the
DifferentialEquations.jl
documentation for more details.
PowerSimulationsDynamics.get_activepower_branch_flow
— Methodget_activepower_branch_flow(
res::SimulationResults,
name::String,
location::Symbol,
)
Function to obtain the active power flowing through the series element of a Branch. The user must specified is the power should be computed in the :from or to :bus, by specifying a symbol.
If :from is specified, the power is computed flowing outwards the :from bus. If :to is specified, the power is computed flowing into the :to bus.
Arguments
res::SimulationResults
: Simulation Results object that contains the solutionname::String
: Name to identify the specified linelocation::Symbol
: :from or :to to specify a bus
PowerSimulationsDynamics.get_activepower_series
— Methodget_activepower_series(
res::SimulationResults,
name::String,
)
Function to obtain the active power output time series of a Dynamic Injection series out of the DAE Solution.
Arguments
res::SimulationResults
: Simulation Results object that contains the solutionname::String
: Name to identify the specified device
PowerSimulationsDynamics.get_field_current_series
— Methodget_field_current_series(
res::SimulationResults,
name::String,
)
Function to obtain the field current time series of a Dynamic Generator out of the DAE Solution.
Arguments
res::SimulationResults
: Simulation Results object that contains the solutionname::String
: Name to identify the specified device
PowerSimulationsDynamics.get_field_voltage_series
— Methodget_field_voltage_series(
res::SimulationResults,
name::String,
)
Function to obtain the field voltage time series of a Dynamic Generator out of the DAE Solution.
Arguments
res::SimulationResults
: Simulation Results object that contains the solutionname::String
: Name to identify the specified device
PowerSimulationsDynamics.get_frequency_series
— Methodget_frequency_series(
res::SimulationResults,
name::String,
)
Function to obtain the frequency time series of a Dynamic Injection out of the DAE Solution.
Arguments
res::SimulationResults
: Simulation Results object that contains the solutionname::String
: Name to identify the specified device
PowerSimulationsDynamics.get_imaginary_current_branch_flow
— Methodget_imaginary_current_branch_flow(
res::SimulationResults,
name::String,
)
Function to obtain the imaginary current flowing through the series element of a Branch
Arguments
res::SimulationResults
: Simulation Results object that contains the solutionname::String
: Name to identify the specified line
PowerSimulationsDynamics.get_imaginary_current_series
— Methodget_imaginary_current_series(
res::SimulationResults,
name::String,
)
Function to obtain the imaginary current time series of a Dynamic Injection series out of the DAE Solution.
Arguments
res::SimulationResults
: Simulation Results object that contains the solutionname::String
: Name to identify the specified device
PowerSimulationsDynamics.get_jacobian
— Methodfunction get_jacobian(
::Type{T},
system::PSY.System,
sparse_retrieve_loop::Int = 3,
) where {T <: SimulationModel}
Returns the jacobian function of the system model resulting from the system data.
Arguments:
::SimulationModel
: Type of Simulation Model.ResidualModel
orMassMatrixModel
. See Models Section for more detailssystem::PowerSystems.System
: System datasparse_retrieve_loop::Int
: Number of loops for sparsity detection. If 0, builds the Jacobian with a DenseMatrix
PowerSimulationsDynamics.get_mechanical_torque_series
— Methodget_mechanical_torque_series(
res::SimulationResults,
name::String,
)
Function to obtain the mechanical torque time series of the mechanical torque out of the DAE Solution.
Arguments
res::SimulationResults
: Simulation Results object that contains the solutionname::String
: Name to identify the specified device
PowerSimulationsDynamics.get_pss_output_series
— Methodget_pss_output_series(
res::SimulationResults,
name::String,
)
Function to obtain the pss output time series of a Dynamic Generator out of the DAE Solution.
Arguments
res::SimulationResults
: Simulation Results object that contains the solutionname::String
: Name to identify the specified device
PowerSimulationsDynamics.get_reactivepower_branch_flow
— Methodget_reactivepower_branch_flow(
res::SimulationResults,
name::String,
location::Symbol,
)
Function to obtain the reactive power flowing through the series element of a Branch. The user must specified is the power should be computed in the :from or to :bus, by specifying a symbol.
If :from is specified, the power is computed flowing outwards the :from bus. If :to is specified, the power is computed flowing into the :to bus.
Arguments
res::SimulationResults
: Simulation Results object that contains the solutionname::String
: Name to identify the specified linelocation::Symbol
: :from or :to to specify a bus
PowerSimulationsDynamics.get_reactivepower_series
— Methodget_reactivepower_series(
res::SimulationResults,
name::String,
)
Function to obtain the reactive power output time series of a Dynamic Injection series out of the DAE Solution.
Arguments
res::SimulationResults
: Simulation Results object that contains the solutionname::String
: Name to identify the specified device
PowerSimulationsDynamics.get_real_current_branch_flow
— Methodget_real_current_branch_flow(
res::SimulationResults,
name::String,
)
Function to obtain the real current flowing through the series element of a Branch
Arguments
res::SimulationResults
: Simulation Results object that contains the solutionname::String
: Name to identify the specified line
PowerSimulationsDynamics.get_real_current_series
— Methodget_real_current_series(
res::SimulationResults,
name::String,
)
Function to obtain the real current time series of a Dynamic Injection series out of the DAE Solution.
Arguments
res::SimulationResults
: Simulation Results object that contains the solutionname::String
: Name to identify the specified device
PowerSimulationsDynamics.get_setpoints
— Methodget_setpoints(sim::Simulation)
Function that returns the reference setpoints for all the dynamic devices.
Arguments
sim::Simulation
: Simulation object that contains the initial condition and setpoints.
PowerSimulationsDynamics.get_source_imaginary_current_series
— FunctionFunction to obtain output imaginary current for a source. It receives the simulation results, the Source name and an optional argument of the time step of the results.
PowerSimulationsDynamics.get_source_real_current_series
— FunctionFunction to obtain output real current for a source. It receives the simulation results, the Source name and an optional argument of the time step of the results.
PowerSimulationsDynamics.get_state_series
— Methodget_state_series(
res::SimulationResults,
ref::Tuple{String, Symbol};
dt::Union{Nothing, Float64, Vector{Float64}} = nothing
)
end
Function to obtain series of states out of DAE Solution.
Arguments
res::SimulationResults
: Simulation Results object that contains the solutionref:Tuple{String, Symbol}
: Tuple used to identify the dynamic device, via its name, as aString
, and the associated state as aSymbol
.
PowerSimulationsDynamics.get_voltage_angle_series
— Methodget_voltage_angle_series(
res::SimulationResults,
bus_number::Int
)
Function to obtain the voltage angle series out of the DAE Solution.
Arguments
res::SimulationResults
: Simulation Results object that contains the solutionbus_number::Int
: Bus number identifier
PowerSimulationsDynamics.get_voltage_magnitude_series
— Methodget_voltage_magnitude_series(
res::SimulationResults,
bus_number::Int
)
Function to obtain the voltage magnitude series out of the DAE Solution.
Arguments:
res::SimulationResults
: Simulation Results object that contains the solutionbus_number::Int
: Bus number identifier
PowerSimulationsDynamics.read_initial_conditions
— MethodReturns a Dictionary with the resulting initial conditions of the simulation
PowerSimulationsDynamics.show_states_initial_value
— Methodshow_states_initial_value(res::SimulationResults)
Function to print initial states.
Arguments
res::SimulationResults
: Simulation Results object that contains the solution
PowerSimulationsDynamics.show_states_initial_value
— Methodshow_states_initial_value(sim::Simulation)
Function to print initial states.
Arguments
sim::Simulation
: Simulation object that contains the initial condition
PowerSimulationsDynamics.small_signal_analysis
— Methodsmall_signal_analysis(
sim::Simulation,
)
Returns the Small Signal Output object that contains the eigenvalues and participation factors.
Arguments
sim::Simulation
: Small Signal Output object that contains the eigenvalues and participation factors
PowerSimulationsDynamics.summary_eigenvalues
— Methodsummary_eigenvalues(
sm::SmallSignalOutput,
)
Function to obtain a summary of the eigenvalues of the Jacobian at the operating point. It returns a DataFrame with the most associated state for each eigenvalue, its real and imaginary part, damping and frequency.
Arguments
sm::SmallSignalOutput
: Small Signal Output object that contains the eigenvalues and participation factors
PowerSimulationsDynamics.summary_participation_factors
— Methodsummary_participation_factors(
sm::SmallSignalOutput,
)
Function to obtain the participation factor of each state to each eigenvalue. It returns a DataFrame with the participation factors of each state to all eigenvalues.
Arguments
sm::SmallSignalOutput
: Small Signal Output object that contains the eigenvalues and participation factors