Description of the XML definition file
1.Introduction
The XML definition file specifies the basic properties of HSL-2.0 logic blocks:
- Name, ID, category (for administration in the expert and for display in the GLE)
- Context
- Number, designations and types of inputs and outputs
- Number and names of remanent variables
- Framework and standard modules that must be imported
- Type of logging
From this XML definition file, the HSL 2.0 generator first creates a Python file. This file contains a Python class, which must be supplemented and programmed by the developer. With the help of the Python file and the XML definition file, the HSL 2.0 generator can then generate the finished logic module (.hsl file).
2.Structure of the XML definition file
|
- <config>
Container. - <modules>
Contains all logic module definitions of the project. Any number of modules can be defined here. - <modules>
Definition of a single logic block.- category
Module category for the GLE (Graphical Logic Editor) in HS/FS Experte. - context
Context in which the module is defined. See also: Threading. - id
ID of the building block - name, internal_name, external_name
- internal_name:
Name of the Python class. Also used for the name of the module file (.hsl). (Should not contain umlauts) - external_name:
Name in GLE (Graphical Logic Editor of the Expert) - name:
Is used if external_name and/or internal_name are not specified. (Should not contain umlauts)
- internal_name:
- version
Version designation of the module
- category
- <inputs>
Contains all inputs of a logic device - <input> Defines a single input of a logic device
- type
Input type: number, string, destination_port or base_path.- number: Numerical value.
- string: Alphanumeric value / character string.NoteFor fixed texts, which are on the input of a logic block, the encoding "iso-8859-1" is used.
- destination_port: Port at which the module must listen if it is to be reached from outside via the base path. For further explanations see here.
- base_path: Base path via which all calls are forwarded to the module. If the HomeServer URL is appended. For further explanations see here.NoteThe input types destination_port and base_path may only be used in one input per module. If an input has the type destination_port, an input with the type base_path must also exist and vice versa.
- init_value
Value with which the input is initialised. The generator checks for inputs of type number whether the specified init_value is valid.
Example (number)init_value="5"
Example (string)init_value="abc"
- const_name
(optional) Name of the constant for this input in the Python script. If const_name is not specified, E_BEZ is used instead. - E_BEZ
Name of the entrance. Displayed in the GLE.
- type
- <outputs>
Contains all outputs of a logic moduleNoteAt least one output must be created! - <output>
Defines a single output of a logic device.- type
Output type: number or string. - init_value
Value with which the output is initialised. The generator checks for outputs of the type number whether the specified init_value is valid.
Example (number)init_value="5"
Example (string)init_value="abc"
- const_name
(optional) Name of the constant for this output in the Python script. If const_name is not specified, A_BEZ is used instead. - A_BEZ
Name of the output. Displayed in the GLE.
- type
- <remanent_variables>
Contains all remanent variables of a logic module - <remanent_variable>
Defines a single remanent variable- type
Type of remanent variable: number or string. - init_value
(optional) Value with which the remanent variable is initialised. For remanent variables of type number the generator checks if the specified init_value is valid. - const_name
(optional) Name of the remanent variables in the Python script. If const_name is not specified, V_BEZ is used instead. - V_BEZ
Name of the variable.
- type
- <imports>
Contains all import instructions for framework modules or directory / ZIP archive names of external libraries to be used by the block. - <import>
Defines a single module importNoteThese are not logic blocks, but modules that are included in the framework (e.g. interval timer) or libraries that are not included in the standard Python package! - M_NAME
Absolute or relative path to a directory or ZIP archive, or the name of a framework module.- Directory:
The directory represents a single library whose name corresponds to that of the directory (e.g.C:\Python27\Lib\site-packages\websocket
). - ZIP archive:
The ZIP archive can contain several directories like the one described above and/or individual Python files. - Framwork module:
Name of a framework module (e.g.hsl20_4_timer
). - For the use of imports see also: Code example "EasterDate".NoteIn the '.py' file, Python 'import' statements must be used in the upper area not overwritten by the generator to access internal or external libraries.
Import' statements within methods or at runtime only work with Python standard modules (e.g. import math)!
- Directory:
- <translations>
Contains all texts of the module visible in the GLE. One translation instruction per language must be given.
If the texts are not available in the set language, the expert uses the texts defined in the module, input and output tags. - <translation>
Defines the texts of a block for a language.- language
Language abbreviation. Valid are all languages supported by the expert. Currently these are:- de (German)
- en (English)
- fr (French)
- it (Italian)
- name
Display name in the GLE in language language for the module. - category
Name and path in language language under which the block is to be displayed in the context menu of the GLE.
- language
- <translation_inputs>
Contains the names for all inputs of the block. - <translation_input>
Contains the name in language language for an input of the block. For each input defined in the block (<input> ) a translation_input element must be created in the same order. - <translation_outputs>
Contains the names for all outputs of the block. - <translation_output>
Contains the name in language language for one output of the block. For each output defined in the block (<output> ) a translation_output element must be created in the same order. - <logging>
Optional. Specifies the logging server and the type of logging.- type
Logging type. Is either Syslog or None (No logging) - ip
Only for logging type Syslog. IP address of the syslog server - port
Only for logging type Syslog. Port of the syslog server. Default is 514.
- type
3.Example of an XML definition file
|
In the definition of the module the English language is used and there is a translation for the language German.
This means that if the language "German" is set for the HS/FS Expert, this block is displayed in German in the GLE.
When using any other language setting in the HS/FS Expert, the block is displayed in English in the GLE, as this is the default setting.
This means that if the language "German" is set for the HS/FS Expert, this block is displayed in German in the GLE.
When using any other language setting in the HS/FS Expert, the block is displayed in English in the GLE, as this is the default setting.