Single site
double volt,curr;
int CL_Time;
#define VERROR 0.003
#define VERRORH 0.005
#define CLAMP_VERROR 0.03
#define IERROR 0.003
#define IERRORH 0.004
#define CLAMP_IERROR 0.03
#define RLY_STON 0.005
#define RLY_STOFF 0.001
#define ON 1
#define OFF 0
#define D_1MS 0.001
#define D_5MS 0.005
#define D_10MS 0.01
#define D_15MS 0.015
#define D_20MS 0.02
#define D_30MS 0.03
#define D_40MS 0.04
#define D_50MS 0.05
#define D_60MS 0.06
#define D_70MS 0.07
#define D_80MS 0.08
#define D_90MS 0.09
#define D_100MS 0.1
#define D_150MS 0.15
#define D_200MS 0.2
#define CLAMP_10UA 10e-6
#define CLAMP_100UA 100e-6
#define CLAMP_1MA 1e-3
#define CLAMP_10MA 10e-3
#define CLAMP_100MA 100e-3
#define CLAMP_500MA 500e-3
#define CLAMP_1A 1.0
#define CLAMP_4V 4.0
#define CLAMP_8V 8.0
#define CLAMP_16V 16.0
#define CLAMP_32V 32.0
#define LOAD2_5 2.5
#define LOAD5 5
#define LOAD10 10
#define LOAD30 30
#define LOAD100 100
#define LOAD300 300
#define LOAD1K 1e+3
#define LOAD3K 3e+3
#define LOAD10K 10e+3
#define LOAD30K 30e+3
#define LOAD100K 100e+3
#define LOAD300K 300e+3
#define LOAD1M 1e+6
#define LOAD3M 3e+6
#define OVC_FVERROR 0.003
#define OVC_FVERRORH 0.004
#define OVC_FVERROR12V3UA 0.005
#define OVI_CLAMP_FVERROR 0.1
#define OVC_FIERROR 0.003
#define OVC_FIERRORH 0.005
#define OVI_CLAMP_FIERROR 0.02
#define OVI_CLAMP_3UA 3e-6
#define OVI_CLAMP_30UA 30e-6
#define OVI_CLAMP_300UA 300e-6
#define OVI_CLAMP_3MA 3e-3
#define OVI_CLAMP_30MA 30e-3
#define OVI_CLAMP_300MA 300e-3
#define OVI_CLAMP_2V 2.0
#define OVI_CLAMP_4V 4.0
#define OVI_CLAMP_6V 6.0
#define OVI_CLAMP_12V 12.
#define PASS "PASS"
#define FAIL "FAIL"
#define SKIP "SKIP"
//__Global_Variable_Section__ End;
//---------------------------------------------------------------------------
USERPROGEXPORT bool __stdcall PVI_P100MAMV_FP100MAMV( bool testResult[4])
{
double? meas[2];
double loLimit,hiLimit;
char *testRltA, *testRltB;
testRltA = testRltB = SKIP;
int activeSite[2];
GetActiveSite( activeSite);// Get Active Site
SetUR(CHT1,ON, D_5MS);//Set User relay on
SetUR(CTR6,ON, D_5MS);//Set User relay on
for (curr=1.0e-2;curr<=3.0e-2;curr+=1.0e-2)
{
PVC_FI(pviChA, curr, 0,PVC_RNG_4V,PVC_RNG_100MA, CLAMP_4V,D_10MS,ON);//? PVC moudle? Force? current and PVC Relay On
meas[0]= PVC_Meas(pviChA, 1,true,FILTER_AVERAGE_ALL,5,D_1MS,0);// measure site 1 PVC voltage value
meas[1]= PVC_Meas(pviChA, 2,true,FILTER_AVERAGE_ALL,5,D_1MS,0);// measure site 2 PVC voltage value
loLimit=(curr*LOAD100)-CLAMP_100MA*LOAD100*IERROR;//? Campare Low Limit Value
hiLimit=(curr*LOAD100)+CLAMP_100MA*LOAD100*IERROR;//? campare High Limit Value
TEST_VALUEA( meas, loLimit, hiLimit);//? TEST site 1 and site 2 measure value between Low Limit and High Limit
if ( activeSite[0]) //Get Site 1 and Site 2 Pass/Fail Result
testRltA = testResult[0] ? PASS : FAIL;
if ( activeSite[1])?
testRltB = testResult[1] ? PASS : FAIL;
DataLogPrintf( "curr=%e, MeasA=%e, MeasB=%e , lolimit=%e, hilimit=%e,? Site1=%s ,? Site2=%s ", curr, meas[0],meas[1],loLimit,hiLimit, testRltA,testRltB);
//Print to System Data Logger
DebugOut( " curr=%e, MeasA=%e, MeasB=%e , lolimit=%e, hilimit=%e,? Site1=%s ,? Site2=%s ", curr, meas[0],meas[1],loLimit,hiLimit, testRltA,testRltB);
//Print to TextMode Data Logger
|