Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA Enterprise SCADA BLT API Reference

Synchronously execute a Business Logic Tier (BLT) component using the Data Access Layer (DAL)

Synchronously execute a Business Logic Tier (BLT) component using the Data Access Layer (DAL)

This scenario guides you through the steps required to synchronously execute the TestBLT Business Logic Tier (BLT) component using the Data Access Layer (DAL) .

To identify the code associated with each step, see the code comments in the Example code section.

The TestBLT component is called using the following input parameters:

  • table and point names 
  • numberOfAlarms

The TestBLT component returns the following outputs:

  • numberOfAlarms parameter
  • numberOfEvents parameter
  • table and point names are returned as a tabular result or dataset

Tosynchronouslyexecute the BLT component using the DAL

  1. Open the Program.cs file from the created project. 

    In this example, the project is named DALBLTTest and the BLT component is named TestBLT.

  2. Create a method to execute the BLT component by doing the following:
    1. Get a DALBLTConnection to the driver where the BLT component is hosted. For example, RealTime.
    2. Create the BLT component parameters, providing initial values for the input parameters and ouput variables for the output parameters.
    3. Execute the BLT component synchronously.
    4. Retrieve the result data.
    5. Retrieve the output values of the parameters.
  3. On the Main method, do the following:
    1. Initialize the DAL client service layer.
    2. Call the BLT component execution method.
  4. Run the DALBLTTest.exe to check the TestBLT component execution by doing the following:
    1. On the desktop, double-click the Windows PowerShell for DNA shortcut.
    2. Execute the following commands:
      set-silo RealTime
      dalblttest      

Example code

private static void SynchronousExecute()
{
    // Get a DALBLTConnection to the driver.
    var bltConnection = DALBLTClient.GetGlobalConnection("Realtime", null);
    // Create the BLT component parameters.
    var bltParameters = new List<DALBLTParam>
    {
        new DALBLTParam(name:"point", value:"0analog", isOutput: false),
        new DALBLTParam(name:"table", value:"analog", isOutput: false),
        new DALBLTParam(name:"numberOfAlarms", value:100, isOutput: true),
        new DALBLTParam(name:"numberOfEvents", value:null, isOutput: true),
    };
    var bltValues = new List<DALBLTParam>();
    const String bltName = "TestBLT";
    const Int32 maxRowsToReturn = 0; // unlimited rows.
   
    // Execute the BLT component synchronously.
    if (!bltConnection.ExecuteSync(
        bltName,
        maxRowsToReturn,
        bltParameters,
        out bltValues,
        out Int32 rowsAffected,
        out DataSet data,
        out DALBLTExecutionStatus execStatus,
        out String failureReason))
    {
        Console.WriteLine(
quot;BLT execution failed due to:
{failureReason}"); return; } // Retrieve the result data. var table = data.Tables[0]; foreach (DataRow row in table.Rows) { var name = row[0].ToString(); var value = row[1].ToString(); Console.WriteLine(
quot;The result with field
{name} has value {value}"); } // Retrieve the output values of the parameters. foreach (var value in bltValues) { if (value.IsOutput) { Console.WriteLine(
quot;The output parameter
{value.Name} has changed its value to: {value.Value}"); } } } static void Main(String[] args) { // Initialize the DAL client service layer. DALService.Initialize(); // Call the BLT component execution method. SynchronousExecute(); }
TitleResults for “How to create a CRG?”Also Available in