Siemens TIA Portal Code Generator via Openness Interface
Since we are doing import of Graph step sequence through an Excel sheet using Openness, I was thinking of building a "structure" code generator for the TIA portal. Right now, most important functions are working so it would be possible to
-build a group tree
-import any kind of blocks like FB, FC, OB or data types
-generate step sequences as graph (not 100% complete yet) - no config right now
This covers mainly the function we can find in the Openness scripter. But I want to go a little further to build structures more variable. Not sure where it leads to but my goal will be to use templates to build FB with n-times valve FBs through a scripter or later on maybe a tool to configure this.
Based on the description found here:
https://support.industry.siemens.com/cs/attachments/109477163/TIAPortalOpennessenUS_en-US.pdf (English) https://cache.industry.siemens.com/dl/files/163/109477163/att_926040/v1/TIAPortalOpennessdeDE_de-DE.pdf (Deutsch)
This version is based on TIA V16.
With some small changes this will also work with 14SP1,15 or 15.1 (work ongoing)
Functions added:
-open TIA with interface (first instance or new instance)
-open project file via file dialog
-compile software
-save project
-close project
-show folder structure software
-show data types
-add / delete groups in the treeview
-add complete path to the treeview
-imports PLC blocks (with rename if needed)
-import data types
-export blocks / types
-export project text (de/en)
-import project text (de/en)
Test
-add / change language for editing
-for devolpment set the key in the registry to avoid firewall each time
Limtitations:
-no global search for block/types
-import fails if language is not in the project
-export projects text can not overwrite existing files
Screenshot:
Some code for the graph generation is "reversed engineered" since there is no description. In my case I used the openness scripter in the version 14 to export a couple graph's to understand the structure. See the scripts I added in the OPNS folder. Some generated step sequence for testing are in the sample folder. Right now there is only one "step class" which is doing the configuration. In the futrue I will plan to use a excel file to read the config.
For the sequence generation I used a V14 sample of an empty seqeunce. In the XML we need to add transitions and steps into the static area (change in later versions) Then I enumerate through my defined steps to build the sequence including transitions and branches. Of course I can not cover 100% of any posibility, so my sequences are straight forward - only with alternate branches and jumps. In the next version I will also cover actions and supervisions for each step.