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

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
64
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
65
I have created a project in TIA Portal v16 Upd6 with S7-1200 (6ES7214-1AG40-0XB0) and WinCC Unified (PC station). The communication between the...
Replies
4
Views
145
I am creating a project with WinCC Unified v16 Upd6 (PC runtime) with an S7-1200. The communication is good between the PC and the PLC as I can...
Replies
6
Views
194
hello s7-400h and wincc are connected to each other via Ethernet. I need help on how to do time synchronization
Replies
0
Views
54
Back
Top Bottom