Applies To:
  • CitectSCADA 4.xx, 5.00, 5.01, 5.10, 5.20, 5.21

Summary:
The Citect "spcxrschart" templates only show me the subgroup element details for each new subgroup.  I would like to be able to see the element values for each subgroup as I view them i.e. when using the subgroup or trend cursor control buttons.  Can I do this? 

Solution:
Many of the SPC cicode functions need to be called on a displayed SPC trend page.  You can use the SPC cicode to update the subgroup values with each change of subgroup in runtime.  To do this you should create a new template/s by modifying and saving the Citect template/s in the Citect Include project.  Save your templates in your own project otherwise the changes will be lost if Citect is removed or reinstalled.  You can then base your pages on your own modified templates.

On the "spcxrschart" templates there are five number animations which display subgroup element values.  You need to modify these or replace them with new version 5 number animations.  The following cicode can be added to the animation expression fields for each respective element:

SubGroupValue(0);

SubGroupValue(1);

SubGroupValue(2);

SubGroupValue(3);

SubGroupValue(4);

This will pass the element number (0,1,2,3 or 4) to a cicode function called SubGroupValue() which you will need to write in a cicode file in your project:

global REAL rSubgroup[8];

STRING
FUNCTION
SubGroupValue(INT iElement)

INT iError=-1;
STRING sTag=TrnGetPen(50, 0); // SPC tag name
INT iSubNo=SPCSubgrpNoGet(); // Subgroup number
INT iSubSize=StrToInt(DspSPCClientInfo(1,0)); // Subgroup size

IF sTag <> "" THEN
iError = SPCGetSubgroupTable(sTag,iSubNo,rSubgroup); // store subgroup element values

IF iError=0 THEN
IF iElement<= iSubSize-1 AND rSubgroup[iElement]>-32001 AND rSubgroup[iElement]<32001 THEN
RETURN RealToStr(rSubgroup[iElement],5,1);
ELSE RETURN "<na>";
END
ELSE RETURN "<na>";
END
ELSE RETURN "<na>";
END
END

Now when you change subgroup number in runtime, the element data will change to display the values for the chosen subgroup.

 

Keywords:
 

Attachments