Strings stored in Test and Virtual Channels


Recommended Posts

A problem that was never resolved was the "wrapping" of string values in Test and Virtual channels:

Posted Under Title "Attempt at Readable Date & Time"

Still having a similar problem as I reported previously, with reliably getting

another STRING into a Virtual Channel.

See attach 09_140_wind_compass_test_6min.csv file,

The first set of columns are for an export file, exported every 6 minutes

using *chan[0] referencing,

The 2nd set of columns are for data exported with a test export set

using *chan[] referencing, i.e., from the histories.

The two files were merged to show the disparity between the V.W_compass string values.

The exported data match for everything, EXCEPT for the string V.W_compass data,

which wraps around about every hour. This is about the same problem I had with

the previous attempt at a readable Date_time Virtual channel.

Note:

There was a disparity in sign. digits. between the two export sets, so some mismatch.

V.w_compass_i historical data values match +-

v.w_compass[] historical data STRINGS do NOT match

I've played around with trying to get something similiar to the working

(FormatDateTime("%m/%d/%y %H%M", (W_dir.Time[] -15)))

in V.date_time channel expression window.

for the V.w_compass channel's expression window, to putch in something like

compass_rose[V.w_compass_i[]]

played around with straight () and {} in various combinations.

but DF doesn't like any of them. No time associated with compass_rose[]????

Running DF 5.80 and 5.81 on two different machines.

Any hints?????????????????

v.w_compass is READ/Output with other export sets as [0] and [0,10]

as are almost all other channels. Final goal is to output 24 hrs of data at

the end of each day with [0,239] export set (equiv. to [].)

CODE SNIPPETS follow:*************************

//*******

//R_count_extern snippet Assigning wind compass stuff Done every 6 minutes.

//ALL channel's times are the same, and this is the ONLY ROUTINE THAT does

//*.addvalue to affected channel(s)

Private String xxx

Private valx

// add wind direction compass 08 May 09

// below about 0.5 to 1.0 mph, Davis direction N.G.

valx =V.w_mph[0]

if (valx <=0.5)

valx =(-100) // set for calm

else

valx =W_dir[0] // otherwise putch in real

endif

// sets global var w_c_i to compass index

xxx =Wind_compass(valx) // call routine to give us compass rose string

V.W_compass.AddValue(insertTime(xxx, R_count.Time[0], 0))

V.W_compass_i.AddValue(insertTime(w_c_i, R_count.Time[0], 0))

//*********<<<< End R_count_extern snippet

//*******

function Wind_compass(dir) // snippet

Global w_c_i

Global string compass_rose[]

// 17 May 09 renamed var from compass to compass_rose

// shifted everything up by 1, so can have easier to use Max, Min.

Compass_rose[] ={"nd"," N","NNE","NE","ENE"," E","ESE","SE","SSE"," S","SSW","SW","WSW"," W","WNW","NW","NNW"," N", "Calm", "o.r."}

// code here

// traps and returns values out of range and returns/sets appropriate values.

// dir here has values between 0 and 370

// account for shift of compass_rose[] by 1 17 May 09

w_c_i =floor((dir +11.25) /22.5) +1 // assign current index value

return(compass_rose[w_c_i]) // return the string

//*********<<<< end wind_compass snippet

Link to comment
Share on other sites

If you have troubles doing more specialized things with Export or Logging sets, you should just drop down and use the file. functions, which will give you total control over what gets logged. These functions are desribed in the Logging section of the User's guide -> Direct File Access

Link to comment
Share on other sites

It is NOT a problem with the logging or export set. It is a problem with channel storing of strings.

The data stored is kewacky. Its kewacky in channel's "table" view. Its kewacky on export.

If the string data weren't kewacky, I could just do a straight export. The only reason I wanted something like

compass_rose[V.w_compass_i[]]

was to get around the problem of kewacky data in the V.w_compass[] channel, since the scalar values in V.w_compass_i are not kewacky.

I'll try to think of another work around.

ek

Link to comment
Share on other sites

Haven't tried with this exact code, but if you will look at "Attempt at readable date & Time" posting, it does occur with real channels, just that the wrap of data was @ at every 16 to 20 entries, vs about 10 for a Virtual channel.

ek

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.