 |
plc.myforum.ro PLCs users www.plc.myforum.ro!
|
| View previous topic :: View next topic |
| Author |
Message |
gert Member 3


Joined: 02 Jan 2015 Posts: 645
|
Posted: 14/05/2015 21:41 Post subject: Stop the Runtime WinCC without stopping the server in PCS7 |
|
|
How can you Stop the Runtime of a UniClients, close WinCC and restart the computer without stopping the server in PCS7 ?
If you configure exclusively the WinCC standard function "Close WinCC or Windows" for a UniClient, then the server is stopped automatically when this is executed.
However, you can extend this function in order to keep the server in Runtime.
Please proceed as follows to do this:
1. Open a picture in the "Graphics Designer" and add a button to the picture.
2. Mark the button and call the Dynamic Wizard "Close WinCC or Windows".
3. Define the event which is to start the C function (right or left mouse-click).
4. Then select the option "Close WinCC and Restart Windows".
5. Now open the Properties window of the button and switch to the "Event" tab.
6. The Dynamic Wizard has added a C function under the option "Mouse-click".
7. Extend this function so that you can generate the following program sequence.
DeactivateRTProject(); // Line 1: insert in front of existing C function
DMExitWinCCEx (DM_SDMODE_REBOOT); // Line 2: C function already inserted by the wizard
ExitWinCC (); // Line 3: insert after existing C function
or in Line 2 replace with...as you wish:
DMExitWinCCEx(DM_SDMODE_POWEROFF)
DMExitWinCCEx(DM_SDMODE_REBOOT)
DMExitWinCCEx(DM_SDMODE_SYSTEM)
DMExitWinCCEx(DM_SDMODE_WINCC)
8. Compile the function and quit the mask with "OK".
9. Then save your picture.
Note)********************************************************
Please follow the order of the solution's steps exactly. It is very important that you start the Dynamic Wizard first and then extend the C function.
In the result, pressing a button on the UniClient ends its Runtime. Then WinCC is closed and finally the PC is rebooted.
A stronger command is using "C:\Program Files\Siemens\WinCC\bin\Reset_WinCC.vbs" but it has an msgbox at the end, you might edit a copy of this script, remove the msgbox line and add the shutdown option
| Code: | '**********************************
'Clean processes and services
'**********************************
Dim lvoWshShell
Set lvoWshShell = CreateObject("Wscript.Shell")
lvowshShell.run "CCCleaner.exe -terminate",0,TRUE
'**********************************
'Create eventlog entry
'**********************************
'Create entry in application eventlog
Const EVENT_SUCCESS = 0
Dim objUser
Dim strUser
Dim objShell
For Each objUser In GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_ComputerSystem")
strUser = objUser.UserName
Next
Set objShell = CreateObject("WScript.Shell")
objShell.LogEvent EVENT_SUCCESS, "UPS Shutdown Process Initiated using Custom Script when logged user was " & strUser
'**********************************
'Safe Shutdown of SCADA System
'**********************************
lvowshShell.Run "shutdown.exe -t 60"
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group Fa-ti si tu propriul forum GRATUIT, pe www.myforum.ro
|