Repository navigation
Conversation
Iec103AsduBuilder.ClockSynchronization encoded the time with EncodeCp32Time2a: four octets of time and one zero octet, five octets in all. IEC 60870-5-103 clause 7.3.1.6 defines the information element of ASDU 6 as seven octets of binary time (CP56Time2a, clause 7.2.6.29), so a station that checks the length ignores the command and sends no confirmation. Add EncodeCp56Time2a (milliseconds, minute, hour, day of month with day of week, month, year) and use it for ASDU 6. ASDU 1 keeps CP32Time2a.
Iec103AsduBuilder.GeneralCommand ended ASDU 20 after the DCO, e.g. 14 81 14 01 A0 63 02. IEC 60870-5-103 clause 7.3.2.4 defines the information element as DCO followed by the return information identifier (RII, clause 7.2.6.19), which the protection equipment returns as SIN of the ASDU 1 that confirms the command (clause 7.4.4). A station that checks the length drops the short ASDU and sends no confirmation. Add an optional returnInformationIdentifier parameter (default 0) and append it after the DCO. AsduDecoder notes the RII of a type 20 ASDU.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1
Fixes #2
Two changes to
Iec103AsduBuilder, one commit each:ClockSynchronizationsends ASDU 6 with a CP56Time2a (7 octets), as in IEC 60870-5-103 clause 7.3.1.6. The newEncodeCp56Time2awrites milliseconds, minute, hour, day of month with day of week (1 = Monday), month and year. ASDU 1 still usesEncodeCp32Time2a.GeneralCommandtakes an optionalreturnInformationIdentifier(default 0) and appends it after the DCO, as in clause 7.3.2.4. Existing callers compile unchanged.AsduDecoderadds the RII to the notes of a type 20 ASDU.The slave simulator only acknowledges ASDU 6 and ASDU 20 on the link layer and does not read their information elements, so it needs no change.
Tests
Two new cases in
tests/ArIEC103.Protocol.Testscheck the encoded bytes of both ASDUs and decode them again. Restore, build (ArIEC103.sln, Release) and the protocol smoke tests pass (13/13) with the .NET 8 SDK. Against the old code the ASDU 6 case fails and the ASDU 20 case does not compile.Interoperability
With these changes ArIEC103 as the control system gets a confirmation of the clock synchronization (ASDU 6, cause 8) and of the general command (ASDU 1, cause 20, SIN = RII, then cause 12) from a station that checks the ASDU lengths; before, both timed out. This was run in the iec60870-5-interop harness against vitusdong/iec103-dotnet and against go-iec60870-5: six cases moved from failing to passing and no other case changed.