Tekvel Magic
Loading...
Searching...
No Matches
GOOSESubscriber Class Reference

GOOSESubscriber class for monitoring GOOSE messages. More...

Inheritance diagram for GOOSESubscriber:

Public Member Functions

def __init__ (self, SCL scl=None, str ied_name=None, nif_id=None, str cb_ref=None, str da_ref=None, bool autostart=True, Subnetwork sn=None)
 Initialize a GOOSESubscriber instance. More...
 
def __str__ (self)
 
def get_gocb_ref (self)
 Returns a reference to the GOOSE Control Block associated with this GOOSESubscriber. More...
 
def gocbref (self)
 Returns a reference to the GOOSE Control Block associated with this GOOSESubscriber. More...
 
Subnetwork sn (self)
 Returns the associated Subnetwork instance. More...
 
def get_ied_name (self)
 Returns IED name of the GOOSE publishing IED. More...
 
def get_ap_name (self)
 Returns AccessPoint name of the GOOSE publishing IED. More...
 
def wait_for_goose (self, int timeout=10000)
 Wait for first GOOSE message. More...
 
def wait_for_goose_change (self, int timeout=1000)
 Wait for GOOSE change. More...
 
def wait_for_signal_change (self, int timeout=5000)
 Wait for specific signal change in the GOOSE. More...
 
def wait_for_signal_value (self, value, str valType="BOOLEAN", int timeout=5000)
 Wait for a specific value of a signal in the GOOSE. More...
 
def destroy (self)
 Destroys GOOSE subscriber. More...
 

Detailed Description

GOOSESubscriber class for monitoring GOOSE messages.

The GOOSESubscriber class allows subscribing to GOOSE messages to trigger actions based on received GOOSE messages. It supports selecting specific data attributes within GOOSE messages or monitoring the entire message. The class utilizes an SCL file to identify and connect to the appropriate IED and GOOSE control block.

When a specific Subnetwork is not provided, a new instance will be created. This class ensures that only one subscriber can be set up for each GOOSE control block reference to avoid conflicts. The subscription is configured using the GOOSE control block references, which can be manually selected or provided directly. Network interface connections can also be managed via the Subnetwork parameter.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
SCL  scl = None,
str  ied_name = None,
  nif_id = None,
str  cb_ref = None,
str  da_ref = None,
bool  autostart = True,
Subnetwork  sn = None 
)

Initialize a GOOSESubscriber instance.

This constructor sets up a GOOSESubscriber instance by connecting it to an IED and GOOSE control block defined in the provided SCL file. The user can either pass specific parameters or let the class prompt for selections. The setup includes selecting the IED, verifying GOOSE control blocks, and configuring network interfaces.

If multiple IEDs are present in the SCL file and the ied_name is not provided, the user will be prompted to select one. Similarly, if no specific GOOSE control block reference (cb_ref) is passed, a selection list will be presented. The class ensures only valid configurations proceed, raising exceptions if issues arise during the setup.

The network interface can be specified via the sn parameter, an instance of Subnetwork, or a new instance will be created automatically if not provided.

Parameters
sclThe SCL file object used for configuration.
ied_nameName of the IED to connect to.

xrefitem deprecated 2.

Parameters
cb_refControl block reference for the GOOSE message.
da_refSpecific data attribute reference to monitor within the GOOSE message.
autostartBoolean flag to automatically start the subscriber after setup. Default is True.
snSubnetwork instance to specify network connection.
Exceptions
ExceptionRaised when configuration issues prevent successful initialization.

Member Function Documentation

◆ __str__()

def __str__ (   self)

◆ destroy()

def destroy (   self)

Destroys GOOSE subscriber.

◆ get_ap_name()

def get_ap_name (   self)

Returns AccessPoint name of the GOOSE publishing IED.

◆ get_gocb_ref()

def get_gocb_ref (   self)

Returns a reference to the GOOSE Control Block associated with this GOOSESubscriber.

Returns
GOOSE Control Block reference in the format of MMSReference

◆ get_ied_name()

def get_ied_name (   self)

Returns IED name of the GOOSE publishing IED.

◆ gocbref()

def gocbref (   self)

Returns a reference to the GOOSE Control Block associated with this GOOSESubscriber.

Returns
GOOSE Control Block reference in the format of MMSReference

◆ sn()

Subnetwork sn (   self)

Returns the associated Subnetwork instance.

This property returns the Subnetwork instance that the GOOSESubscriber is connected to. If the Subnetwork was not provided during initialization, a default instance would have been created.

Returns
Subnetwork instance.

◆ wait_for_goose()

def wait_for_goose (   self,
int  timeout = 10000 
)

Wait for first GOOSE message.

This method allows to pause the scenario until the first goose message has been recieved by the GOOSESubscriber instance.

Note
It is highly recommended to use this method before actual test to ensure that GOOSESubscriber has received at least one GOOSE-message before any changes. Otherwise wait_for_goose_change() and wait_for_signal_change() might work incorrectly.
Parameters
timeoutGOOSE wait timeout in ms. The function throws an Exception if timeout has expired and no GOOSE message has been recieved.

◆ wait_for_goose_change()

def wait_for_goose_change (   self,
int  timeout = 1000 
)

Wait for GOOSE change.

Pause script execution until data changes in the subscribed GOOSE message or timeout event occurs.

Note
Be sure to wait_for_goose() function first to ensure that the subscriber was able to recieve at least one message prior to changes.
Parameters
timeoutGOOSE change wait timeout in ms. The function throws an Exception if timeout has expired and no data changed in the GOOSE message.

◆ wait_for_signal_change()

def wait_for_signal_change (   self,
int  timeout = 5000 
)

Wait for specific signal change in the GOOSE.

Pause script execution until data changes in the specified signal of the specified GOOSE message or timeout event occurs.

Note
Be sure to wait_for_goose() function first to ensure that the subscriber was able to recieve at least one message prior to changes.
This function requires that valid da_ref for the signal to be monitored is passed at initialization of the GOOSESubscriber class or using initializatoin wizard. Otherwise the exception shall be thrown.
Parameters
timeoutGOOSE change wait timeout in ms. The function throws an Exception if timeout has expired and no data changed in the GOOSE message.

◆ wait_for_signal_value()

def wait_for_signal_value (   self,
  value,
str  valType = "BOOLEAN",
int  timeout = 5000 
)

Wait for a specific value of a signal in the GOOSE.

Pause script execution until the specified FCDA reaches specified value or timeout event occurs.

Note
Be sure to wait_for_goose() function first to ensure that the subscriber was able to recieve at least one message prior to changes.
This function requires that valid da_ref for the signal to be monitored is passed at initialization of the GOOSESubscriber class or using initializatoin wizard. Otherwise the exception shall be thrown.
Parameters
valueThe expected value of the specified signal.
valTypeThe Type of the signal. Selected from the following list: [‘BOOLEAN’, ‘INT8’, ‘INT16’, ‘INT32’, ‘INT64’, ‘INT8U’, ‘INT16U’, ‘INT24U’, ‘INT32U’, ‘FLOAT32’, ‘FLOAT64’, ‘VisString32’, ‘VisString64’, ‘VisString65’, ‘VisString128’, ‘VisString255’, ‘Dbpos’]
timeoutGOOSE change wait timeout in ms. The function throws an Exception if timeout has expired and no data changed in the GOOSE message.