com.powsybl.openrao.data.cracimpl.PhaseTapChangerTapPositionActionAdderImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of open-rao-crac-impl Show documentation
Show all versions of open-rao-crac-impl Show documentation
Object model for CRAC implementation
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.openrao.data.cracimpl;
import com.powsybl.action.Action;
import com.powsybl.action.PhaseTapChangerTapPositionActionBuilder;
import com.powsybl.openrao.data.cracapi.networkaction.PhaseTapChangerTapPositionActionAdder;
import static com.powsybl.openrao.data.cracimpl.AdderUtils.assertAttributeNotNull;
/**
* @author Pauline JEAN-MARIE {@literal }
*/
public class PhaseTapChangerTapPositionActionAdderImpl extends AbstractSingleNetworkElementActionAdderImpl implements PhaseTapChangerTapPositionActionAdder {
private Integer tapPosition;
PhaseTapChangerTapPositionActionAdderImpl(NetworkActionAdderImpl ownerAdder) {
super(ownerAdder);
}
@Override
public PhaseTapChangerTapPositionActionAdder withTapPosition(int tapPosition) {
this.tapPosition = tapPosition;
return this;
}
protected Action buildAction() {
return new PhaseTapChangerTapPositionActionBuilder()
.withId(String.format("%s_%s_%s", getActionName(), networkElementId, tapPosition))
.withNetworkElementId(networkElementId)
.withTapPosition(tapPosition)
.withRelativeValue(false)
.build();
}
protected void assertSpecificAttributes() {
assertAttributeNotNull(tapPosition, getActionName(), "tapPosition", "withTapPosition()");
}
protected String getActionName() {
return "PhaseTapChangerTapPositionAction";
}
}