-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimeRelayFuncB.cpp
More file actions
55 lines (52 loc) · 930 Bytes
/
TimeRelayFuncB.cpp
File metadata and controls
55 lines (52 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "TimeRelayFuncB.h"
TimeRelayFuncB::TimeRelayFuncB()
{
trigger=0;
timeSet=0;
elapsed=0;
enable=0;
switchON=0;
status=0;
NO=0;
NC=0;//1 active, 0 not active
}
bool TimeRelayFuncB::ckIfDN()
{
if (enable)
{
if (switchON && !trigger)
{
status=1;
trigger=1;
}
if (!switchON && trigger)
{
if (elapsed>=timeSet)//Relay will transfer as soon as timer is reaches preset.
{
status=0;
trigger=0;
}
elapsed++;
}
if (switchON && trigger)
{
elapsed=0;
status=1;
}
}else
{
trigger=false;
status=false;
}
return status;
}
bool TimeRelayFuncB::contactsNO()
{
NO=status ? true:false;
return NO;
}
bool TimeRelayFuncB::contactsNC()
{
NC=status ? false:true;
return NC;
}