Commit 80759d43 authored by Claes's avatar Claes

Plc loop options added for policy when execution time exceeds scantime

parent d879e4d3
......@@ -154,6 +154,7 @@ struct plc_sThread {
plc_sArea copy;
io_tCtx plc_io_ctx;
pwr_tBoolean first_scan;
int skip_count;
};
struct plc_sProcess {
......
......@@ -282,6 +282,7 @@ scan (
if (time_Dcomp(&delta, NULL) > 0) {
pwr_tStatus sts;
int phase = 0;
tp->skip_count = 0;
if (tp->csup_lh != NULL) {
pwr_tTime now;
......@@ -322,8 +323,16 @@ scan (
}
break;
} else
} else {
tp->sliped++;
if ( tp->PlcThread->Options & pwr_mThreadOptionsMask_OverExecScanSingle &&
tp->skip_count < 10) {
tp->skip_count++;
break;
}
else if ( tp->PlcThread->Options & pwr_mThreadOptionsMask_OverExecScanAlways)
break;
}
} while (!tp->exit);
......
......@@ -57,6 +57,16 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Plc thread options.
! Specification of the action when the execution time exceeds
! the scantime.
!*/
Object Options $Attribute 36
Body SysBody
Attr TypeRef = "pwrb:Type-ThreadOptionsMask"
EndBody
EndObject
!/**
! Scan time for the plc thread.
!*/
Object ScanTime $Attribute 3
......
!
! Proview $Id$
! Copyright (C) 2005 SSAB Oxelsund AB.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with the program, if not, write to the Free Software
! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
!
! pwrb_td_threadoptionsmask.wb_load -- Defines the enum type ThreadOptionsMask
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! Mask for thread options.
!*/
Object ThreadOptionsMask $TypeDef 53
Body SysBody
Attr TypeRef = "pwrs:Type-$Mask"
Attr PgmName = "ThreadOptionsMask"
EndBody
!/**
! When the execution time exeeds the scantime
! the next scan is always executed.
!*/
Object OverExecScanAlways $Bit
Body SysBody
Attr PgmName = "OverExecScanAlways"
Attr Text = "OverExecScanAlways"
Attr Value = 1
EndBody
EndObject
!/**
! When the execution time exeeds the scantime ten times in
! a row, one scan is skipped.
!*/
Object OverExecScanSingle $Bit
Body SysBody
Attr PgmName = "OverExecScanSingle"
Attr Text = "OverExecScanSingle"
Attr Value = 2
EndBody
EndObject
EndObject
EndSObject
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment