Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.

### TimeIntoInterval, even hour mystery!

VMK Jan 26, 2023 07:52 AM

Hi all, newbie here,

I've build a storage CO2 measurement setup for three layers. I've one gas sensor and three valves to arrange that. All seems to be going great, except in start of the every hour the 1st layer measurent "flag" gets stuck to "true"-position.

In datatable I have the CO2_Flag_Measured_2m "-1" for 89 sec after every even hour. After that cycle AOK, table showing "-1" only once per measuring cycle. Non of the other layers have this problem.

What's going on? "TimeIntoInterval"-part of the code below:

```   'measure port1
If TimeIntoInterval(0, 270,sec) Then Valve_2m = 1 : Flow_2m = Flow
If TimeIntoInterval(89, 270, sec) Then CO2_2m = CO2_Cal : C02_Time_Measured_2m = ICOSTimeStamp : C02_Flag_Measured_2m = 1
If TimeIntoInterval(90, 270, sec) Then Valve_2m= 0 : Flow_2m = 0 : C02_Flag_Measured_2m = 0

'measure port2
If TimeIntoInterval(90, 270,sec) Then Valve_6m = 1 : Flow_6m = Flow
If TimeIntoInterval(179, 270, sec) Then CO2_6m = CO2_Cal : C02_Time_Measured_6m = ICOSTimeStamp : C02_Flag_Measured_6m = 1
If TimeIntoInterval(180, 270, sec) Then Valve_6m = 0 : Flow_6m = 0 : : C02_Flag_Measured_6m = 0

'measure port3
If TimeIntoInterval(180, 270, sec) Then Valve_12m = 1 : Flow_12m = Flow
If TimeIntoInterval(269, 270, sec) Then CO2_12m = CO2_Cal  : C02_Time_Measured_12m = ICOSTimeStamp : C02_Flag_Measured_12m = 1
If TimeIntoInterval(0, 270, sec) Then Valve_12m= 0 : Flow_12m = 0 : C02_Flag_Measured_12m = 0

PortSet (C2, Valve_2m)
PortSet (C3, Valve_6m)
PortSet (C4, Valve_12m)```