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

Cimext master merge #1793

Merged
merged 16 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
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
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion gov.pnnl.goss.gridappsd/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
osgi.enroute.base.api,\
org.mockito.mockito-all,\
httpcore,\
cimhub.lib;version=1.0.1,\
cimhub.lib;version=2.0.3,\
httpclient,\
com.bigdata.rdf,\
org.glassfish.jersey.core.jersey-client;version=2.26,\
Expand Down
2 changes: 1 addition & 1 deletion gov.pnnl.goss.gridappsd/conf/pnnl.goss.gridappsd.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fncs.bridge.path = ./scripts/goss_fncs_bridge.py
applications.path = /gridappsd/applications
services.path = /gridappsd/services
# Requires no /
blazegraph.ns.path = http://localhost:8889/bigdata/namespace/kb/sparql
blazegraph.ns.path = urn:uuid:

# Uses docker composed blazegraph host here. Note this is not the
# external address, but from inside one of the containers on the
Expand Down
2 changes: 1 addition & 1 deletion gov.pnnl.goss.gridappsd/gridappsd.api.bnd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Bundle-Version: 1.0.0.${tstamp}
Bundle-Version: 2.0.0.${tstamp}
Export-Package: \
gov.pnnl.goss.gridappsd.dto.field,\
gov.pnnl.goss.gridappsd.api,\
Expand Down
2 changes: 1 addition & 1 deletion gov.pnnl.goss.gridappsd/gridappsd.bnd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Bundle-Version: 0.0.1.${tstamp}
Bundle-Version: 1.0.0.${tstamp}

Private-Package: \
gov.pnnl.goss.gridappsd.configuration,\
Expand Down
2 changes: 1 addition & 1 deletion gov.pnnl.goss.gridappsd/run.bnd.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
httpcore,\
httpclient,\
xml-apis,\
cimhub.lib;version=1.0.1,\
cimhub.lib;version=2.0.3,\
org.eclipse.jetty.aggregate.jetty-all-server;version=7.6.9,\
com.bigdata.rdf,\
proven-message;version=0.5,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
* PACIFIC NORTHWEST NATIONAL LABORATORY operated by BATTELLE for the
* UNITED STATES DEPARTMENT OF ENERGY under Contract DE-AC05-76RL01830
******************************************************************************/
@aQute.bnd.annotation.Version("1.0.0")
@aQute.bnd.annotation.Version("2.0.0")
package gov.pnnl.goss.gridappsd.api;
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@

import java.io.File;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Properties;

import org.apache.felix.dm.annotation.api.Component;
Expand Down Expand Up @@ -227,12 +228,14 @@ public void generateConfig(Properties parameters, PrintWriter out, String proces
boolean bHaveEventGen = true;

//TODO add climate

String fEarth = "carson"; //values "deri", "carson", or "fullcarson". This only matters for OpenDSS, which uses "deri" by default. However, "carson" gives the best match to GridLAB-D
int iManualFile = 0; //values 1 to reference manual pre-edits, 2 for post-edits, 3 for both edits in exported
boolean bUseProfiles = true; //true to use players, schedules and shapes
//cimhub utility uses
CIMImporter cimImporter = new CIMImporter();
CIMQuerySetter qs = new CIMQuerySetter();
cimImporter.start(queryHandler, qs, CONFIGTARGET, fRoot, scheduleName, loadScale, bWantSched, bWantZip, bWantRandomFractions, useHouses, zFraction, iFraction, pFraction, bHaveEventGen, modelState, false);
cimImporter.start(queryHandler, qs, CONFIGTARGET, fRoot, scheduleName, loadScale, bWantSched, bWantZip, bWantRandomFractions, useHouses, zFraction, iFraction, pFraction, bHaveEventGen, modelState, false, fEarth, iManualFile, bUseProfiles);
logManager.info(ProcessStatus.RUNNING, processId, "Finished generating all DSS configuration files.");


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,18 @@ public void generateConfig(Properties parameters, PrintWriter out, String proces
//TODO write a query handler that uses the built in powergrid model data manager that talks to blazegraph internally
QueryHandler queryHandler = new BlazegraphQueryHandler(bgHost, logManager, processId, username);
queryHandler.addFeederSelection(modelId);

String fEarth = "carson"; //values "deri", "carson", or "fullcarson". This only matters for OpenDSS, which uses "deri" by default. However, "carson" gives the best match to GridLAB-D
boolean bUseProfiles = true; //true to use players, schedules and shapes
CIMImporter cimImporter = new CIMImporter();
//If the simulation info is available also write to file
if(configFile!=null){
cimImporter.generateDSSFile(queryHandler, new PrintWriter(new FileWriter(configFile)), new PrintWriter(new FileWriter(idFile)), buscoords, guids, loadScale,
bWantSched, null, bWantZip, zFraction, iFraction, pFraction);
bWantSched, null, bWantZip, zFraction, iFraction, pFraction, fEarth, bUseProfiles);
//config was written to base file, so return that
printFileToOutput(configFile, out);
} else {
PrintWriter idFileWriter = new PrintWriter(new StringWriter());
cimImporter.generateDSSFile(queryHandler, out, idFileWriter, buscoords, guids, loadScale, bWantSched, null, bWantZip, zFraction, iFraction, pFraction);
cimImporter.generateDSSFile(queryHandler, out, idFileWriter, buscoords, guids, loadScale, bWantSched, null, bWantZip, zFraction, iFraction, pFraction, fEarth, bUseProfiles);
idFileWriter.close();
}
logManager.info(ProcessStatus.RUNNING, processId, "Finished generating DSS Base configuration file.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,13 @@ public void generateConfig(Properties parameters, PrintWriter out, String proces
logManager.error(ProcessStatus.ERROR,processId,"No "+SEPARATED_LOADS_FILE+" parameter provided");
throw new Exception("Missing parameter "+SEPARATED_LOADS_FILE);
}

String fEarth = "carson"; //values "deri", "carson", or "fullcarson". This only matters for OpenDSS, which uses "deri" by default. However, "carson" gives the best match to GridLAB-D
int iManualFile = 0; //values 1 to reference manual pre-edits, 2 for post-edits, 3 for both edits in exported
boolean bUseProfiles = true; //true to use players, schedules and shapes
//cimhub utility uses
CIMImporter cimImporter = new CIMImporter();
CIMQuerySetter qs = new CIMQuerySetter();
cimImporter.start(queryHandler, qs, CONFIGTARGET, fRoot, scheduleName, loadScale, bWantSched, bWantZip, bWantRandomFractions, useHouses, zFraction, iFraction, pFraction, -1, bHaveEventGen, modelState, false, separateLoads);
cimImporter.start(queryHandler, qs, CONFIGTARGET, fRoot, scheduleName, loadScale, bWantSched, bWantZip, bWantRandomFractions, useHouses, zFraction, iFraction, pFraction, -1, bHaveEventGen, modelState, false, fEarth, iManualFile, bUseProfiles, separateLoads);
String tempDataPath = dir.getAbsolutePath();

//If use climate, then generate gridlabd weather data file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,17 @@ public void generateConfig(Properties parameters, PrintWriter out, String proces
queryHandler.addFeederSelection(modelId);

boolean useHouses = GridAppsDConstants.getBooleanProperty(parameters, USEHOUSES, false);

boolean bUseProfiles = true; //bUseProfiles true to use players, schedules and shapes
boolean bHaveEventGen = true;

CIMImporter cimImporter = new CIMImporter();
CIMQuerySetter qs = new CIMQuerySetter();

//If the simulation info is available also write to file
if(configFile!=null){
cimImporter.generateGLMFile(queryHandler, qs, new PrintWriter(new FileWriter(configFile)), scheduleName, loadScale, bWantSched, bWantZip, bWantRandomFractions, useHouses, zFraction, iFraction, pFraction, bHaveEventGen);
cimImporter.generateGLMFile(queryHandler, qs, new PrintWriter(new FileWriter(configFile)), scheduleName, loadScale, bWantSched, bWantZip, bWantRandomFractions, useHouses, zFraction, iFraction, pFraction, bHaveEventGen, bUseProfiles);
} else {
cimImporter.generateGLMFile(queryHandler, qs, out, scheduleName, loadScale, bWantSched, bWantZip, bWantRandomFractions, useHouses,zFraction, iFraction, pFraction, bHaveEventGen);
cimImporter.generateGLMFile(queryHandler, qs, out, scheduleName, loadScale, bWantSched, bWantZip, bWantRandomFractions, useHouses,zFraction, iFraction, pFraction, bHaveEventGen, bUseProfiles);
}
if(configFile!=null){
//config was written to file, so return that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ public static void main(String[] args){
// " ?pxf c:IdentifiedObject.name ?key"+
// "} GROUP BY ?key ORDER BY ?key";
// BGPowergridModelDataManagerImpl bg = new BGPowergridModelDataManagerImpl("http://localhost:9999/blazegraph/namespace/kb/sparql");
// BGPowergridModelDataManagerImpl bg = new BGPowergridModelDataManagerImpl("http://192.168.99.100:8889/bigdata/namespace/kb/sparql");
BGPowergridModelDataManagerImpl bg = new BGPowergridModelDataManagerImpl("http://localhost:8889/bigdata/namespace/kb/sparql");
// BGPowergridModelDataManagerImpl bg = new BGPowergridModelDataManagerImpl("http://192.168.99.100:8889/bigdata/namespace/kb/sparql");
BGPowergridModelDataManagerImpl bg = new BGPowergridModelDataManagerImpl("urn:uuid");
bg.logManager = new LogManagerImpl();

bg.endpointNSURL = "http://localhost:8889/bigdata/namespace/kb/sparql";
bg.endpointNSURL = "urn:uuid";
try {
// String query = "select ?s ?p ?o where {?s r:type c:ConnectivityNode. ?s ?p ?o}";
// System.out.println(bg.query("ieee13", query, "JSON"));
Expand Down Expand Up @@ -978,7 +978,7 @@ public void putModel(String modelId, String model, String inputFormat, String pr

private String getEndpointNS(String modelId){
if(modelId!=null) {
return endpointNSURL+"#"+modelId;
return endpointNSURL+modelId;
}
return endpointNSURL;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ static String GetRegulatorData (Model mdl, Resource rXf, String name, String xfG
}
buf.append ("}\n");

buf.append ("object regulator {\n name \"reg_" + name + "\";\n");
buf.append ("object regulator {\n name \"xf_" + name + "\";\n");
buf.append (" from \"" + bus1 + "\";\n");
buf.append (" to \"" + bus2 + "\";\n");
buf.append (" phases " + phs + ";\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ public class SimulationConfig implements Serializable {

//Slow simulator down to realtime if true. If false it will run as fast as the simulator allows
public boolean run_realtime = true;

//instruct simulation to pause automatically after publishing measurements if true.
public boolean pause_after_measurements = false;


//eg "simulation_output": [{"name":"objectname", "properties": ["prop1","prop2"]},{"name":"object2name","properties":["prop1","prop2"]}]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
* PACIFIC NORTHWEST NATIONAL LABORATORY operated by BATTELLE for the
* UNITED STATES DEPARTMENT OF ENERGY under Contract DE-AC05-76RL01830
******************************************************************************/
@aQute.bnd.annotation.Version("1.0.0")
@aQute.bnd.annotation.Version("2.0.0")
package gov.pnnl.goss.gridappsd.dto;
20 changes: 12 additions & 8 deletions services/helicsgossbridge/service/helics_goss_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class HelicsGossBridge(object):
"TapChanger.step" : {
"regulator" : {
"property" : ["tap_{}"],
"prefix" : "reg_"
"prefix" : "xf_"
}
},
"TapChanger.lineDropCompensation" : {
Expand Down Expand Up @@ -533,6 +533,10 @@ def on_disconnected(self):

def run_simulation(self):
simulation_output_topic = topics.simulation_output_topic(self._simulation_id)
message_str = 'Running simulation for simulation_request:' \
f'{json.dumps(self._simulation_request, indent=4, sort_keys=True)}'
log.debug(message_str)
self._gad_connection.send_simulation_status('RUNNING', message_str, 'INFO')
run_realtime = self._simulation_request.get("simulation_config",{}).get("run_realtime",1)
simulation_length = self._simulation_request.get("simulation_config",{}).get("duration",0)
simulation_start = self._simulation_request.get("simulation_config",{}).get("start_time",0)
Expand Down Expand Up @@ -723,7 +727,7 @@ def _get_gld_object_name(self, object_mrid):
elif object_type in ["LoadBreakSwitch","Recloser","Breaker"]:
prefix = "sw_"
elif object_type == "RatioTapChanger":
prefix = "reg_"
prefix = "xf_"
else:
object_base_name = stored_object.get("name","")
prefix = stored_object.get("prefix","")
Expand Down Expand Up @@ -1178,11 +1182,11 @@ def _get_helics_bus_messages(self, measurement_filter, pause_after_measurements
log.debug(f"measurement message recieved at timestep {current_time}.")
self._gad_connection.send(topics.simulation_output_topic(self._simulation_id),
json.dumps(cim_output, indent=4, sort_keys=True))
if pause_after_measurements:
self._pause_simulation = True
debugStr = "Simulation paused automatically after publishing measurements."
log.debug(debugStr)
self._gad_connection.send_simulation_status('PAUSED', debugStr, 'INFO')
if pause_after_measurements:
self._pause_simulation = True
debugStr = "Simulation paused automatically after publishing measurements."
log.debug(debugStr)
self._gad_connection.send_simulation_status('PAUSED', debugStr, 'INFO')
log.debug("Message from simulation processing time: "
f"{time.perf_counter() - get_helics_bus_messages_start}.")
return {}
Expand Down Expand Up @@ -1436,7 +1440,7 @@ def _create_cim_object_map(self,map_file=None):
"phases" : object_phases[z],
"total_phases" : "".join(object_phases),
"type" : "regulator",
"prefix" : "reg_"
"prefix" : "xf_"
}
for y in switches:
self._object_mrid_to_name[y.get("mRID")] = {
Expand Down
Loading