All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.powsybl.openloadflow.lf.AbstractLoadFlowContext Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (c) 2022, Coreso SA (https://www.coreso.eu/) and TSCNET Services GmbH (https://www.tscnet.eu/)
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 * SPDX-License-Identifier: MPL-2.0
 */
package com.powsybl.openloadflow.lf;

import com.powsybl.openloadflow.equations.EquationSystem;
import com.powsybl.openloadflow.equations.JacobianMatrix;
import com.powsybl.openloadflow.equations.Quantity;
import com.powsybl.openloadflow.network.LfNetwork;

import java.util.Objects;

/**
 * @author Jean-Luc Bouchot (Artelys) {@literal }
 */
public abstract class AbstractLoadFlowContext  & Quantity, E extends Enum & Quantity, P extends AbstractLoadFlowParameters>
        implements LoadFlowContext, AutoCloseable {

    protected final LfNetwork network;

    protected final P parameters;

    protected EquationSystem equationSystem;

    protected JacobianMatrix jacobianMatrix;

    protected AbstractLoadFlowContext(LfNetwork network, P parameters) {
        this.network = Objects.requireNonNull(network);
        this.parameters = Objects.requireNonNull(parameters);
    }

    public P getParameters() {
        return parameters;
    }

    public LfNetwork getNetwork() {
        return network;
    }

    @Override
    public void close() {
        if (jacobianMatrix != null) {
            jacobianMatrix.close();
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy