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.


Log in or register to post/reply in the forum.

Rating Lookup Table


ZS Mar 21, 2016 02:19 PM

I've been keeping up with reported rating curves at a few sites by updating the programs with new equations.  However, this has reached what I would consider to be critical mass.  Does anyone have a example program/script that can read in a text file residing on the logger and act like a a lookup table?  Thanks. 


JDavis Mar 22, 2016 03:45 PM

There are multiple ways of doing this. A simple method is to put the data in a text file with a pair of values on each line. A loop is needed to read lines from the file at startup. SplitStr will break the line into two numbers and place them in the array. 

Const MaxCount = 20 'Maximum number of lines in your rating table

Public RatingTable(MaxCount,2)
Dim DataLine As String * 48
Dim LineLength As Long, FileHandle As Long
Dim k As Long

'Main Program
BeginProg
FileHandle = FileOpen ("CPU:RatingTable.csv","r",0) 'Open the csv text file
For k = 1 To MaxCount
LineLength = FileReadLine (FileHandle,DataLine,48) 'The Read Length should be the same as the destination string size
If LineLength > 1 Then
SplitStr (RatingTable(k,1),DataLine,"",2,0)
Else
RatingTable(k,1) = NAN 'Fills missing values with NAN
RatingTable(k,2) = NAN
EndIf
Next k

FileClose(FileHandle) 'Closing the file is important


Scan (1,Sec,0,0)
'Measurements etc. go here

NextScan
EndProg


dandersonncwcd Nov 19, 2020 06:14 AM

I am having a hard time understanding how you would match up the sensor measurements to the values in the text file?

Log in or register to post/reply in the forum.