From f2940775f60864c491375678994466df005d7e4b Mon Sep 17 00:00:00 2001 From: Maxson Ramon dos Anjos Medeiros Date: Mon, 21 Jul 2025 09:44:37 +0200 Subject: [PATCH] Add SV control handler --- .../IEC61850Model/SVControlBlock.cs | 5 + .../server_example_access_control/Program.cs | 13 + .../server_example_access_control.csproj | 4 +- .../simpleIO_access_control.icd | 660 ++++++++++++++++++ 4 files changed, 680 insertions(+), 2 deletions(-) create mode 100644 dotnet/server_example_access_control/simpleIO_access_control.icd diff --git a/dotnet/IEC61850forCSharp/IEC61850Model/SVControlBlock.cs b/dotnet/IEC61850forCSharp/IEC61850Model/SVControlBlock.cs index b1dce114..d9dc7105 100644 --- a/dotnet/IEC61850forCSharp/IEC61850Model/SVControlBlock.cs +++ b/dotnet/IEC61850forCSharp/IEC61850Model/SVControlBlock.cs @@ -46,6 +46,11 @@ namespace IEC61850 this.parent = parent; } + /// + /// create a new Multicast/Unicast Sampled Value (SV) control block (SvCB) + /// Create a new Sampled Value control block(SvCB) and add it to the given logical node(LN) + /// + /// the svcontrol instance public SVControlBlock(IntPtr self) { this.self = self; diff --git a/dotnet/server_example_access_control/Program.cs b/dotnet/server_example_access_control/Program.cs index a936d0a2..18f54645 100644 --- a/dotnet/server_example_access_control/Program.cs +++ b/dotnet/server_example_access_control/Program.cs @@ -16,6 +16,7 @@ using System.Reflection.Metadata; using IEC61850.Client; using ReportControlBlock = IEC61850.Server.ReportControlBlock; using IEC61850.Model; +using System.Data.Common; namespace server_access_control { @@ -331,6 +332,18 @@ namespace server_access_control iedServer.SetEditSettingGroupChangedHandler(editSGChangedHandler, settingGroupControlBlock, null); iedServer.SetEditSettingGroupConfirmationHandler(editSGConfirmationHandler, settingGroupControlBlock, null); + LogicalNode logicalNode = (LogicalNode)iedModel.GetModelNodeByShortObjectReference("GenericIO/LLN0"); + SVControlBlock sampledValuesControlBlock_1 = iedModel.GetSVControlBlock(logicalNode, "SMV1"); + SVControlBlock sampledValuesControlBlock_2 = iedModel.GetSVControlBlock(logicalNode, "SMV2"); + + void sVCBEventHandler(SVControlBlock sampledValuesControlBlock, SMVEvent sMVEvent, object parameter) + { + Console.WriteLine("control called"); + } + + iedServer.SetSVCBHandler(sVCBEventHandler, sampledValuesControlBlock_1, null); + iedServer.SetSVCBHandler(sVCBEventHandler, sampledValuesControlBlock_2, null); + iedServer.Start(102); if (iedServer.IsRunning()) diff --git a/dotnet/server_example_access_control/server_example_access_control.csproj b/dotnet/server_example_access_control/server_example_access_control.csproj index 618a553d..941a4574 100644 --- a/dotnet/server_example_access_control/server_example_access_control.csproj +++ b/dotnet/server_example_access_control/server_example_access_control.csproj @@ -8,11 +8,11 @@ - + - + Always diff --git a/dotnet/server_example_access_control/simpleIO_access_control.icd b/dotnet/server_example_access_control/simpleIO_access_control.icd new file mode 100644 index 00000000..b70d8921 --- /dev/null +++ b/dotnet/server_example_access_control/simpleIO_access_control.icd @@ -0,0 +1,660 @@ + + +
+
+ + + Station bus + 10 + +
+

0.0.0.0

+

255.255.255.0

+

192.168.2.1

+

1,3,9999,33

+

33

+

00000001

+

0001

+

0001

+

102

+
+ +
+

1

+

4

+

01-0c-cd-01-00-01

+

1000

+
+ 1000 + 3000 +
+ +
+

01-0C-CD-04-00-01

+

4000

+

4

+

123

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + ok + + + + + + + on + + + status-only + + + + + on + + + + + ok + + + + + direct-with-normal-security + + + + + direct-with-normal-security + + + + + direct-with-normal-security + + + + + direct-with-normal-security + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + on + + + status-only + + + + + on + + + + + ok + + + + + MZ Automation + + + 1.3.0 + + + libiec61850 server example + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Unknown + Not-supported + Blocked-by-switching-hierarchy + Select-failed + Invalid-position + Position-reached + Parameter-change-in-execution + Step-limit + Blocked-by-Mode + Blocked-by-process + Blocked-by-interlocking + Blocked-by-synchrocheck + Command-already-in-execution + Blocked-by-health + 1-of-n-control + Abortion-by-cancel + Time-limit-over + Abortion-by-trip + Object-not-selected + Object-already-selected + No-access-authority + Ended-with-overshoot + Abortion-due-to-deviation + Abortion-by-communication-loss + Blocked-by-command + None + Inconsistent-parameters + Locked-by-other-client + + + on + blocked + test + test/blocked + off + + + ok + warning + alarm + + + status-only + direct-with-normal-security + sbo-with-normal-security + direct-with-enhanced-security + sbo-with-enhanced-security + + + not-supported + bay-control + station-control + remote-control + automatic-bay + automatic-station + automatic-remote + maintenance + process + + + no-error + instance-not-available + instance-in-use + access-violation + access-not-allowed-in-current-state + parameter-value-inappropriate + parameter-value-inconsistent + class-not-supported + instance-locked-by-other-client + control-must-be-selected + type-conflict + failed-due-to-communications-constraint + failed-due-to-server-constraint + + + Unknown + Associate + Abort + Release + GetServerDirectory + GetLogicalDeviceDirectory + GetAllDataValues + GetDataValues + SetDataValues + GetDataDirectory + GetDataDefinition + GetDataSetValues + SetDataSetValues + CreateDataSet + DeleteDataSet + GetDataSetDirectory + SelectActiveSG + SelectEditSG + SetEditSGValue + ConfirmEditSGValues + GetEditSGValue + GetSGCBValues + Report + GetBRCBValues + SetBRCBValues + GetURCBValues + SetURCBValues + GetLCBValues + SetLCBValues + QueryLogByTime + QueryLogAfter + GetLogStatus + SendGOOSEMessage + GetGoCBValues + SetGoCBValues + GetGoReference + GetGOOSEElementNumber + SendMSVMessage + GetMSVCBValues + SetMSVCBValues + SendUSVMessage + GetUSVCBValues + SetUSVCBValues + Select + SelectWithValue + Cancel + Operate + CommandTermination + TimeActivatedOperate + GetFile + SetFile + DeleteFile + GetFileAttributValues + TimeSynchronisation + InternalChange + + + unknown + forward + backward + both + + +
\ No newline at end of file