Sanchez Posted July 11, 2008 Share Posted July 11, 2008 Hi Azeotech, I have a strange problem with an Export. I have a sequence that adds data to several channels and then I call a export with those channels. This is the sequence that adds data: if(!isempty(PLANT_KW_TON)) ExportData1.AddValue(PLANT_KW_TON[0] / 100) else ExportData1.AddValue(0) endif if(!isempty(CHLRCAPACITY)) ExportData2.AddValue(CHLRCAPACITY[0]) else ExportData2.AddValue(0) endif if(!isempty(TOT_CHLR_KW)) ExportData3.AddValue(TOT_CHLR_KW[0]/10) else ExportData3.AddValue(0) endif if(!isempty(TOT_CHWPUMPS_KW)) ExportData4.AddValue(TOT_CHWPUMPS_KW[0]/10) else ExportData4.AddValue(0) endif if(!isempty(TOT_CDWPUMPS_KW)) ExportData5.AddValue(TOT_CDWPUMPS_KW[0]/10) else ExportData5.AddValue(0) endif if(!isempty(TOT_FANS_KW)) ExportData6.AddValue(TOT_FANS_KW[0]/10) else ExportData6.AddValue(0) endif if(!isempty(TOTKW)) ExportData7.AddValue(TOTKW[0]/10) else ExportData7.AddValue(0) endif if(!isempty(PERCENT_CAPACITY)) ExportData8.AddValue(PERCENT_CAPACITY[0]/10) else ExportData8.AddValue(0) endif if(!isempty(AVECHWKW)) ExportData9.AddValue(AVECHWKW[0] / 10) else ExportData9.AddValue(0) endif if(!isempty(B )) ExportData10.AddValue(B[0] / 100) else ExportData10.AddValue(0) endif if(!isempty(A)) ExportData11.AddValue(A[0] / 100) else ExportData11.AddValue(0) endif if(!isempty(NOC)) ExportData12.AddValue(NOC[0]) else ExportData12.AddValue(0) endif if(!isempty(DIFF_TEMPERATURE)) ExportData13.AddValue(DIFF_TEMPERATURE[0] / 10) else ExportData13.AddValue(0) endif then I call the Export like this: ExportData13[0,8640] In my computer it works fine, no problem, but I installed DAQFactory on a customers site and the export fails with the error: "The channel doesn't have valid Values" What can be causing this? Why it doesn't work on that particular PC? I am using DF V5.40 on both cases. Thanks. Link to comment Share on other sites More sharing options...
AzeoTech Posted July 11, 2008 Share Posted July 11, 2008 I don't understand what you mean by "call the export". Is ExportData13 a channel or export set (or both)? What are you trying to do in this line: ExportData13[0,8640] Link to comment Share on other sites More sharing options...
Sanchez Posted July 11, 2008 Author Share Posted July 11, 2008 I have another sequence that calls the export after I add data to the channels: beginexport(Data_log2) This is the Expression inside the Export (see attachment) ExportData13[0,8640] Link to comment Share on other sites More sharing options...
AzeoTech Posted July 11, 2008 Share Posted July 11, 2008 That makes more sense. Go through each of the channels in your export set and make sure it has data. Also make sure that the time on the data is correct. Link to comment Share on other sites More sharing options...
Sanchez Posted July 11, 2008 Author Share Posted July 11, 2008 BY doing this every 5 minutes: if(!isempty(PLANT_KW_TON)) ExportData1.AddValue(PLANT_KW_TON[0] / 100) else ExportData1.AddValue(0) endif Am I not making sure there is data in the channels? I already checked and all the channels in the export are being updated. I am not sure if that takes care of the timing too. Thanks. Link to comment Share on other sites More sharing options...
AzeoTech Posted July 11, 2008 Share Posted July 11, 2008 It depends: ExportData1.AddValue(0) will use the current system time because you didn't specify any time, but: ExportData1.AddValue(PLANT_KW_TON[0] / 100) will use the time of PLANT_KW_TON[0], and I don't know what that is. Link to comment Share on other sites More sharing options...
Sanchez Posted July 11, 2008 Author Share Posted July 11, 2008 Ok, but I still don't understand what effect has the channel time on the Export, can you explain what condition would make it fail? Link to comment Share on other sites More sharing options...
AzeoTech Posted July 11, 2008 Share Posted July 11, 2008 It has to do with alignment. Depending on the export set settings, the data will be aligned so that it can be on consistent rows. The data is aligned to the first expression in the export set. The problem is that if there is no overlap in time between the first expression and one of the other expressions, you end up with no data in that expression and thus your error. This same thing can happen if your align threshold is too tight. I'm not saying this is the problem, but its a good start. Take a look at the details page of the export set and see what it says, maybe posting a screenshot. Link to comment Share on other sites More sharing options...
Sanchez Posted July 11, 2008 Author Share Posted July 11, 2008 Ok, here is a screen shots of the details.... Link to comment Share on other sites More sharing options...
AzeoTech Posted July 11, 2008 Share Posted July 11, 2008 Yes, you have Alignment selected. Try selecting "Fixed Interval", put the interval at whatever your timing loops are at (or try 0 first), and select Snapshot. Link to comment Share on other sites More sharing options...
Sanchez Posted July 11, 2008 Author Share Posted July 11, 2008 Ok, I'll try that. Link to comment Share on other sites More sharing options...
Sanchez Posted July 17, 2008 Author Share Posted July 17, 2008 I used this settings (see attachment) and the export generates only one line of data, but the channels have several values in persist memory. Why it doesn't bring all the persist data? Link to comment Share on other sites More sharing options...
AzeoTech Posted July 18, 2008 Share Posted July 18, 2008 I'm not sure, but I would consider using the File. functions instead of the export set. This gives you total control. You'd have to combine your data into a single big array and then write it out using the file.writedelim() function. To combine the data, just create a loop (I'll assume you have 13 channels named exportdata0 to exportdata12): private bigarray bigarray[][0] = exportdata0.time[0,3600] for (private x = 0, x < 13, x++) bigarray[][x+1] = evaluate("exportdata" + doubletostr(x) + "[0,3600]") endfor // at this point we have a big two dimensional array, with time in the first column, now write to file: private handle = file.open("c:\myfile.csv",0,1,0,1) file.writedelim(handle,bigarray,",",chr(10)) file.close(handle) That's it. The first part puts all the data in a big block. The second part writes it to file using just three lines of script. The other advantage to this is that you can better format your data. For example, lets say you wanted to put your date in human readable format instead of raw DAQFactory time, and you want the first 6 channels to have 2 decimals, and the rest to have 1. First thing is that I make bigarray into a string array instead of just numbers, that way I can do the formatting. Then its basically the same thing: private string bigarray bigarray[][0] = formatdatetime("%c",exportdata0.time[0,3600]) for (private x = 0, x < 13, x++) bigarray[][x+1] = format("%." + iif(x < 6,"2","1") + "f", evaluate("exportdata" + doubletostr(x) + "[0,3600]") endfor // at this point we have a big two dimensional string array, with time in the first column, now write to file: private handle = file.open("c:\myfile.csv",0,1,0,1) file.writedelim(handle,bigarray,",",chr(10)) file.close(handle) Basically I just added some formatting commands. Notice how I used the iif() function to do either "%.2f" or "%.1f" in the format depending on x. Of course you can use regular if statements too, but the inline if will process faster. Link to comment Share on other sites More sharing options...
anekut Posted July 19, 2008 Share Posted July 19, 2008 it works! thanks. looking forward to using labjacks/daqfactory extensively. Link to comment Share on other sites More sharing options...
Sanchez Posted July 30, 2008 Author Share Posted July 30, 2008 Hi, When I created a log file with direct file functions, I still got an error. Somehow the channel didn't have any values which is weird because the same application has worked before. However, when generating the log from a sequence I got an Alert telling my exactly on which line the error was and therefore I knew which channel was giving problems. I crated a new channel with the same characteristics, replaced it and it worked. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.