Skip to content

Commit

Permalink
Synthesis add info (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
quinarygio authored and mathbagu committed Mar 29, 2017
1 parent adc1523 commit b44fe12
Show file tree
Hide file tree
Showing 7 changed files with 277 additions and 239 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import eu.itesla_project.modules.online.OnlineWorkflowParameters;
import eu.itesla_project.modules.online.OnlineWorkflowResults;
import eu.itesla_project.modules.online.StateProcessingStatus;
import eu.itesla_project.online.OnlineUtils;
import eu.itesla_project.online.UnitEnum;
import eu.itesla_project.online.rest.api.DateTimeParameter;
import eu.itesla_project.online.rest.model.Indicator;
import eu.itesla_project.online.rest.model.IndicatorEnum;
Expand All @@ -36,7 +38,6 @@
import eu.itesla_project.online.rest.model.SimulationResult;
import eu.itesla_project.online.rest.model.StateSynthesis;
import eu.itesla_project.online.rest.model.TimeValue;
import eu.itesla_project.online.rest.model.UnitEnum;
import eu.itesla_project.online.rest.model.Violation;
import eu.itesla_project.online.rest.model.ViolationSynthesis;
import eu.itesla_project.online.rest.model.WorkflowInfo;
Expand Down Expand Up @@ -298,13 +299,14 @@ private void fillViolationSynthesis( DateTime dateTime, List<ViolationSynthesis>
if (search_synt.isPresent())
synt = search_synt.get();
else {
synt = new ViolationSynthesis(equipment, violationType, limit);
synt = new ViolationSynthesis(equipment, lv.getBaseVoltage(), violationType, limit, lv.getLimitName());
violationList.add(synt);
}

double perc = value / limit;
TimeValue tv = new TimeValue(dateTime);
tv.putIndicator(new Indicator(IndicatorEnum.RELATIVE, UnitEnum.PERCENTAGE, perc));
tv.putIndicator(new Indicator(IndicatorEnum.ABSOLUTE, OnlineUtils.getUnit(violationType), value));
synt.addTimeValue(tv);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package eu.itesla_project.online.rest.model;

import java.util.Objects;
import eu.itesla_project.online.UnitEnum;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@
public class ViolationSynthesis {
private final String equipment;
private final LimitViolationType type;
private final String limitName;
private final float limit;
private final float voltageLevel;
private final List<TimeValue> timeValues = new ArrayList<TimeValue>();

public ViolationSynthesis(String equipment, LimitViolationType type, float limit ) {
public ViolationSynthesis(String equipment, float voltageLevel, LimitViolationType type, float limit, String limitName ) {
this.equipment = Objects.requireNonNull(equipment);
this.type = Objects.requireNonNull(type);
this.limit = limit;
this.voltageLevel = voltageLevel;
this.limitName = limitName;
}

@Override
Expand Down Expand Up @@ -65,5 +69,13 @@ public void addTimeValue(TimeValue val){
Objects.requireNonNull(val);
timeValues.add(val);
}

public String getLimitName() {
return limitName;
}

public float getVoltageLevel() {
return voltageLevel;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
package eu.itesla_project.online;

import eu.itesla_project.contingency.Contingency;
import eu.itesla_project.security.LimitViolationType;
import eu.itesla_project.simulation.securityindexes.SecurityIndex;

import java.util.Collection;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -52,4 +52,18 @@ public static String getPostContingencyId(String stateId, String contingencyId)
Objects.requireNonNull(contingencyId, "contingency id is null");
return stateId + "-post-" + contingencyId;
}

public static UnitEnum getUnit(LimitViolationType type) {
Objects.requireNonNull(type);
switch (type) {
case CURRENT:
return UnitEnum.MW;
case LOW_VOLTAGE:
case HIGH_VOLTAGE:
return UnitEnum.KV;
default:
throw new IllegalArgumentException();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 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 eu.itesla_project.online.rest.model;
package eu.itesla_project.online;

import com.fasterxml.jackson.annotation.JsonValue;

Expand Down

0 comments on commit b44fe12

Please sign in to comment.