Hi!
I work in WinCC project of the filling bottle. I have problem.
I have to set high three bits depending on bottle position. I define 3 variables lLeft1, lLeft2 and lLeft3. When is:
lLeft1 == position 491 the bit M125.5 must be set high,
lLeft1 == position 622 the bit M125.6 must be set high,
lLeft1 == position 759 the bit M125.7 must be set high,
lLeft2 == position 622 the bit M125.5 must be set high,
lLeft2 == position 759 the bit M125.6 must be set high,
lLeft3 == position 491 the bit M125.5 must be set high.
With C-action i was write following code and that not work!
Can somebody tell me what is wrong in the code.
float lLeft1;
float lLeft2;
float lLeft3;
float lLeft4;
float lLeft5;
float lLeft6;
LPCTSTR tijelo1 = "Group39";
LPCTSTR tijelo2 = "Group36";
LPCTSTR tijelo3 = "Group4";
#define slika1 "Maketa.Pdl"
#define TAG1 "Postrojenje_ON"
#define TAG5 "Automatski_mod"
#define TAG6 "Auto_desno_1"
#define TAG7 "Senzor_1" -> M125.5
#define TAG8 "Senzor_2" -> M125.6
#define TAG9 "Senzor_3" -> M125.7
if ( GetTagBit (TAG1) == TRUE && GetTagBit (TAG5) == TRUE && GetTagBit (TAG6) == TRUE)
{
for ( lLeft1= 313e+0; lLeft1<= 1170e+0; lLeft1= lLeft1 + 5e-2 )
{
labela11:
SetLeft(slika1, tijelo1, lLeft1);
if ( lLeft1 == 491)
SetTagBit (TAG7, TRUE);
else
SetTagBit (TAG7, FALSE);
if (GetTagBit (TAG1) == FALSE || GetTagBit (TAG5) == FALSE || GetTagBit (TAG6) == FALSE)
goto labela11;
if (GetLeft(slika1, tijelo1) == 598)
{
for ( lLeft2 = 313e+0, lLeft1= 598e+0; lLeft2 <= 1170e+0, lLeft1 <= 1170e+0; lLeft2 = lLeft2 + 10e-2, lLeft1 = lLeft1 + 10e-2 )
{
labela12:
SetLeft(slika1, tijelo1, lLeft1);
SetLeft(slika1, tijelo2, lLeft2);
if (lLeft1 == 622)
SetTagBit (TAG8, TRUE);
else
SetTagBit (TAG8, FALSE);
if ( lLeft1 == 759)
SetTagBit (TAG9, TRUE);
else
SetTagBit (TAG9, FALSE);
if ( lLeft2 == 491)
SetTagBit (TAG7, TRUE);
else
SetTagBit (TAG7, FALSE);
if (GetTagBit (TAG1) == FALSE || GetTagBit (TAG5) == FALSE || GetTagBit (TAG6) == FALSE)
goto labela12;
if (GetLeft(slika1, tijelo1) == 883)
{
labela14:
for ( lLeft3 = 313e+0, lLeft1 = 883e+0, lLeft2 = 598e+0; lLeft2 <= 1170e+0, lLeft1 <= 1170e+0, lLeft3 <= 1170e+0; lLeft2 = lLeft2 + 20e-2, lLeft1 = lLeft1 + 20e-2, lLeft3 = lLeft3 + 20e-2 )
{
labela13:
SetLeft(slika1, tijelo1, lLeft1);
SetLeft(slika1, tijelo2, lLeft2);
SetLeft(slika1, tijelo3, lLeft3);
if ( lLeft2 == 622)
SetTagBit (TAG8, TRUE);
else
SetTagBit (TAG8, FALSE);
if ( lLeft2 == 759)
SetTagBit (TAG9, TRUE);
else
SetTagBit (TAG9, FALSE);
if ( lLeft3 == 491)
SetTagBit (TAG7, TRUE);
else
SetTagBit (TAG7, FALSE);
if (GetLeft( slika1, tijelo1) == 1170)
goto labela14;
if (GetTagBit (TAG1) == FALSE || GetTagBit (TAG5) == FALSE || GetTagBit (TAG6) == FALSE)
goto labela13;
}
}
}
}
}
}
Thanks!
I work in WinCC project of the filling bottle. I have problem.
I have to set high three bits depending on bottle position. I define 3 variables lLeft1, lLeft2 and lLeft3. When is:
lLeft1 == position 491 the bit M125.5 must be set high,
lLeft1 == position 622 the bit M125.6 must be set high,
lLeft1 == position 759 the bit M125.7 must be set high,
lLeft2 == position 622 the bit M125.5 must be set high,
lLeft2 == position 759 the bit M125.6 must be set high,
lLeft3 == position 491 the bit M125.5 must be set high.
With C-action i was write following code and that not work!
Can somebody tell me what is wrong in the code.
float lLeft1;
float lLeft2;
float lLeft3;
float lLeft4;
float lLeft5;
float lLeft6;
LPCTSTR tijelo1 = "Group39";
LPCTSTR tijelo2 = "Group36";
LPCTSTR tijelo3 = "Group4";
#define slika1 "Maketa.Pdl"
#define TAG1 "Postrojenje_ON"
#define TAG5 "Automatski_mod"
#define TAG6 "Auto_desno_1"
#define TAG7 "Senzor_1" -> M125.5
#define TAG8 "Senzor_2" -> M125.6
#define TAG9 "Senzor_3" -> M125.7
if ( GetTagBit (TAG1) == TRUE && GetTagBit (TAG5) == TRUE && GetTagBit (TAG6) == TRUE)
{
for ( lLeft1= 313e+0; lLeft1<= 1170e+0; lLeft1= lLeft1 + 5e-2 )
{
labela11:
SetLeft(slika1, tijelo1, lLeft1);
if ( lLeft1 == 491)
SetTagBit (TAG7, TRUE);
else
SetTagBit (TAG7, FALSE);
if (GetTagBit (TAG1) == FALSE || GetTagBit (TAG5) == FALSE || GetTagBit (TAG6) == FALSE)
goto labela11;
if (GetLeft(slika1, tijelo1) == 598)
{
for ( lLeft2 = 313e+0, lLeft1= 598e+0; lLeft2 <= 1170e+0, lLeft1 <= 1170e+0; lLeft2 = lLeft2 + 10e-2, lLeft1 = lLeft1 + 10e-2 )
{
labela12:
SetLeft(slika1, tijelo1, lLeft1);
SetLeft(slika1, tijelo2, lLeft2);
if (lLeft1 == 622)
SetTagBit (TAG8, TRUE);
else
SetTagBit (TAG8, FALSE);
if ( lLeft1 == 759)
SetTagBit (TAG9, TRUE);
else
SetTagBit (TAG9, FALSE);
if ( lLeft2 == 491)
SetTagBit (TAG7, TRUE);
else
SetTagBit (TAG7, FALSE);
if (GetTagBit (TAG1) == FALSE || GetTagBit (TAG5) == FALSE || GetTagBit (TAG6) == FALSE)
goto labela12;
if (GetLeft(slika1, tijelo1) == 883)
{
labela14:
for ( lLeft3 = 313e+0, lLeft1 = 883e+0, lLeft2 = 598e+0; lLeft2 <= 1170e+0, lLeft1 <= 1170e+0, lLeft3 <= 1170e+0; lLeft2 = lLeft2 + 20e-2, lLeft1 = lLeft1 + 20e-2, lLeft3 = lLeft3 + 20e-2 )
{
labela13:
SetLeft(slika1, tijelo1, lLeft1);
SetLeft(slika1, tijelo2, lLeft2);
SetLeft(slika1, tijelo3, lLeft3);
if ( lLeft2 == 622)
SetTagBit (TAG8, TRUE);
else
SetTagBit (TAG8, FALSE);
if ( lLeft2 == 759)
SetTagBit (TAG9, TRUE);
else
SetTagBit (TAG9, FALSE);
if ( lLeft3 == 491)
SetTagBit (TAG7, TRUE);
else
SetTagBit (TAG7, FALSE);
if (GetLeft( slika1, tijelo1) == 1170)
goto labela14;
if (GetTagBit (TAG1) == FALSE || GetTagBit (TAG5) == FALSE || GetTagBit (TAG6) == FALSE)
goto labela13;
}
}
}
}
}
}
Thanks!