-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move boolean regulating from equipment to RegulatingPoint (#483)
Signed-off-by: Etienne LESOT <[email protected]>
- Loading branch information
Showing
15 changed files
with
102 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
network-store-iidm-impl/src/test/java/com/powsybl/network/store/iidm/impl/GeneratorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* 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/. | ||
*/ | ||
package com.powsybl.network.store.iidm.impl; | ||
|
||
import com.powsybl.iidm.network.Generator; | ||
import com.powsybl.iidm.network.Load; | ||
import com.powsybl.iidm.network.Network; | ||
import com.powsybl.iidm.network.test.FourSubstationsNodeBreakerFactory; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* @author Etienne Lesot <etienne.lesot at rte-france.com> | ||
*/ | ||
class GeneratorTest { | ||
|
||
@Test | ||
void testRegulationWhenRegulatedElementIsRemoved() { | ||
Network network = FourSubstationsNodeBreakerFactory.create(); | ||
|
||
// initialization | ||
Generator generator = network.getGenerator("GH3"); | ||
Load load = network.getLoad("LD1"); | ||
Assertions.assertTrue(generator.isVoltageRegulatorOn()); | ||
Assertions.assertEquals(generator.getTerminal(), generator.getRegulatingTerminal()); | ||
Assertions.assertEquals(400, generator.getTargetV()); | ||
|
||
// set the generator's regulation on the load terminal (both equipments are not on the same voltage level/bus) | ||
generator.setRegulatingTerminal(load.getTerminal()); | ||
generator.setTargetV(225); | ||
Assertions.assertTrue(generator.isVoltageRegulatorOn()); | ||
Assertions.assertEquals(load.getTerminal(), generator.getRegulatingTerminal()); | ||
Assertions.assertEquals(225, generator.getTargetV()); | ||
|
||
// remove the load | ||
network.getLoad("LD1").remove(); | ||
Assertions.assertEquals(generator.getTerminal(), generator.getRegulatingTerminal()); | ||
Assertions.assertFalse(generator.isVoltageRegulatorOn()); | ||
} | ||
|
||
@Test | ||
void testRegulationWhenRegulatedElementOnSameBusIsRemoved() { | ||
Network network = FourSubstationsNodeBreakerFactory.create(); | ||
|
||
// initialization | ||
Generator generator = network.getGenerator("GH3"); | ||
Load load = network.getLoad("LD2"); | ||
Assertions.assertTrue(generator.isVoltageRegulatorOn()); | ||
Assertions.assertEquals(generator.getTerminal(), generator.getRegulatingTerminal()); | ||
|
||
// set the generator's regulation on the load terminal (both equipments are on the same voltage level/bus) | ||
generator.setRegulatingTerminal(load.getTerminal()); | ||
Assertions.assertTrue(generator.isVoltageRegulatorOn()); | ||
Assertions.assertEquals(load.getTerminal(), generator.getRegulatingTerminal()); | ||
|
||
// remove the load | ||
network.getLoad("LD2").remove(); | ||
Assertions.assertEquals(generator.getTerminal(), generator.getRegulatingTerminal()); | ||
Assertions.assertTrue(generator.isVoltageRegulatorOn()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters