TIA AddIn Code2Docu DOC V1 3 0 en
TIA AddIn Code2Docu DOC V1 3 0 en
Code2Docu for
generating
documentation
Siemens
TIA Portal Industry
Online
https://support.industry.siemens.com/cs/ww/en/view/109809007 Support
Legal information
Legal information
Use of application examples
Application examples illustrate the solution of automation tasks through an interaction of several components in
the form of text, graphics and/or software modules. The application examples are a free service by Siemens AG
and/or a subsidiary of Siemens AG ("Siemens"). They are non-binding and make no claim to completeness or
functionality regarding configuration and equipment. The application examples merely offer help with typical
tasks; they do not constitute customer-specific solutions. You yourself are responsible for the proper and safe
operation of the products in accordance with applicable regulations and must also check the function of the
respective application example and customize it for your system.
Siemens grants you the non-exclusive, non-sublicensable and non-transferable right to have the application
examples used by technically trained personnel. Any change to the application examples is your responsibility.
Sharing the application examples with third parties or copying the application examples or excerpts thereof is
permitted only in combination with your own products. The application examples are not required to undergo the
customary tests and quality inspections of a chargeable product; they may have functional and performance
defects as well as errors. It is your responsibility to use them in such a manner that any malfunctions that may
occur do not result in property damage or injury to persons.
Disclaimer of liability
Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation, liability for
the usability, availability, completeness and freedom from defects of the application examples as well as for
related information, configuration and performance data and any damage caused thereby. This shall not apply in
cases of mandatory liability, for example under the German Product Liability Act, or in cases of intent, gross
negligence, or culpable loss of life, bodily injury or damage to health, non-compliance with a guarantee,
fraudulent non-disclosure of a defect, or culpable breach of material contractual obligations. Claims for damages
arising from a breach of material contractual obligations shall however be limited to the foreseeable damage
typical of the type of agreement, unless liability arises from intent or gross negligence or is based on loss of life,
bodily injury or damage to health. The foregoing provisions do not imply any change in the burden of proof to
© Siemens AG 2023 All rights reserved
your detriment. You shall indemnify Siemens against existing or future claims of third parties in this connection
except where Siemens is mandatorily liable.
By using the application examples you acknowledge that Siemens cannot be held liable for any damage beyond
the liability provisions described.
Other information
Siemens reserves the right to make changes to the application examples at any time without notice. In case of
discrepancies between the suggestions in the application examples and other Siemens publications such as
catalogs, the content of the other documentation shall have precedence.
The Siemens terms of use (https://support.industry.siemens.com) shall also apply.
Security information
Siemens provides products and solutions with industrial security functions that support the secure operation of
plants, systems, machines and networks.
In order to protect plants, systems, machines and networks against cyber threats, it is necessary to implement –
and continuously maintain – a holistic, state-of-the-art industrial security concept. Siemens’ products and
solutions constitute one element of such a concept.
Customers are responsible for preventing unauthorized access to their plants, systems, machines and networks.
Such systems, machines and components should only be connected to an enterprise network or the internet if
and to the extent such a connection is necessary and only when appropriate security measures (e.g. firewalls
and/or network segmentation) are in place.
For additional information on industrial security measures that may be implemented, please visit
https://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them more secure. Siemens strongly
recommends that product updates are applied as soon as they are available and that the latest product versions
are used. Use of product versions that are no longer supported, and failure to apply the latest updates may
increase customer’s exposure to cyber threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed under
https://www.siemens.com/cert.
Table of contents
Legal information .............................................................................................................................. 2
1 Introduction ............................................................................................................................. 5
1.1 What is Code2Docu ................................................................................................... 5
1.1.1 Benefits of Code2Docu .............................................................................................. 5
1.2 Functionality and delimitation .................................................................................... 6
1.3 Structure of the documentation / outline .................................................................... 7
1.4 MarkDown as markup language ................................................................................ 8
2 Installation of “Code2Docu” .................................................................................................. 9
2.1 Dependencies / Requirements .................................................................................. 9
2.1.1 Supported TIA Portal version(s) ................................................................................ 9
2.1.2 Components as part of the application ...................................................................... 9
2.1.3 Components as reference in the application ............................................................. 9
2.1.4 Components to run the application .......................................................................... 10
2.2 Installation................................................................................................................ 11
2.2.1 Add user to Windows user group “Siemens TIA Openness” ................................... 11
2.2.2 Install dependent programs and copy add-in file..................................................... 11
2.3 Activate “Code2Docu” add-in .................................................................................. 13
3 Markdown syntax (Cheat Sheet) ......................................................................................... 15
3.1 Chapter / headings / titles ........................................................................................ 15
3.2 Paragraphs / Line Breaks ........................................................................................ 15
© Siemens AG 2023 All rights reserved
1 Introduction
1.1 What is Code2Docu
With the help of “Code2Docu”, documentation is generated from functions (FCs), function
blocks (FBs) and PLC data types ( in the following named as “objects”) of a TIA Portal project.
In defined properties and areas objects can be documented using MarkDown (MD) as defined
markup language. With “Code2Docu” this information and text elements are extracted from the
objects, prepared for the documentation to be generated and stored accordingly.
Figure: Code2Docu process flow
© Siemens AG 2023 All rights reserved
Note Safety Software Unit's (Safety Unit) have been introduced in TIA Portal V18, and therefore
not supported, as the Development of “Code2Docu” stays on the TIA Portal V17 API.
“Code2Docu” extracts the texts from the block interface, the title and block comments of the
objects and generates documentation from them. It works as follows:
© Siemens AG 2023 All rights reserved
• The texts of the objects are exported from TIA Portal using the TIA Portal add-in
“Code2Docu” and saved as a SimaticML / XML file.
• The exported data is then parsed and the following information is extracted:
– Variable names, data types and comments from the inputs, outputs and inputs/outputs
of the function block interface.
– Defined comments, header information, texts from description part created with
MarkDown (MD).
• The result is saved as HTML, DocX and PDF based on a template.
Additionally, areas for introduction, appendix and generic document information are provided.
More about this later.
Note The fixed level structuring is due to the fact that only a finite number of hierarchy and outline
levels are available in the documents.
This property is circumvented by the fixed structuring.
How the content for this must be stored in the TIA Portal project is described in the following
chapters.
Note A detailed list of the markups possible in “Code2Docu” can be found in the chapter
"Supported MarkDown Syntax (Cheat Sheet)".
© Siemens AG 2023 All rights reserved
2 Installation of “Code2Docu”
This chapter describes how to install the TIA Portal add-in and integrate it into the TIA Portal
environment.
Note Copyright © Siemens AG 2023, and licensors. All rights reserved. Portions include Open
Source Software. See ReadMe_OSS for details.
© Siemens AG 2023 All rights reserved
2.2 Installation
Each add-in is represented by its own file with the extension “.addin”. The installation of the add-
in requires administrator rights for the following steps:
• Add user to “Siemens TIA Openness” Windows user group.
• Install dependent programs and copy add-in file to add-in folder
• Activate add-in in TIA Portal
Each Windows user working on the Windows system with TIA Portal must be added to the
Windows user group “Siemens TIA Openness”. The user must then be logged off and logged on
again for the modified policy to become active.
Further information about setting up the user can be found in the TIA Portal Openness manual
(chapter “General”):
https://support.industry.siemens.com/cs/ww/en/view/109773802/101778035467
For installation and update of the add-in “Code2Docu” two batch files are provided, which take
over the installation or update of the add-in for the user.
• Code2Docu_Installation.cmd
© Siemens AG 2023 All rights reserved
– Installation of “Code2Docu”
– Installation of “PanDoc”
Document renderer: Document renderer: for Math formulas and syntax highlighting
Checking the installation, if Pandoc is not installed the download web page for manual
installation appears.
– Adjustment of default “Time-out” for TIA Portal add-in in the installation folder of TIA
Portal:
Bin\Siemens.Automation.Opns.AddIn.Impl.dll.config
– Copy the add-in files to the default add-in installation path:
C:\Program Files\Siemens\Automation\Portal V17\AddIns\
• Code2Docu_Update.cmd
– Update of the “Code2Docu” add-in
Note The respective batch script must be started with administrator rights, since the target
directory is located in C:\. To do this, right-click on the batch file and select Run as
administrator.
Note The installation or update cannot be started via the respective batch file if the files are stored
in a network drive or “shared folder”.
You can copy the folder Code2Docu from the delivered installation directory with all files
manually into the Or the installation directory of TIA Portal, or copy the data to your local
computer.
Note TIA Portal add-ins can be installed while TIA Portal is running. It is not necessary to close
TIA Portal during installation or to restart it after installation.
The add-in must be reactivated each time after installation or an update.
Note For further information on TIA Portal add-ins and their integration into the TIA Portal
environment, please refer to the TIA Portal online help or the “SIMATIC STEP 7
Basic/Professional V17 and SIMATIC WinCC V17” manual in the chapter “Extending TIA
Portal functions with add-ins”.
https://support.industry.siemens.com/cs/ww/en/view/109798671/135143324427
© Siemens AG 2023 All rights reserved
Note TIA Portal add-ins can be integrated at various points in the TIA Portal environment. They
are displayed for certain elements in the TIA Portal user interface in the context menu of the
respective element.
During the execution of an add-in, the TIA Portal user interface is blocked. Thus, it is not
possible to perform actions in TIA Portal during execution.
If the add-in contains its own user interface, TIA Portal is also blocked as long as the add-in
window is displayed.
Data loss
The use of an add-in can lead to data loss and a possible resulting production stop.
CAUTION For example, Snapshots, start values (except constants), setpoints, texts of
Program_Alarm or ProDiag settings will be lost.
Comments written in a language that is not enabled at the time of conversion will also be
lost.
An add-in has access to project data as well as access to disks and Internet connections. Be
aware to install only add-ins from trusted sources and refer to the documentation of the
respective add-in.
The user must regularly create data backups and check the correctness of the program after
using the add-in.
© Siemens AG 2023 All rights reserved
Note Before or after figures, lists, tables, note boxes, math blocks or code blocks, three hyphens -
-- create a blank line.
Example:
Text before
---
---
Text afterwards
Unsortierte Listen
© Siemens AG 2023 All rights reserved
Unsortierte Listen erstellen Sie mit einem Sternchen gefolgt von einem Leerzeichen. Die
Einrückung einer untergeordneten Liste erreichen Sie mit drei Leerzeichen.
Appearance
• Unsorted list with nesting
a. simple subordinated sorted list
b. further list entry
• second unsorted list entry
Sorted lists
You create sorted lists with a number followed by a dot and a space.
Appearance
1. Simple sorted list with nesting
– unsorted child list
– second list entry
2. further list entry
Appearance
block quote
second line in quote
```scl
stringVariable := 'code with syntax highlighting';
© Siemens AG 2023 All rights reserved
FunctionCall(stringVariable);
```
Appearance
$$
\int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}
$$
Appearance
∞
𝑥3 𝜋4
∫ 𝑑𝑥 =
0 𝑒𝑥 − 1 15
Note It is also possible to include mathematical formulas in the form of images instead of working
with LaTeX scripts.
3.10 Hyperlink
You can create hyperlinks without and with link text in square brackets.
Direct hyperlink:
https://support.industry.siemens.com
Appearance
https://support.industry.siemens.com
Hyperlink with link text:
[go to SIEMENS Industry Support](https://support.industry.siemens.com)
Appearance
go to SIEMENS Industry Support
Spaces in filename or path
Relative Hyperlinks including spaces can be created by enclosing them between the < and >
characters :
[LCode2Docu_DemoType_FC.htm](<../../../../../code2doc_demo/UserFiles/UserDocumentatio
n/en-US/Library Types/LCode2Docu_DemoType_FC.htm>)
Note Relative paths can only be displayed as Hyperlinks in HTML but not in Word or PDF
documents.
© Siemens AG 2023 All rights reserved
Note The following file formats for graphics and images are supported:
© Siemens AG 2023 All rights reserved
Examples
Image indented with text (text width):

Appearance
Image over full page width with attribute {.pageWidth} in the line before the image:
{.pageWidth}

Appearance
© Siemens AG 2023 All rights reserved
3.12 Tables
You can use tables for a clear arrangement of data and texts.
Pipe tables are created from vertical bars | and hyphens - as well as the texts. You can use
colons : in the separator between the header and the rest of the lines to specify the alignment
of the text.
Table indented with the text:
Appearance
tables are great
column 1 is left aligned 456
column 2 is centered 123
© Siemens AG 2023 All rights reserved
Table over full page width without indentation with prefixed attribute [pageWidth]:
{.pageWidth}
| tables | are | great |
| ----------- |:-------------:| -----:|
| column 1 is | left aligned | 456 |
| column 2 is | centered | 123 |
| column 3 is | right aligned | 0815 |
Appearance
tables are great
column 1 is left aligned 456
column 2 is centered 123
column 3 is right aligned 0815
Note Tables are always to be considered as independent paragraphs, i.e. there must always be a
blank line before and after a table.
Grid tables additionally use the plus sign + and equal sign =. The plus sign defines the nodes of
the grid lines and the equal sign defines the separation between the header row and the rest of
the rows. Grid tables allow multiple rows per cell as well as connecting a cell across multiple
columns.
The following figure shows you a simple grid table:
+---------+---------+
| Header | Header |
| Column1 | Column2 |
+=========+=========+
| 1 ab | the second column
| 2 cde |
| 3 f |
+---------+---------+
| Second row spanning
| on two columns
+---------+---------+
| Back | |
| to | |
| one | |
| column | |
© Siemens AG 2023 All rights reserved
Appearance
Header Header
Column1 Column2
1 ab the second column
2 cde
3f
Second row spanning
on two columns
Back
to
one
column
Rules
• A table must be preceded by a blank line, and the table must then start with the column
separator +.
• Each column separator starts with an optional space…
– followed by an optional : to specify left alignment, followed by optional spaces
(alignment can be specified on the first line)
– followed by a sequence of at least one - character, followed by optional spaces
– followed by an optional : to specify the right alignment (or the middle alignment if the
left alignment is also defined)
– followed by optional spaces
• A table header is separated with +========+ instead of +---------+.
• The first line separator must be followed by a regular line.
• A regular line must start with the | character, which starts at the same position as the +
column separator of the first line separator.
• A regular line can continue a previous regular line if the column separators | are in the
same position as the previous line. If they are in the same position, the column can span
several columns.
• The last column separator | can be omitted.
• A table must not have irregularly shaped cells.
• The respective width of the columns is calculated from the ratio of the total size of the first
table row without considering the +:
+----+--------+----+ would be divided into 4/16 = 25%, 8/16 = 50%, 4/16 = 25%.
A grid table can have cells that span columns as well as rows.
+---+---+---+
| AAAAA | B |
+---+---+ B +
| D | E | B |
+ D +---+---+
| D | CCCCC |
+---+---+---+
Appearance
AAAAA B
B
D E
© Siemens AG 2023 All rights reserved
D B
D CCCCC
A cell can be connected by columns as well as by rows.
+---+---+---+
| AAAAA | B |
+ AAAAA +---+
| AAAAA | C |
+---+---+---+
| D | E | F |
+---+---+---+
Appearance
AAAAA B
AAAAA C
AAAAA
D E F
NOTE
: indicates a possible advantage. Has tip character.
: New line in the box.
---
© Siemens AG 2023 All rights reserved
Appearance
Reference to literature
What to read?
Why?
Read me
© Siemens AG 2023 All rights reserved
Note In the folder AddIn\Code2Docu you will find the previously exported TIA Portal objects as XML
files. The XML files correspond to the regular Openness XML export.
A log file is written in the Logs folder directly under the TIA Portal project folder and is named
like {TIA_ProjectFileName}_C2D.log.
Every step of generating the documentation is logged.
© Siemens AG 2023 All rights reserved
Note The chapter names are second order headings. If further folders are subordinate to the
subordinate folder, then the chapter name is composed of the names of all subordinate
folders, whereby the individual folder names are separated with /.
The use of the characters / and \ must be omitted in the designation of the folder names,
since these are used by the operating system for the storage paths.
Note Safety Software Unit's (Safety Unit) have been introduced in TIA Portal V18, and therefore
not supported, as the Development of “Code2Docu” stays on the TIA Portal V17 API.
To select the desired project languages, double-click on Project languages in the project
navigation under Languages & resources.
Then activate the languages that are to be available as project languages.
Figure: Activate project languages
The part with the generic project information is mandatory. A non-observance leads to an
incorrect generation!
CAUTION
General and generic project and document information for the introduction and appendix is
provided outside the regular program blocks in a separate block. For this a block in the
programming language SCL is used, which contains this information for “Code2Docu”. This block
is conveniently named with the name of the library and _Description, e.g.
LCode2Docu_Description for the demo project of this documentation.
Note The block can then be delivered together with the library. This way, the entire documentation
of the project is delivered with it.
The document information is divided into three SCL regions in the block.
Figure: Block LCode2Docu_Description
© Siemens AG 2023 All rights reserved
REGION INFO
This region contains all the generic information needed to generate the documentation.
The information is used to store the document, as well as used in the cover page and footers.
REGION INFO
(/*
title: Document title "Code2Docu Demo for TIA Portal STEP 7".
subTitle: Subtitle "STEP 7 Basic/Professional V17 (TIA PORTAL)".
fileName: FileNameForTheOverallDocumentation.
projectId: 1000000
link: https://support.industry.siemens.com/cs/ww/en/view/100000000
version: V1.0.0
date: 04/2022
classification: "Empty" "Free to use" "Internal" "Confidential" "Strictly
Confidential
*/)
END_REGION INFO
Note The Version can be specified by typing the description block, then the specification in the
block header is not necessary.
The specification of Date is optional. If this is not used and is not present, then the current
© Siemens AG 2023 All rights reserved
Note The file name of the overall documentation is then composed of the components of the Info
region as follows:
projectId_fileName_version_LANGUAGE
The file name as well as the file path follow the Universal Naming Convention (UNC) and
therefore must not contain the following characters: <>:"/\|?*
REGION PREAMBLE
This region contains all general information, which is necessary for the use of the library. After
the preamble the generated descriptions of the objects (PLC blocks, data types and global
constants) follow in the documentation.
REGION PREAMBLE
(/*
Here the information of the introduction is written in a multilingual comment.
In these comments you can structure the text using MarkDown syntax and mark it up
accordingly.
*/)
(/*
Several multilingual comments are allowed in the REGION
*/)
END_REGION PREAMBLE
REGION APPENDIX
This region contains the appendix of the documentation. It is inserted in the document after the
global constants and before the global change history of the document.
REGION APPENDIX
(/*
Here the information of the appendix is placed in a multilingual comment.
In these comments you can structure the text using MarkDown syntax and mark it up
© Siemens AG 2023 All rights reserved
accordingly.
*/)
(/*
Several multilingual comments are allowed in the REGION
*/)
END_REGION APPENDIX
Note With the multilingual comment fields, it is possible to integrate the description in multiple
languages.
It is also possible to split the description between several multilingual comments within the
region.
Note Multilingual comment fields are limited in the number of characters. If the character budget of
a multilingual comment is exhausted, create a new multilingual comment block.
Note With the options of “Code2Docu” it is possible to hide a leading numeric prefix in the
documentation (only for folder names). Numeric prefixes are often used for sorting and
structuring in TIA Portal and are not helpful in the documentation and make it difficult to read.
The prefix is removed according to the scheme number(-_. blank)name.
To do this, activate in the Code2Docu settings the option:
Settings > Rendering options > Remove number prefix from folder name.
Note The module can then be delivered together with the library. This way, the entire
documentation is delivered with the project.
The folder description block contains two SCL region's for the content of this information.
© Siemens AG 2023 All rights reserved
REGION PREAMBLE
This region contains all the general information that is valid and important for this folder. The
preamble is followed by the descriptions of the objects in the documentation.
REGION PREAMBLE
(/*
Here the information of the introduction is written in a multilingual comment.
In these comments you can structure the text using MarkDown syntax and mark it up
accordingly.
*/)
(/*
Several multilingual comments are allowed in the REGION
*/)
END_REGION PREAMBLE
REGION APPENDIX
This region contains the appendix for the folder description. It is inserted in the document after
the descriptions of the objects.
REGION APPENDIX
© Siemens AG 2023 All rights reserved
(/*
Here the information of the appendix is placed in a multilingual comment.
In these comments you can structure the text using MarkDown syntax and mark it up
accordingly.
*/)
(/*
Several multilingual comments are allowed in the REGION
*/)
END_REGION APPENDIX
Note If further subfolders are used in this folder, the appendix is given its own subchapter in the
document, named like the folder itself, with the additional extension / appendix.
Note Due to the multilingual comment fields, it is possible to integrate the description in several
languages.
It is also possible to split the description between several multilingual comments within the
region.
Note In this chapter the examples from the demo project are used.
Note Since no spaces are allowed in the Author field, underscores _ are used for it, which are
replaced by spaces in the documentation. If the Author field is empty, or the text for the
Author keyword in GenericTextsCustomized.csv is empty, the paragraph for it will not be
displayed.
Note In the block diagram, you can use the following setting of “Code2Docu” to specify whether
the data types are on the outside and the parameter names on the inside, or vice versa:
Settings > Rendering options > Block Interface Image.
Note You can achieve a line break within a comment field of a variable by placing two spaces at
the desired position of the line break. This way the texts remain visible in TIA Portal and are
also editable in the comment field.
Note You can use the following setting of “Code2Docu” to render Retain information: Settings >
Rendering options > Include retain in documentation.
Note You can use the following “Code2Docu” setting to specify whether the predefined values
should be displayed: Settings > Rendering options > Display predefined Values....
© Siemens AG 2023 All rights reserved
Note The description and the definition of status and error handling in PLC blocks can be found in
the Programming Style Guide in chapter Design Guidelines/ Architecture in rule DA013 /
Return status / error via “status”/ “error”.
Programming style guide for SIMATIC S7-1200/ S7-1500
Note A line break within a comment field of a constant is achieved by placing two spaces at the
desired position of the line break. This way, the texts remain visible in TIA Portal and can
also be edited in a meaningful way in the comment field of the constant.
© Siemens AG 2023 All rights reserved
Note So that the PLC data types are listed in the block description, you must activate the following
option in the settings of “Code2Docu”:
Settings > Rendering options > Include UDTs beside the block documentation.
More information about the documentation of PLC data types can be found in chapter “PLC
data types”.
The function description of a block is embedded in SCL in a region with the name DESCRIPTION
and multilingual comment fields.
Due to the multilingual comment fields it is also possible here to integrate the description in
several languages. As in the general part, it is also possible here to split the description into
several multilingual comments within the region.
The following figures show the relationship:
Figure: Function description of a SCL block in TIA Portal
Note For functional block description MarkDown can be used for markup.
Note In the programming languages FBD, LAD and STL the second network with the title
Description is used instead of the region. Insert the text into the comment field. Do not use
SCL networks and comment characters, but only the comment field of the network.
Note In order to keep the hierarchy levels and to make it easier for the user to use, the headings in
the descriptions will again start at the first level (#). “Code2Docu” automatically moves to the
fourth and fifth level.
This means that only levels four (block header) and five (block header with table of contents)
are available to the user in the function description.
Note Through the multilingual comment fields it is possible to integrate the function description in
several languages.
It is also possible to split the description into several multilingual comments within the region.
Note The short description must always be the very first entry in the comment field.
Note If a block without know-how protection contains the functional description in the comment
field as well as in the regions then these texts will be concatenated in the generated
document, where the functional description from the comment field comes first.
If there are ProDiag Supervisons defined, they can be included in the documentation.
Supervisions are displayed as a table containing the following columns:
• Supervised Parameter,
• Trigger,
• Type and
• Category.
Figure: ProDiag Supervisions Table
Note In order to include the ProDiag Supervisions in the documentation, you must activate the
following option in the settings of “Code2Docu”:
Settings > Rendering options > Include ProDiag Supervisions.
© Siemens AG 2023 All rights reserved
The generic block header contains the change history in addition to the general block
information. “Code2Docu” uses this for the block documentation. The block header is in SCL
always at the first place in the block and is surrounded by the region with the name BLOCK INFO
HEADER.
From the Change log table, in addition to the change history for the block, an overall change
history is also created, which is described in the chapter “Global change history”.
The following figures show the relationship:
Figure: Change history of an SCL block in TIA Portal.
© Siemens AG 2023 All rights reserved
Note The change history is recorded in the reference language, regardless of the type of
programming language selected for the block.
If this does not contain any text, the language setting EN-US is searched for and then the first
available one is used.
Note Generating the history directly in the block documentation is optional and can be enabled
and disabled via the following Code2Docu setting:
Settings > Code2Docu options > Generate single Changelog beside a block.
Note In the programming languages FBD, LAD and STL the first network with the title BLOCK INFO
HEADER is used instead of the region. The text is inserted into the comment field. Do not use
SCL networks and comment characters, only the comment field of the network.
© Siemens AG 2023 All rights reserved
Figure: Functional description and block header in the comment field of a block
Note If a block without know-how protection contains the block header in the comment field as well
as in the regions then the change history entries are concatenated based on their date and
version number. This could lead to an undesirable result. Please keep the change history
only in one place, either in the comment field or in the regions/networks.
Note In this chapter the examples from the demo project are used.
Note In order to keep the hierarchy levels and make it easier for the user, the descriptions start
© Siemens AG 2023 All rights reserved
with the headings on the first level (#). “Code2Docu” automatically moves to the fourth and
fifth level.
This means that only levels four (block header) and five (block header with table of contents)
are available to the user in the function description.
The following figures show a PLC data type with elementary data types in TIA Portal and in the
documentation.
Figure: PLC data type and its properties in TIA Portal
© Siemens AG 2023 All rights reserved
Note You can achieve a line break within a comment field of a variable by placing two spaces at
the desired position of the line break. This way the texts remain visible in TIA Portal and can
also be edited in a meaningful way in the comment field of the variable.
If subordinate anonymous structures of type Struct are used in a PLC data type, they are
displayed indented as subordinate elements in the data type itself.
Figure: PLC data type with subordinate Struct in TIA Portal
The following notation and naming apply to a global status and error code table:
LibraryPrefix_KEYWORDxxxx: e.g. LCode2Docu_ErrorCodes.
All other notations are treated as standard constants table (see chapter “General constants”).
The same keywords are used as for local constants:
© Siemens AG 2023 All rights reserved
• STATUS
• INFO
• DIAG / DIAGNOSTIC
• ERR / ERROR
• WARN / WARNING
• ALARM
• MAINTENANCE
• PROC / PROCESS
• RET / RETURN
Status and error codes are displayed in a table with the code in the left column and the name
with the description from the comment field (Multilingual) in the right column.
Global constants are displayed in a table with the name and value of the constant in the left
column and the description from the comment field (Multilingual) in the right column.
Figure: Global constants in TIA Portal
Note A line break within a comment field of a constant is achieved by placing two spaces at the
desired position of the line break. This way, the texts remain visible in TIA Portal and can
also be edited in a meaningful way in the comment field of the constant.
Based on the change information from the blocks, “Code2Docu” can generate a global change
history. To do this, the current status is compared with the last release status of the history and
the difference is formed from this.
To generate a release state, you must save the current change history as a release state, so
that for the next generations the difference can be formed again over the changes.
To do this, activate the Store Changelog for RELASE option in the Code2Docu add-in before
generation. With it the “Current state” of the change history is stored with the next generation
and compared with the “Previous state”.
Figure: Activate Store Changelog for RELASE in TIA Portal
© Siemens AG 2023 All rights reserved
Note The option is only active for one generation run and is automatically reset.
Note The generation of the overall change history is optional and can be enabled and disabled via
the Code2Docu settings:
Settings > Code2Docu options > Generate full Changelog overall versions.
© Siemens AG 2023 All rights reserved
Note The overall change history can be sorted ascending or descending, i.e. V1.0.0 before V2.0.0
or vice versa:
Settings > Rendering options > Sort overall Changelog > Newest version first or Oldest
version first
Note Note that you have to adjust the version and also the date in the generic part of the
description (region BLOCK INFO HEADER / Version and Date).
This is not necessary if the version is automatically generated from the type version of the
description block, as well as the date field is not present and thus the current date of the
computer is used.
You can generate a separate file for the change history. The format corresponds to that of the
overall documentation.
Note You can enable or disable the generation of the separate overall change history via the
following Code2Docu setting:
Settings > Code2Docu options > Generate separate Changelog File.
Note that all software dependencies expected in the project are also present / installed in the
TIA Portal environment.
If a software package, an HSP, a GSD or a GSDML is not installed, the export of the objects
CAUTION
and thus the generation of the documentation is aborted.
Generate Documentation
With the function Generate Documentation you start the generation of the documentation for all
projected languages.
With the function Generate Documentation for active Language you start the generation of the
documentation for the currently active language in TIA Portal.
Settings
With Settings, you open the menu for the settings of the add-in.
Open Settings
With Open Settings you open the dialog window for the settings. The possible settings are
described in the following chapters.
Clear exclude's
With Clear exclude's you remove all objects from the exclude list and thus reset them.
Open the Settings dialog box with the Open Settings function. After opening, the Export
options tab is displayed with the export options.
Figure: Dialog box settings / Export options
© Siemens AG 2023 All rights reserved
General area
Cleanup Export folder prior to export
With the option Cleanup Export folder prior to export the folder AddIn\Code2Docu in the
project directory is automatically cleaned up at each generation. All export files in the folder are
deleted and old states are removed. This is useful, for example, if an object has been renamed
in TIA Portal.
Cleanup Docu folder prior to export
With the option Cleanup Docu folder prior to export the folder UserDocumentation in the
project directory under UserFiles with the complete documentation is automatically deleted at
each generation.
Export area
Export UDTs for rendering
With the option Export UDTs for rendering the export of user defined data types can be
deactivated, if no documentation of these is desired.
Export global TagTables to render global constants
The Export global TagTables to render global constants option can be used to disable the
export of user-defined data types if no documentation of them is desired.
Note Dependent options (rendering options) are automatically disabled when export is disabled
and enabled when export is enabled.
© Siemens AG 2023 All rights reserved
Select the Code2Docu options tab to set the options for Code2Docu.
The tab is divided into three sections:
• General
• Document
• ChangeLog
General area
In this section you define general settings for “Code2Docu”.
Overwrite Stylesheet for HTML docu
The option Overwrite Stylesheet for HTML docu allows overwriting the stylesheet for the
HTML documentation with the default stylesheet of “Code2Docu”.
Document area
In this section you define settings for the documentation.
Generate single Documentation files
The Generate single Documentation files option generates user-defined documentation (user
help) for TIA Portal for each block. You can call the user help for each block with the key
combination Shift+F1.
Generate overall Documentation file
With the option Generate overall Documentation file an overall documentation for the TIA
Portal project is generated.
© Siemens AG 2023 All rights reserved
ChangeLog area
In this area you define settings for the change history.
Generate single Changelog beside a block
With the option Generate single Changelog beside a block you can generate a change history
for each block.
Generate full Changelog overall versions
With Generate full Changelog overall versions you can generate a project wide change
history.
Generate separate Changelog File
With Generate separate Changelog File you generate a separate file for the change history.
Note The image files in the folder defined in this setting will be copied to the images folder in the
project folder structure during documentation generation. Please consider that images
having the same file names will be overwritten (updated).
Select the Rendering options tab to set the options for the display (rendering).
The tab is divided into four sections:
• General
• Block Interface Image
• Sort overall ChangeLog
• Full ChangeLog is…
General
In this section you define general settings for the display.
Remove number prefix from folder name
With Remove number prefix from folder name you can remove a numeric prefix in the
documentation for sorting folders in the TIA Portal project.
Note Retain will only be shown if Interface parameters have other values set as ‘NonRetain’.
Only static interface parameters are rendered that have ‘Retain’ or ‘SetInIDB’ values, the
© Siemens AG 2023 All rights reserved
Note The displayed symbols for Retain are defined in the ‘GenericTextsCustomized.csv’ and can
be customized by the user.
You can find the file in the TIA Portal project folder >
UserFiles\Code2Docu\GenericTextsCustomized.csv.
Note The category separator as well as the default placeholder text for not specified categories
are defined in ‘GenericTextsCustomized.csv’ and can be customized by the user.
You can find the file in the TIA Portal project folder >
UserFiles\Code2Docu\GenericTextsCustomized.csv.
6 Location of documentation
library UserFiles.
The following files from the folder UserFiles\Code2Docu are relevant for the global library and
must be provided:
• images: This is where all images used in the documentation are stored.
This is the initial folder for referencing the images and graphics accessed by code2Docu.
• highlightJS: JavaScript library for user defined documentation.
• katex: JavaScript library for user-defined documentation.
• styleCustomized.css: Stylesheet for the design of the user-defined documentation,
customizable by the user.
• style.css: Stylesheet for the design of the user-defined documentation.
• xxx_ChangeLog_Previous.xml: Previous status at release time of the change history.
The following files from the folder UserFiles\Code2Docu are not relevant for the global library
and can be provided:
• Code2DocuSettings.xml: Settings of “Code2Docu”.
• GenericTexts.csv: Generic texts that are not stored in TIA Portal.
• GenericTextsCustomized.csv": Generic texts that are not stored in TIA Portal, customizable
by the user.
Based on GenericTexts.csv the generic text list is generated. Possible changes can be
traced there. A failure due to incorrect adjustments in the ...Customized.csv is thereby
excluded and the system remains updateable.
• xxx_ChangeLog.xml: Current status of the change history.
• startCode2Docu.bat: Batch file to start the generation again, without previous export from
TIA Portal.
If these files are nevertheless delivered, the documentation can be restored with the help of
“Code2Docu” and thus also further maintained.
Note File names of help files must correspond exactly to the name of the object in TIA Portal.
Note Further information on user-defined documentation can be found in the “SIMATIC STEP 7
Basic/Professional and SIMATIC WinCC” system manual at:
https://support.industry.siemens.com/cs/ww/en/view/109798671/138092722827
Note In the project server environment it is also possible to create an “Exclusive Engineering
Session”. In this session you work on the server project and the documentation is generated
directly in the project folder “SV”.
Note that all other local sessions are locked as long as the “Exclusive Engineering Session”
exists.
Note Further information on document classification (Microsoft Information Protection / MIP) can
be found under the following link:
https://docs.microsoft.com/en-us/microsoft-365/compliance/information-
protection?view=o365-worldwide
9 Appendix
Technical Support
The Technical Support of Siemens Industry provides you fast and competent support regarding
all technical queries with numerous tailor-made offers
- ranging from basic support to individual support contracts. Please send queries to Technical
Support via Web form:
siemens.com/SupportRequest
© Siemens AG 2023 All rights reserved
Service offer
Our range of services includes the following:
• Plant data services
• Spare parts services
• Repair services
• On-site and maintenance services
• Retrofitting and modernization services
• Service programs and contract's
You can find detailed information on our range of services in the service catalog web page:
support.industry.siemens.com/cs/sc
The Siemens Industry Mall is the platform on which the entire Siemens Industry product portfolio
is accessible. From the selection of products to the order and the delivery tracking, the Industry
Mall enables the complete purchasing processing – directly and independently of time and
location:
mall.industry.siemens.com
https://support.industry.siemens.com/cs/ww/en/view/109773802
\4\ Programming Guidelines and Programming Style guide for SIMATIC S7-1200 and S7-1500
https://support.industry.siemens.com/cs/ww/en/view/81318674
\5\ Library with PLC data types (LPD) for STEP 7 (TIA Portal) and SIMATIC S7-1200 / S7-1500
https://support.industry.siemens.com/cs/ww/en/view/109482396
\6\ Guideline on Library Handling in Tia Portal
https://support.industry.siemens.com/cs/ww/en/view/109747503
\7\ Libraries in the TIA Portal
https://support.industry.siemens.com/cs/ww/en/view/109738702
\8\ LaTeX project
https://www.latex-project.org/
\9\ LaTeX @ Wikipedia
https://en.wikipedia.org/wiki/LaTeX
\10\ LaTeX compendium & LaTex math compendium @ Wiki Books
https://en.wikibooks.org/wiki/LaTeX
https://en.wikibooks.org/wiki/LaTeX/Mathematics
https://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics
\11\ PanDoc - Document render (Renders mathematics formula, syntax highlighting)
https://pandoc.org/
\12\ OpenXml - DocX & PDF rendering
https://www.nuget.org/packages/DocumentFormat.OpenXml
\13\ Markdig - Markdown parser & rendering
https://github.com/xoofx/markdig
\14\ QRCoder - QR Code rendering
https://github.com/codebude/QRCoder/