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

com.powsybl.action.DanglingLineAction Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (c) 2024, RTE (http://www.rte-france.com)
 * 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.action;

import com.powsybl.iidm.modification.DanglingLineModification;
import com.powsybl.iidm.modification.NetworkModification;

import java.util.Objects;

/**
 * An action to:
 * 
    *
  • change the P0 of a load, either by specifying a new absolute value (MW) or a relative change (MW).
  • *
  • change the Q0 of a load, either by specifying a new absolute value (MVar) or a relative change (MVar).
  • *
* * @author Anne Tilloy {@literal } */ public class DanglingLineAction extends AbstractLoadAction { public static final String NAME = "DANGLING_LINE"; private final String danglingLineId; /** * @param id the id of the action. * @param danglingLineId the id of the dangling line on which the action would be applied. * @param relativeValue True if the dangling line P0 and/or Q0 variation is relative, False if absolute. * @param activePowerValue The new dangling line P0 (MW) if relativeValue equals False, otherwise the relative variation of dangling line P0 (MW). * @param reactivePowerValue The new dangling line Q0 (MVar) if relativeValue equals False, otherwise the relative variation of dangling line Q0 (MVar). */ DanglingLineAction(String id, String danglingLineId, boolean relativeValue, Double activePowerValue, Double reactivePowerValue) { super(id, relativeValue, activePowerValue, reactivePowerValue); this.danglingLineId = Objects.requireNonNull(danglingLineId); } public String getDanglingLineId() { return danglingLineId; } @Override public String getType() { return NAME; } @Override public NetworkModification toModification() { return new DanglingLineModification( getDanglingLineId(), isRelativeValue(), getActivePowerValue().stream().boxed().findFirst().orElse(null), getReactivePowerValue().stream().boxed().findFirst().orElse(null) ); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } DanglingLineAction that = (DanglingLineAction) o; return Objects.equals(danglingLineId, that.danglingLineId); } @Override public int hashCode() { return Objects.hash(super.hashCode(), danglingLineId); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy