diff --git a/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/configuration/GLDAllConfigurationHandler.java b/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/configuration/GLDAllConfigurationHandler.java index 4546f6df..02afa0a5 100644 --- a/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/configuration/GLDAllConfigurationHandler.java +++ b/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/configuration/GLDAllConfigurationHandler.java @@ -395,15 +395,38 @@ protected void generateStartupFile(Properties parameters, String tempDataPath, P double nominalv = 0; try{ - String nominalVoltageQuery = "SELECT (MAX(xsd:float(?vnom)) AS ?vnomvoltage) WHERE {" - + "?fdr c:IdentifiedObject.mRID '" + modelId + "'. " - + "?s c:ConnectivityNode.ConnectivityNodeContainer|c:Equipment.EquipmentContainer ?fdr. " - + "?s c:ConductingEquipment.BaseVoltage ?lev. " + "?lev c:BaseVoltage.nominalVoltage ?vnom." - + "}"; + //OLD vnom query that was not correct + //String nominalVoltageQuery = "SELECT (MAX(xsd:float(?vnom)) AS ?vnomvoltage) WHERE {" + // + "?fdr c:IdentifiedObject.mRID '" + modelId + "'. " + // + "?s c:ConnectivityNode.ConnectivityNodeContainer|c:Equipment.EquipmentContainer ?fdr. " + // + "?s c:ConductingEquipment.BaseVoltage ?lev. " + "?lev c:BaseVoltage.nominalVoltage ?vnom." + // + "}"; + + + String nominalVoltageQuery = "SELECT ?nomv WHERE {" + + " ?s r:type c:EnergySource." + + " ?s c:Equipment.EquipmentContainer ?fdr."+ + " ?fdr c:IdentifiedObject.mRID ?fdrid."+ + " ?s c:IdentifiedObject.name ?name." + + " ?s c:ConductingEquipment.BaseVoltage ?bv."+ + " ?bv c:BaseVoltage.nominalVoltage ?basev."+ + " ?s c:EnergySource.nominalVoltage ?nomv." + + " ?s c:EnergySource.voltageMagnitude ?vmag." + + " ?s c:EnergySource.voltageAngle ?vang." + + " ?s c:EnergySource.r ?r1." + + " ?s c:EnergySource.x ?x1." + + " ?s c:EnergySource.r0 ?r0." + + " ?s c:EnergySource.x0 ?x0." + + " ?t c:Terminal.ConductingEquipment ?s." + + " bind(strafter(str(?s),\"#\") as ?id)."+ + " ?t c:Terminal.ConnectivityNode ?cn." + + " ?cn c:IdentifiedObject.name ?bus" + + "}"; + // ORDER by DESC(?vnom)"; ResultSet rs = powergridModelManager.queryResultSet(modelId, nominalVoltageQuery, processId, username); QuerySolution binding = rs.nextSolution(); - Double vnom = binding.getLiteral("vnomvoltage").getDouble(); + Double vnom = binding.getLiteral("nomv").getDouble(); nominalv = vnom / sqrt3; }catch (Exception e) { //send error and fail in vnom not found in model or bad format