How to find errors in the application

While creating or running an application, errors may occur. Such errors must be detected, analysed and corrected.

Finding errors in the scripts

INFO system:

Most errors can be detected in the INFO system in /Errors/Script. Each error is listed with description, the row and column number in script.

The Pm.Debug method:

Some script errors can be more "tricky". For example the error can be of semantic origin instead of syntactic, i.e. the script is running, but not exactly the way it should be. The cause of such error can be used the Pm.Debug method and e.g. so-called "interval bisection". It means that somewhere in the application this method is placed into the script (together with the tuning remark as a first parameter). Then it is possible to check the script completion in the running application and see the "tuning remark" in the INFO system in Debug_info. This information can be useful in order to decide whether the error occured in the script before or after the remark.

Web panels:

A frequent error that occures when writing scripts for Web is incorrect value assignment or reading graphic item properties. In order to read or write the properties correctly it is necessary to use the GetProp and SetProp method. Additional limitations are described in Web panels chapter.

The Pm.Debug method works also in the Web client and the report can be viewed after pressing Shift-Ctrl-Alt-space simultaneously in Web panel.

VBScript statement "On Error":

Some errors cannot be prevented easily, because they can be, for example, dependant on user input. For example if the user enters 0 into a variable that is then used in script for division, then an error occurs. The application does not crash, but the script is terminated. This situation can be prevented by including the On Error statement before the script expression that is prone to such errors. By this statement it is ensured that the script continues even if the error occurs.

Initialization write into the graphic item:

Script errors often occur in the onStart event of the graphic item that reads or writes into another panel item based on this event. The cause of such error is the fact that the other graphic item is not initialized at the moment of executing this event. This is the panel item order error that can be avoided by placing such graphic item (that contains the script) above all others (i.e. select the item, right mouseclick and go to menu "Marked items / Move marked items by order in memory / above all items").

External debugger:

The special external tuning program (debugger) can also be used for script debugging. The usage is described here: How to debug scripts in the PROMOTIC application.


Long term application error observation

Information about errors that is written into the INFO system is visible only if the application is running or stopped (in the runtime mode and in the development environment). If the application is closed, the error information is lost.
Saving error information into the LOG file:

The global errors can be written into the "Application.ini" file. This kind of error log can be set in the "Application.ini" file in the [Log] section. The LOG file can then be explored long after the application is running or stopped. The error log is preset to record only the first occurrence of errors of each type.

Individual error logs:

The onAppError event of the PmRoot object also can be used for example:

- creating own error log file
- writing error event into alarms and events
- calling another action (send e-mail, SMS, ...)


Application restart

There are situations that are not likely to accur during short term running of the application. For example:
- after OS Windows restart, the application is launched before all Windows services necessary for running it are active
- after some time of the application runtime the OS Windows run out of free resources (Watching running PROMOTIC application memory, GDI,...)
- the connection with communication device is not re-estabilished after network breakdown, etc.
The application launch can be postponed for example by:
- by the utility RunLater or
- setting the RtStartDelay key in the Application.ini file in the Description of keys in the [Promotic] section section
If the application or the OS Windows "freezes" the PmRtManager as WatchDog security component can be used for forcing the restart.
PROMOTIC 8.3.30 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice