XML - Database
The variable values will be saved at a XML file. The structure of the database, tables and columns are defined at the XSD-file. With the function blocks FB_DBCreate and FB_DBTableCreate it is possible to create the XML file and the XSD file. Further information to work with XML files together with the TwinCAT3 Database Server, see XML information .
<?xml version="1.0" encoding="UTF-8"?>
<TestDB_XML xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="TestDB_XML.xsd">
<myTable_Double>
<row ID="1" Timestamp="2012-03-08T12:45:08" Name="TestValue1" Value="222.222" />
<row ID="2" Timestamp="2012-03-08T12:45:14" Name="TestValue1" Value="222.222" />
<row ID="3" Timestamp="2012-03-08T12:45:18" Name="TestValue1" Value="222.222" />
<row ID="4" Timestamp="2012-03-08T12:45:22" Name="TestValue1" Value="222.222" />
<row ID="5" Timestamp="2012-03-08T12:45:23" Name="TestValue1" Value="222.222" />
</myTable_Double>
</TestDB_XML>
Spaltenname | Datentyp | Null zulässig | Eigenschaft |
---|---|---|---|
ID | xsd:long | nein |
|
Timestamp | xsd:dateTime | nein |
|
Name | xsd:string | nein | 80 |
ValueType="Double" | |||
Value | xsd:double | nein |
|
ValueType="Bytes" | |||
Value | xsd:hexBinary | nein | längenwert |
An AutoID is generated in the "ID" column. The value in this column is, in other words, always increased by 1.
The "Timestamp" column stores the time at which the data record was saved.
The name of the variable is stored in the "Name" column.
The "Value" column stores the value of the variable.
E_DBColumnTypes | XML | PLC Control |
---|---|---|
eDBColumn_BigInt | xsd:long | T_LARGE_INTEGER (TcUtilities.lib) |
eDBColumn_Integer | xsd:int | DINT |
eDBColumn_SmallInt | xsd:short | INT |
eDBColumn_TinyInt | xsd:byte | BYTE |
eDBColumn_Bit | xsd:boolean | BOOL |
eDBColumn_Money | xsd:double | LREAL |
eDBColumn_Float | xsd:double | LREAL |
eDBColumn_Real | xsd:double | LREAL |
eDBColumn_DateTime | xsd:dateTime | DT |
eDBColumn_NText | xsd:string | STRING |
eDBColumn_NChar | xsd:string | STRING |
eDBColumn_Image | xsd:hexBinary | ARRAY OF BYTE |
eDBColumn_NVarChar | xsd:string | STRING |
eDBColumn_Binary | xsd:hexBinary | ARRAY OF BYTE |
eDBColumn_VarBinary | xsd:hexBinary | ARRAY OF BYTE |
Notice | |
Compact Flash Card Lifetime Do not save the database on the Compact Flash Card in case of an embedded system. |