AddEventEntry

AddEventEntry metodu: ID ile belirtilen kullanıcı tanımlı bir girdiye dayanarak yeni bir genişletilmiş CEL girdisi oluşturur.

ID ile belirtilen kullanıcı tanımlı bir girdiye dayanarak yeni bir genişletilmiş CEL girdisi oluşturur.

Ad alanı: Scada.AddIn.Contracts.ChronologicalEventList

Assembly: Scada.AddIn.Contracts (Scada.AddIn.Contracts.dll içinde) Version=16.0.0.0

C#
Scada.AddIn.Contracts.ChronologicalEventList.AddEventEntryResult AddEventEntry(
    int dwEntryId,
    string strCelString,
    string szPvName,
    int iGroup,
    int iClass,
    object value,
    int status
)

Parametreler

dwEntryId (Tip: Int32)

Kullanıcı tanımlı kategori eşlemesini belirtir.

strCelString (Tip: String)

Verilen dize kronolojik olay listesine yazılır (geçerli zaman damgasıyla).

szPvName (Tip: String)

Bir değişkenin adı; değişken kronolojik olay listesinde listelenir.

iGroup (Tip: Int32)

Kronolojik olay listesinde filtreleme için AlarmGroup ID'si.

iClass (Tip: Int32)

Kronolojik olay listesinde filtreleme için AlarmClass ID'si.

value (Tip: Object)

Variant olarak değer; kronolojik olay listesindeki değer girdisi anlamına gelir.

status (Tip: Int32)

StatusValue, tüm geçerli durum bilgilerini tek tek bitler olarak içerir.

Dönüş değeri

Tip: AddEventEntryResult

ID ile belirtilen kullanıcı tanımlı bir girdiye dayanarak yeni bir CEL girdisi oluşturur. ID iletildiğinde sabit CEL girdileri de tanımlanabilir.

OrtamKullanılabilirlik
Engineering StudioKullanılmaz
Service EngineSalt okunur
C#

                  using System;
using System.Diagnostics;
using Scada.AddIn.Contracts;
using Scada.AddIn.Contracts.ChronologicalEventList;

namespace Samples
{
  [AddInExtension("ChronologicalEventList.ChronologicalEventList.AddEventEntry", "Service that subscribes to the EventEntryAdded of the Chron. Event List and Prints the added event entry", "Samples")]
  public class ProjectServiceExtension_ChronologicalEventList_ChronologicalEventList_AddEventEntry : IProjectServiceExtension
  {

    IChronologicalEventList chronologicalEventList;
    public void Start(IProject context, IBehavior behavior)
    {
      chronologicalEventList = context.ChronologicalEventList;
      chronologicalEventList.EventEntryAdded += ChronologicalEventListOnEventEntryAdded;
      // This is an entry with a simple text and nothing more.
      chronologicalEventList.AddEventEntry("ChronologicalEvenList Event was subscribed in Addin");

      // It is also possible to define an event entry id
      chronologicalEventList.AddEventEntry(dwEntryId: 33, "This is an entry with the id 33.");

      // also, some fiels in an entry can be written.
      // take care on the calculation of the time value
      var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
      chronologicalEventList.AddEventEntry(
        dwEntryId: 33,
        "Entry with id, variable name, groupId, class id, value, status and timestamp",
        szPvName: "VariableName",
        iGroup: 1,
        iClass: 2,
        value: (double)3.0,
        status: 4,
        time: Convert.ToInt32((DateTime.Now.ToUniversalTime() - epoch).TotalSeconds),
        timeMilliSec: (short)DateTime.Now.Millisecond);

      // It is also possible to define an event entry object and add this object.
      // more setting like user name or computer name can be set in this object.
      // ATTENTION: every attribute like group, class or even the user must exist in the
      // zenon project or otherwise the event will not be written in the CEL.
      var eventEntryData = chronologicalEventList.CreateEventEntryData();
      eventEntryData.EntryId = 33;
      eventEntryData.GroupNumber = 1;
      eventEntryData.ClassNumber = 2;
      eventEntryData.ComputerName = "Computer Name";
      eventEntryData.UserName = "Admin";
      eventEntryData.Text = "This entry is created with the eventEntryData object.";
      AddEventEntryResult addEventEntryResult = context.ChronologicalEventList.AddEventEntry(eventEntryData);
    }

    //procedure is executed when an EventEntry comes
    void ChronologicalEventListOnEventEntryAdded(object sender, EventEntryAddedEventArgs eventEntryAddedEventArgs)
    {
      Debug.Print("{0} > {1}", eventEntryAddedEventArgs.Item.Time, eventEntryAddedEventArgs.Item.Text);
    }

    public void Stop()
    {
      // enter your code which should be executed when stopping the SCADA Runtime Service
      chronologicalEventList.EventEntryAdded -= ChronologicalEventListOnEventEntryAdded;
      chronologicalEventList.AddEventEntry("ChronologicalEvenList Event was unsubscribed in Addin");
    }

  }
}
Bu sayfa, COPA-DATA zenon 16 çevrimiçi yardımının Türkçe çevirisidir. Menü ve ayar adları, programdaki gibi bulmanız için İngilizce bırakılmıştır.