Skip to content

Commit

Permalink
Merge pull request #1785 from afisher1/bugfix/cimhubIssue50
Browse files Browse the repository at this point in the history
Bugfix/cimhub issue50
  • Loading branch information
poorva1209 authored Jan 17, 2025
2 parents 69668a9 + 60458fe commit 7b64290
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
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
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

0 comments on commit 7b64290

Please sign in to comment.