8
Answers

Duty Cycle Calculation

David Smith

David Smith

11y
1.3k
1

Below I want to calculate a ratio x:5, meaning for every Xminutes you are on, you are off or wait 5 mins to turn back on. On/Off is a complete cycle. Below are three cycles. I am trying to come up with a good way to do this using linq. Basically I am going to return how much time you have to wait or stay off before you start another cycle if that make sense.

So below you have a

ArrayOnOff[0]= "1:00AM On";
ArrayOnOff[1]= "1:01AM Off";
ArrayOnOff[2]= "1:02AM On";
ArrayOnOff[3]= "1:03AM Off";
ArrayOnOff[4]= "1:04AM On";
ArrayOnOff[5]= "1:05AM Off";


CycleId    StateOnOFF

     1            1:00AM        -on
     2            1:01AM        -off
     3            1:02AM        -on
     4            1:03AM        -off
     5            1:04AM        -on
     6            1:05AM        -off
Answers (8)