GridCal.Engine.Simulations.Stochastic package¶
Submodules¶
GridCal.Engine.Simulations.Stochastic.blackout_driver module¶
-
class
GridCal.Engine.Simulations.Stochastic.blackout_driver.
CascadeType
¶ Bases:
enum.Enum
An enumeration.
-
LatinHypercube
= 1¶
-
PowerFlow
= (0,)¶
-
-
class
GridCal.Engine.Simulations.Stochastic.blackout_driver.
Cascading
(grid: GridCal.Engine.Core.multi_circuit.MultiCircuit, options: GridCal.Engine.Simulations.PowerFlow.power_flow_driver.PowerFlowOptions, triggering_idx=None, max_additional_islands=1, cascade_type_: GridCal.Engine.Simulations.Stochastic.blackout_driver.CascadeType = <CascadeType.LatinHypercube: 1>, n_lhs_samples_=1000)¶ Bases:
PySide2.QtCore.QThread
-
cancel
()¶ Cancel the simulation :return:
-
done_signal
= <PySide2.QtCore.Signal object>¶
-
get_failed_idx
()¶ Return the array of all failed branches Returns:
array of all failed branches
-
get_table
()¶ Get DataFrame of the failed elements :return: DataFrame
-
perform_step_run
()¶ Perform only one step cascading Returns:
Nothing
-
progress_signal
= <PySide2.QtCore.Signal object>¶
-
progress_text
= <PySide2.QtCore.Signal object>¶
-
static
remove_elements
(circuit: GridCal.Engine.Core.multi_circuit.MultiCircuit, loading_vector, idx=None)¶ Remove branches based on loading Returns:
Nothing
-
static
remove_probability_based
(numerical_circuit: GridCal.Engine.Core.numerical_circuit.NumericalCircuit, results: GridCal.Engine.Simulations.Stochastic.monte_carlo_results.MonteCarloResults, max_val, min_prob)¶ Remove branches based on their chance of overload :param numerical_circuit: :param results: :param max_val: :param min_prob: :return: list of indices actually removed
-
run
()¶ Run the monte carlo simulation @return:
-
staticMetaObject
= <PySide2.QtCore.QMetaObject object>¶
-
-
class
GridCal.Engine.Simulations.Stochastic.blackout_driver.
CascadingReportElement
(removed_idx, pf_results, criteria)¶ Bases:
object
-
class
GridCal.Engine.Simulations.Stochastic.blackout_driver.
CascadingResults
(cascade_type: GridCal.Engine.Simulations.Stochastic.blackout_driver.CascadeType)¶ Bases:
object
-
get_failed_idx
()¶ Return the array of all failed branches Returns:
array of all failed branches
-
get_table
()¶ Get DataFrame of the failed elements :return: DataFrame
-
plot
()¶
-
GridCal.Engine.Simulations.Stochastic.lhs_driver module¶
-
class
GridCal.Engine.Simulations.Stochastic.lhs_driver.
LatinHypercubeSampling
(grid: GridCal.Engine.Core.multi_circuit.MultiCircuit, options: GridCal.Engine.Simulations.PowerFlow.power_flow_driver.PowerFlowOptions, sampling_points=1000)¶ Bases:
PySide2.QtCore.QThread
-
cancel
()¶ Cancel the simulation
-
done_signal
= <PySide2.QtCore.Signal object>¶
-
get_steps
()¶ Get time steps list of strings
-
progress_signal
= <PySide2.QtCore.Signal object>¶
-
progress_text
= <PySide2.QtCore.Signal object>¶
-
run
()¶ Run the monte carlo simulation @return:
-
run_multi_thread
()¶ Run the monte carlo simulation @return:
-
run_single_thread
()¶ Run the monte carlo simulation @return:
-
staticMetaObject
= <PySide2.QtCore.QMetaObject object>¶
-
GridCal.Engine.Simulations.Stochastic.monte_carlo_driver module¶
-
class
GridCal.Engine.Simulations.Stochastic.monte_carlo_driver.
MonteCarlo
(grid: GridCal.Engine.Core.multi_circuit.MultiCircuit, options: GridCal.Engine.Simulations.PowerFlow.power_flow_driver.PowerFlowOptions, mc_tol=0.001, batch_size=100, max_mc_iter=10000)¶ Bases:
PySide2.QtCore.QThread
-
cancel
()¶ Cancel the simulation :return:
-
done_signal
= <PySide2.QtCore.Signal object>¶
-
get_steps
()¶ Get time steps list of strings
-
progress_signal
= <PySide2.QtCore.Signal object>¶
-
progress_text
= <PySide2.QtCore.Signal object>¶
-
run
()¶ Run the monte carlo simulation @return:
-
run_multi_thread
()¶ Run the monte carlo simulation @return:
-
run_single_thread
()¶ Run the monte carlo simulation @return:
-
staticMetaObject
= <PySide2.QtCore.QMetaObject object>¶
-
-
GridCal.Engine.Simulations.Stochastic.monte_carlo_driver.
make_monte_carlo_input
(numerical_input_island: GridCal.Engine.Core.calculation_inputs.CalculationInputs)¶ Generate a monte carlo input instance :param numerical_input_island: :return:
GridCal.Engine.Simulations.Stochastic.monte_carlo_input module¶
GridCal.Engine.Simulations.Stochastic.monte_carlo_results module¶
-
class
GridCal.Engine.Simulations.Stochastic.monte_carlo_results.
MonteCarloResults
(n, m, p=0)¶ Bases:
object
-
append_batch
(mcres)¶ Append a batch (a MonteCarloResults object) to this object @param mcres: MonteCarloResults object @return:
-
compile
()¶ Compiles the final Monte Carlo values by running an online mean and @return:
-
get_index_loading_cdf
(max_val=1.0)¶ Find the elements where the CDF is greater or equal to a velue :param max_val: value to compare :return: indices, associated probability
-
get_results_dict
()¶ Returns a dictionary with the results sorted in a dictionary :return: dictionary of 2D numpy arrays (probably of complex numbers)
-
get_voltage_sum
()¶ Return the voltage summation @return:
-
open
(fname)¶ open pickle Args:
fname: file nameReturns: true if succeeded, false otherwise
-
plot
(result_type: GridCal.Engine.Simulations.result_types.ResultTypes, ax=None, indices=None, names=None)¶ Plot the results :param result_type: :param ax: :param indices: :param names: :return:
-
query_voltage
(power_array)¶ Fantastic function that allows to query the voltage from the sampled points without having to run power flows Args:
power_array: power injections vectorReturns: Interpolated voltages vector
-
save
(fname)¶ Export as pickle
-
GridCal.Engine.Simulations.Stochastic.reliability_driver module¶
-
class
GridCal.Engine.Simulations.Stochastic.reliability_driver.
ReliabilityStudy
(circuit: GridCal.Engine.Core.multi_circuit.MultiCircuit, pf_options: GridCal.Engine.Simulations.PowerFlow.power_flow_driver.PowerFlowOptions)¶ Bases:
PySide2.QtCore.QThread
-
cancel
()¶
-
done_signal
= <PySide2.QtCore.Signal object>¶
-
progress_callback
(l)¶ Send progress report :param l: lambda value :return: None
-
progress_signal
= <PySide2.QtCore.Signal object>¶
-
progress_text
= <PySide2.QtCore.Signal object>¶
-
run
()¶ run the voltage collapse simulation @return:
-
staticMetaObject
= <PySide2.QtCore.QMetaObject object>¶
-
-
GridCal.Engine.Simulations.Stochastic.reliability_driver.
get_failure_time
(mttf)¶ Get an array of possible failure times :param mttf: mean time to failure
-
GridCal.Engine.Simulations.Stochastic.reliability_driver.
get_reliability_events
(horizon, mttf, mttr, tpe: GridCal.Engine.Devices.meta_devices.DeviceType)¶ Get random fail-repair events until a given time horizon in hours :param horizon: maximum horizon in hours :return: list of events, Each event tuple has: (time in hours, element index, activation state (True/False))
-
GridCal.Engine.Simulations.Stochastic.reliability_driver.
get_reliability_scenario
(nc: GridCal.Engine.Core.numerical_circuit.NumericalCircuit, horizon=10000)¶ Get reliability events Args:
nc: numerical circuit instance horizon: time horizon in hoursReturns: dictionary of events Each event tuple has: (time in hours, element index, activation state (True/False))
-
GridCal.Engine.Simulations.Stochastic.reliability_driver.
get_repair_time
(mttr)¶ Get an array of possible repair times :param mttr: mean time to recovery
-
GridCal.Engine.Simulations.Stochastic.reliability_driver.
run_events
(nc: GridCal.Engine.Core.numerical_circuit.NumericalCircuit, events_list: list)¶