User Tools

Site Tools


debugging_complex_programs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
debugging_complex_programs [2018/12/26 10:53] – [First scan] emozolyakdebugging_complex_programs [2018/12/26 11:21] – [Debug messages] emozolyak
Line 37: Line 37:
  
 If the order of execution of the scripts is 1 - 2, then everything will work, because at the current scan start script #2 saw one value, and before its execution another one(which script #1 has changed before), and will correctly work 'by changing the state of the register.' If the script execution order is interchanged, then script 2 will not work, because at the the current scan start it will see the changed value, and the new change will occur after script #2 execution in script #1. If the order of execution of the scripts is 1 - 2, then everything will work, because at the current scan start script #2 saw one value, and before its execution another one(which script #1 has changed before), and will correctly work 'by changing the state of the register.' If the script execution order is interchanged, then script 2 will not work, because at the the current scan start it will see the changed value, and the new change will occur after script #2 execution in script #1.
 +
 +===== Running backup on the new device =====
 +
 +If you take the new WebHMI with clean internal DS - memory, where some complex project has to be run, usually you need some presets (initial values) for correct operation. You can use a recipe feature and make a list of all registers with initial values, and then just apply this recipe. 
 +
 +If the project was linked to Level2 account, when restoring its backup on the new WebHMI, check that Level2 integration is switched off, otherwise this WebHMI may interefer another one which use same Level2 account.
 +
 +===== Debug messages =====
 +
 +It is desirable after the key moments of logic or calculations in scripts to immediately put the functions INFO, ERROR, DEBUG, TRACE, with respectve values at this point, script's name, line number at the beginning, etc. Then these fragments are conveniently searched and analyzed in the communication log. 
 +
 +When there is a lot of records in the communication log, you can filter out unneccerary output from scripts with this [[http://docs.webhmi.com.ua/useful_programs#debug_printing|method]].
 +
 +In the script editor, there is a debugging console, which always prints out the functions INFO, DEBUG, ERROR, TRACE regardless of the system log level settings. If the output changes too quickly to analize, you can slow down the script by changging in execution type to "Execute on register's value change" and link to system time register or another one, slower.
 +
 +There are also messaging functins like [[ http://docs.webhmi.com.ua/scripts#writing_to_message_log|AddInfoMessage]], which can be used to write in a separate Messages log. Just take care of using them in logic transition points, otherwise you will get huge number of records generated in every scan from these functions.
  
debugging_complex_programs.txt · Last modified: 2022/01/15 20:50 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki