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

SVPublisher class for simulating SV message publishing. More...

Inheritance diagram for SVPublisher:

Public Member Functions

def __init__ (self, ServerSimulator ss=None, Subnetwork sn=None, msvCbRef=None, sim=True, **kwargs)
 Initialize a SVPublisher instance. More...
 
None disable_all (cls)
 
None enable_all (cls)
 
ServerSimulator ss (self)
 Get the ServerSimulator instance associated with the SVPublisher. More...
 
Subnetwork sn (self)
 Get the Subnetwork instance associated with the SVPublisher. More...
 
def msvCbRef (self)
 Get the SV control block reference. More...
 
def enabled (self)
 
def enabled (self, bool enable)
 
None enable (self)
 Enable the SVPublisher. More...
 
None disable (self)
 Disable the GOOSEPublisher. More...
 
def set_smpSynch (self, smpSynch)
 Set SVPublisher synchronization. More...
 
def smpSynch (self)
 
def smpSynch (self, smpSynch)
 Set SVPublisher synchronization. More...
 
def get_fcda_ref_list (self, ref_type=ReferenceType.ObjectReference)
 Returns a list of data attribute references of dataset associated with SV control block . More...
 

Public Attributes

 smpSynch
 
 all_enabled
 
 enabled
 

Static Public Attributes

list instances = []
 
bool all_enabled = False
 

Detailed Description

SVPublisher class for simulating SV message publishing.

The SVPublisher class is used to simulate the publishing of Sampled Values (SV) messages within a specified subnetwork. Each instance is associated with a ServerSimulator and a Subnetwork object. The class ensures that only one SVPublisher instance is created for a specific SV control block reference. If no Subnetwork or ServerSimulator is provided, new instances are created. This class enables simulation of different signal states (e.g., pre-fault, fault, and post-fault) using the SGSineWave class for the signal generation and switching between different states.

Example usage of SVPublisher class:

try:
sp1 = SVPublisher()
TestEngine.log(f"{sp1} has been initialized successfully.")
Dialog.show_message(f"{sp1} has been initialized successfully. Click Ok to enable")
sgSin1 = SGSineWave(sp1.ss.ied_name, sp1.ss.ap_name, 4) # Signal generator with 4 states
TestEngine.log("Successfully initialized SignalGenerator with 4 groups")
sgSin1.set_signal_list(sp1.get_fcda_ref_list()) # Set signal list for signal generator
# Create states (pre-fault, fault, post-fault)
state1 = SG3PhaseState(cRms=1000, vRms=10000, cScale=1000)
state2 = SG3PhaseState(cRms=10000, vRms=7000, cScale=1000)
state3 = SG3PhaseState(cRms=100, vRms=10000, cScale=1000)
sgSin1.set_state(0, state1) # Set pre-fault state
sgSin1.set_state(1, state2) # Set fault state
sgSin1.set_state(2, state3) # Set post-fault state
sgSin1.set_state(3, state1) # Repeat pre-fault state
sgSin1.switch_to_state(1) # Switch to pre-fault state
sp1.enabled = True # Enable SV simulation
TestEngine.log(f"{sp1} successfully enabled")
Dialog.show_message(f"{sp1} successfully enabled. Click Ok to switch to state 2.")
sgSin1.switch_to_state(2) # Switch to fault state
Dialog.show_message(f"Signal Generator Successfully switched to State 2. Click Ok to switch to state 3.")
sgSin1.switch_to_state(3) # Switch to post-fault state
Dialog.show_message(f"Signal Generator Successfully switched to State 3. Click Ok to finish.")
del sp1
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,
  msvCbRef = None,
  sim = True,
**  kwargs 
)

Initialize a SVPublisher instance.

Initializes a SVPublisher object, which simulates SV 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 SVPublisher.
snSubnetwork object that connects the SVPublisher.
msvCbRefThe reference of the SV control block to be used.
simBoolean flag to indicate if the simulation flag is set in the SV message (default is True).
smpSynchinteger sychronization flag. Use SmpSynch enum for handy shortcuts.
kwargsAdditional keyword arguments (such as scl, mms_port) used to customize the simulator.
Exceptions
AttributeErrorRaised when ServerSimulator is None and msvCbRef is provided.
ExceptionRaised if no SV 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.

Exceptions
NotImplementedErrorThis function is not yet implemented.

◆ disable_all()

None disable_all (   cls)

◆ enable()

None enable (   self)

Enable the SVPublisher.

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

◆ enable_all()

None enable_all (   cls)

◆ enabled() [1/2]

def enabled (   self)

◆ enabled() [2/2]

def enabled (   self,
bool  enable 
)

◆ 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 SV 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 SV control block.
See also
ReferenceType, SCL Тип ссылок, используемый в возвращаемых данных. Тип ссылки определяется классом ReferenceType.
Returns

◆ msvCbRef()

def msvCbRef (   self)

Get the SV control block reference.

This property retrieves the SV control block reference (msvCbRef) associated with the SVPublisher.

Returns
The msvCbRef associated with the SVPublisher.

◆ set_smpSynch()

def set_smpSynch (   self,
  smpSynch 
)

Set SVPublisher synchronization.

Parameters
smpSynchinteger sychronization flag. Use SmpSynch enum for handy shortcuts.
Deprecated:
This method is deprecated. Use smpSynch setter instead.
See also
SmpSynch smpSynch

◆ smpSynch() [1/2]

def smpSynch (   self)

◆ smpSynch() [2/2]

def smpSynch (   self,
  smpSynch 
)

Set SVPublisher synchronization.

Parameters
smpSynchinteger sychronization flag. Use SmpSynch enum for handy shortcuts.
See also
SmpSynch

◆ sn()

Subnetwork sn (   self)

Get the Subnetwork instance associated with the SVPublisher.

This property retrieves the Subnetwork instance associated with the SVPublisher.

Returns
The Subnetwork instance associated with the SVPublisher.

◆ ss()

ServerSimulator ss (   self)

Get the ServerSimulator instance associated with the SVPublisher.

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

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

Member Data Documentation

◆ all_enabled [1/2]

bool all_enabled = False
static

◆ all_enabled [2/2]

all_enabled

◆ enabled

enabled

◆ instances

list instances = []
static

◆ smpSynch

smpSynch