Requirements:
- The preparatory steps on the file level have been carried out.
- EEC is started.
- Section Generating a configuration by importing an IMX file is carried out.
In addition to the system libraries, the library catalog contains the architecture T_Mechatronic_Architecture and the modular system T_Mechatronic_ModularSystem.
The Feeder project exists in the Project catalog.
The CSV file Parameter.csv is imported in order to set parameter values in the existing configuration. To this purpose the template file Template_CSV.imx is additionally required.
Note:
Identically structured Excel files can be imported with the identically template and scheme files.
Description of the CSV file:
The CSV file consists of 8 rows and 3 columns.
The columns do not have any headers.
An area for header data is introduced via the data to be evaluated with a cell that contains the "Header" text. The header data end in the row that contains a cell with the "LineEndHeader" text.
The data to be evaluated are distributed across 3 columns:
A = Name of the parameter
B = Value of the parameter
C = Type of the parameter
These specifications are converted internally into a fragment in IMX format by means of the XSL file Parameter.xsl. The fragment is inserted into the template file Template_CSV.imx instead of the <importFragment/> tag.
<?xml version="1.0" encoding="utf-8"?>
<imx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xi="http://www.w3.org/2001/XInclude" version="1.0">
<project name="Feeder" save="true">
<libraries>
<add type="String" value="T_Mechatronic_ModularSystem"/>
</libraries>
<mo name="Feeder" typeClass="T_Mechatronic_ModularSystem.Mechatronic.Stations.Feeder" >
<importFragment/>
</mo>
</project>
</imx>
Proceed as follows to set parameter values:
- Select the menu item File > Import....
- Navigate to Project > Import.
- Confirm via [Next >].
- Specify the file Parameter.csv in the Source file name field.
- Select Default:Parameter.xsl from the drop-down list. This grays out the input field.
- Enter the file Template_CSV.imx in the Template file name field.
- Remove the Create new project option and mark the Feeder project in the list below it.
- Confirm with [Finish].
The import wizard opens with the Select page.
The import wizard opens the page Import file.
The file is located in the following directory:
<EEC installation path>\resources\Import\CSV
Use [Browse...] to navigate to the file. If appropriate, select the filter Excel workbooks (*.xls, *.xlsx, *.xlsm).
The file is located in the following directory:
<EEC installation path>\resources\Import\IMX
Use [Browse...] to navigate to the file. If applicable, select the file filter IMX files (*.imx).
Result:
The configuration called Feeder is displayed in the project catalog:
- Open the Feeder component.
- Select the Parameters editor.
The Value column shows that all the values from the CSV file have been imported as String.
The ParameterBoolean parameter is filled with the value ='true'. Since this is not a valid Boolean value, false is entered as the result.
Formula errors are displayed for the parameters ParameterDouble and ParameterInteger because the imported values cannot be interpreted as Double or Integer respectively.
The ParameterMap parameter is not filled by the import and is therefore <<null>>.
Solely the ParameterString parameter is set correctly with the value Hello World.
In other words:
The third column of the CSV value is not detected during the conversion and consequently all the imported values are interpreted as a string.
If the parameters are imported with the correct type, the scheme file for the transformation of the CSV file into a fragment has to be customized.
Proceed as follows to change the XSL file:
- Copy the <EEC installation path>\install\importschemas\Parameter.xsl file into the following folder:
- Rename the file to ParameterWithType.xsl.
- Open the file ParameterWithType.xsl with any editor, for example Notepad++.
- Navigate to the <xsl:template match="row" > tag in the file.
<EEC installation path>\resources\Import\XSL
Appearance before the change:
<xsl:template match="row" >
<xsl:choose>
<xsl:when test="@number > $LineEndHeader ">
<xsl:element name="parameter">
<xsl:attribute name="name">
<xsl:value-of select="col[@number='1']"/>
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="col[@number='2']"/>
</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Insert the following rows at the end of the block of <xsl:element name="parameter">:
<xsl:attribute name="type">
<xsl:value-of select="col[@number='3']"/>
</xsl:attribute>
The result should look as follows:
<xsl:template match="row" >
<xsl:choose>
<xsl:when test="@number > $LineEndHeader ">
<xsl:element name="parameter">
<xsl:attribute name="name">
<xsl:value-of select="col[@number='1']"/>
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="col[@number='2']"/>
</xsl:attribute>
<xsl:attribute name="type">
<xsl:value-of select="col[@number='3']"/>
</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Import with the modified scheme file ParameterWithType.xsl:
- Select the menu item File > Import....
- Navigate to Project > Import.
- Confirm via [Next >].
- Specify the file Parameter.csv in the Source file name field.
- Select Customer scheme from the drop-down list. Specify the modified scheme file.
- Enter the file Template_CSV.imx in the Template file name field.
- Remove the Create new project option and mark the Feeder project in the list below it.
- Confirm with [Finish].
The import wizard opens with the Select page.
The import wizard opens the page Import file.
The file is located in the following directory:
<EEC installation path>\resources\Import\CSV
Use [Browse...] to navigate to the file. If appropriate, select the filter Excel workbooks (*.xls, *.xlsx, *.xlsm).
<EEC installation path>\resources\Import\XSL\ParameterWithType.xsl
Use [Browse...] to navigate to the file. If applicable, select the file filter Scheme XSL files (*.xsl, *.xslt).
The file is located in the following directory:
<EEC installation path>\resources\Import\IMX
Use [Browse...] to navigate to the file. If applicable, select the file filter IMX files (*.imx).
Result:
The configuration called Feeder is displayed in the project catalog:
- Open the Feeder component.
- Open the Parameter editor.
The Values column shows that all the values from the CSV file have been imported with their own types.
The ParameterMap parameter is not filled by the import and is therefore <<null>>.