JCOP FWWG 28 Nov 2023

→ Europe/Zurich
40/2-A01 (CERN)

40/2-A01

CERN

40
Show room on map
Zoom Meeting ID
63140383490
Host
Piotr Golonka
Useful links
Join via phone
Zoom URL

What's possible with WinCC OA Script Editor and CTRL Debugger nowadays

Pavel made a live-demonstration of various features of WinCC OA GEDI/ScriptEditor, helpful for project engineering/debugging and in particular CTRL code development.

The points below serve as a reminder of what is possible

Script Editor

  • it is possible to add own auto-completion (documented in the help); e.g. "DTN" could unfold to complete "DebugTN(__FUNCTION__,);"  
    This is very easy to configure nowadays
  • It is possible to create own menus, toolbars and dock modules in Script Editor (not only in the main GEDI.
    • for instance, a dedicated dock module allowing to run the current script in a new CTRL manager, and have the parsed/analysed output displayed in the dock area of the script editor itself. This could be triggered directly from a keyboard shortcut of the script editor 
    • note: output appears there is only when a manager exits (IO buffering in Managers); 
      LukaszG: could probably be worked-around with a wrapper script
    • the module has extra buttons to start/stop/kill the CTRL process, or start the debugger and open its main window
    • Demonstrated executing unit tests and showing the results immediately, with a report of coverage, etc.
  • In general, a lot of functionality is possible, as we have access to the path of edited file and the actual content of the editor
  • Customizing keyboard shortcuts:
    • PVSS00ui.ini -> all the keyboard shortcuts definitions; 
    • Clarified by MariuszS: also possible from GEDI: Edit->Shortcuts menu

WinCC OA Debugger

  • One needs to enable debugging / stop the execution of script explicitly, and there are various way to achieve it: either via GEDI Tools->activateDebug, in the project console by sending a debug flag or via setDbgFlag("CTRL_DEBUGBREAK") inside CTRL script; then you need debugBreak() in your script to effectively set the breakpoint in a particular line, or set the breakpoint interactively inside the debugger window
  • Selecting the manager to be debugged (connecting the debugger to it) -> relies on the _CtrlDebug datapoints existence
    • apparently it offers to debug ASCII Manager???  Does it have a CTRL interpretter at all (seemed so)? What would it be used for?
  • Once the debugger window opens it sometimes looses the layout of its docked modules ... will be reported to ETM
  • There is only a "step into" (no step over or step out as known from IDEs)
  • breakpoints MUST BE PUT ON THE LAST LINE of the multi-line statement; otherwise it is ignored
  • Pavel's extension: making the breakpoints persistent (they are not out-of-the-box)...
    • would be nice that with every set-breakpoint we persist them...
    • one may need to refresh the view after loading them, by e.g. switching to another file and back
    • some experience needed to put breakpoints in an effective way... Put more than needed in the next lines as a workaround, etc
  • Inspecting the values of variables
    • it is possible to modify the values of local variables not only inspect them -> good for simulating/debugging "strange" conditions.
    • tooltips over the variables show their values
    • the values of struct/class are displayed as serialized to string
  • All things could be done via "command line" (which has a command-response interface over _CtrlDebug datapoint)
    • -> e.g. you could print a variable using the "print" command
    • use "h" in the commandline to see the list of commands
    • note: libraries are referred to by a number... -> "info breakpoints" gives both... one could also do "info libs"
    • info connections -> show established dpConnects, alertConnects, etc;
    • info source -> gets source code if stored internally
    • etc..
  • Pavel's extension for the commandline - preserves the ones that were actually typed in, and not commanded by the debugger GUI

Discussion/Questions

  • Can we get Pavel's scripts? 
    • Yes, we will share them with JCOP FWWG. They will be given "as is" with no support, etc.
    • Should we think of some dedicated effort within the JCOP Fw to follow this up? To be seen.
  • Proposal: we will welcome developer's feedback on usability of engineering/development tools in WinCC OA and transmit them to ETM in January. Then, we could propose to ETM to work together on the topic (e.g. workshops with users, etc). Please, send suggestions to icecontrols.support@CERN.CH
  • Note that the "Reload CTRL Libs" in WinCC OA 3.19 really reloads the changed libraries (it does not reject the requests like it was in 3.16). 
    • This is very much needed e.g. when editing static methods/mebers -> if modified, they are sometimes reported by GEDI Script Editor as syntax error. Then you need to force-reload the libraries which will re-parse them and the syntax will be indicated as perfectly fine
  • The "profiler" or "performance analysis" tool is helpful to debug performance problems. You need to generate the "report file" using a debug flag, then load the report into the analysis tool (in the "Tools" menu of GEDI) and then there is a breakdown of number of execution times and annotated CTRL code

 

 

 

 

 

 

There are minutes attached to this event. Show them.
    • 14:00 → 14:05
      News about WinCC OA and JCOP Framework 5m
      Speaker: Piotr Golonka (CERN)
    • 14:05 → 14:50
      Hidden powers of WinCC OA Script Editor and Debugger 45m
      Speaker: Pavel Fiala (CERN)
    • 14:50 → 15:10
      Q&A, Discussion 20m
    • 15:10 → 15:20
      AOB 10m