Ejemplo n.º 1
0
    def __init__(self, grid: MultiCircuit, sigmas=0.5, min_group_size=2, ptdf_results: LinearAnalysisResults = None):
        """
        Electric distance clustering
        :param grid: MultiCircuit instance
        :param sigmas: number of standard deviations to consider
        """
        DriverTemplate.__init__(self, grid=grid)

        self.grid = grid

        self.sigmas = sigmas

        self.min_group_size = min_group_size

        n = len(grid.buses)

        self.use_ptdf = True

        self.ptdf_results = ptdf_results

        # results
        self.X_train = np.zeros((n, n))
        self.sigma = 1.0
        self.groups_by_name = list()
        self.groups_by_index = list()

        self.__cancel__ = False
Ejemplo n.º 2
0
    def __init__(self,
                 grid: MultiCircuit,
                 options: PowerFlowOptions,
                 opf_results: OptimalPowerFlowResults = None):
        """
        PowerFlowDriver class constructor
        :param grid: MultiCircuit instance
        :param options: PowerFlowOptions instance
        :param opf_results: OptimalPowerFlowResults instance
        """

        DriverTemplate.__init__(self, grid=grid)

        # Options to use
        self.options = options

        self.opf_results = opf_results

        self.results = PowerFlowResults(n=0,
                                        m=0,
                                        n_tr=0,
                                        n_hvdc=0,
                                        bus_names=(),
                                        branch_names=(),
                                        transformer_names=(),
                                        hvdc_names=(),
                                        bus_types=())

        self.logger = Logger()

        self.convergence_reports = list()

        self.__cancel__ = False
Ejemplo n.º 3
0
    def __init__(self, grid: MultiCircuit, options: ShortCircuitOptions, pf_options: PowerFlowOptions,
                 pf_results: PowerFlowResults, opf_results=None):
        """
        PowerFlowDriver class constructor
        @param grid: MultiCircuit Object
        """
        DriverTemplate.__init__(self, grid=grid)

        # power flow results
        self.pf_results = pf_results

        self.pf_options = pf_options

        self.opf_results = opf_results

        # Options to use
        self.options = options

        self.results = None

        self.logger = Logger()

        self.__cancel__ = False

        self._is_running = False
Ejemplo n.º 4
0
    def __init__(self,
                 circuit: MultiCircuit,
                 options: ContinuationPowerFlowOptions,
                 inputs: ContinuationPowerFlowInput,
                 pf_options: PowerFlowOptions,
                 opf_results=None,
                 t=0):
        """
        ContinuationPowerFlowDriver constructor
        :param circuit: NumericalCircuit instance
        :param options: ContinuationPowerFlowOptions instance
        :param inputs: ContinuationPowerFlowInput instance
        :param pf_options: PowerFlowOptions instance
        :param opf_results:
        """

        DriverTemplate.__init__(self, grid=circuit)

        # voltage stability options
        self.options = options

        self.inputs = inputs

        self.pf_options = pf_options

        self.opf_results = opf_results

        self.t = t

        self.results = None
Ejemplo n.º 5
0
    def __init__(self, circuit: MultiCircuit):
        """
        Constructor
        :param circuit: circuit object
        """

        DriverTemplate.__init__(self, grid=circuit)

        self.se_results = None
Ejemplo n.º 6
0
    def __init__(self, grid: MultiCircuit, branch_indices):
        """
        Topology reduction driver
        :param grid: MultiCircuit instance
        :param options:
        """
        DriverTemplate.__init__(self, grid=grid)

        self.br_to_remove = branch_indices

        self.__cancel__ = False
Ejemplo n.º 7
0
    def __init__(self, circuit: MultiCircuit, pf_options: PowerFlowOptions):
        """
        ContinuationPowerFlowDriver constructor
        @param circuit: NumericalCircuit instance
        @param pf_options: power flow options instance
        """
        DriverTemplate.__init__(self, grid=circuit)

        # voltage stability options
        self.pf_options = pf_options

        self.results = list()

        self.__cancel__ = False
Ejemplo n.º 8
0
    def __init__(self, grid: MultiCircuit, options: OptimalPowerFlowOptions,
                 pf_options: PowerFlowOptions):
        """
        PowerFlowDriver class constructor
        @param grid: MultiCircuit Object
        @param options: OPF options
        """
        DriverTemplate.__init__(self, grid=grid)

        # Options to use
        self.options = options

        self.pf_options = pf_options

        self.all_solved = True
Ejemplo n.º 9
0
    def __init__(self, grid: MultiCircuit, options: TransientStabilityOptions,
                 pf_res: PowerFlowResults):
        """
        TimeSeries constructor
        @param grid: MultiCircuit instance
        @param options: PowerFlowOptions instance
        """
        DriverTemplate.__init__(self, grid=grid)

        self.grid = grid

        self.options = options

        self.pf_res = pf_res

        self.results = None
Ejemplo n.º 10
0
    def __init__(self, grid: MultiCircuit, objects, sel_idx):
        """

        :param grid:
        :param objects: list of objects to reduce (buses in this cases)
        :param sel_idx: indices
        """
        DriverTemplate.__init__(self, grid=grid)

        self.objects = objects

        self.sel_idx = sel_idx

        self.buses_merged = list()

        self.__cancel__ = False
Ejemplo n.º 11
0
    def __init__(self, grid: MultiCircuit, options: PowerFlowOptions):
        """
        PowerFlowDriver class constructor
        :param grid: MultiCircuit instance
        :param options: PowerFlowOptions instance
        """
        DriverTemplate.__init__(self, grid=grid)

        # Options to use
        self.options = options

        self.results = None

        self.logger = Logger()

        self.convergence_reports = list()

        self.__cancel__ = False
Ejemplo n.º 12
0
    def __init__(self, grid: MultiCircuit, options: ContingencyAnalysisOptions):
        """
        N - k class constructor
        @param grid: MultiCircuit Object
        @param options: N-k options
        @:param pf_options: power flow options
        """
        DriverTemplate.__init__(self, grid=grid)

        # Options to use
        self.options = options

        # N-K results
        self.results = ContingencyAnalysisResults(nbus=0, nbr=0,
                                                  bus_names=(),
                                                  branch_names=(),
                                                  bus_types=())

        self.numerical_circuit = None
Ejemplo n.º 13
0
    def __init__(self, grid: MultiCircuit, options: LinearAnalysisOptions):
        """
        Power Transfer Distribution Factors class constructor
        @param grid: MultiCircuit Object
        @param options: OPF options
        """
        DriverTemplate.__init__(self, grid=grid)

        # Options to use
        self.options = options

        # OPF results
        self.results = LinearAnalysisResults(n_br=0,
                                             n_bus=0,
                                             br_names=[],
                                             bus_names=[],
                                             bus_types=[])

        self.all_solved = True
Ejemplo n.º 14
0
    def __init__(
        self,
        grid: MultiCircuit,
        options: PowerFlowOptions,
        mc_tol=1e-3,
        batch_size=100,
        sampling_points=10000,
        opf_time_series_results=None,
        simulation_type: StochasticPowerFlowType = StochasticPowerFlowType.
        LatinHypercube):
        """
        Monte Carlo simulation constructor
        :param grid: MultiGrid instance
        :param options: Power flow options
        :param mc_tol: monte carlo std.dev tolerance
        :param batch_size: size of the batch
        :param sampling_points: maximum monte carlo iterations in case of not reach the precission
        :param simulation_type: Type of sampling method
        """
        DriverTemplate.__init__(self, grid=grid)

        self.options = options

        self.opf_time_series_results = opf_time_series_results

        self.mc_tol = mc_tol

        self.batch_size = batch_size

        self.sampling_points = sampling_points

        self.simulation_type = simulation_type

        self.results = None

        self.logger = Logger()

        self.pool = None

        self.returned_results = list()

        self.__cancel__ = False
Ejemplo n.º 15
0
    def __init__(self, grid: MultiCircuit,
                 options: AvailableTransferCapacityOptions):
        """
        Power Transfer Distribution Factors class constructor
        @param grid: MultiCircuit Object
        @param options: OPF options
        @:param pf_results: PowerFlowResults, this is to get the Sf
        """
        DriverTemplate.__init__(self, grid=grid)

        # Options to use
        self.options = options

        # OPF results
        self.results = AvailableTransferCapacityResults(n_bus=0,
                                                        br_names=[],
                                                        bus_names=[],
                                                        bus_types=[],
                                                        bus_idx_from=[],
                                                        bus_idx_to=[],
                                                        br_idx=[])
Ejemplo n.º 16
0
    def __init__(self,
                 grid: MultiCircuit,
                 options: PowerFlowOptions,
                 opf_time_series_results=None,
                 start_=0,
                 end_=None):
        """
        TimeSeries constructor
        @param grid: MultiCircuit instance
        @param options: PowerFlowOptions instance
        """
        DriverTemplate.__init__(self, grid)

        # reference the grid directly
        # self.grid = grid

        self.options = options

        self.opf_time_series_results = opf_time_series_results

        self.start_ = start_

        self.end_ = end_
Ejemplo n.º 17
0
    def __init__(self,
                 grid: MultiCircuit,
                 options: PowerFlowOptions,
                 triggering_idx=None,
                 max_additional_islands=1,
                 cascade_type_: CascadeType = CascadeType.LatinHypercube,
                 n_lhs_samples_=1000):
        """
        Constructor
        Args:
            grid: MultiCircuit instance to cascade
            options: Power flow Options
            triggering_idx: branch indices to trigger first
            max_additional_islands: number of islands that shall be formed to consider a blackout
            cascade_type_: Cascade simulation kind
            n_lhs_samples_: number of latin hypercube samples if using LHS cascade
        """

        DriverTemplate.__init__(self, grid=grid)

        self.name = 'Cascading'

        self.options = options

        self.triggering_idx = triggering_idx

        self.__cancel__ = False

        self.current_step = 0

        self.max_additional_islands = max_additional_islands

        self.cascade_type = cascade_type_

        self.n_lhs_samples = n_lhs_samples_

        self.results = CascadingResults(self.cascade_type)