static void checkLoadType(Validable validable, LoadType loadType) { if (loadType == null) { throw new ValidationException(validable, "load type is null"); } }
static void checkConnected(Validable validable, Boolean connected) { if (connected == null) { throw new ValidationException(validable, "connection status is invalid"); } }
static void checkForecastDistance(Validable validable, int forecastDistance) { if (forecastDistance < 0) { throw new ValidationException(validable, "forecast distance < 0"); } }
protected void checkParams() { if (Double.isNaN(r)) { throw new ValidationException(this, "r is not set"); } if (Double.isNaN(x)) { throw new ValidationException(this, "x is not set"); } if (Double.isNaN(ratedU)) { throw new ValidationException(this, "rated u is not set"); } }
@Override public Substation addGeographicalTag(String tag) { if (tag == null) { throw new ValidationException(this, "geographical tag is null"); } geographicalTags.add(tag); return this; }
static void checkR(Validable validable, double r) { if (Double.isNaN(r)) { throw new ValidationException(validable, "r is invalid"); } }
static void checkX(Validable validable, double x) { if (Double.isNaN(x)) { throw new ValidationException(validable, "x is invalid"); } }
static void checkB2(Validable validable, double b2) { if (Double.isNaN(b2)) { throw new ValidationException(validable, "b2 is invalid"); } }
static void checkRatedS(Validable validable, double ratedS) { if (!Double.isNaN(ratedS) && ratedS <= 0) { throw new ValidationException(validable, "Invalid value of rated S " + ratedS); } }
static void checkP0(Validable validable, double p0) { if (Double.isNaN(p0)) { throw new ValidationException(validable, "p0 is invalid"); } }
static void checkPowerFactor(Validable validable, double powerFactor) { if (Double.isNaN(powerFactor)) { throw new ValidationException(validable, "power factor is invalid"); } }
@Override public <RL extends ReactiveLimits> RL getReactiveLimits(Class<RL> type) { if (type == null) { throw new IllegalArgumentException("type is null"); } if (type.isInstance(reactiveLimits)) { return type.cast(reactiveLimits); } else { throw new ValidationException(this, "incorrect reactive limits type " + type.getName() + ", expected " + reactiveLimits.getClass()); } }
@Override public <RL extends ReactiveLimits> RL getReactiveLimits(Class<RL> type) { if (type == null) { throw new IllegalArgumentException("type is null"); } if (type.isInstance(reactiveLimits)) { return type.cast(reactiveLimits); } else { throw new ValidationException(this, "incorrect reactive limits type " + type.getName() + ", expected " + reactiveLimits.getClass()); } }
@Override public void add() { if (node1 == null) { throw new ValidationException(this, "first connection node is not set"); } if (node2 == null) { throw new ValidationException(this, "second connection node is not set"); } graph.addEdge(node1, node2, null); invalidateCache(); }
protected VoltageLevelExt checkAndGetVoltageLevel1() { if (voltageLevelId1 == null) { throw new ValidationException(this, "first voltage level is not set"); } VoltageLevelExt voltageLevel1 = getNetwork().getVoltageLevel(voltageLevelId1); if (voltageLevel1 == null) { throw new ValidationException(this, "first voltage level '" + voltageLevelId1 + "' not found"); } return voltageLevel1; }
protected VoltageLevelExt checkAndGetVoltageLevel2() { if (voltageLevelId2 == null) { throw new ValidationException(this, "second voltage level is not set"); } VoltageLevelExt voltageLevel2 = getNetwork().getVoltageLevel(voltageLevelId2); if (voltageLevel2 == null) { throw new ValidationException(this, "second voltage level '" + voltageLevelId2 + "' not found"); } return voltageLevel2; }
@Override public ReactiveCapabilityCurve add() { if (points.size() < 2) { throw new ValidationException(owner, "a reactive capability curve should have at least two points"); } ReactiveCapabilityCurveImpl curve = new ReactiveCapabilityCurveImpl(points); owner.setReactiveLimits(curve); return curve; }
public S getStep(int tapPosition) { if (tapPosition < lowTapPosition || tapPosition > getHighTapPosition()) { throw new ValidationException(parent, "incorrect tap position " + tapPosition + " [" + lowTapPosition + ", " + getHighTapPosition() + "]"); } return steps.get(tapPosition - lowTapPosition); }
@Override public Terminal setQ(double q) { if (connectable.getType() == ConnectableType.BUSBAR_SECTION) { throw new ValidationException(connectable, "cannot set reactive power on a busbar section"); } double oldValue = this.q.set(network.get().getVariantIndex(), q); getConnectable().notifyUpdate("q" + (num != -1 ? num : ""), oldValue, q); return this; }
public C setTapPosition(int tapPosition) { if (tapPosition < lowTapPosition || tapPosition > getHighTapPosition()) { throw new ValidationException(parent, "incorrect tap position " + tapPosition + " [" + lowTapPosition + ", " + getHighTapPosition() + "]"); } int oldValue = this.tapPosition.set(network.get().getVariantIndex(), tapPosition); parent.getNetwork().getListeners().notifyUpdate(parent.getTransformer(), getTapChangerAttribute() + ".tapPosition", oldValue, tapPosition); return (C) this; }