- .NET API: added ControlAction.GetControlTime methods

pull/202/head
Michael Zillgith 6 years ago
parent 5fbb67c44c
commit 881ebac3dc

@ -510,6 +510,9 @@ namespace IEC61850
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern int ControlAction_getCtlNum(IntPtr self); static extern int ControlAction_getCtlNum(IntPtr self);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern UInt64 ControlAction_getControlTime(IntPtr self);
private IntPtr self; private IntPtr self;
private IedServer.ControlHandlerInfo info; private IedServer.ControlHandlerInfo info;
private IedServer iedServer; private IedServer iedServer;
@ -577,6 +580,24 @@ namespace IEC61850
return info.controlObject; return info.controlObject;
} }
/// <summary>
/// Gets the time of control execution, if it's a time activated control
/// </summary>
/// <returns>The time of control execution or 0 for immediate execution</returns>
public UInt64 GetControlTime()
{
return ControlAction_getControlTime(self);
}
/// <summary>
/// Gets the tome of control execution as data time offset.
/// </summary>
/// <returns>The control execution time as data time offset.</returns>
public DateTimeOffset GetControlTimeAsDataTimeOffset()
{
return MmsValue.MsTimeToDateTimeOffset(GetControlTime());
}
/// <summary> /// <summary>
/// Gets the client object associated with the client that caused the control action /// Gets the client object associated with the client that caused the control action
/// </summary> /// </summary>

@ -113,7 +113,7 @@ namespace reporting
if (rcb3.IsBuffered()) if (rcb3.IsBuffered())
Console.WriteLine ("RCB: " + rcbReference3 + " is buffered"); Console.WriteLine ("RCB: " + rcbReference3 + " is buffered");
rcb3.InstallReportHandler(reportHandler, rcb2); rcb3.InstallReportHandler(reportHandler, rcb3);
rcb3.SetOptFlds(ReportOptions.REASON_FOR_INCLUSION | ReportOptions.SEQ_NUM | ReportOptions.TIME_STAMP | rcb3.SetOptFlds(ReportOptions.REASON_FOR_INCLUSION | ReportOptions.SEQ_NUM | ReportOptions.TIME_STAMP |
ReportOptions.CONF_REV | ReportOptions.ENTRY_ID | ReportOptions.DATA_REFERENCE | ReportOptions.DATA_SET); ReportOptions.CONF_REV | ReportOptions.ENTRY_ID | ReportOptions.DATA_REFERENCE | ReportOptions.DATA_SET);

@ -31,13 +31,22 @@ namespace server1
IedServer iedServer = new IedServer (iedModel, config); IedServer iedServer = new IedServer (iedModel, config);
iedServer.SetCheckHandler(spcso1, delegate(ControlAction action, object parameter, MmsValue ctlVal, bool test, bool interlockCheck) {
Console.WriteLine("Received binary control command:");
Console.WriteLine(" ctlNum: " + action.GetCtlNum());
Console.WriteLine(" execution-time: " + action.GetControlTimeAsDataTimeOffset().ToString());
return CheckHandlerResult.ACCEPTED;
}, null);
iedServer.SetControlHandler (spcso1, delegate(ControlAction action, object parameter, MmsValue ctlVal, bool test) { iedServer.SetControlHandler (spcso1, delegate(ControlAction action, object parameter, MmsValue ctlVal, bool test) {
bool val = ctlVal.GetBoolean(); bool val = ctlVal.GetBoolean();
if (val) if (val)
Console.WriteLine("received binary control command: on"); Console.WriteLine("execute binary control command: on");
else else
Console.WriteLine("received binary control command: off"); Console.WriteLine("execute binary control command: off");
return ControlHandlerResult.OK; return ControlHandlerResult.OK;
}, null); }, null);

Loading…
Cancel
Save