Skip to content

Commit

Permalink
Update service name and output topic path.
Browse files Browse the repository at this point in the history
  • Loading branch information
craig8 committed Jul 17, 2024
1 parent 915fd3f commit 85b9e96
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
5 changes: 1 addition & 4 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
---
server: WE48687
port: 8090

service_name: IEEE_2030_5
proxy_hostname: 0.0.0.0:8443

tls_repository: "~/tls"
Expand Down Expand Up @@ -82,9 +82,6 @@ gridappsd:
# How often should the aggregates for the houses be published.
publish_interval_seconds: 3

# The topic the aggregate houses should publish to the goss bus.
publish_topic: '/topic/goss.gridappsd.simulation.ochre.output'

# An alternate to using the gridappsd house models for named inverters.
# This is a regex that will be used to match the name of the inverters for
# both houses as well as utilities. When utiliities are found there will
Expand Down
6 changes: 6 additions & 0 deletions ieee_2030_5/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ def _main():
help="Use lfdi mode allows a single lfdi to be connected to on an http connection")
parser.add_argument("--show-lfdi", action="store_true",
help="Show all of the lfdi for the generated certificates and exit.")
parser.add_argument("--simulation_id",
help="When running as a service the simulation_id must be passed for it to run in this mode.")
opts = parser.parse_args()

logging_level = logging.DEBUG if opts.debug else logging.INFO
Expand All @@ -163,6 +165,10 @@ def _main():

config = ServerConfiguration(**cfg_dict)

os.environ['GRIDAPPSD_SERVICE_NAME'] = config.service_name
if config.simulation_id:
os.environ['GRIDAPPSD_SIMULATION_ID'] = config.simulation_id

if config.lfdi_mode == "lfdi_mode_from_file":
os.environ["IEEE_2030_5_CERT_FROM_COMBINED_FILE"] = '1'

Expand Down
13 changes: 10 additions & 3 deletions ieee_2030_5/adapters/gridappsd_adapter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from __future__ import annotations

import os
from dataclasses import asdict
import json
import logging
Expand Down Expand Up @@ -280,11 +282,16 @@ def publish_house_aggregates(self):
if field_bus := self.gridappsd_configuration.field_bus_def.id:
...

# TODO: the output topic goes to the field bus manager regardless of the message_bus_id for some reason.
output_topic = topics.field_output_topic(message_bus_id=field_bus)
if simulation_id := os.environ.get("GRIDAPPSD_SIMULATION_ID"):
pass
if service_name := os.environ.get("GRIDAPPSD_SERVICE_NAME"):
pass

output_topic = topics.application_output_topic(application_id=service_name, simulation_id=simulation_id)
# # TODO: the output topic goes to the field bus manager regardless of the message_bus_id for some reason.
# output_topic = topics.field_output_topic(message_bus_id=field_bus)

message = self.get_message_for_bus()

#if message:
_log.debug(f"Output: {output_topic}\n{pformat(message, 2)}")
mb.send(topic=output_topic, message=message)
4 changes: 4 additions & 0 deletions ieee_2030_5/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ class ServerConfiguration:

server: str
port: int

service_name: str = "IEEE_2030_5"
simulation_id: str | None = None

ui_port: int = None

include_default_der_on_all_devices: bool = True
Expand Down

0 comments on commit 85b9e96

Please sign in to comment.