WinCC Globale Sript - DCE FEL ČVUT v Praze
WinCC Globale Sript - DCE FEL ČVUT v Praze
WinCC Globale Sript - DCE FEL ČVUT v Praze
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Background Processing (Global Script)<br />
SITRAIN<br />
ST-BWINCCS /GlobalScript Page 1 Siemens AG © 2007<br />
Objectives<br />
- Project Functions<br />
- Standard Functions<br />
- Internal Functions<br />
- Project-wide Actions<br />
- Project Modules<br />
SITRAIN<br />
ST-BWINCCS /GlobalScript Page 2 Siemens AG © 2007<br />
1
Global Script C Actions and Functions<br />
Output field for<br />
- Search files<br />
- Compile all functions<br />
SITRAIN<br />
ST-BWINCCS /GlobalScript Page 3 Siemens AG © 2007<br />
Example of a Project Function and/or Standard Function<br />
0<br />
A function defined in the Global Script (Standard Functions:<br />
void BitSet(BOOL OnOff, char* lpszWordtag, WORD wbitnumber)<br />
{<br />
Switching on a motor:<br />
Events/ Mouse/ Left mouse button/ C function...<br />
BitSet ( 1, "MotorStatus", 2);<br />
/*Bit 2 is set in the “MotorStatus” tag, to reset the<br />
bit use: BitSet ( 0, “MotorStatus”, 2)*/<br />
WORD winput = 0; // Create local tags<br />
int iscreen = 1;<br />
winput = GetTagWord ( lpszWordtag ) ; // Read process tags<br />
iscreen
Background Processing (Actions) with Global Script<br />
Operating hours.PAS<br />
WORD HOUR, MINUTE;<br />
BYTE Z_ON;<br />
Z_ON = GetTagByte ("Z_On");<br />
if (Z_ON) {<br />
MINUTE = GetTagWord ("Minutes");<br />
MINUTE = MINUTE + 1;<br />
SetTagWord ("Minutes", MINUTE);<br />
HOUR = MINUTE / 60;<br />
SetTagWord ("operating hours", HOUR);<br />
}<br />
return(HOUR);<br />
Note: Global Script must be activated in the computer startup list<br />
SITRAIN<br />
ST-BWINCCS /GlobalScript Page 5 Siemens AG © 2007<br />
Example with Functions from DLLs<br />
Counting with the DLL function<br />
Events/ Button/ Mouse/ Press left/ C action...<br />
#pragma code (“d:\ab_pas\library\demo_dll.dll")<br />
int CountingDll(int start, int end);<br />
#pragma code()<br />
int result, start, end, partial step;<br />
partial step = GetTagDWord("partial step");<br />
printf("\r\n\r\noutput of 10 partial steps with DLL function ");<br />
printf("to max. value: %d",partial step*10);<br />
for (start=0;start
Global Script VBS Actions and Procedures 1/2<br />
To be created by the user<br />
(empty)<br />
Procedures<br />
(Function)<br />
Output window for compiling<br />
SITRAIN<br />
ST-BWINCCS /GlobalScript Page 7 Siemens AG © 2007<br />
Global Script VBS Actions and Procedures 2/2<br />
In the project<br />
Trigger<br />
Action<br />
Instruction 1<br />
Instruction 2<br />
Procedure C<br />
….<br />
Instruction n<br />
Module<br />
Procedure A<br />
Procedure B<br />
Procedure C<br />
Instruction a<br />
Instruction b<br />
Procedure D<br />
Procedure E<br />
SITRAIN<br />
ST-BWINCCS /GlobalScript Page 8 Siemens AG © 2007<br />
4
.pdl<br />
Example of a VBS Project Function<br />
SITRAIN<br />
ST-BWINCCS /GlobalScript Page 9 Siemens AG © 2007<br />
Call<br />
5