wincc oa ide - readthedocs.web.cern.ch
Post on 20-Jan-2022
6 Views
Preview:
TRANSCRIPT
1. a.
i.
WinCC OA IDE
EN-ICE WinCC OA IDE
Purpose
This project aims at providing a modern and well featured development environment for WinCC OA.
It is initially focused on editing and analyzing CTRL code. It can also provide the basis for developing other tools that will reuse the CTRL parser developed for this IDE.
Status
In development.
The initial development was made by TUe students at the end of 2013. The development was then restarted in July 2014 within EN-ICE-SCD.
The current solution is based on Eclipse RCP and the Xtext parser.
Portable version
You can download the whole IDE with the WinCC plugin already installed.
Windows x64G:\Departments\BE\Groups\ICS\Services\PVSS\IDE\Eclipse\eclipse-wincc-win-x64.zip (accessible for WinCC OA registered users from the CERN domain)i.e. from \\cern.ch\dfs\Departments\EN\Groups\ICE\Services\PVSS\IDE\Eclipse\
Linux x64not yet created
Installation
Download/copy necessary filesIf you don't have already installed, download it from: (on 64-bit should be used also 64-bit version Eclipse http://eclipse.org/downloads/of Eclipse)
It is recommended to download Eclipse IDE for Java and DSL Developers, because this version that is already contains Xtextneeded by the plugin.
Availability and support
The IDE is not currently in a state considered stable. Support is provided only to give you the possibility to test it and suggest features.
1. a.
ii.
b.
c.
d.
2. a.
i. ii.
1. 2.
3. a. b.
i. ii.
1.
2. 3.
a.
If you have already Eclipse installed on your computer, make sure that it has installed and updated Xtext plugin. In the case that you need to install Xtext plugin, go to "Help -> Eclipse Marketplace...", search for "Xtext" and install the plugin.
Make sure that ( ) or newer is properly installed: Java 1.8 Java SE 8 http://www.oracle.com/technetwork/java/javase/downloads/index.html (full JDK is recommended)WinCC plugin for Eclipse can be found here: G:\Departments\BE\Groups\ICS\Services\PVSS\IDE\plugin (accessible for [WebDFS]WinCC OA registered users from the CERN domain)If you want to use you have appropriate executable file ( ) from here: G:debugger Windows/Linux\Departments\BE\Groups\ICS\Services\PVSS\IDE\API_manager_executable (accessible for WinCC OA registered users from [WebDFS]the CERN domain)
The debugger is not supported anymoreConfigure Eclipse
Go to Eclipse installation folder and open/edit file eclipse.iniSet up required Java by changing following line: -Dosgi.requiredJavaVersion=1.8If your computer has enough memory, change also following configuration
-Xms40m to -Xms512m-Xmx512m to -Xmx1700m
Install the plugin to Eclipse IDELaunch Eclipse and go to: Help->Install New Software...In opened "Install" window, click on (See item 1 in the "Install" Panel screenshot)Add...
In "Add Repository" dialog write name for repository (for example "WinCC OA IDE") (See "Add repository" panel screenshot)To "Location" field, copy following text:
(Windows) (accefile:////cern.ch/dfs/Departments/BE/Groups/ICS/Services/PVSS/IDE/plugin/ssible for WinCC OA registered users from the CERN domain)(Linux) file:////afs/cern.ch/project/itcobe/Delivery/Products/IDE/plugin/(Web) https://en-dep-ice-scd.web.cern.ch/en-dep-ice-scd/Services/Pvss/Download/Software/IDE/plugin/
You can always copy plugin to different location and use "Local..." or "Archive..." buttons to select its location
Access right for DFS/AFS
Be sure that you have access rights for plugin's folder and its content."read"
3.
b.
ii.
3.
a.
iii.
c. d.
e. 4.
a. b. c.
i. ii. iii.
Click OK
Back in "Install" window, (Item 2)uncheck Group items by category Select plugin form list (item 3) and click on "Next >" button (and another next button, license agreement etc. until it is installed)
Restart Eclipse IDEInstall debugger - depracated
Create WinCC OA project or use existingCopy to of your projectdebugger file "bin" folderStart IDEMAnager and click on "Append a new manager"After setting up this manager, make sure that it is running properly (green color and status 2)
Select WCCOAIDEManagerTo "Options" filed write (it is port number)9090Choose "Start mode" and other setting as you need
Installation process length
Installation process (even if the plugin itself is not very big) because Eclipse needs to may take few minutes calculate . Please be patient.dependencies
4.
c.
iv.
1. 2. 3.
Click OK
How to use WinCC plugin for Eclipse
Let's assume that you have successfully passed installation process. So launch Eclipse IDE with installed WinCC plugin.
Go to and in "Import" window select File->Import... WinCC OA project Import->Import WinCC OA projectIn opened wizard select root folder of your WinCC OA project and click "Finish"And that is all now you can use Eclipse with WinCC plugin. Just remember that if you want debug your code, you have to start debug manager in WinCC OA.Usage of this plugin is very similar to usage of other Eclipse plugins (code completion, break points, , ...)debugging
3.
Useful shortcuts
Shortcut Description of function
Ctrl+Space Code completion
Ctrl+1 Quick fix
Ctrl+3 Quick access (just type command name)
Ctrl+/ Comment code
Alt+Shift+R Rename variable
Ctrl+Shift+F Format code
Ctrl+F9 Run script
F9 Debug script
F6 Step in debug mode
F7 Resume in debug mode
F8 Stop debugging
F3 Go to declaration
Alt+(Page Up || Page Down) Switching tabs in Ctl-XML editor
Ctrl+(Page Up || Page Down) Switching tabs
Ctrl+F6 Shows list of opened editors
Plugin features
Code re-factoring
Rename element - select variable/function and rename all its occurrencesExtract function - select part of code and extract it as a new functionExtract constant - helps you to get rid of "magical numbers" and long "ID strings"DebugXX - Function extracts variables form selected code and creates Debug function with these variable
Code assist
List of features may not be complete
Please not that list of features may not be complete or up to date.
Code completion - Press to complete code ( statements are added automatically)Ctrl+Space #uses
Code templates - Code assist provides also code templates for basic programming structures (iterations, conditions, try-catch, etc.).
You can also in Eclipse preferences window.create your own templates
Quick-fix
Quick-fix functionality (activate by: or by clicking on mark in code editor) can help you basic tasks like:Ctrl+1
Assign value returned by function to new variable
Create new local/global variable
Create function definition
Cast expressions
Add #uses statement for functions/variables
...
Import organizer
Import organizer can be run by right clicking in code editor and selecting "Import Organizer".
This feature tries to: statements, #uses statements, statements, statements alphabetically.add missing #uses remove unused remove duplicate sort
Doxygen comments
Create doxygen comments - move cursor above "function declaration" and pres "/" key
See function documentation - hover mouse cursor over function call and Eclipse will display you documentation for hovered function
Code navigation
Outline view - this window helps you to navigate through source code in current file
Call hierarchy - shows how from where is some function calledGlobal search - . Ctrl+H
Integration with WinCC OA/PVSS
Eclipse can be connected with WinCC OA/PVSS using simple commands that can allow you to run scripts, panels and unit tests.
This commands are not part of plugin by default. Following images show example setting on Windows machine.
Run scripts - run current script from command-line
Run panels - run current panel from command-line
1. 2. 3.
Unit testing - allows you to run unit tests for current project (how to setup tests in your project see ):separate chapter
Creating unit tests
Prerequisites
To run tests in your project you'll need:
Download JCOP Framework Component InstallationCopy files to WinCC OA projectInstall from FwUnitTestComponent https://svn.cern.ch/reps/en-ice-svn/trunk/tools/JCOP/Projects/Framework/Test/UnitTestHarness/
How to do it
You can generate unittest skeletons for selected function. This feature automatically creates files for unit tests and adds new tests.
Other useful plugins for Eclipse
Plugin name Description
Quick Bookmarks http://marketplace.eclipse.org/content/quick-bookmarks-plugin
SVN - Subversive http://www.eclipse.org/subversive/
Ctl Code AnalyzerEclipse can be also launched from and perform . Result of this analysis can be stored in log files command line code analysis on WinCC/PVSS projector printed on stdout.
Currently supported are only and WinCC projects.valid "adopted"
Arguments for Ctl Code Analyzer
Argument Description
-WinCCProjectPath <projectPath> Specifies path full of valid WinCC/PVSS project.
-analysisPreferences <preferencesFilePath> This argument allows to specify custom preferences for code analysis.
-WCCOAuiPath Path to -WCCOAui (required for panels analysis)
-WinCCOAProjectName Name of WinCC OA project that is should be analyzed (required for panels analysis)
-analysisOutputFormat [checkstyle, xml, html, json, javacompiler, humanreadable]
Defines output format.
-analysisLogFile <resultOfAnalysisFilePath> Where should be stored result of code analysis.
-analysisLogLevel [SEVERE | WARNING | ALL] Specifies what information from code analysis should be logged. Default is ALL.
For more information about levels, see: http://docs.oracle.com/javase/8/docs/api/java/util/logging/Level.html
-appLogFile <appLogFilePath> File path of internal logs of Ctl Code Analyzer.
-appLogLevel [SEVERE | WARNING | ALL] Specifies what information about Ctl Code Analyzer run should be logged.
-consoleLog Prints logs to STDOUT.
-parallel Ctl Code Analyzer will try to split computation on several threads. Parallel computation is default.
-sequential Ctl Code Analyzer will use only one thread for analysis.
Examples
Running Clt Code Analyzer without any parameters$ .\eclipse.exe -consoleLog -console -nosplash -application ch.cern.winccoa.ctl.CodeAnalyzer.CtlCodeAnalyzer
Analyze WinCC project in "C:\WinCCOAProjects\MyProject" folder and saving analysis to "C:\tmp\CodeAnalyzer.log" file (Power Shell)$ .\eclipse.exe -consoleLog -console -nosplash -application ch.cern.winccoa.ctl.CodeAnalyzer.CtlCodeAnalyzer -WinCCProjectPath c:\WinCCOAProjects\MyProject\ -consoleLog -analysisLogFile C:\tmp\CodeAnalyzer.log -analysisLogLevel ALL -appLogFile C:\tmp\CodeAnalyzerApp.log -appLogLevel ALL -analysisOutputFormat checkstyle
Ctl analysis preferences
You can disable/allow/modify validation rules and other things related to Ctl code analysis, by loading custom preferences.
The file format is standard Java Properties file format: http://docs.oracle.com/cd/E23095_01/Platform.93/ATGProgGuide/html/s0204propertiesfileformat01.html
Currently supported preferences
# ######################### Code diagnostics block# ########################validation.CONTINUE_STATEMENT_IS_NOT_INSIDE_LOOP.severity = errorvalidation.BREAK_STATEMENT_IS_NOT_INSIDE_LOOP_OR_SWITCH.severity = errorvalidation.FUNCTION_DECLARED_AS_GLOBAL.severity = errorvalidation.VARIABLE_DECLARED_AS_SYNCHRONIZED.severity = errorvalidation.VARIABLE_ALREADY_DECLARED.severity = errorvalidation.VARIABLE_DECLARED_MULTIPLE_TIMES_IN_FILE_SCOPE.severity = errorvalidation.UNUSED_VARIABLE_DECLARATION.severity = warningvalidation.UNUSED_PARAMETER_DECLARATION.severity = infovalidation.GLOBAL_VARIABLE_DECLARED_AFTER_MAIN_FUNCTION.severity = errorvalidation.CTRL_LIB_PATH_WAS_NOT_FOUND.severity = errorvalidation.CTRL_LIB_PATH_SI_NEVER_USED.severity = warningvalidation.CTRL_LIB_PATH_WAS_ALREADY_USED.severity = warningvalidation.CTRL_LIB_PATH_IMPORTS_FUNCTION_THAT_IS_ALREADY_IMPORTED.severity = errorvalidation.CTRL_LIB_PATH_IMPORTS_VARIABLE_THAT_IS_ALREADY_IMPORTED.severity = errorvalidation.DECLARED_FUNCTION_IS_ALREADY_IMPORTED.severity = errorvalidation.FUNCTION_IS_ALREADY_DECLARED_IN_CURRENT_FILE.severity = errorvalidation.DECLARED_CONSTANT_IS_NOT_INITIALIZED.severity = warningvalidation.MODIFICATION_OF_FUNCTION_CALL_RESULT.severity = errorvalidation.MODIFICATION_OF_CONSTANT_ARRAY.severity = errorvalidation.MODIFICATION_OF_CONSTANT_PURE_CONSTANT.severity = errorvalidation.MODIFICATION_OF_CONSTANT_EXPRESSION.severity = errorvalidation.MODIFICATION_OF_CONSTANT_VARIABLE.severity = errorvalidation.ASSIGNMENT_TO_PURE_CONSTANT.severity = errorvalidation.ASSIGNMENT_TO_EXPRESSION.severity = errorvalidation.ASSIGNMENT_TO_CONSTANT_VARIABLE.severity = errorvalidation.DECLARED_VARIABLE_CAN_BE_DECLARED_AS_CONSTANT.severity = infovalidation.ASSIGNMENT_EXPRESSION_HAS_INCOMPATIBLE_TYPE_ON_THE_RIGHT_SIDE.severity = warningvalidation.ASSIGNMENT_EXPRESSION_IN_VARIABLE_INITIALIZATION_HAS_INCOMPATIBLE_TYPE_ON_THE_RIGHT_SIDE.severity = warningvalidation.ASSIGNMENT_EXPRESSION_IN_PARAMETER_INITIALIZATION_HAS_INCOMPATIBLE_TYPE_ON_THE_RIGHT_SIDE.severity = warningvalidation.FUNCTION_RETURNED_VALUE_IS_NOT_USED.severity = infovalidation.SOME_PARTS_OF_EXPRESSION_STATEMENT_MAY_NOT_CAUSES_ANY_SIDE_EFFECTS.severity = warningvalidation.INVALID_FUNCTION_CALL_FUNCTION_REQUIRES_MORE_ARGUMENTS.severity = errorvalidation.INVALID_FUNCTION_CALL_METHOD_REQUIRES_MORE_ARGUMENTS.severity = errorvalidation.INVALID_FUNCTION_CALL_FUNCTION_CALLED_WITH_TOO_MANY_PARAMS.severity = errorvalidation.INVALID_FUNCTION_CALL_METHOD_CALLED_WITH_TOO_MANY_PARAMS.severity = errorvalidation.GRAPHICAL_OBJ_PROPERTY_CANNOT_BE_USED_AS_A_SETTER.severity = warningvalidation.GRAPHICAL_OBJ_PROPERTY_CANNOT_BE_USED_AS_A_GETTER.severity = warningvalidation.EXPRESSION_CANNOT_BE_IMPLICITLY_CONVERTED_TO_DIFFERENT_TYPE.severity = errorvalidation.NO_MORE_MANDATORY_PARAMETERS_ARE_ALLOWED_AFTER_OPTIONAL.severity = errorvalidation.STATEMENT_IS_UNREACHABLE.severity = errorvalidation.DEFAULT_CASE_STATEMENT_IS_THE_ONLY_STATEMENT_IN_SWITCH.severity = infovalidation.MULTIPLE_DEFAULT_CASE_STATEMENTS_DETECTED.severity = errorvalidation.CASE_CONDITION_EXPRESSION_IS_DIFFERENT_TYPE_FROM_SWITCH_CONDITION.severity = errorvalidation.SWITCH_CONDITION_EXPRESSION_IS_NOT_OF_RECOMMENDED_TYPE.severity = errorvalidation.CASE_CONDITION_EXPRESSION_IS_FLOAT_TYPE.severity = errorvalidation.CASE_CONDITION_CANNOT_BE_FUNCTION_CALL.severity = errorvalidation.CASE_CONDITION_VARIABLE_IS_NOT_CONSTANT.severity = errorvalidation.CASE_CONDITION_EXPRESSION_IS_NOT_PURE_CONSTANT_EXPRESSION.severity = errorvalidation.LABELED_STATEMENT_IS_NOT_INSIDE_SWITCH_STATEMENT.severity = errorvalidation.SUSPICIOUS_EXPRESSION_DETECTED.severity = errorvalidation.VARIABLE_IS_NOT_INITIALISED.severity = warningvalidation.RETURN_STATEMENT_RETURN_SHOULD_BE_VOID.severity = errorvalidation.NON_VOID_FUNC_HAS_NO_RETURN_STATEMENT.severity = errorvalidation.RETURN_STATEMENT_HAS_DIFFERENT_TYPE.severity = errorvalidation.NOT_EVERY_BRANCH_HAS_RETURN_STATEMENT.severity = errorvalidation.VARIABLE_WAS_NOT_FOUND_IN_SCOPE.severity = errorvalidation.FUNCTION_WAS_NOT_FOUND_IN_SCOPE.severity = errorvalidation.GRAPHICAL_OBJ_IS_NOT_DECLARED.severity = warningvalidation.GRAPHICAL_OBJ_DOES_NOT_EXIST_METHOD_CALL.severity = errorvalidation.GRAPHICAL_OBJ_PROPERTY_DOES_NOT_EXIST.severity = errorvalidation.FUNCTION_CANNOT_HAVE_CONSTANT_RETURN_TYPE.severity = errorvalidation.INVALID_FUNCTION_PUBLIC_AND_PRIVATE_MODIFIER.severity = errorvalidation.INVALID_FUNCTION_PROTECTED_MODIFIER.severity = errorvalidation.INVALID_VARIABLE_PUBLIC_AND_PRIVATE_MODIFIER.severity = errorvalidation.INVALID_VARIABLE_PROTECTED_MODIFIER.severity = errorvalidation.EXPRESSION_IN_CONDITION_IS_VOID.severity = errorvalidation.DECLARED_VARIABLE_NAME_COLLIDES_WITH_A_FUNCTION_OF_THE_SAME_NAME.severity = errorvalidation.PARAMETER_NAME_COLLIDES_WITH_A_FUNCTION_OF_THE_SAME_NAME.severity = errorvalidation.CONDITION_IN_FOR_STATEMENT_IS_ALWAYS_FALSE.severity = errorvalidation.CONDITION_IN_WHILE_STATEMENT_IS_ALWAYS_FALSE.severity = errorvalidation.CONDITION_IN_IF_STATEMENT_IS_ALWAYS_TRUE.severity = warningvalidation.CONDITION_IN_IF_STATEMENT_IS_ALWAYS_FALSE.severity = error
1. 2.
validation.ITERATION_STATEMENT_IS_INFINITE_LOOP.severity = warningvalidation.INDEX_IN_FOR_LOOP_SHOULD_START_AT_DIFFERENT_POSITION.severity = infovalidation.FUNCTION_PARAMETER_HAS_VOID_TYPE.severity = errorvalidation.LOCAL_VARIABLE_HAS_VOID_TYPE.severity = errorvalidation.DEFINED_VARIABLE_HAS_VOID_TYPE.severity = errorvalidation.PROHIBIT_CAPITALS_IN_VARIABLE_NAME.severity = ignorevalidation.PROHIBIT_LOWER_CASE_IN_VARIABLE_NAME.severity = ignorevalidation.PROHIBIT_UNDERSCORES_IN_VARIABLE_NAME.severity = ignorevalidation.VARIABLE_NAME_SHOULD_START_WITH_CAPITAL_LETTER.severity = ignorevalidation.VARIABLE_NAME_SHOULD_START_WITH_LOWER_CASE_LETTER.severity = ignorevalidation.VARIABLE_NAME_MIN_LENGTH.severity = warningvalidation.VARIABLE_NAME_MIN_LENGTH.data = 0validation.VARIABLE_NAME_MAX_LENGTH.severity = warningvalidation.VARIABLE_NAME_MAX_LENGTH.data = 128validation.PROHIBIT_CAPITALS_IN_FUNCTION_NAME.severity = ignorevalidation.PROHIBIT_LOWER_CASE_IN_FUNCTION_NAME.severity = ignorevalidation.PROHIBIT_UNDERSCORES_IN_FUNCTION_NAME.severity = ignorevalidation.FUNCTION_NAME_SHOULD_START_WITH_CAPITAL_LETTER.severity = ignorevalidation.FUNCTION_NAME_SHOULD_START_WITH_LOWER_CASE_LETTER.severity = ignorevalidation.FUNCTION_NAME_MIN_LENGTH.severity = warningvalidation.FUNCTION_NAME_MIN_LENGTH.data = 0 validation.FUNCTION_NAME_MAX_LENGTH.severity = warningvalidation.FUNCTION_NAME_MAX_LENGTH.data = 128
FAQEclipse start-up/files validation takes too long
By default Eclipse is trying to validate all *.ctl files. If you want to speed things up you can prevent Eclipse to validate all files.Go to menu and .Project uncheck Build Automatically
How to update plugin?There are two ways how to update plugins in EclipseManually: Help -> Check for UpdatesAutomatically: Window -> Preferences -> Install/Update -> Automatic Updates
How to disable marks/annotations for code editorAnnotations in code editor can help you to navigate through a code. But sometimes you may want to modify how certain annotations look/behave.For example you can disable "Info annotations" on the right side of code editor because you use a lot of "Debug" functions and you don't use returned values.
To modify annotations setting, go to:
Window -> Preferences -> General -> Editors -> Text Editors -> Annotations and select annotation you want to modify.
Contact persons
Matej MarecekPiotr Golonka
top related