com.powsybl.openrao.data.cracimpl.GeneratorActionAdderImpl 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.GeneratorActionBuilder;
import com.powsybl.openrao.data.cracapi.networkaction.GeneratorActionAdder;
import static com.powsybl.openrao.data.cracimpl.AdderUtils.assertAttributeNotNull;
/**
* @author Pauline JEAN-MARIE {@literal }
*/
public class GeneratorActionAdderImpl extends AbstractSingleNetworkElementActionAdderImpl implements GeneratorActionAdder {
private Double activePowerValue;
GeneratorActionAdderImpl(NetworkActionAdderImpl ownerAdder) {
super(ownerAdder);
}
@Override
public GeneratorActionAdder withActivePowerValue(double activePowerValue) {
this.activePowerValue = activePowerValue;
return this;
}
protected Action buildAction() {
return new GeneratorActionBuilder()
.withId(String.format("%s_%s_%s", getActionName(), networkElementId, activePowerValue))
.withNetworkElementId(networkElementId)
.withActivePowerRelativeValue(false)
.withActivePowerValue(activePowerValue)
.build();
}
protected void assertSpecificAttributes() {
assertAttributeNotNull(activePowerValue, getActionName(), "activePowerValue", "withActivePowerValue()");
}
protected String getActionName() {
return "GeneratorAction";
}
}