ElectricGrid.AckermannGainMatrix
— MethodK = AckermannGainMatrix(λ)
Description
Finds the Ackermann Gain Matrix given the chosen eigenvalues.
ElectricGrid.ButterworthLPF
— MethodButterworthLPF(fc, x, y, μ) - Low Pass Filter
ElectricGrid.CableLengthSetup
— MethodCableLengthSetup(num_cables; random=0, length_bounds=[0.5; 1.5])
under development
ElectricGrid.CharpolyCoef
— Methodα = CharpolyCoef(λ)
Description
given the roots, this function finds the coefficients
Return Values
α
: vector of length(λ)
ElectricGrid.CheckParameters
— MethodCheckParameters(parameters, num_sources, num_loads, num_connections, CM, ts, verbosity)
Checks the parameter dict for completeness.
Gets parameters
and controls the entries based on the given inputs num_sources
, num_loads
, num_connections
, CM
and ts
. Messages can be suppressed by verbosity
.
Arguments
parameters::Dict
: dict containing all parameters of the nodenum_sources::Int
: number of sourcesnum_loads::Int
: number of loadsnum_connections::Int
: number of connectionsCM::Matrix
: connectivity matrix describing the connections in the grid
ElectricGrid.CheckPowerBalance
— Methodp_load_total, q_load_total, s_load_total, s_source_total = CheckPowerBalance(parameters)
Description
Determines based on the parameters of the grid the total power (active and reactive) drawn from all load and the total power provided by the sources. Thereby, steady state is assumed.
Arguments
parameters::Dict
: Dictonary to define the parameter of the grid.num_sources::Int
: Number of sources in the electric power grid.num_loads::Int
: Number of loads in the electric power grid.CM::Matrix
: Conectivity matrix to define the structure of the electric power grid.
Return Values
p_load_total::float
: Total active power drawn by all loads (passive components as well as controlled with negative reference value).q_load_total::float
: Total reactive power drawn by all loads.- sloadtotal::float`: Total apparent power drawn by all loads.
s_source_total::float
: Total apparent power provided by all sources in steady state.
ElectricGrid.ClarkeMag
— MethodDescription
Scaled L2 norm in αβγ coordinates - intantaneous approximation of rms for 3 phase systems
ElectricGrid.ClassicalControl
— MethodClassicalControl(ClassicalPolicy, ElectricGridEnv)
Description
Loops through all of the sources, obtaining measurments from the environment and calculating the actions.
ElectricGrid.CountFilters
— MethodCountFilters(source_list)
Counts the number of filter types, if parameters
is passed.
ElectricGrid.CountLoads
— MethodCountLoads(load_list)
Counts the number of load types, if parameters
is passed.
ElectricGrid.CurrentController
— MethodCurrentController(Source::ClassicalControls, num_source, θ, ω; Kb = 1)
Description
Inner current control with anti-windup.
ElectricGrid.CurrentPILoopShaping
— MethodCurrentPILoopShaping(Source::ClassicalControls, num_source)
Description
Tuning of proportional and integral gain for inner current controller.
ElectricGrid.CustomRun
— FunctionWraps the Run function form https://juliareinforcementlearning.org/ to enable turning off the action noise.
ElectricGrid.DCLinkVoltagesInit
— MethodInitializes the VDC link struct by extracting the structs from the parameterdict and collecting them in a separate struct which will be queried later at runtime.
ElectricGrid.DefaultDataHook
— Methodwhich signals are the default ones if the user does not define a data hook for plotting
ElectricGrid.DividedDiff
— MethodDividedDiff(x, y)
Description
Calculates the coefficients required for Newton interpolation using a divided differences algorithm.
ElectricGrid.DrawGraph
— MethodDrawGraph(self::NodeConstructor)
Plotting a graphical representation of the grid.
ElectricGrid.DroopControlMode
— MethodDroopControlMode(Source::ClassicalControls, num_source; t_end = 0.04)
Description
Wrapper for simple grid forming control.
ElectricGrid.EnvInterface
— MethodEnvInterface(ClassicalControls)
Description
Passes the actions back to the environment.
ElectricGrid.FaultLevel
— MethodR, L = FaultLevel(S, X_R, Vrms; fsys = 50, phase = 3)
Arguments
S::Float
: 3 phase short-circuit power [VA].X/R::Float
: The (Short Circuit) ratio of reactance to resistance.Vrms::Float
: Line to Neutral rms voltage of external network [V].
Keyword Arguments
fsys::Float
: System frequency [Hz].phase::Int
: Single or 3 phase system, i.e. phase = 1, or phase = 3.
Return Values
R::Float
: Effective resistance [Ω].L::Float
: Effective inductance [H].
Theory
An external network is often characterised by its Fault level and its X/R ratio. In particular the Fault Level is a measure of the strength of a network. It is the amount of apparent power that the network can supply when a three-phase bolted to ground fault is applied at the point of connection. From these values an effective resistance and inductance can be calculated. Typical values of X/R ratios are in the range of 0.5 to 1.5, for distribution networks. Transmission networks operating at higher voltages tend to have higher X/R ratios.
ElectricGrid.FilterDesign
— MethodFilterDesign(Sr, fs, fltr; Vrms = 230, Vdc = 800, ΔILf_ILf = 0.15, ΔVCf_VCf = 0.01537)
Description
Designs the filter inductances and capacitances for the sources
Arguments
Sr::Float
: rated 3 phase Apparent Power [VA]fs::Float
:switching frequencyfltr::String
: topology "LCL", "LC", "L"
Keyword Arguments
Vrms::Float
: nominal AC rms voltageVdc::Float
: nominal DC voltageΔILf_ILf::Float
: current ripple ratioΔVCf_VCf::Float
: voltage ripple ratio
ElectricGrid.Filtering
— MethodFiltering(Source::ClassicalControls, num_source, θ)
Description
First order Low pass filter on voltage DQ0 components.
ElectricGrid.FirstOrderLPF
— MethodFirstOrderLPF(fc, x, y, μ) - Low Pass Filter
ElectricGrid.GenerateA
— MethodGenerateA(self::NodeConstructor)
Returns the A matrix by joining the individual sub-matrices together.
ElectricGrid.GenerateALoad
— MethodGenerateALoad(self::NodeConstructor, load_i)
Create the Atranload_l entry in the A matrix.
ElectricGrid.GenerateATrn
— MethodGenerateATrn(self::NodeConstructor)
Create the A_tran entry in the A matrix.
ElectricGrid.GenerateATrnLoadC
— MethodGenerateATrnLoadC(self::NodeConstructor, load_i)
Create the Atranload_c entry in the A matrix.
ElectricGrid.GenerateB
— MethodGenerateB(self::NodeConstructor)
Returns the B matrix by joining the individual sub-matrices together.
ElectricGrid.GenerateC
— MethodGenerateC(self::NodeConstructor)
Returns the C matrix.
ElectricGrid.GenerateCM
— MethodGenerateCM(num_sources, num_loads, S2L_p, S2S_p, L2L_p)
Returns the constructed CM
and the total number of connections.
Gets num_sources
and num_loads
to calculate the total number of elements. Depending on the probabilities S2L_p
, S2S_p
and L2L_p
, the entries are then set in the CM matrix. After the entries have been set randomly, it is checked that all elements have at least one connection and that no subnets have been created.
Arguments
num_sources::Int
: number of sourcesnum_loads::Int
: number of loadsS2L_p::Int
: probability that a source is connected to a loadS2S_p::Int
: probability that a source is connected to a sourceL2L_p::Int
: probability that a load is connected to a load
Return Values
cntr::Int
: number of connectionsCM::Matrix
: connectivity matrix describing the connections in the grid
ElectricGrid.GenerateD
— MethodGenerateD(self::NodeConstructor)
Returns the D matrix.
ElectricGrid.GetASource
— MethodGetASource(self::NodeConstructor, source_i)
Create the A_src entry for a source in the A matrix.
ElectricGrid.GetASourceTrnC
— MethodGetASourceTrnC(self::NodeConstructor, source_i)
Create the Asrctrn_c entry in the A matrix.
ElectricGrid.GetActionIds
— MethodGetActionIds(self::NodeConstructor)
Creates the State Vector for an related NodeConstructor and outputs it as a list of strings.
ElectricGrid.GetBSource
— MethodGetBSource(self::NodeConstructor, source_i)
Create the B_source entry for a source in the B matrix.
ElectricGrid.GetCSumCableNode
— MethodGetCSumCableNode(node_i, self::NodeConstructor)
Returns the sum of the capacities at a node point.
ElectricGrid.GetCableStateIndices
— MethodGetCableStateIndices(self::NodeConstructor,cables)
Returns all state indices for passed cables.
ElectricGrid.GetFltrDistr
— MethodGetFltrDistr(num)
Calculates the distribution of filters based on a Dirichlet distribution and the total num
of filters.
ElectricGrid.GetLoadStateIndices
— MethodGetLoadStateIndices(self::NodeConstructor,loads)
Returns all state indices for passed loads.
ElectricGrid.GetLoadsDistr
— MethodGetLoadsDistr(num)
Calculates the distribution of loads based on a Dirichlet distribution and the total num
of loads.
ElectricGrid.GetOptimizerStatus
— Methodoptimizer_status = GetOptimizerStatus(model)
Description
Returns the status of the optimizer after the optimization process.
Arguments
model::JuMP.Model
: JuMP model of the optimization problem.
Return Values
optimizer_status::Dict
: Dictionary containing the termination status, the primal status and the objective value of the optimization problem.
ElectricGrid.GetPQ
— MethodP, Q = GetPQ(model)
Description
Returns the active and reactive power of all nodes in the grid.
Arguments
model::JuMP.Model
: JuMP model of the optimization problem.
Return Values
P::Vector
: Vector containing the active power of all nodes in the grid.Q::Vector
: Vector containing the reactive power of all nodes in the grid.
ElectricGrid.GetSourceStateIndices
— MethodGetSourceStateIndices(self::NodeConstructor,sources)
Returns all state indices for passed sources.
ElectricGrid.GetStateIds
— MethodGetStateIds(self::NodeConstructor)
Creates the State Vector for an related NodeConstructor and outputs it as a list of strings.
ElectricGrid.GetStateParameters
— MethodGetStateParameters(self::NodeConstructor)
Creates a Vector containing the related L or C Parameters for the states of a NodeConstructor.
ElectricGrid.GetSystem
— MethodGetSystem(self::NodeConstructor)
Returns the system matrices A, B, C and D.
ElectricGrid.GetYBus
— MethodGetYBus(self::NodeConstructor)
Returns the Admittance Matrix of the power grid based on the CM matrix and the parameters.
ElectricGrid.Learn
— Methodhook = Learn(controllers, env, num_episodes = 1 hook=hook)
Description
Executed the given controllers in the environments for num_episodes. Fills thereby the hook. Here the RL agents are training and e.g. action noise is applied.
Arguments
controllers::MultiController
: Contains controllers and agentsenv::ElectricGridEnv
: mutable struct containing the environment.num_episodes::Int
: Number of episodes simulated.hook::DataHook
: Stores the data to measure in a DataFrame.
Return Values
hook::DataHook
: Measured data.
ElectricGrid.LoadSetup
— MethodLoadSetup(num_loads, total_gen; gen_load_ratio=6, random=nothing, Vrms=230)
under development
ElectricGrid.LuenbergerObserver
— MethodLuenbergerObserver(Source::ClassicalControls, num_source)
Description
Discrete time approximate deadbeat Luenberger observer operating in DQ0 frame
ElectricGrid.Measurements
— MethodMeasurements(Source::ClassicalControls)
Description
Calculates RMS quantities and Active and Reactive power for every classical source.
ElectricGrid.MultiGainMatrixPar
— MethodK, v = MultiGainMatrixPar(A, C, λ, p)
Description
Finds the Gain Matrix given the chosen eigenvalues for a multi input system.
ElectricGrid.NewtonInterpolation
— MethodNewtonInterpolation(coef, x_data, x)
Description
Performs a Newton interpolation. Think of x as the point in time, and x_data as the points in time where we know what values the function takes.
ElectricGrid.Observability
— MethodO, rank(O) = Observability(C, A)
Description
Finds the observability matrix.
Return Values
O
: Observability matrixrank(O)
: rank of O
ElectricGrid.ObserverInitialiser
— MethodObserverInitialiser(Source::ClassicalControls, ns)
Description
Initialises the observers
ElectricGrid.OrnsteinUhlenbeck
— MethodOrnsteinUhlenbeck(Source::ClassicalControls)
Description
Produces an Ornstein Uhlenbeck process.
ElectricGrid.PIController
— MethodPIController(Error_new, Error_Hist, Error_t, Kp, Ki, μ; bias = zeros(length(Error_new)))
Description
Generic PI controller.
ElectricGrid.PQControlMode
— MethodPQControlMode(Source::ClassicalControls, num_source, pq0)
Description
Wrapper for simple grid following control. A controllable load on the real and imaginary power.
ElectricGrid.PVControlMode
— MethodPVControlMode(Source::ClassicalControls, num_source, pq0)
Description
Wrapper for more elaborate grid following control. A controllable load on the real power and voltage magnitude.
ElectricGrid.ParallelLoadImpedance
— MethodR, LC, X, Z = ParallelLoadImpedance(S, pf, vrms; fsys = 50, typesign = nothing)
Arguments
S::Float
: 3 phase Apparent Power [VA]pf::Float
: power factor. pf > 0 -> inductive load, pf < 0 -> capacitive loadVrms::Float
: Line to Neutral rms voltage of external network [V]
Keyword Arguments
fsys::Float
: system frequency [Hz]type_sign::String
: "L" or "C" -> for purely capacitive or inductive loads
Return Values
R::Float
: resistance [Ω]L_C::Float
: inductance [H] or capacitance [F]X::Float
: reactance [Ω]Z::Complex
: impedance [Ω]
Theory
Converts a Resistance-Inductance Load, or a Resistance-Capacitance Load from power to circuit values, where the components are placed in parallel.
ElectricGrid.PhaseLockedLoop3ph
— MethodPhaseLockedLoop3ph(Source::ClassicalControls, num_source; ωn = 70, ξ = 0.35)
Description
Tuned 3 phase Phase Locked loop.
ElectricGrid.RMS
— MethodDescription
Per phase least squares calculation of fundamental rms signal
ElectricGrid.Ramp
— MethodRamp(final, μ, i; t_end = 0.02)
Description
Ramps up a signal.
Arguments
final
: the final value.μ
: time step size [s].i
: time step.
Keyword Arguments
t_end
: when the final value should be reached [s].
ElectricGrid.RenderHookResults
— MethodRenderHookResults(; hook,
states_to_plot = nothing,
actions_to_plot = nothing ,
episode = 1,
power_p_inv = [],
power_q_inv = [],
power_p_poc = [],
power_q_poc = [],
v_mag_inv = [],
v_mag_poc = [],
i_mag_inv = [],
i_mag_poc = [],
freq = [],
angles = [],
i_sat = [],
i_err = [],
i_err_t = [],
v_sat = [],
v_err = [],
v_err_t = [],
plot_reward = false,
plot_reference = false,
vdc_to_plot = [],)
Keyword Arguments
episode::Int
: episode to plotpower_p_inv::Vector{Int}
: instantaneous real power at the terminals of the source [W]power_q_inv::Vector{Int}
: instantaneousimaginary power at the terminals of the source [VAi]power_p_poc::Vector{Int}
: instantaneousreal power at the point of connection of the source [W]power_q_poc::Vector{Int}
: instantaneous imaginary power at the point of connection of the source [VAi]v_mag_inv::Vector{Int}
: scaled L₂ norm in αβγ coordinates of the 3 phase voltages at the terminals of the source [V]v_mag_poc::Vector{Int}
: scaled L₂ norm in αβγ coordinates of the 3 phase voltages at the node just after the first filter inductor and resistor of the source [V]i_mag_inv::Vector{Int}
: scaled L₂ norm in αβγ coordinates of the 3 phase currents at the terminals of the source [A]i_mag_poc::Vector{Int}
: scaled L₂ norm in αβγ coordinates of the 3 phase currents flowing into the external network of the source [A]freq::Vector{Int}
: angular velocity of the 3 phase voltages over the capacior nearest to the source [Hz]angles::Vector{Int}
: relative positive phase sequence angles of the 3 phase voltages at the control nodes (measured with respect to the average angle over all the grid-forming sources) [degrees]i_sat::Vector{Int}
: normalised and scaled L₂ norm in αβγ coordinates of the degree of nonlinearity (or anti-windup) of the current controller [V]i_err::Vector{Int}
: L₂ norm in αβγ coordinates of the current error signal (measured current subtracted from reference current in DQ0 coordinates) [A]i_err_t::Vector{Int}
: L₂ norm in αβγ coordinates of the integrated current error signal [As]v_sat::Vector{Int}
: normalised and scaled L₂ norm in αβγ coordinates of the degree of nonlinearity (or anti-windup) of the voltage controller [A]v_err::Vector{Int}
: L₂ norm in αβγ coordinates of the voltage error signal (measured voltage subtracted from reference voltage in DQ0 coordinates) [V]v_err_t::Vector{Int}
: L₂ norm in αβγ coordinates of the integrated voltage error signal [Vs]return_plot::Bool
: specifies whether the plot object should be returned.
Note
For quantities denoted by "...mag..." for balanced symmetrical networks in steady state this quantity equals the root-mean-square (rms) of the signal.
ElectricGrid.SampleCable
— MethodSampleCable()
Sample parameters for the cable.
ElectricGrid.SampleFilterL
— MethodSampleFilterL()
Sample parameters for the L filter.
ElectricGrid.SampleFilterLC
— MethodSampleFilterLC()
Sample parameters for the LC filter.
ElectricGrid.SampleFilterLCL
— MethodSampleFilterLCL()
Sample parameters for the LCL filter.
ElectricGrid.SampleLoadC
— MethodSampleLoadC()
Sample parameters for the C load.
ElectricGrid.SampleLoadL
— MethodSampleLoadL()
Sample parameters for the L load.
ElectricGrid.SampleLoadLC
— MethodSampleLoadLC()
Sample parameters for the LC load.
ElectricGrid.SampleLoadR
— MethodSampleLoadR()
Sample parameters for the R load.
ElectricGrid.SampleLoadRC
— MethodSampleLoadRC()
Sample parameters for the RC load.
ElectricGrid.SampleLoadRL
— MethodSampleLoadRL()
Sample parameters for the RL load.
ElectricGrid.SampleLoadRLC
— MethodSampleLoadRLC()
Sample parameters for the RLC load.
ElectricGrid.SampleSource
— Methoddefault source settings
ElectricGrid.SetConnection
— MethodSetConnection(cntr, x, p)
Sets x to zero or to the value of the counter as a function of p and increases it as well.
ElectricGrid.SetupAgents
— FunctionSetupAgents(env, custom_agents)
Description
Initialises up the agents that will be controlling the electrical network. It depends on the control_type and mode in the parameter dict. Handles to connect the different controllers to the correcponding sources represended by there indices (for states and actions).
Arguments
env::ElectricGridEnv
: mutable struct containing the environment.custom_agents::Dict{Agent}
: Dict of Agents. The key is used as name in the MultiController.
Return Values
Multi_Agent::MultiController
: the struct containing the initialised agents
ElectricGrid.SetupMG
— MethodSetupMG(num_sources, num_cables; random=nothing, avg_pwr=200e3, Vrms=230)
under development
ElectricGrid.Simulate
— Methodhook = Simulate(controllers, env, num_episodes = 1 hook=hook)
Description
Executed the given controllers in the environments for num_episodes. Fills thereby the hook. In case of RL agents deterministic actions are chosen, e.g., no action noise is used.
Arguments
controllers::MultiController
: Contains controllers and agentsenv::ElectricGridEnv
: mutable struct containing the environment.num_episodes::Int
: Number of episodes simulated.hook::DataHook
: Stores the data to measure in a DataFrame.
Return Values
hook::DataHook
: Measured data.
ElectricGrid.SourceInitialiser
— MethodSourceInitialiser(env, Source, modes, source_indices)
Description
Initialises all of the sources with droop coefficients and proportional and integral gains.
ElectricGrid.SourceSetup
— Methodunder development
ElectricGrid.StepMode
— MethodStepMode(Source::ClassicalControls, num_source; t_end = 0.04)
Description
Open loop control. Produces 3 stepped signals.
ElectricGrid.SwingMode
— MethodSwingMode(Source::ClassicalControls, num_source; t_end = 0.04)
Description
Open loop control. Produces 3 phase sinusoidal signals.
ElectricGrid.SwitchRows!
— MethodSwitchRows!(A, row_1, row_2)
Description
Switches rows and columns of a matrix
ElectricGrid.SynchronverterMode
— MethodSynchronverterMode(Source::ClassicalControls, num_source; pq0_ref = [Source.P[num_source]; Source.Q[num_source]], t_end = 0.04, mode = 2)
Description
Wrapper for enhanced grid forming control.
ElectricGrid.ThirdOrderIntegrator
— MethodThirdOrderIntegrator(y_i, μ, u)
ElectricGrid.VoltageControlMode
— MethodVoltageControlMode(Source::ClassicalControls, num_source; t_end = 0.04)
Description
Closed loop voltage control with an inner current loop. Produces 3 phase sinusoidal voltage signals over the filter capacitor.
ElectricGrid.VoltageController
— MethodVoltageController(Source::ClassicalControls, num_source, θ, ω; Kb = 1)
Description
Outer voltage control with anti-windup.
ElectricGrid.VoltagePILoopShaping
— MethodVoltagePILoopShaping(Source::ClassicalControls, num_source)
Description
Tuning of proportional and integral gain for outer voltage controller.
ElectricGrid.plot_rewardresults
— Methodplot_rewardresults(rewardresults = nothing)
# Description
Plots the rewards with time steps on the x-axis and std as a shadowed area around the curve.
Either `rewardresults` or `controllers` have to be defined.
# Keyword Arguments
- `rewardresults::Float64[]`: List containing the rewards for each timestep
- `controllers`: the controllers object returned by `SetupAgents`
ReinforcementLearningBase.reset!
— Methodreset!(env)
Resets the environment. The state is set to x0, the time to t0, reward to zero and done to false.
ReinforcementLearningBase.update!
— MethodProvide a special update for setting no 'terminal' flag when the env is just truncated.
ElectricGrid.ClassicalControls
— TypeClassicalControls
Description
Mutable struct containing all of the variables and properties necessary to define any classical controller
ElectricGrid.ClassicalPolicy
— TypeClassicalPolicy()
Description
The policy which is called when a classical controller is required.
ElectricGrid.DCLinkVoltages
— TypeBasic example for a diffrent source
ElectricGrid.ElectricGridEnv
— Methodenv(action)
Description
Basic function to interact with an RL agent or other controller. Takes the action and evolvs the system defined by the linear state-space system using that action.
Keyword Arguments
action::Vector
: Action which is applied to the env. One per source per phase. Will be multiplied with vdc and can be interpreted as modulation index.
ElectricGrid.ElectricGridEnv
— MethodElectricGridEnv(...)
Description
Returns an environment consisting of an electrical power grid as control plant, which can interact via this interface with a reinforcement learing agent from https://juliareinforcementlearning.org/
Arguments
Keyword Arguments
maxsteps::Int
: The number of time steps that the simulation is run.ts::Float
: Sampling time by which the environment is evolved per step.action_space::Space
: Defines the valide space per action.state_space::Space
: Defines the valide space per state. Default is [-1, 1] since the states of the env will be normalized.prepare_action::function(env::ElectricGridEnv)
: Function to adjust, change, prepare the actions before they are applied to the env during a step(). Per default it returns the action without changes.featurize::function(x:Vector, t:Float; env::ElectricGridEnv, name::String)
: Function to adjust the state before it is returned by the env. For example here reference values can be added to provide the to an RL agent or other feature engineering to improve the learning.reward_function::function(env::ElectricGridEnv, name::String) )
: Function to define the reward for a (named) policy. Return 0 per default.CM::Matrix
: Conectivity matrix to define the structure of the electric power grid (for more details see NodeConstructor).num_sources::Int
: Number of sources in the electric power grid.num_loads::Int
: Number of loads in the electric power grid.parameter::Dict
: Dictonary to define the parameter of the grid. Entries can be "grid", "source", "load", "cable". Here, e.g. the electric components are defined.x0::Vector
: Initial states which will be used in reset!().t0::Float
: Initial time where the env starts from simulating.state_ids::Vector{String}
: IDs of the states. Can be used for plotting or collecting trajectories during a simulation with the DataHook.convert_state_to_cpu::Bool
: Flag if the states are converted to cpu if calculated one gpu beforeuse_gpu::Bool
: Flag if the simulation is done on gpu (if possible).reward::Float
: Reward which the action achieved, applied in the env.action::Vector{Float}
: Action which is applied to the env.action_ids::Vector{String}
: IDs of the actions. Can be used for plotting or collecting trajectories during a simulation with the DataHook.state_action_delay::Int
: Specifies the number of simulation steps it is delayed from giving an action to the env to when it is applied to the plant.t_end::Float
: Spezifies the end time of an episode. If defined it overwrites maxsteps.verbosity::Int
: Defines the level of how much information (warnings, info,...) is printed to the console (0 - nothing, 1 - warn, 2 - debug(warn, info,...)).state_ids_RL::Vector{String}
: State IDs which are given to RL agents.action_ids_RL::Vector{String}
: Action IDs which are given to RL agents.
Return Values
ElectricGridEnv::ElectricGridEnv
: Environment an agent can interact with
ElectricGrid.MultiController
— MethodMultiController(agents, action_ids)
Description
Constructs the MultiController providing different subfunctions mappen the correct env indices to the corresponding controllers and agents.
Arguments
agents::Dict(NamedPolicy, ids)
: Contains all the agents as named policys with there corresponding ids.action_ids::Vector{String}
: All env action indices.
Return Values
Multi_Agent::MultiController
: the struct containing the initialised agents
ElectricGrid.NodeConstructor
— MethodNodeConstructor(;
num_sources,
num_loads,
CM = nothing,
parameters = nothing,
S2S_p = 0.1,
S2L_p = 0.8,
L2L_p = 0.3,
ts = 10000,
verbosity = 0
)
Create a mutable struct NodeConstructor, which serves as a basis for the creation of an energy grid: num_sources
corresponse to the amount of sources and num_loads
is the amount of loads in the grid. CM
is the connection matrix which indicates how the elements in the grid are connected to each other. To specify the elements of the net in more detail, values for the elements can be passed via parameters
. If no connection matrix is entered, it can be generated automatically. S2S_p
is the probability that a source is connected to another source and S2L_p
is the probability that a source is connected to a load.
ElectricGrid.TD3Policy
— MethodTD3Policy(;kwargs...)
Keyword arguments
behavior_actor
,behavior_critic
,target_actor
,target_critic
,start_policy
,γ = 0.99f0
,ρ = 0.995f0
,batch_size = 32
,start_steps = 10000
,update_after = 1000
,update_freq = 50
,policy_freq = 2
# frequency in which the actor performs a gradient update_step and critic target is updatedtarget_act_limit = 1.0
, # noise added to actor targettarget_act_noise = 0.1
, # noise added to actor targetact_limit = 1.0
, # noise added when outputing actionact_noise = 0.1
, # noise added when outputing actionupdate_step = 0
,rng = Random.default_rng()
,
ElectricGrid.solar_module
— TypeBasic example for a diffrent source