Outages

This application implements scheduled and/or random outages at constituent ground stations.

The application contains one Scheduler (Observer) object class to monitor the time for outages pre-defined before the simulation begins and one Randomizer (ScenarioIntervalPublisher) object class for executing random Bernoulli trials to trigger randomized outages dynamically during the simulation.


Scheduler

class Scheduler(app, name, scheduled_outages)

Bases: Observer

The Scheduler object class inherits properties from the Observer object class in the NOS-T tools library

app

An application containing a test-run namespace, a name and description for the app, client credentials, and simulation timing instructions

Type:

ManagedApplication

scheduled_outages

Dataframe of scenario scheduled outages including groundId (int), outageStart (datetime), outageDuration (timedelta), outageEnd (datetime)

Type:

DataFrame

Scheduler.on_ground(ch, method, properties, body)

Callback function appends a dictionary of information for a new ground station to grounds list when GroundLocation message detected on the PREFIX/ground/location topic. Ground station information is published at beginning of simulation, and the completed list is converted to a DataFrame.

Parameters:
  • client (MQTT Client) – Client that connects application to the event broker using the MQTT protocol. Includes user credentials, tls certificates, and host server-port information.

  • userdata – User defined data of any type (not currently used)

  • message (message) – Contains topic the client subscribed to and payload message content as attributes

Scheduler.on_change(source, property_name, old_value, new_value)

Standard on_change callback function format inherited from Observer object class

In this instance, the callback function checks the simulation datetime against each scheduled outage datetime for the scenario. If past the scheduled start of an outage, an OutageReport message is sent to PREFIX/outage/report:


Randomizer

class Randomizer(app, scheduler, probOutage, time_status_step=None, time_status_init=None)

Bases: ScenarioTimeIntervalPublisher

This object class inherits properties from the ScenarioTimeIntervalPublisher object class from the publisher template in the NOS-T tools library

Parameters:
  • app (ManagedApplication) – An application containing a test-run namespace, a name and description for the app, client credentials, and simulation timing instructions.

  • scheduler (Scheduler) – A Scheduler object class must be added to the publisher.

  • probOutage (float) – A value between 0 and 1 that sets the probability of an outage for each random Bernoulli trial.

  • time_status_step (timedelta) – Optional duration between time status ‘heartbeat’ messages.

  • time_status_init (datetime) – Optional scenario datetime for publishing the first time status ‘heartbeat’ message.

Randomizer.publish_message()

Abstract publish_message method inherited from the ScenarioTimeIntervalPublisher object class from the publisher template in the NOS-T tools library

This method executes a random Bernoulli trial for each ground station at regular scenario time intervals. The probability of outage is typically set to a very low threshold and OutageReport messages are only sent when the random float between 0 and 1 is less than this defined threshold.


Schema

Schema are implemented using the pydantic library. The following schema define consistent message structures between this application and other observer applications:

pydantic settings GroundLocation

Bases: BaseModel

Message schema object class with properties inherited from the pydantic library’s BaseModel

Standardized message for ground station information includes:

Show JSON schema
{
   "title": "GroundLocation",
   "description": "*Message schema object class with properties inherited from the pydantic library's BaseModel*\n\nStandardized message for ground station information includes:",
   "type": "object",
   "properties": {
      "groundId": {
         "description": "Unique ground station identifier",
         "title": "Groundid",
         "type": "integer"
      },
      "latitude": {
         "description": "Latitude (deg) of ground station.",
         "maximum": 90,
         "minimum": -90,
         "title": "Latitude",
         "type": "number"
      },
      "longitude": {
         "description": "Longitude (deg) of ground station.",
         "maximum": 180,
         "minimum": -180,
         "title": "Longitude",
         "type": "number"
      },
      "elevAngle": {
         "description": "Minimum elevation angle (deg) for satellite-ground communications",
         "title": "Elevangle",
         "type": "number"
      },
      "operational": {
         "default": true,
         "description": "True, if this ground station is operational",
         "title": "Operational",
         "type": "boolean"
      },
      "downlinkRate": {
         "description": "Downlink rate for this ground station in Megabytes per second",
         "title": "Downlinkrate",
         "type": "number"
      },
      "costPerSecond": {
         "description": "Cost in $ per second for downlinks",
         "title": "Costpersecond",
         "type": "number"
      },
      "costMode": {
         "default": "discrete",
         "description": "Could be a boolean, options are discrete or fixed, default to discrete",
         "title": "Costmode",
         "type": "string"
      }
   },
   "required": [
      "groundId",
      "latitude",
      "longitude",
      "elevAngle",
      "downlinkRate",
      "costPerSecond"
   ]
}

Fields:
  • groundId (int)

  • latitude (float)

  • longitude (float)

  • elevAngle (float)

  • operational (bool)

  • downlinkRate (float)

  • costPerSecond (float)

  • costMode (str)

field groundId: int [Required]

Unique ground station identifier

field latitude: float [Required]

Latitude (deg) of ground station.

Constraints:
  • ge = -90

  • le = 90

field longitude: float [Required]

Longitude (deg) of ground station.

Constraints:
  • ge = -180

  • le = 180

field elevAngle: float [Required]

Minimum elevation angle (deg) for satellite-ground communications

field operational: bool = True

True, if this ground station is operational

field downlinkRate: float [Required]

Downlink rate for this ground station in Megabytes per second

field costPerSecond: float [Required]

Cost in $ per second for downlinks

field costMode: str = 'discrete'

Could be a boolean, options are discrete or fixed, default to discrete


pydantic settings OutageReport

Bases: BaseModel

Message schema object class with properties inherited from the pydantic library’s BaseModel

Standardized message indicating the beginning of an outage at a ground station includes:

Show JSON schema
{
   "title": "OutageReport",
   "description": "*Message schema object class with properties inherited from the pydantic library's BaseModel*\n\nStandardized message indicating the beginning of an outage at a ground station includes:",
   "type": "object",
   "properties": {
      "groundId": {
         "description": "Unique ground station identifier experiencing outage",
         "title": "Groundid",
         "type": "integer"
      },
      "outageStart": {
         "description": "Initial time of outage report",
         "format": "date-time",
         "title": "Outagestart",
         "type": "string"
      },
      "outageDuration": {
         "description": "Duration of the reported outage",
         "format": "duration",
         "title": "Outageduration",
         "type": "string"
      },
      "outageEnd": {
         "description": "outageStart + outageDuration",
         "format": "date-time",
         "title": "Outageend",
         "type": "string"
      }
   },
   "required": [
      "groundId",
      "outageStart",
      "outageDuration",
      "outageEnd"
   ]
}

Fields:
  • groundId (int)

  • outageStart (datetime.datetime)

  • outageDuration (datetime.timedelta)

  • outageEnd (datetime.datetime)

field groundId: int [Required]

Unique ground station identifier experiencing outage

field outageStart: datetime [Required]

Initial time of outage report

field outageDuration: timedelta [Required]

Duration of the reported outage

field outageEnd: datetime [Required]

outageStart + outageDuration


pydantic settings OutageRestore

Bases: BaseModel

Message schema object class with properties inherited from the pydantic library’s BaseModel

Standardized message indicating the end of an outage with restored service at a ground station includes:

Show JSON schema
{
   "title": "OutageRestore",
   "description": "*Message schema object class with properties inherited from the pydantic library's BaseModel*\n\nStandardized message indicating the end of an outage with restored service at a ground station includes:",
   "type": "object",
   "properties": {
      "groundId": {
         "description": "Unique ground station identifier",
         "title": "Groundid",
         "type": "integer"
      },
      "outageEnd": {
         "description": "outageStart + outageDuration",
         "format": "date-time",
         "title": "Outageend",
         "type": "string"
      }
   },
   "required": [
      "groundId",
      "outageEnd"
   ]
}

Fields:
  • groundId (int)

  • outageEnd (datetime.datetime)

field groundId: int [Required]

Unique ground station identifier

field outageEnd: datetime [Required]

outageStart + outageDuration