WinCC Trend in WebNavigator

R

Thread Starter

R.K.

Hello,
I would like to plot an array in WinCC coming from a PLC. I am trying to create this graph using the Trend Control supplied by WinCC. I've got a loop that adds the points to the graph and then displays them and it works beautifully in WinCC Runtime, but does not in web Navigator. Does anyone know if there is a special initialization process needed to have it run properly on web navigator? Attached below is my code:

// WINCC:TAGNAME_SECTION_START
// syntax: #define TagNameInAction "DMTagName"
// next TagID : 1
// WINCC:TAGNAME_SECTION_END
#define TAG_M12_0312_Det2_Curve_Force_Live "M12_0312_Det2_Curve_Force_Test" // Force is an INT (2 Bytes)
#define TAG_M12_0312_Det2_Curve_Pos_Live "M12_0312_Det2_Curve_Pos_Test" // Position is an INT (2 Bytes)

//-------- Not Neccessary------------------
//#define nbByte_for_INT sizeof(int) //BYTE (default format for a raw tag ...)
#define nbByte_for_DINT sizeof(float) //BYTE (default format for a raw tag ...)
#define nbByte_for_REAL sizeof(long) //BYTE (default format for a raw tag ...)
#define nbSamples_Array 100 // Size of the arrays that contains Force and Position data curve analysis

#define szData_Force nbSamples_Array*nbByte_for_REAL // Force Values are REAL (4 Bytes)
#define szData_Position nbSamples_Array*nbByte_for_DINT // Position Values are DINT (4 Bytes)
//#define szData_Time nbSamples_Array*nbByte_for_DINT // TimeValues are DINT (4 Bytes)

//Declaration of Force and Position input arrays

float *Force_2;
long *Position_2;
double Force_Detail2[100];
double Position_Detail2[100];

unsigned int j;
unsigned int i;
unsigned int Null_Count_Force_2=0;
unsigned int Null_Count_Position_2=0;
static double ForceMax_Detail2;
static double PositionMax_Detail2;

// Creation of the BYTE array in which the values of the raw data tag are stored
BYTE byData_Force[szData_Force];
BYTE byData_Position[szData_Position];

GetTagRaw(TAG_M12_0312_Det2_Curve_Force_Live,byData_Force,szData_Force);
GetTagRaw(TAG_M12_0312_Det2_Curve_Pos_Live,byData_Position,szData_Position);

// Pointer to Raw Data Array
Force_2=&byData_Force[0];
Position_2=&byData_Position[0];


//Verification of actual values

ForceMax_Detail2==0;
for (i=0;i<100;i++)
{
Force_Detail2=Force_2;
Position_Detail2=Position_2;
//printf("%e , %e \r\n", Position_2,Force_Detail2);

/* if (Force_Detail2[ i ] > ForceMax_Detail2)
{

ForceMax_Detail2 = Force_Detail2[ i ];


}
else
{

ForceMax_Detail2 = ForceMax_Detail2;

}

*/
if (Position_Detail2[ i ] > PositionMax_Detail2)
{

PositionMax_Detail2=Position_Detail2[ i ];

}
else
{

PositionMax_Detail2=PositionMax_Detail2;

}

if (Force_Detail2==0)
{

Null_Count_Force_2++;

}
if (Position_Detail2==0)
{

Null_Count_Position_2++;

}
}

printf("\r\n Force Values are =\r\n");
for (j=0;j<100;j++)
{
printf("%e \r\n", Force_Detail2[j]);
}
printf("\r\n Position Values are =\r\n");
for (j=0;j<100;j++)
{
printf("%e \r\n", Position_Detail2[j]);
}


//Plot Graph
SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","DeleteData",1);
SetPropWord(lpszPictureName,"BushingDet2CurveGraph","Index",0);
SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","Online",FALSE); //
SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","Activate",FALSE); //

SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","ItemVisible",1);
SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","AutoRangeX",0);
SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","AutoRangeY",1);
SetPropDouble(lpszPictureName,"BushingDet2CurveGraph","BeginX",(Position_Detail2[0]/10000));//10000);
SetPropDouble(lpszPictureName,"BushingDet2CurveGraph","EndX",(PositionMax_Detail2/10000));//10000);

i=0;
for (i=0;i<100;i++)

{

if (Force_Detail2[ i]!= ForceMax_Detail2)
{
SetPropDouble(lpszPictureName,"BushingDet2CurveGraph","DataX",Position_Detail2/10000);
SetPropDouble(lpszPictureName,"BushingDet2CurveGraph","DataY",Force_Detail2); //Return-Type :BOOL
SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","InsertData",1);
}
else
{
break;
}

}

SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","Online",TRUE);
SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","Activate",TRUE); //

}
}
 
Top