August 16

WinCC SCADA C-action Scripting Course: Tutorial #70

scripting wincc scada c-action

In this lecture, we learn about scripting process to control colors of rectangle in WinCC window. Sometimes we need to use scripting during runtime (WinCC RT) and we need to know how to make it!

One of subscribers asked for help:

"Can you please make one video for changing object colour with 3 different conditions using C script.
If Tag A is 1it should be greenWith Tag B is 1 it should be redWith Tag C is 1 yellow and flashing"

Check the script below with flashing option:


// WINCC:TAGNAME_SECTION_START
// syntax: #define TagNameInAction "DMTagName"
// next TagID : 2
#define TAG_1 "TagA"
#define TAG_2 "TagB"
#define TAG_3 "TagC"
// WINCC:TAGNAME_SECTION_END

// WINCC:PICNAME_SECTION_START
// syntax: #define PicNameInAction "PictureName"
// next PicID : 1
// WINCC:PICNAME_SECTION_END

if (GetTagBit(TAG_1) & GetTagBit(TAG_2) & GetTagBit(TAG_3)) // TagA = 1 AND TagB = 1 AND TagC = 1??
{
SetPropBOOL(lpszPictureName,"Rec10","FlashBackColor",1);//FLASHING RECTANGLE ON
return 64255; //YELLOW COLOR
}
else if (GetTagBit(TAG_1) & GetTagBit(TAG_2)) // TagA = 1 AND TagB = 1??
{
SetPropBOOL(lpszPictureName,"Rec10","FlashBackColor",0);//FLASHING RECTANGLE OFF
return 255;
}
else if (GetTagBit(TAG_1))// TagA = 1?
{
SetPropBOOL(lpszPictureName,"Rec10","FlashBackColor",0);//FLASHING RECTANGLE OFF
return 65280;
}
else
SetPropBOOL(lpszPictureName,"Rec10","FlashBackColor",0);//FLASHING RECTANGLE OFF
return 0;

About the author 

SCADA World

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Online courses

In the courses, I lead you through WinCC SCADA from point A to point Z with the shortest and effective path possible. During your studies you have full contact with me. I will answer every question! 🙂 The methods developed thanks to the online training of over 3,000 people allow you to transfer knowledge in the most effective way. See you in the course!

>