So I decided to start a project where I was looking to time the opening and closing of a contactor and a circuit breaker.
The basic idea is the contactor puts an earth fault on to the system and the circuit breaker then has to clear it. Both the contactor and the circuit breaker have auxiliary contacts which can be used to measure when they are open or closed.
My idea was:
When the contactor closed onto the earth fault I would take a note of the current time with "micros"
Then when the circuit breaker opened i would take a note of that time again with "micros", subtract the two and i would have the tripping time.
The problem is that when the relay is closed it keeps resetting the currentTime so when the circuit breaker does open the value I'm recording is incorrect.
Any ideas how I can resolve this? I was considering the "for" command but I have not used this before. or to get it stuck in a loop as soon as RelayState goes HIGH
if(RelayState== HIGH) {
currentTime = micros();
}
if(CBState== HIGH){
currentTime2 = micros();
TripTime = currentTime2 - currentTime;