How to change / Add a new Reading Interval in an RSTAR Program, if there was no reading interval, e.g. for 3 hours (180 minutes), in the existing program.

 

First, open the existing program by CR Basic and add the new Variable   

Alias rstarFlag(6) = rstarHr_3

 

and increase the size of the rstarFlag from (5) to (6)

Public rstarFlag(6) As Boolean, RTUwakeupResponse As String * 70

 

Add 

If rstarInterval = 180 AND rstarFlag(6) = True Then Exit Sub

 

Add 

If rstarFlag(6) = -1 Then
rstarMeasurementInterval ="03:00:00"
rstarInterval = 180
 End If

 

Change For ri = 1 to 6

 

Add

If rstarInterval = 180 AND rstarFlag(6) = True Then Exit Sub

 

Send the new program to CR6 Logger and select the new option by Clicking on the Port / Flags.

 

Then, the DT Logger will update its Interval the next time it synchs with the FlexDAQ. 

Note: If the DT Logger was set at a longer Interval, e.g. 30 Min, before the new Interval is set and the new Interval is shorter, e.g. 10 Min, it will still wait for 30 Mins to synch with the FlexDAQ and then the next cycle will be every 10 Mins. 

 

 

‘ RSTAR Program Example‘ 

Public rstarFlag(6) As Boolean, RTUwakeupResponse As String * 70

Alias rstarFlag(1) = rstarMin_10
Alias rstarFlag(2) = rstarMin_30
Alias rstarFlag(3) = rstarHr_1
Alias rstarFlag(4) = rstarHr_6
Alias rstarFlag(5) = rstarHr_12
Alias rstarFlag(6) = rstarHr_3

Sub updateNetworkReadInterval
TotalFlags = 0
For ri = 1 To 6
If rstarFlag(ri) = True
TotalFlags += 1
End If
Next ri
Select Case TotalFlags
Case 1
If rstarInterval = 180 AND rstarFlag(6) = True Then Exit Sub
If rstarInterval = 720 AND rstarFlag(5) = True Then Exit Sub
If rstarInterval = 360 AND rstarFlag(4) = True Then Exit Sub
If rstarInterval = 60 AND rstarFlag(3) = True Then Exit Sub
If rstarInterval = 30 AND rstarFlag(2) = True Then Exit Sub
If rstarInterval = 10 AND rstarFlag(1) = True Then Exit Sub

If rstarFlag(6) = -1 Then
rstarMeasurementInterval ="03:00:00"
rstarInterval = 180
 End If

If rstarFlag(5) = -1 Then
rstarMeasurementInterval ="12:00:00"
rstarInterval = 720
End If

If rstarFlag(4) = -1 Then
rstarMeasurementInterval ="06:00:00"
rstarInterval = 360
End If

If rstarFlag(3) = -1 Then
rstarMeasurementInterval ="01:00:00"
rstarInterval = 60
End If

If rstarFlag(2) = -1 Then
rstarMeasurementInterval ="00:30:00"
rstarInterval = 30
End If

If rstarFlag(1) = -1 Then
rstarMeasurementInterval = "00:10:00"
rstarInterval = 10
End If

Call wakeRTU
Delay (0,500,mSec)
SerialOut (ComC1,"INTW "+ rstarMeasurementInterval + CHR(13),"",0,100)
Delay (0,500,mSec)
SerialFlush(ComC1)
SerialClose (ComC1)
Delay (0,500,mSec)
Case Else
For ri = 1 to 6
rstarFlag(ri) = False
Next ri

If rstarInterval = 180 AND rstarFlag(6) = True Then Exit Sub
If rstarInterval = 720 Then rstarFlag(5) = True
If rstarInterval = 360 Then rstarFlag(4) = True
If rstarInterval = 60 Then rstarFlag(3) = True
If rstarInterval = 30 Then rstarFlag(2) = True
If rstarInterval = 10 Then rstarFlag(1) = True

End Select
 EndSub