From cba9d9b5a9c6b349e2a5b0297672dc60bb6c9395 Mon Sep 17 00:00:00 2001 From: afisher1 <4552674+afisher1@users.noreply.github.com> Date: Tue, 14 May 2024 10:54:21 -0700 Subject: [PATCH 1/3] adding pause_after_measurements functionality to helics_goss_bridge and SimulationConfig.java --- .../pnnl/goss/gridappsd/dto/SimulationConfig.java | 3 +++ .../helicsgossbridge/service/helics_goss_bridge.py | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/dto/SimulationConfig.java b/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/dto/SimulationConfig.java index 17b1f3dc1..b86bd2c76 100644 --- a/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/dto/SimulationConfig.java +++ b/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/dto/SimulationConfig.java @@ -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"]}] diff --git a/services/helicsgossbridge/service/helics_goss_bridge.py b/services/helicsgossbridge/service/helics_goss_bridge.py index c9e48208b..c031af605 100644 --- a/services/helicsgossbridge/service/helics_goss_bridge.py +++ b/services/helicsgossbridge/service/helics_goss_bridge.py @@ -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) @@ -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 {} From 812fcf1c3b623c1bf60ed62bf8c88490e39e559f Mon Sep 17 00:00:00 2001 From: afisher1 <4552674+afisher1@users.noreply.github.com> Date: Thu, 11 Jul 2024 08:59:16 -0700 Subject: [PATCH 2/3] object name prefix change for regulators. --- .../pnnl/goss/gridappsd/data/handlers/CIMDataRDFToGLM.java | 2 +- services/helicsgossbridge/service/helics_goss_bridge.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/data/handlers/CIMDataRDFToGLM.java b/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/data/handlers/CIMDataRDFToGLM.java index 0d14e284c..8943e1ceb 100644 --- a/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/data/handlers/CIMDataRDFToGLM.java +++ b/gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/data/handlers/CIMDataRDFToGLM.java @@ -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"); diff --git a/services/helicsgossbridge/service/helics_goss_bridge.py b/services/helicsgossbridge/service/helics_goss_bridge.py index c031af605..3af1f645f 100644 --- a/services/helicsgossbridge/service/helics_goss_bridge.py +++ b/services/helicsgossbridge/service/helics_goss_bridge.py @@ -242,7 +242,7 @@ class HelicsGossBridge(object): "TapChanger.step" : { "regulator" : { "property" : ["tap_{}"], - "prefix" : "reg_" + "prefix" : "xf_" } }, "TapChanger.lineDropCompensation" : { @@ -727,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","") @@ -1440,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")] = { From 15f454d0cd5b894b8eb22dd810a23432d6b25b9b Mon Sep 17 00:00:00 2001 From: afisher1 <4552674+afisher1@users.noreply.github.com> Date: Thu, 25 Jul 2024 11:27:45 -0700 Subject: [PATCH 3/3] adding updated cimhub bugfix/50 version to this branch --- cnf/ext/repositories.bnd | 2 +- gov.pnnl.goss.gridappsd/bnd.bnd | 2 +- gov.pnnl.goss.gridappsd/run.bnd.bndrun | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cnf/ext/repositories.bnd b/cnf/ext/repositories.bnd index 8f5d2f0ed..c32316777 100644 --- a/cnf/ext/repositories.bnd +++ b/cnf/ext/repositories.bnd @@ -1,7 +1,7 @@ -plugin: \ aQute.bnd.deployer.repository.FixedIndexedRepo;name=GOSS Core;locations=https://raw.githubusercontent.com/GridOptics/GOSS/master/cnf/releaserepo/index.xml,\ aQute.bnd.deployer.repository.FixedIndexedRepo; name=GOSS Dependencies; locations=https://github.com/GridOptics/GOSS-Repository/raw/master/dependencies/index.xml.gz,\ - aQute.bnd.deployer.repository.FixedIndexedRepo;name=CIMHub;locations=https://raw.githubusercontent.com/GRIDAPPSD/CIMHub/master/cnf/release/index.xml,\ + aQute.bnd.deployer.repository.FixedIndexedRepo;name=CIMHub;locations=https://raw.githubusercontent.com/afisher1/CIMHub/bugfix/50/cnf/release/index.xml,\ aQute.bnd.deployer.repository.LocalIndexedRepo;name=Local;local=${workspace}/cnf/Local;pretty=true,\ aQute.bnd.deployer.repository.FixedIndexedRepo;name=BND Hub;locations=https://raw.githubusercontent.com/bndtools/bundle-hub/master/index.xml.gz,\ aQute.lib.deployer.FileRepo;name=Build;location=${workspace}/cnf/buildrepo;latest=false diff --git a/gov.pnnl.goss.gridappsd/bnd.bnd b/gov.pnnl.goss.gridappsd/bnd.bnd index 2377e4b3f..55affa73f 100644 --- a/gov.pnnl.goss.gridappsd/bnd.bnd +++ b/gov.pnnl.goss.gridappsd/bnd.bnd @@ -29,7 +29,7 @@ osgi.enroute.base.api,\ org.mockito.mockito-all,\ httpcore,\ - cimhub.lib;version=1.0.1,\ + cimhub.lib;version=1.0.2,\ httpclient,\ com.bigdata.rdf,\ org.glassfish.jersey.core.jersey-client;version=2.26,\ diff --git a/gov.pnnl.goss.gridappsd/run.bnd.bndrun b/gov.pnnl.goss.gridappsd/run.bnd.bndrun index 098e99a2e..95ac09807 100644 --- a/gov.pnnl.goss.gridappsd/run.bnd.bndrun +++ b/gov.pnnl.goss.gridappsd/run.bnd.bndrun @@ -76,7 +76,7 @@ httpcore,\ httpclient,\ xml-apis,\ - cimhub.lib;version=1.0.1,\ + cimhub.lib;version=1.0.2,\ org.eclipse.jetty.aggregate.jetty-all-server;version=7.6.9,\ com.bigdata.rdf,\ proven-message;version=0.5,\