pascalSCADA OPM: PLCMemoryManager: Class TPLCMemoryManager

Pascal SCADA OPM

Class TPLCMemoryManager

Unit

PLCMemoryManager

Declaration

type TPLCMemoryManager = class(TObject)

Description

Class that handles non-continuous memory blocks (fragmented) and the better organization of it.

:

Hierarchy

  • TObject
  • TPLCMemoryManager

Overview

Fields

Public Blocks:TRegisterRangeArray;

Methods

Public constructor Create; virtual;
Public destructor Destroy; override;
Public procedure AddAddress(Address,Size,RegSize,Scan:Cardinal); overload; virtual;
Public procedure RemoveAddress(Address,Size,RegSize:Cardinal); overload; virtual;
Public function SetValues(AdrStart,Len,RegSize:Cardinal; Values:TArrayOfDouble; LastResult:TProtocolIOResult):LongInt; virtual;
Public function GetValues(AdrStart,Len,RegSize:Cardinal; var Values:TArrayOfDouble; var LastResult:TProtocolIOResult; var ValueTimeStamp:TDateTime):LongInt; virtual;
Public procedure SetFault(AdrStart,Len,RegSize:Cardinal; Fault:TProtocolIOResult); virtual;

Properties

Published property MaxHole: LongInt read FMaxHole write SetHoleSize;
Published property MaxBlockItems: LongInt read FMaxBlockSize write SetBlockSize;
Published property Size: LongInt read GetSize;

Description

Fields

Public Blocks:TRegisterRangeArray;

: Continous memory blocks.

Methods

Public constructor Create; virtual;

: Creates the handler of non continuous memory block.

Public destructor Destroy; override;

: Destroys the handler of non continuous memory block.

Public procedure AddAddress(Address,Size,RegSize,Scan:Cardinal); overload; virtual;

: Adds one or more memory into the manager.

For example, to add the MW0, MW2 and MW4 of a Siemens PLC (the smaller word is the byte) with 1200ms of scan into the manager, you must call: AddAddress(0,3,2,1200);

However, on a Schneider PLC (the smaller word has 16 bits), to add the address W0, W1 and W2, you must call: AddAddress(0,3,1,1200);

Parameters
Address
Cardinal. Initial address of memory range.
Size
Cardinal. How many memories will be managed by the manager.
RegSize
Cardinal. Word size of your variable compared with the smaller word of your device.
Scan
Cardinal. Scan time of your variables
See also
RemoveAddress
SetValues
GetValues
Public procedure RemoveAddress(Address,Size,RegSize:Cardinal); overload; virtual;

: Removes one or more variables from the manager.

These parameters works like the of function AddAddress.

Parameters
Address
Cardinal. Initial address of memory range.
Size
Cardinal. How many memories will be removed from the manager.
RegSize
Cardinal. Word size of your variable compared with the smaller word of your device.
See also
AddAddress
SetValues
GetValues
Public function SetValues(AdrStart,Len,RegSize:Cardinal; Values:TArrayOfDouble; LastResult:TProtocolIOResult):LongInt; virtual;

: SetValues stores values in a range of memories, continuous or non continuous.

One value on Values array represents the value of the smaller word of your device.

For example: if you are storing the value of MW0 (word) of an Siemens PLC, you must call:

SetValues(0,1,2,[vb0_value,vb1_value]);

Because on Siemens PLC's the smaller word size is the byte, so, one word are two bytes.

But, on a Schneider PLC, you must call:

SetValues(0,1,1,[valor_VW0]);

Because on this PLC, the smaller word size is the Word (16bits).

Parameters
Address
Cardinal. Initial address of memory range.
Len
Cardinal. How many memory will be stored on the manager.
RegSize
Cardinal. Word size of your variable compared with the smaller word of your device.
Values
TArrayOfDouble. Values that will be stored in the memory manager.
LastResult
TProtocolIOResult. Last I/O result of the values being stored.
See also
AddAddress
RemoveAddress
GetValues
Public function GetValues(AdrStart,Len,RegSize:Cardinal; var Values:TArrayOfDouble; var LastResult:TProtocolIOResult; var ValueTimeStamp:TDateTime):LongInt; virtual;

: GetValues gets the values stored in memory manager, continuous or non-continuous.

One value on Values array represents the value of the smaller word of your device.

Parameters
Address
Cardinal. Initial address of memory range.
Len
Cardinal. How many memories will got from the manager.
RegSize
Cardinal. Word size of your variable compared with the smaller word of your device.
Values
TArrayOfDouble. Array that will return the values that are stored in the memory manager.
LastResult
TProtocolIOResult. Last I/O result of the memory range.
ValueTimeStamp
TDateTime. Date time of the last update of the values on the memory manager.
See also
AddAddress
RemoveAddress
SetValues
GetValues
Public procedure SetFault(AdrStart,Len,RegSize:Cardinal; Fault:TProtocolIOResult); virtual;

: SetFault updates the last I/O result of a range of memories on manager.

Parameters
Address
Cardinal. Initial address of memory range.
Len
Cardinal. How many memories will be updated on the manager.
RegSize
Cardinal. Word size of your variable compared with the smaller word of your device.
Fault
TProtocolIOResult. Last I/O result of the memory range.
See also
SetValues

Properties

Published property MaxHole: LongInt read FMaxHole write SetHoleSize;

: Tells how many memory address can be missing without break the block on two or more smaller blocks.

For example, if are added the memory address [0, 1] and [3, 4] into the Manager with MaxHole=0, will be built two blocks, the first with the address [0, 1] and the second block with the address [3, 4].

However, if the MaxHole is set to 1, will be built only one block with the address [0,1,2,3,4]. Will be included the address 2, to avoid the break the block on two pieces.

Published property MaxBlockItems: LongInt read FMaxBlockSize write SetBlockSize;

: Tells the max size of the blocks. If has no limit, set MaxBlockItems to 0.

For example, if are added the memory address [0,1,2,3,4] and MaxBlockItems=0 will be created only one block with these address. However if MaxBlockItems=3, will be created two blocks, the first with the address [0,1,2] and the second with the address [3,4].

Published property Size: LongInt read GetSize;

: How many memories are handled by the manager.

Author


Generated by PasDoc 0.14.0.