WinCC 7.0 expression

krneki10

Member
Join Date
Aug 2012
Location
slovenia
Posts
18
I was wondering how could I write up expression for this cases:

1st case: object A changes color this way: when Q0.1 is on 1 AND Q.2 on 0, it's red. When Q0.2 is on 1 AND Q0.1 on 0, it,s green. In all other cases, it stays in current color.

2nd case: object B changes color from red to green as soon as Q0.3 gets on 1 and stays green until Q0.4 gets to 1, which sets it back to red. Just like SR flipflop.

Thank you for help in advance.
 
Using C Script control over the colour variable...

As a basic example for changing the colour of a pump using multiple states...

//================== DECLARE DATA TYPES ==================//
short RUNNING;
short RUN;
//================== SCOOP DATA INTO ALIAS ==================//
RUNNING=GetTagBit("DIN_00_15");
RUN=GetTagBit("DOUT_BUFF_01_05");
//===================== APPEARANCE LOGIC =====================//
if (RUN==0&RUNNING==0) // STOPPED
{
return RGB(255,0,0); // SOLID RED
}
if (RUN==1&RUNNING==1) // RUNNING
{
return RGB(0,255,0); // SOLID GREEN
}
if (RUN==1&RUNNING==0) // STARTING
{
return RGB(0,255,0); // SOLID GREEN IN CONJUNCTION WITH BLINK VARIABLE
}
if (RUN==0&RUNNING==1) // STOPPING
{
return RGB(255,0,0); // SOLID RED IN CONJUNCTION WITH BLINK VARIABLE
}
}
 
Last edited:
Thank you very much ChrisWOvivo. I'm really a complete newbie to C and VBS so any help would be greatly appreciated. I will try yours and report back later.

Could I ask you to write down similar script for changing y position and height property? Thanks!
 
Very similar...

//================== DECLARE DATA TYPES ==================//
short RUNNING;
short RUN;
//================== SCOOP DATA INTO ALIAS ==================//
RUNNING=GetTagBit("DIN_00_15");
RUN=GetTagBit("DOUT_BUFF_01_05");
//===================== APPEARANCE LOGIC =====================//
if (RUN==0&RUNNING==0) // STOPPED
{
return 10
}
}


Whatever number you return, will be loaded into the variable.

Also remember the difference between GetTagBit and GetTagBitWait.

GetTagBitWait goes directly to the PLC Processor to retrieve the latest value, as opposed to relying on the Tag Database in WINCC to retrieve the value (GetTagBit). Handy with a lot of data exchange.


Useful links...

C for WINCC Manual: http://www.scribd.com/doc/38460994/C-For-WinCC

WinCC Forums: https://www.automation.siemens.com/WW/forum/guests/Conference.aspx?SortField=LastPostDate&SortOrder=Descending&ForumID=162&Language=en
 

Similar Topics

is there any free trial version available for step7 professional and wincc comfort v17. i searched and downloaded TRIAL Download STEP 7...
Replies
1
Views
85
Hello. I have a db which is 1000 INT, and this db is represented in WinCC as a raw data type set of 5x 400 Bytes. This set is read with a script...
Replies
1
Views
88
Hello Experts I am working on a project with WinCC Unified v16 PC system and want to create an option on the screen to export logs to the...
Replies
0
Views
77
Does anyone happen to know how to install the graphic picture in HMI when I go into blower selection there are no graphics shown not only blower...
Replies
1
Views
111
Hi folks, I'm not as accustom with Siemens & WinCC, however I've been asked to increase the amount of data an existing application is logging...
Replies
2
Views
90
Back
Top Bottom