Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vnom query #1675

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down