Encoding of SV message shall be according to ASN.1 and BER rules. BER rules allow for three length field encoding formats: short definite (1 byte), long definite (minimum 2 bytes) and indefinite format.
SV messages needs to have determinable size, based on (SCL) settings, to enable efficient parsing.
In order for SV message to have deterministic size, encoding of Length field must be well defined. As it is now, any Length field encoding is allowed, leading to indeterministic message size. For example, length of 4 can be coded as 04 (short definite) or 81 04 (long definite).
Length of some fields depends on settings (e.g. svID or ASDU depending on number of U/I element in it) and some are fixed (e.g. smpCnt always 2 bytes), but still Length field encoding of all of them needs to be minimum size.
The size for encoding the Length field (TLV) of the variable size elements shall always use minimum length encoding.
This will make SV encoding to be in line with fix-length GOOSE encoding, part 8-1 annex A-3.
1) It is not sufficient to make the proposed change in 61850-9-2 Annex A, because this Annex is informative only. This is in contrast to 61850-8-1 Annex A, which is normative. Either 9-2 Annex A must be made normative, or the change must be added to a normative section of the Standard, eg. "8.5.1 Application Layer Functionality" or "8.5.2 Presentation Layer Functionality".
2) The change suggested on April 1 states "The Length field itself shall always use the minimum length encoding". However, this is not sufficient because it still allows Length encoding in indefinite form for constructed fields at the sender's option, so does not achieve the desired fixed length encoding.
Instead of that change, I propose adding a sentence to the beginning of the "8.5.2 Presentation Layer Functionality" clause:
"[... the sampled value buffer is encoded as specified in Table 14.] All BER TLV Length fields shall be definite form, and encoded using the minimum size BER encoding possible."
The fixed-length GOOSE encoding should similarly prohibit the use of indefinite form for encoding the Length field.
04 Apr 22
Last commenter stated: "BER encoding, per ASN.1 already mandates minimum length encoding. If we want to restate it, then fine. But it is already there and should just re-iterate the BER rule."
That comment is incorrect with regards to the encoding of the Length field - BER allows the use of "definite short form" or "definite long form" encoding at the sender's option for lengths less than or equal to 127 octets, or even "indefinite form" for constructed fields, which will all result in different message lengths and field offsets.
04 Apr 22
BER encoding, per ASN.1 already mandates minimum length encoding. If we want to restate it, then fine. But it is already there and should just re-iterate the BER rule.
01 Apr 22
I suggest modifying the "Annex A / A.2 ASN.1 basic encoding rules (BER)" clause:
"[..]The BER transfer syntax has the format of a TLV triplet (Type, Length, Value)
or (Tag, Length, Value) as shown in Figure A.4.
The Length field itself shall always use the minimum length encoding.
All fields (T, L, V) are series of [..]"
This issue should be considered as well in part 8-1 for variable-length GOOSE encoding.
01 Apr 22
moved to discussion
01 Apr 22
9-2 must be aligned with 8-1 regarding this point.