RAID_Intro

TwinCAT PLC Library: RAID Controller

Introduction

Following function blocks are available for RAID controller services.

FB_RAIDFindCntlr : This function block returns the RAID controller count and the corresponding RAID controller IDs.

FB_RAIDGetInfo : This function block returns RAID Info, which includes number of RAID controller sets and maximum number of RAID drives per set.

FB_RAIDGetStatus : This function block returns the RAID set index, RAID type, RAID status, RAID Drive count, RAID Drive status.

CAUTION: Calling the function blocks FB_RAIDFindCntlr and FB_RAIDGetInfo only once in PLC program fulfills the need. System performance can be dramatically affected due to repetitive cyclic call of these function block.


FB_RAIDFindCntl

TwinCAT PLC Library: RAID Controller

FB_RAIDFindCntlr

This function block returns the RAID controller count and the corresponding controller IDs.

CAUTION: Calling this function block only once in PLC program fulfills the need. System performance can be dramatically affected due to cyclic call of this function block.

VAR_INPUT

Name			: Type
sNETID 			: T_AmsNetId;
bWrtRd 			: BOOL;
tTimeOut 			: TIME := DEFAULT_ADS_TIMEOUT;

sNETID: Is a string containing the AMS network identifier of the target device to which the ADS command is directed.

bWrtRd: The ADS command is triggered by a rising edge at this input.

tTimeOut: States the time before the function is cancelled.

VAR_OUTPUT

Name			: Type
stRAIDCntlrFound 		: ST_RAIDCntlrFound;
nBytesRead 		: UDINT;
bBusy 			: BOOL;
bError 			: BOOL;
nErrorID 			: UDINT;

stRAIDCntlrFound: includes the count of RAID controller found and corresponding RAID controller IDs.

nBytesRead: Number of succesfully returned data bytes.

bBusy: This output remains TRUE until the block has executed a command, but at the longest for the duration supplied to the ‘Timeout’ input. While Busy = TRUE, no new command will be accepted at the inputs. Please note that it is not the execution of the service but its acceptance whose time is monitored.

bError: This output is switched to TRUE if an error occurs during the execution of a command. The command-specific error code is contained in ‘nErrorId’. If the block has a timeout error, ‘bError’ is TRUE and ‘nErrorId’ is 1861 (hexadecimal 0x745). Is reset to FALSE by the execution of a command at the inputs.

nErrorID: Contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of a command at the inputs.


FB_RAIDGetInfo

This function block returns RAID info, which includes number of RAID controller sets and maximum number of drives per set.

CAUTION: Calling this function block only once in PLC program fulfills the need. System performance can be dramatically affected due to cyclic call of this function block.

VAR_INPUT

Name			: Type
sNETID 			: T_AmsNetId;
bWrtRd 			: BOOL;
nRAIDCntlrID		: UDINT;
tTimeOut 			: TIME := DEFAULT_ADS_TIMEOUT;

sNETID: Is a string containing the AMS network identifier of the target device to which the ADS command is directed.

bWrtRd: The ADS command is triggered by a rising edge at this input.

nRAIDCntlrID: The RAID controller ID. (Hint: Can be read using FB_RAIDCntlrFind)

tTimeOut: States the time before the function is cancelled.

VAR_OUTPUT

Name			: Type
stRAIDInfo 		: ST_RAIDInfo;
nBytesRead 		: UDINT;
bBusy 			: BOOL;
bError 			: BOOL;
nErrorID 			: UDINT;

stRAIDInfo: returns RAID info, which includes number of RAID controller sets and maximum number of drives per set.

nBytesRead: Number of succesfully returned data bytes.

bBusy: This output remains TRUE until the block has executed a command, but at the longest for the duration supplied to the ‘Timeout’ input. While Busy = TRUE, no new command will be accepted at the inputs. Please note that it is not the execution of the service but its acceptance whose time is monitored.

bError: This output is switched to TRUE if an error occurs during the execution of a command. The command-specific error code is contained in ‘nErrorId’. If the block has a timeout error, ‘bError’ is TRUE and ‘nErrorId’ is 1861 (hexadecimal 0x745). Is reset to FALSE by the execution of a command at the inputs.

nErrorID: Contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of a command at the inputs.


FB_RAIDGetStatus

This function block returns the RAID set index, RAID type, RAID status, RAID drive count, RAID drive status.

CAUTION: Please not that system performance can be dramatically affected due to cyclic call of this function block. The fastest recommended factor for this function block is once per second.

VAR_INPUT

Name			: Type
sNETID 			: T_AmsNetId;
bWrtRd 			: BOOL;
stRAIDConfigReq 		: ST_RAIDConfigReq;
tTimeOut 			: TIME := DEFAULT_ADS_TIMEOUT;

sNETID: Is a string containing the AMS network identifier of the target device to which the ADS command is directed.

bWrtRd: The ADS command is triggered by a rising edge at this input.

stRAIDConfigReq: RAID configuration request parameters are to be stated in this structure. It includes controller ID and RAID set index.

tTimeOut: States the time before the function is cancelled.

VAR_OUTPUT

Name			: Type
stRAIDStatusRes 		: ST_RAIDStatusRes;
nBytesRead 		: UDINT;
bBusy 			: BOOL;
bError 			: BOOL;
nErrorID 			: UDINT;

stRAIDStatusRes: RAID status response is received in this structure format. It includes RAID set index, RAID type, RAID status, RAID drive count, RAID drive status.

nBytesRead: Number of succesfully returned data bytes.

bBusy: This output remains TRUE until the block has executed a command, but at the longest for the duration supplied to the ‘Timeout’ input. While Busy = TRUE, no new command will be accepted at the inputs. Please note that it is not the execution of the service but its acceptance whose time is monitored.

bError: This output is switched to TRUE if an error occurs during the execution of a command. The command-specific error code is contained in ‘nErrorId’. If the block has a timeout error, ‘bError’ is TRUE and ‘nErrorId’ is 1861 (hexadecimal 0x745). Is reset to FALSE by the execution of a command at the inputs.

nErrorID: Contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of a command at the inputs.


E_RAIDDriveStatus

TYPE E_RAIDDriveStatus :
(
eRAID_DRIVE_STATUS_OK 		:= 0,
eRAID_DRIVE_STATUS_REBUILDING 	:= 1,
eRAID_DRIVE_STATUS_FAILED 		:= 2,
eRAID_DRIVE_STATUS_DEGRADED 	:= 3
);
END_TYPE

0 = eRAID_DRIVE_STATUS_OK, indicates the physical drive is operational.

1 = eRAID_DRIVE_STATUS_DEGRADED, indicates the physical drive has posted a SMART notification to the controller.

2 = eRAID_DRIVE_STATUS_REBUILDING, indicates the physical drive is the target drive of a RAID set rebuild. Once the rebuild completes successfully, the status will change to eRAID_DRIVE_STATUS_OK. If the rebuilding process fails, the status will be updated appropriately.

3 = eRAID_DRIVE_STATUS_FAILED, indicates the physical drive has posted unrecoverable errors to the controller or has triggered a vendor specific action to remove the physical drive from the RAID set. There is no guarantee on the operational behavior of the drive and data loss has occurred or is imminent.


E_RAIDDriveUsage

TYPE E_RAIDDriveUsage :
(
eRAID_DRIVE_CONFIG_NOT_USED 	:= 0,
eRAID_DRIVE_CONFIG_MEMBER 		:= 1,
eRAID_DRIVE_CONFIG_SPARE 		:= 2
);
END_TYPE

0 = eRAID_DRIVE_CONFIG_NOT_USED, indicates the physical drive is not part of a RAID set.

1 = eRAID_DRIVE_CONFIG_MEMBER, indicates the physical drive is part of this RAID set.

2 = eRAID_DRIVE_CONFIG_SPARE, indicates the physical drive is part of this RAID set as a hot swap spare.


E_RAIDStatus

TYPE E_RAIDStatus :
(
eRAID_SET_STATUS_OK 		:= 0,
eRAID_SET_STATUS_DEGRADED 		:= 1,
eRAID_SET_STATUS_REBUILDING 	:= 2,
eRAID_SET_STATUS_FAILED 		:= 3
);
END_TYPE

0 = eRAID_SET_STATUS_OK, indicates the RAID set is operational.

1 = e RAID_SET_STATUS_DEGRADED, indicates the RAID set is no longer functioning in a fault tolerant mode.

2 = eRAID_SET_STATUS_REBUILDING, indicates the RAID set is rebuilding. This implies a degraded operation. Once the rebuild completes successfully, the status will change to eRAID_SET_STATUS_OK. If the rebuilding process fails, the status will be updated appropriately.

3 =eRAID_SET_STATUS_FAILED, indicates the RAID set has failed. There is no guarantee on the operational behavior of the RAID set and data loss has occurred or is imminent.


E_RAIDType

TYPE E_RAIDType :
(
eRAID_TYPE_NONE 		:= 0,
eRAID_TYPE_0 		:= 1,
eRAID_TYPE_1 		:= 2,
eRAID_TYPE_10 		:= 3,
eRAID_TYPE_5 		:= 4,
eRAID_TYPE_15 		:= 5,
eRAID_TYPE_OTHER 		:= 255
);
END_TYPE

0 = eRAID_TYPE_NONE, indicates the RAID set is composed of a single drive. No Set with the given number exists.

1 = eRAID_TYPE_0, indicates the RAID set is a striped set, with no fault tolerance.

2 = eRAID_TYPE_1, indicates the RAID set is a mirrored set.

3 = eRAID_TYPE_10, indicates the RAID set is a striped mirror set.

4 = eRAID_TYPE_5, indicates the RAID set is a parity set.

5 = eRAID_TYPE_15, indicates the RAID set is an advanced parity set.

255 = eRAID_TYPE_OTHER, indicates the RAID set type configuration does not match the standard types.


ST_RAIDCntlFound

TwinCAT PLC Library: RAID Controller

ST_RAIDCntlrFound

TYPE ST_RAIDCntlrFound :
STRUCT
    nRAIDCntlrCount 	: UDINT;
    nRAIDCntlrIds 	: ARRAY [1..g_nMAX_NUMBER_OF_RAID_CNTLRS] OF UDINT;
END_STRUCT
END_TYPE

nRAIDCntlrCount: Number of RAID controllers

nRAIDCntlrIds: ID of each RAID controller (Default value is 4294967295 and hence invalid). g_nMAX_NUMBER_OF_RAID_CNTLRS is the maximum number of RAID controllers and is defined as global constant = 10.


ST_RAIDDriveStatus

TYPE ST_RAIDDriveStatus :
STRUCT
    eRAIDDriveStatus 		: E_RAIDDriveStatus;
    eRAIDDriveUsage 		: E_RAIDDriveUsage;
    nSATAPort			: UINT;
    sRAIDDriveSerial 		: STRING [39];
END_STRUCT
END_TYPE

eRAIDDriveStatus: Contains the status of the physical drive.

eRAIDDriveUsage: Contains whether the physical drive is part of the RAID set.

nSATAPort: Contains the SAS address of the physical drive. If the drive does not have a SAS address as is the case with a directly attached SATA drive, then this field shall be 0 filled

sRAIDDriveSerial: serial number designation of the RAID drive (40 characters).


ST_RAIDConfigReq

TYPE ST_RAIDConfigReq :
STRUCT
    nRAIDCntlrID 	: UDINT;
    nRAIDSetIndex 	: UDINT;
END_STRUCT
END_TYPE

nRAIDCntlrID: RAID controller ID

nRAIDSetIndex: Contains the number of the RAID set for which information is being requested. Please note that in case of Beckhoff Boards CBx051 the sets begin with Index 0.


ST_RAIDInfo

TYPE ST_RAIDInfo :
STRUCT
    nNumRAIDSets 	: UDINT;
    nMaxDrivesPerSet 	: UDINT;
    bReserved 	: ARRAY [1..92] OF BYTE;
END_STRUCT
END_TYPE

nNumRAIDSets: Number of logical RAID sets currently defined. If no sets have been defined, then a 0 value is returned.

nMaxDriverPerSet: Maximum number of physical drives within a logical RAID set. This may be an absolute maximum or the actual maximum currently defined for all sets

bReserved: reserved for internal use


ST_RAIDStatusRes

TYPE ST_RAIDStatusRes :
STRUCT
    nRAIDSetIndex 	: UDINT;
    eRAIDType 	: E_RAIDType;
    eRAIDStatus 	: E_RAIDStatus;
    nRAIDDriveCount 	: UINT;
    nReserved 	: UINT;
    stRAIDDriveStatus 	: ARRAY [1..g_nMAX_NUMBER_OF_RAID_DRIVES] OF ST_RAIDDriveStatus;
END_STRUCT
END_TYPE

nRAIDSetIndex: RAID set ID, same as input.

eRAIDType: Contains the basic RAID type of the RAID set. eRAID_TYPE_NONE, indicates the RAID set is composed of a single drive. In other words, no set with the given number exists.

eRAIDStatus: Contains the status of the RAID set.

nRAIDDriveCount: Contains the number of drives in the RAID set

nReserved: reserved

stRAIDDriveStatus: Contains the status of the physical drive and whether the physical drive is part of the RAID set. g_nMAX_NUMBER_OF_RAID_DRIVES is the number of RAID drive status that can be read and is defined as global constant = 10.