openETCS / dataDictionary

This repository is the container for the openETCS data dictionary
6 stars 7 forks source link

Special values are not consistently stored in the xml #17

Closed astante closed 9 years ago

astante commented 10 years ago

The xml contains special values which are not consistently stored in the xml. For example some special values contain ranges

<Variable Name="M_CURRENT" >
<DetailedName>Allowed current consumption</DetailedName>
<Description>It defines the allowed current consumption to be used by the train</Description>
<Specs Length="10 bits" MinVal="0 A" MaxVal="10000 A"  Formula="10 A"  >
<Special Value="1001-1022"  Description="Spare" />
<Special Value="1023"  Description="No restriction for current consumption" />
</Specs>
</Variable>

other have value encoded in binary format

<Variable Name="M_DUP" >
<DetailedName>Duplicate balise</DetailedName>
<Description>Flags to tell whether the balise is a duplicate of one of the adjacent balises.</Description>
<Specs Length="2 bits" >
<Special Value="00"  Description="No duplicates" />
<Special Value="01"  Description="This balise is a duplicate of the next balise (seen in the nominal direction of the balise group)." />
<Special Value="10"  Description="This balise is a duplicate of the previous balise (seen in the nominal direction of the balise group)." />
<Special Value="11"  Description="Spare" />
</Specs>
</Variable>

while other have a completly different way to store the information

<Variable Name="M_LINEGAUGE" >
<DetailedName>Line gauge</DetailedName>
<Description>Defining which loading gauge(s) are permitted on a line (refer to TSI INF)</Description>
<Specs Length="8 bits" Formula="Bitset"  >
<Special Value="xxxx xxx1"  Description="G1" />
<Special Value="xxxx xx1x"  Description="GA" />
<Special Value="xxxx x1xx"  Description="GB" />
<Special Value="xxxx 1xxx"  Description="GC" />
<Special Value="0000 0000"  Description="Spare" />
<Special Value="xxx1 xxxx"  Description="Spare" />
<Special Value="xx1x xxxx"  Description="Spare" />
<Special Value="x1xx xxxx"  Description="Spare" />
<Special Value="1xxx xxxx"  Description="Spare" />
</Specs>
</Variable>

How should we process that data?

astante commented 10 years ago

I want to add that sometimes the data is in hexadecimal form:

<Variable Name="NID_RADIO" >
<DetailedName>Radio subscriber number.</DetailedName>
<Description>Quoted as a 16 digit decimal number. The number is to be entered left adjusted starting with the first digit to be dialled. Padding by the special value F shall be added after the least significant digit of the number.  For further information about NID_RADIO  refer to SUBSET-054.</Description>
<Specs Length="64 bits" MinVal="0" MaxVal="9999999999999999"  Formula="Binary Coded Decimal"  >
<Special Value="A-E"  Description="Not Used" />
<Special Value="F"  Description="Use value F for digit to indicate no digit (if number shorter than 16 digits)" />
<Special Value="FFFF FFFF FFFF FFFF"  Description="Use the short number stored onboard" />
</Specs>
</Variable>
UweSteinkeFromSiemens commented 10 years ago

In general, all occurences of "spare" should not be transferred to the enum.

In the example, the valid range for M_CURRENT is between 0 and 1000. It has to be multiplied via "Formula=10A" to reach the MaxVal="10000 A". So, it can be seen that the indicated special values are beyond the range.

The two other examples are a bit more complex. For the already existing transformation to C, the enum values have integer values assigned (see https://github.com/openETCS/dataDictionary/blob/master/Artifacts/subset-026-7/Decoder/Delivery/GeneratedC/opnETCS_Variables.h ). Search for typedef enum { M_LINEGAUGE_G1 = 1 , M_LINEGAUGE_GA = 2 , M_LINEGAUGE_GB = 4 , M_LINEGAUGE_GC = 8 } M_LINEGAUGE ;

In this case, the "spare" was not transformed.