From 4f33a6669a3e16072282e02be8774968dd17078e Mon Sep 17 00:00:00 2001 From: afisher1 Date: Mon, 12 Aug 2019 10:57:53 -0700 Subject: [PATCH 1/2] fixing incorrect property name for SynchronousMachine VA measurements --- .../GLDSimulationOutputConfigurationHandler.java | 4 ++-- services/fncsgossbridge/service/fncs_goss_bridge.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/configuration/GLDSimulationOutputConfigurationHandler.java b/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/configuration/GLDSimulationOutputConfigurationHandler.java index 3b66f479..528b78a5 100644 --- a/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/configuration/GLDSimulationOutputConfigurationHandler.java +++ b/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/configuration/GLDSimulationOutputConfigurationHandler.java @@ -391,13 +391,13 @@ void parseMeasurement(Map measurements, JsonObject measuremen } else if (conductingEquipmentType.contains("SynchronousMachine")) { if(measurementType.equals("VA")) { objectName = conductingEquipmentName; - propertyName = "power_out_" + phases; + propertyName = "measured_power_" + phases; } else if (measurementType.equals("PNV")) { objectName = connectivityNode; propertyName = "voltage_" + phases; } else if (measurementType.equals("A")) { objectName = conductingEquipmentName; - propertyName = "current_out_" + phases; + propertyName = "measured_current_" + phases; } else { throw new JsonParseException(String.format("CimMeasurementsToGldPubs::parseMeasurement: The value of measurementType is not a valid type.\nValid types for SynchronousMachine are VA, A, and PNV.\nmeasurementType = %s.",measurementType)); } diff --git a/services/fncsgossbridge/service/fncs_goss_bridge.py b/services/fncsgossbridge/service/fncs_goss_bridge.py index 95fae641..65468503 100644 --- a/services/fncsgossbridge/service/fncs_goss_bridge.py +++ b/services/fncsgossbridge/service/fncs_goss_bridge.py @@ -1101,7 +1101,7 @@ def _create_cim_object_map(map_file=None): elif "SynchronousMachine" in conducting_equipment_type: if measurement_type == "VA": object_name = conducting_equipment_name; - property_name = "power_out_" + phases; + property_name = "measured_power_" + phases; elif measurement_type == "PNV": object_name = connectivity_node; property_name = "voltage_" + phases; From 89e8d31f420fddef78c44e29f2c03f7ffe994cc9 Mon Sep 17 00:00:00 2001 From: poorva1209 Date: Mon, 19 Aug 2019 11:20:49 -0700 Subject: [PATCH 2/2] updated timeseries response format --- .../gridappsd/dto/TimeSeriesEntryResult.java | 28 ++++--------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/dto/TimeSeriesEntryResult.java b/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/dto/TimeSeriesEntryResult.java index efa89bf9..e4a07e0c 100644 --- a/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/dto/TimeSeriesEntryResult.java +++ b/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/dto/TimeSeriesEntryResult.java @@ -12,6 +12,7 @@ public class TimeSeriesEntryResult { ArrayList> data; + public ArrayList> getData() { if(data==null){ @@ -32,33 +33,14 @@ public String toString() { } public static TimeSeriesEntryResult parse(String jsonString) { + Type listType = new TypeToken>>(){}.getType(); Gson gson = new Gson(); - TimeSeriesEntryResult obj = gson.fromJson(jsonString, TimeSeriesEntryResult.class); + TimeSeriesEntryResult obj = new TimeSeriesEntryResult(); + ArrayList> data = gson.fromJson(jsonString, listType); + obj.setData(data); if(obj.data==null) throw new JsonSyntaxException("Expected attribute measurements not found"); return obj; - } - - public static void main(String[] args){ - - Type listType = new TypeToken>>(){}.getType(); - - String jsonString = "{\"data\":[{\"Diffuse\":19.958636,\"AvgWindSpeed\":7.9434,\"TowerRH\":31.61,\"long\":\"105.18 W\",\"MST\":\"13:44\",\"TowerDryBulbTemp\":74.534,\"DATE\":\"892013\",\"DirectCH1\":-0.0531206845,\"GlobalCM22\":20.2478337,\"AvgWindDirection\":359.3,\"time\":1376077440,\"place\":\"Solar Radiation Research Laboratory\",\"lat\":\"39.74 N\"}]}"; - Gson gson = new Gson(); - //jsonString = jsonString.substring(8, jsonString.length()-1); - - System.out.println(jsonString); - - //ArrayList> obj = gson.fromJson(jsonString, listType); - TimeSeriesEntryResult obj = gson.fromJson(jsonString, TimeSeriesEntryResult.class); - System.out.println(obj); - - - - - - - } }