@Test public void testMaximumValue() { assertEquals(100.0, g1.maximumValue(network), 0.0); assertEquals(100.0, g1.maximumValue(network, GENERATOR), 0.0); assertEquals(0, g1.maximumValue(network, LOAD), 0.0); assertEquals(100.0, g2.maximumValue(network, GENERATOR), 0.0); assertEquals(0, g2.maximumValue(network, LOAD), 0.0); assertEquals(80, g4.maximumValue(network, GENERATOR), 0); assertEquals(0, g4.maximumValue(network, LOAD), 0); assertEquals(100, g5.maximumValue(network, GENERATOR), 0); assertEquals(-20, g5.maximumValue(network, LOAD), 0); }
@Override public double maximumValue(Network n, ScalingConvention scalingConvention) { Objects.requireNonNull(n); Objects.requireNonNull(scalingConvention); Generator g = n.getGenerator(id); if (g != null) { return scalingConvention == GENERATOR ? Math.min(g.getMaxP(), maxValue) : -Math.max(g.getMinP(), minValue); } else { return 0; } }
GeneratorScalable extends AbstractInjectionScalable { @Override public double maximumValue(Network n, ScalingConvention scalingConvention) { Objects.requireNonNull(n); Objects.requireNonNull(scalingConvention); Generator g = n.getGenerator(id); if (g != null) { return scalingConvention == GENERATOR ? Math.min(g.getMaxP(), maxValue) : -Math.max(g.getMinP(), minValue); } else { return 0; } } }
GeneratorScalable extends AbstractInjectionScalable { @Override public double maximumValue(Network n, ScalingConvention scalingConvention) { Objects.requireNonNull(n); Objects.requireNonNull(scalingConvention); Generator g = n.getGenerator(id); if (g != null) { return scalingConvention == GENERATOR ? Math.min(g.getMaxP(), maxValue) : -Math.max(g.getMinP(), minValue); } else { return 0; } } GeneratorScalable(String id);   GeneratorScalable(String id, double minValue, double maxValue); }
GeneratorScalable extends AbstractInjectionScalable { @Override public double maximumValue(Network n, ScalingConvention scalingConvention) { Objects.requireNonNull(n); Objects.requireNonNull(scalingConvention); Generator g = n.getGenerator(id); if (g != null) { return scalingConvention == GENERATOR ? Math.min(g.getMaxP(), maxValue) : -Math.max(g.getMinP(), minValue); } else { return 0; } } GeneratorScalable(String id);   GeneratorScalable(String id, double minValue, double maxValue); @Override void reset(Network n); @Override double maximumValue(Network n, ScalingConvention scalingConvention); @Override double minimumValue(Network n, ScalingConvention scalingConvention); @Override void filterInjections(Network n, List<Injection> injections, List<String> notFoundInjections); @Override double scale(Network n, double asked, ScalingConvention scalingConvention); }
GeneratorScalable extends AbstractInjectionScalable { @Override public double maximumValue(Network n, ScalingConvention scalingConvention) { Objects.requireNonNull(n); Objects.requireNonNull(scalingConvention); Generator g = n.getGenerator(id); if (g != null) { return scalingConvention == GENERATOR ? Math.min(g.getMaxP(), maxValue) : -Math.max(g.getMinP(), minValue); } else { return 0; } } GeneratorScalable(String id);   GeneratorScalable(String id, double minValue, double maxValue); @Override void reset(Network n); @Override double maximumValue(Network n, ScalingConvention scalingConvention); @Override double minimumValue(Network n, ScalingConvention scalingConvention); @Override void filterInjections(Network n, List<Injection> injections, List<String> notFoundInjections); @Override double scale(Network n, double asked, ScalingConvention scalingConvention);  }