- Added triple axis scan command.
- Introduced simulation mode to simdriv and simcter, i.e they never fail and finish at once. - Started defining MAD compatibility commands in Tcl - Fixed a bug in FOCUS_src which caused it to leak sockets. - Introduced setsockopt SO_REUSEADDR to all new sockets in sinqhm in order to loose the next sinqhm error.
This commit is contained in:
32
simcter.c
32
simcter.c
@@ -48,9 +48,9 @@
|
||||
#include "countdriv.h"
|
||||
/*---------------------------------------------------------------------------
|
||||
A SIMCOUNTER HAS a BUILT IN FAILURE RATE OF 10% FOR TESTING ERROR HANDLING
|
||||
CODE.
|
||||
CODE. A negative failure rate means absolute success.
|
||||
*/
|
||||
#define FAILRATE 0.05
|
||||
#define FAILRATE -0.05
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static float SimRandom(void)
|
||||
{
|
||||
@@ -76,6 +76,14 @@
|
||||
pSim = (SimSt *)self->pData;
|
||||
assert(pSim);
|
||||
|
||||
/*
|
||||
no fail, no wait case
|
||||
*/
|
||||
if(FAILRATE < .0)
|
||||
{
|
||||
return HWIdle;
|
||||
}
|
||||
|
||||
if(SimRandom() < FAILRATE)
|
||||
{
|
||||
return HWFault;
|
||||
@@ -159,6 +167,14 @@
|
||||
|
||||
pSim->iPause = 1;
|
||||
|
||||
/*
|
||||
no fail, no wait case
|
||||
*/
|
||||
if(FAILRATE < .0)
|
||||
{
|
||||
return OKOK;
|
||||
}
|
||||
|
||||
if(SimRandom() < FAILRATE)
|
||||
{
|
||||
return HWFault;
|
||||
@@ -220,6 +236,18 @@
|
||||
pSim = (SimSt *)self->pData;
|
||||
assert(pSim);
|
||||
|
||||
/*
|
||||
no fail, no wait case
|
||||
*/
|
||||
if(FAILRATE < .0)
|
||||
{
|
||||
for(i = 0; i < MAXCOUNT; i++)
|
||||
{
|
||||
self->lCounts[i] = (long)rand();
|
||||
}
|
||||
return OKOK;
|
||||
}
|
||||
|
||||
if(SimRandom() < FAILRATE)
|
||||
{
|
||||
return HWFault;
|
||||
|
||||
Reference in New Issue
Block a user