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

GOOSEPublisher class for simulating GOOSE message publishing. More...

Inheritance diagram for GOOSEPublisher:

Public Member Functions

def __init__ (self, ServerSimulator ss=None, Subnetwork sn=None, goCbRef=None, sim=True, **kwargs)
 Initialize a GOOSEPublisher instance. More...
 
None disable_all (cls)
 
ServerSimulator ss (self)
 Get the ServerSimulator instance associated with the GOOSEPublisher. More...
 
Subnetwork sn (self)
 Get the Subnetwork instance associated with the GOOSEPublisher. More...
 
def gocbref (self)
 Get the GOOSE control block reference. More...
 
None enable (self)
 Enable the GOOSEPublisher. More...
 
None disable (self)
 Disable the GOOSEPublisher. More...
 
def get_fcda_ref_list (self, ref_type=ReferenceType.ObjectReference)
 Returns a list of data attribute references of dataset associated with GOOSE control block . More...
 

Static Public Attributes

list instances = []
 

Detailed Description

GOOSEPublisher class for simulating GOOSE message publishing.

The GOOSEPublisher class is used to simulate the publishing of GOOSE messages within a specified subnetwork. Each instance is associated with a ServerSimulator and a Subnetwork object. The class ensures that only one GOOSEPublisher instance is created for a specific GOOSE control block reference. If no Subnetwork or ServerSimulator is provided, new instances are created. This class is especially useful for testing GOOSE communication in a controlled environment.

Note
When using this class, ensure that the references (like stVal_ref and q_ref) are correctly defined as per the data model in use.

Example usage of the GOOSEPublisher class:

try:
gp1 = GOOSEPublisher()
TestEngine.log(f"{gp1.ss.ied_name} - {gp1.ss.ap_name}")
gp1.enable()
Dialog.show_message(f"{gp1} successfully enabled")
gp2 = GOOSEPublisher()
TestEngine.log(f"{gp2.ss.ied_name} - {gp2.ss.ap_name}")
gp2.enable()
Dialog.show_message(f"{gp2} successfully enabled")
gp3 = GOOSEPublisher()
TestEngine.log(f"{gp3.ss.ied_name} - {gp3.ss.ap_name}")
gp3.enable()
TestEngine.log(f"Data references for {gp1}:")
fcda_ref_list_gp1 = gp1.get_fcda_ref_list()
TestEngine.bulk_log(fcda_ref_list_gp1)
TestEngine.log(f"Data references for {gp2}:")
fcda_ref_list_gp2 = gp2.get_fcda_ref_list()
TestEngine.bulk_log(fcda_ref_list_gp2)
TestEngine.log(f"Data references for {gp3}:")
fcda_ref_list_gp3 = gp3.get_fcda_ref_list()
TestEngine.bulk_log(fcda_ref_list_gp3)
continue_loop = UserSelection.YES
stVal = Dbpos()
q = Quality()
while continue_loop == UserSelection.YES:
stVal_ref = "W1G_Y001_1A1_AD_LD/XCBR1.Pos.stVal"
q_ref = "W1G_Y001_1A1_AD_LD/XCBR1.Pos.q"
stVal.cycle()
gp2.ss.set_val(stVal_ref, stVal, val_type="Dbpos")
TestEngine.log(f"Changed {stVal_ref} to {stVal} ({stVal._position})")
continue_loop = Dialog.yes_no("Would you like to change data again?")
del gp1
del gp2
del gp3
TestEngine.set_result(Result.SUCCESS)
except Exception as err:
TestEngine.log(f"Test failed: {err}")
TestEngine.set_result(Result.FAIL)

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
ServerSimulator  ss = None,
Subnetwork  sn = None,
  goCbRef = None,
  sim = True,
**  kwargs 
)

Initialize a GOOSEPublisher instance.

Initializes a GOOSEPublisher object, which simulates GOOSE message publishing. If no ServerSimulator or Subnetwork is provided, a new one is created. The method also validates the presence of control block references for the selected IED and AccessPoint.

Parameters
ssServerSimulator object to be used for the GOOSEPublisher.
snSubnetwork object that connects the GOOSEPublisher.
goCbRefThe reference of the GOOSE control block to be used.
simBoolean flag to indicate if the simulation flag is set in the GOOSE message (default is True).
kwargsAdditional keyword arguments (such as scl, mms_port) used to customize the simulator.
Exceptions
AttributeErrorRaised when ServerSimulator is None and goCbRef is provided.
ExceptionRaised if no GOOSE control blocks are found for the specified IED and AccessPoint.
ExceptionRaised if the control block reference is not found in the IED's data model.

Member Function Documentation

◆ disable()

None disable (   self)

Disable the GOOSEPublisher.

This method is intended to disable the GOOSEPublisher, but it is not yet implemented. When implemented, it will deactivate the GOOSEPublisher and set the _enabled flag to False.

◆ disable_all()

None disable_all (   cls)

◆ enable()

None enable (   self)

Enable the GOOSEPublisher.

This method enables the GOOSEPublisher by starting the associated ServerSimulator and setting the GOOSE control block to be enabled. If the ServerSimulator is not yet created or running, it is created and started before enabling the GOOSEPublisher.

◆ get_fcda_ref_list()

def get_fcda_ref_list (   self,
  ref_type = ReferenceType.ObjectReference 
)

Returns a list of data attribute references of dataset associated with GOOSE control block .

If no svcb_ref specified the function returns references to all control blocks associated with this SVSimulator instance.

Parameters
ref_typeType of reference for returned data. See ReferenceType for available types.
Returns
List of strings where each string is a reference to data attribute specified by FCDA element in the dataset referenced by GOOSE control block.
See also
ReferenceType, SCL Тип ссылок, используемый в возвращаемых данных. Тип ссылки определяется классом ReferenceType.
Returns

◆ gocbref()

def gocbref (   self)

Get the GOOSE control block reference.

This property retrieves the GOOSE control block reference (GoCBRef) associated with the GOOSEPublisher.

Returns
The GoCBRef associated with the GOOSEPublisher.

◆ sn()

Subnetwork sn (   self)

Get the Subnetwork instance associated with the GOOSEPublisher.

This property retrieves the Subnetwork instance associated with the GOOSEPublisher.

Returns
The Subnetwork instance associated with the GOOSEPublisher.

◆ ss()

ServerSimulator ss (   self)

Get the ServerSimulator instance associated with the GOOSEPublisher.

This property retrieves the ServerSimulator instance associated with the GOOSEPublisher. If the ServerSimulator has not been assigned, an AttributeError is raised.

Exceptions
AttributeErrorRaised if the ServerSimulator has not been assigned to the GOOSEPublisher instance.
Returns
The ServerSimulator instance associated with the GOOSEPublisher.

Member Data Documentation

◆ instances

list instances = []
static