pascalSCADA OPM: PLCTag: Class TPLCTag

Pascal SCADA OPM

Class TPLCTag

Unit

PLCTag

Declaration

type TPLCTag = class(TTag, IManagedTagInterface)

Description

Base class of a communication tag.

:

Hierarchy

  • TComponent
  • TTag
  • TPLCTag

Overview

Fields

Protected PValidTag:Boolean;
Protected PModified:Boolean;
Protected FTagManager:TObject;
Protected FSyncWrites:Boolean;
Protected PProtocolDriver:TProtocolDriver;
Protected PLastScanTimeStamp:TDateTime;
Protected PValueTimeStamp:TDateTime;
Protected PLastSyncReadCmdResult:TProtocolIOResult;
Protected PLastSyncWriteCmdResult:TProtocolIOResult;
Protected PLastASyncReadCmdResult:TProtocolIOResult;
Protected PLastASyncWriteCmdResult:TProtocolIOResult;
Protected FProtocolTagType:TProtocolTagType;
Protected FTagType:TTagType;
Protected FSwapDWords:Boolean;
Protected FSwapWords:Boolean;
Protected FSwapBytes:Boolean;
Protected FProtocolWordSize:Byte;
Protected FCurrentWordSize:Byte;

Methods

Protected function IsMyCallBack(Cback:TTagCommandCallBack):Boolean; virtual;
Protected procedure GetNewProtocolTagSize;
Protected function RemainingMiliseconds:Int64; virtual;
Protected function RemainingMilisecondsForNextScan:Int64; virtual;
Protected function IsValidTag:Boolean; virtual;
Protected procedure SetTagValidity(TagValidity:Boolean); virtual;
Protected function PLCValuesToTagValues(Values:TArrayOfDouble; Offset:Cardinal):TArrayOfDouble; virtual;
Protected function TagValuesToPLCValues(Values:TArrayOfDouble; Offset:Cardinal):TArrayOfDouble; virtual;
Protected function GetAvgUpdateRate:Double;
Protected procedure UpdateTagSizeOnProtocol; virtual;
Protected procedure RebuildValues; virtual;
Protected procedure SetSwapDWords(v:Boolean); virtual;
Protected procedure SetSwapWords(v:Boolean); virtual;
Protected procedure SetSwapBytes(v:Boolean); virtual;
Protected procedure SetGUID(v:AnsiString);
Protected procedure SetAutoRead(v:Boolean); virtual;
Protected procedure SetAutoWrite(v:Boolean); virtual;
Protected procedure SetMemAddress(v:Cardinal); virtual;
Protected procedure SetMemFileDB(v:Cardinal); virtual;
Protected procedure SetMemReadFunction(v:Cardinal); virtual;
Protected procedure SetMemWriteFunction(v:Cardinal); virtual;
Protected procedure SetMemSubElement(v:Cardinal); virtual;
Protected procedure SetPath(v:AnsiString); virtual;
Protected procedure SetPLCStation(v:Cardinal); virtual;
Protected procedure SetPLCHack(v:Cardinal); virtual;
Protected procedure SetPLCSlot(v:Cardinal); virtual;
Protected procedure SetRefreshTime(v:TRefreshTime); virtual;
Protected procedure SetProtocolDriver(p:TProtocolDriver); virtual;
Protected procedure SetTagType(newType:TTagType); virtual;
Protected procedure TagCommandCallBack(Values:TArrayOfDouble; ValuesTimeStamp:TDateTime; TagCommand:TTagCommand; LastResult:TProtocolIOResult; Offset:LongInt); virtual;
Protected procedure BuildTagRec(out tr:TTagRec; Count, OffSet:LongInt);
Protected procedure ScanRead; virtual;
Protected procedure ScanWrite(Values:TArrayOfDouble; Count, Offset:Cardinal); virtual; abstract;
Protected procedure Read; virtual; abstract;
Protected procedure Write(Values:TArrayOfDouble; Count, Offset:Cardinal); overload; virtual; abstract;
Public procedure RemoveDriver;

Properties

Protected property Modified: Boolean read PModified;
Protected property AutoRead write SetAutoRead default true;
Protected property AutoWrite write SetAutoWrite default true;
Protected property CommReadErrors default 0;
Protected property CommReadsOK nodefault;
Protected property CommWriteErrors default 0;
Protected property CommWritesOk nodefault;
Protected property PLCRack write SetPLCHack nodefault;
Protected property PLCSlot write SetPLCSlot nodefault;
Protected property PLCStation write SetPLCStation nodefault;
Protected property MemFile_DB write SetMemFileDB nodefault;
Protected property MemAddress write SetMemAddress nodefault;
Protected property MemSubElement write SetMemSubElement nodefault;
Protected property MemReadFunction write SetMemReadFunction nodefault;
Protected property MemWriteFunction write SetMemWriteFunction nodefault;
Protected property Retries write PRetries default 1;
Protected property RefreshTime write SetRefreshTime stored false;
Protected property UpdateTime write SetRefreshTime default 1000;
Protected property Size nodefault;
Protected property LongAddress write SetPath nodefault;
Protected property ProtocolDriver: TProtocolDriver read PProtocolDriver write SetProtocolDriver;
Protected property ValueTimestamp: TDateTime read PValueTimeStamp;
Protected property SyncWrites: Boolean read FSyncWrites write FSyncWrites default false ;
Protected property TagType: TTagType read FTagType write SetTagType default pttDefault;
Protected property SwapBytes: Boolean read FSwapBytes write SetSwapBytes default false;
Protected property SwapWords: Boolean read FSwapWords write SetSwapWords default false;
Protected property SwapDWords: Boolean read FSwapDWords write SetSwapDWords default false;
Protected property TagSizeOnProtocol: LongInt read GetTagSizeOnProtocol;
Protected property AvgUpdateRate: Double read GetAvgUpdateRate;
Published property TagGUID: AnsiString read PGUID write SetGUID;
Published property LastSyncReadStatus: TProtocolIOResult Read PLastSyncReadCmdResult;
Published property LastSyncWriteStatus: TProtocolIOResult Read PLastSyncWriteCmdResult;
Published property LastASyncReadStatus: TProtocolIOResult Read PLastASyncReadCmdResult;
Published property LastASyncWriteStatus: TProtocolIOResult Read PLastASyncWriteCmdResult;

Description

Fields

Protected PValidTag:Boolean;
 
Protected PModified:Boolean;
 
Protected FTagManager:TObject;

: Stores the tag manager.

Protected FSyncWrites:Boolean;

: Tells if the write command will be synchronous or asynchronous.

Protected PProtocolDriver:TProtocolDriver;

: Stores the protocol driver used by tag.

Protected PLastScanTimeStamp:TDateTime;

: Date/time of the last scan read request of tag.

Protected PValueTimeStamp:TDateTime;

: Date/time of the last update of the tag value.

Protected PLastSyncReadCmdResult:TProtocolIOResult;

: Stores the I/O result of the last synchronous read command done.

Protected PLastSyncWriteCmdResult:TProtocolIOResult;

: Stores the I/O result of the last synchronous write command done.

Protected PLastASyncReadCmdResult:TProtocolIOResult;

: Stores the I/O result of the last asynchronous read command done.

Protected PLastASyncWriteCmdResult:TProtocolIOResult;

: Stores the I/O result of the last synchronous write command done.

Protected FProtocolTagType:TProtocolTagType;

: Stores the datatype returned by the protocol driver.

Protected FTagType:TTagType;

: Datatype of the tag.

Protected FSwapDWords:Boolean;

: Tells if the DWords of an Double (64 bits) will be swaped.

Protected FSwapWords:Boolean;

: Tells if the words of an DWORD (LongInt,cardinal and float) will be swaped.

Protected FSwapBytes:Boolean;

: Tells if the bytes of an WORD (SmallInt, Word) will be swaped.

Protected FProtocolWordSize:Byte;

: Word size returned by the protocol and current word size of the tag in bits.

Protected FCurrentWordSize:Byte;

: Word size returned by the protocol and current word size of the tag in bits.

Methods

Protected function IsMyCallBack(Cback:TTagCommandCallBack):Boolean; virtual;
 
Protected procedure GetNewProtocolTagSize;
 
Protected function RemainingMiliseconds:Int64; virtual;
 
Protected function RemainingMilisecondsForNextScan:Int64; virtual;
 
Protected function IsValidTag:Boolean; virtual;
 
Protected procedure SetTagValidity(TagValidity:Boolean); virtual;
 
Protected function PLCValuesToTagValues(Values:TArrayOfDouble; Offset:Cardinal):TArrayOfDouble; virtual;

: Convert values comming from the PLC to the datatype of the tag.

Protected function TagValuesToPLCValues(Values:TArrayOfDouble; Offset:Cardinal):TArrayOfDouble; virtual;

: Convert values of the datatype of the tag to the datatype of the driver.

Protected function GetAvgUpdateRate:Double;

: Average scan update rate.

Protected procedure UpdateTagSizeOnProtocol; virtual;

: Returns the real size of the tag.

Protected procedure RebuildValues; virtual;

: Rebuild the tag values.

Protected procedure SetSwapDWords(v:Boolean); virtual;

: Enable/disables the swap of DWords. Valid only if your tag type is pttDouble.

Parameters
v
Boolean: True enables the swap, False disables.
Protected procedure SetSwapWords(v:Boolean); virtual;

: Enable/disables the swap of words.

Parameters
v
Boolean: True enables the swap, False disables.
Protected procedure SetSwapBytes(v:Boolean); virtual;

: Enable/disables the swap of bytes.

Parameters
v
Boolean: True enables the swap, False disables.
Protected procedure SetGUID(v:AnsiString);

: Sets a new unique tag identification. Called by the Tag Manager.

Protected procedure SetAutoRead(v:Boolean); virtual;

: Enable/disables the automatic tag read.

Parameters
v
Boolean: True enables, False disables (manual).
Protected procedure SetAutoWrite(v:Boolean); virtual;

: Enable/disables the automatic write of values of the tag.

Parameters
v
Boolean: True automatic, False manual.
Protected procedure SetMemAddress(v:Cardinal); virtual;

: Sets the memory address.

Parameters
v
Cardinal. The memory address.
Protected procedure SetMemFileDB(v:Cardinal); virtual;

: Sets the File/DB that contains the mapped memory.

Parameters
v
Cardinal. File/DB number of your memory.
Protected procedure SetMemReadFunction(v:Cardinal); virtual;

: Sets the function to be used to read the memory.

Parameters
v
Cardinal. Function number to read the memory.
Protected procedure SetMemWriteFunction(v:Cardinal); virtual;

: Sets the function to be used to write values on memory.

Parameters
v
Cardinal. Function number to write values on memory.
Protected procedure SetMemSubElement(v:Cardinal); virtual;

: Sets the sub-element of the memory being mapped.

Parameters
v
Cardinal. The sub-element number of the memory being mapped.
Protected procedure SetPath(v:AnsiString); virtual;

: Sets the long address (text) of the tag.

Parameters
v
String. The long address of the tag (text).
Protected procedure SetPLCStation(v:Cardinal); virtual;

: Sets the address of device being mapped.

Parameters
v
Cardinal. The device address.
Protected procedure SetPLCHack(v:Cardinal); virtual;

: Sets the Rack of the device being mapped.

Parameters
v
Cardinal. The device Rack number.
Protected procedure SetPLCSlot(v:Cardinal); virtual;

: Sets the Slot number of the device being mapped.

Parameters
v
Cardinal. The Slot number.
Protected procedure SetRefreshTime(v:TRefreshTime); virtual;

: Sets the scan rate of the tag in milliseconds.

Parameters
v
Cardinal. Scan rate in milliseconds.
Protected procedure SetProtocolDriver(p:TProtocolDriver); virtual;

: Sets the protocol driver to be used the read/write values on device.

Parameters
p
TProtocolDriver. The protocol driver to be used to read/write values of your device.
Protected procedure SetTagType(newType:TTagType); virtual;

: Sets the datatype of the tag.

See also
TTagType
Protected procedure TagCommandCallBack(Values:TArrayOfDouble; ValuesTimeStamp:TDateTime; TagCommand:TTagCommand; LastResult:TProtocolIOResult; Offset:LongInt); virtual;

########################################################################## : Procedure called by the protocol driver to update tag values.

Protected procedure BuildTagRec(out tr:TTagRec; Count, OffSet:LongInt);

: Returns a structure with all informations about the tag.

See also
TTagRec
Protected procedure ScanRead; virtual;

: Request a update of tag values.

Protected procedure ScanWrite(Values:TArrayOfDouble; Count, Offset:Cardinal); virtual; abstract;

: Write values of the tag on your device asynchronous.

Parameters
Values
TArrayOfDouble: Array of values to be written.
Count
Cardinal: How many values will be written.
Offset
Cardinal: Tells offset after the address where the values will be written.
Protected procedure Read; virtual; abstract;

: Request a synchronous read of the tag value.

Protected procedure Write(Values:TArrayOfDouble; Count, Offset:Cardinal); overload; virtual; abstract;

: Write values of the tag on your device synchronous.

Parameters
Values
TArrayOfDouble: Array of values to be written.
Count
Cardinal: How many values will be written.
Offset
Cardinal: Tells offset after the address where the values will be written.
Public procedure RemoveDriver;

: Called when the protocol driver is being destroyed.

Properties

Protected property Modified: Boolean read PModified;
 
Protected property AutoRead write SetAutoRead default true;

:

See also
TTag.AutoRead
Protected property AutoWrite write SetAutoWrite default true;

:

See also
TTag.AutoWrite
Protected property CommReadErrors default 0;

:

See also
TTag.CommReadErrors
Protected property CommReadsOK nodefault;

:

See also
TTag.CommReadsOK
Protected property CommWriteErrors default 0;

:

See also
TTag.CommWriteErrors
Protected property CommWritesOk nodefault;

:

See also
TTag.CommWritesOK
Protected property PLCRack write SetPLCHack nodefault;

:

See also
TTag.PLCRack
Protected property PLCSlot write SetPLCSlot nodefault;

:

See also
TTag.PLCSlot
Protected property PLCStation write SetPLCStation nodefault;

:

See also
TTag.PLCStation
Protected property MemFile_DB write SetMemFileDB nodefault;

:

See also
TTag.MemFile_DB
Protected property MemAddress write SetMemAddress nodefault;

:

See also
TTag.MemAddress
Protected property MemSubElement write SetMemSubElement nodefault;

:

See also
TTag.MemSubElement
Protected property MemReadFunction write SetMemReadFunction nodefault;

:

See also
TTag.MemReadFunction
Protected property MemWriteFunction write SetMemWriteFunction nodefault;

:

See also
TTag.MemWriteFunction
Protected property Retries write PRetries default 1;

:

See also
TTag.Retries
Protected property RefreshTime write SetRefreshTime stored false;

:

See also
TTag.RefreshTime
Protected property UpdateTime write SetRefreshTime default 1000;

:

See also
TTag.ScanRate
Protected property Size nodefault;

:

See also
TTag.Size
Protected property LongAddress write SetPath nodefault;

:

See also
TTag.LongAddress
Protected property ProtocolDriver: TProtocolDriver read PProtocolDriver write SetProtocolDriver;

: Protocol driver used by tag to read/write values on your device.

See also
TProtocolDriver
Protected property ValueTimestamp: TDateTime read PValueTimeStamp;

: Date/time of the last update of the tag value.

Protected property SyncWrites: Boolean read FSyncWrites write FSyncWrites default false ;

: If True, the write of values will be synchronous.

Protected property TagType: TTagType read FTagType write SetTagType default pttDefault;

: Datatype of the tag.

Protected property SwapBytes: Boolean read FSwapBytes write SetSwapBytes default false;

: Tells if the bytes of an WORD (SmallInt, Word) will be swaped.

Protected property SwapWords: Boolean read FSwapWords write SetSwapWords default false;

: Tells if the words of an DWORD (LongInt, cardinal and float) will be swaped.

Protected property SwapDWords: Boolean read FSwapDWords write SetSwapDWords default false;

: Tells if the DWords of an Double (float 64 bits) will be swaped.

Protected property TagSizeOnProtocol: LongInt read GetTagSizeOnProtocol;

: Tells the real size of the tag on protocol driver.

Protected property AvgUpdateRate: Double read GetAvgUpdateRate;

: Average update rate of the tag.

Published property TagGUID: AnsiString read PGUID write SetGUID;

: Tells the unique tag identification.

Published property LastSyncReadStatus: TProtocolIOResult Read PLastSyncReadCmdResult;

: I/O result of the last synchronous read done.

See also
TProtocolIOResult
Published property LastSyncWriteStatus: TProtocolIOResult Read PLastSyncWriteCmdResult;

: I/O result of the last synchronous write done.

See also
TProtocolIOResult
Published property LastASyncReadStatus: TProtocolIOResult Read PLastASyncReadCmdResult;

: I/O result of the last asynchronous read done.

See also
TProtocolIOResult
Published property LastASyncWriteStatus: TProtocolIOResult Read PLastASyncWriteCmdResult;

: I/O result of the last asynchronous write done.

See also
TProtocolIOResult

Author


Generated by PasDoc 0.14.0.