hschir Posted March 20, 2012 Author Share Posted March 20, 2012 It seems you've abandoned me on this one ? Link to comment Share on other sites More sharing options...
BeeHay Posted March 20, 2012 Share Posted March 20, 2012 Can he do something like this? FTP.strServer = "ftp.server.com"FTP.strUserName = "username"FTP.strPassword = "password"FTP.Timeout = 10000while(1) Page.Capture("data", "C:\data.jpg") FTP.strLocalFile = "C:\data.jpg" FTP.strRemoteFile = "/data/stuff/data.jpg" FTP.Upload() delay(0.5) Page.Capture("data2", "C:\data2.jpg") FTP.strLocalFile = "C:\data2.jpg" FTP.strRemoteFile = "/data/stuff/data2.jpg" FTP.Upload() delay(0.5)//ect with other pages...endwhile[/CODE]Multiple upload calls from one sequence?? Link to comment Share on other sites More sharing options...
AzeoTech Posted March 20, 2012 Share Posted March 20, 2012 No, of course not, but sometimes there are other things going on that delays my response. Start simple. Capture one jpg and transfer it up every 5 minutes. See if it stumbles at all. Use the function. Add: ? "To transfer: " + ftp.bytesToTransfer + ", Transfered: " + ftp.bytesTransfered just before delay(0.1) in the function. Then watch the Command/alert window. Consider adding some other debugging ? statements, like ? "Entering sendFTP()" and ? "Exit sendFTP()", and perhaps "FTP FAILED!" at the appropriate spots in the function. This should allow you to debug what is going on. If you continue to have troubles, we should just do a remote support session as its impossible for me to reproduce how your FTP server responds. To do this, email us directly at the support@ email. Also, you probably should put the Log_FTP code (without the while()) inside the A_Page_Upload loop instead of in its own loop, otherwise the two may conflict every 24 hours. Link to comment Share on other sites More sharing options...
hschir Posted March 20, 2012 Author Share Posted March 20, 2012 I quite understand - thanks for being so candid I have to say I know that you sell the attributes of DAQConnect quite regularly through your posts which is the reason why I checked it out. The problem for me is transparancy: Firstly I can only have two feeds to upload - and I don't want to go there. Secondly - I have to do an entire HMI for my invited guests when I've already one in DAQFactory - so this seems to me duplication of work - and a tedious aspect at that - and I dont want to go the trails and tribulations of that - my god it's hard enough getting things to work in a standalone copy of DAQFactory - which I've managed - with some much appreciated input from you. gesti Let me also add - I am PhD student as well and funds aren't forthcoming to test DAQConnect as a solution - so perhaps with the suggestions I've made about what my DAQConnect expectations are - a rededesign consideration might be made as to sale ability - and secondly an unlimited trial for 30 days - and that way you won't have to harp on about - DAQConnect "is the way" Think about it ... Link to comment Share on other sites More sharing options...
hschir Posted March 20, 2012 Author Share Posted March 20, 2012 The problem as I see it is that the transfer of the two strings from the calling sequence to the function never even happens. This is what makes me think that: while(1)//File.Delete("C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\FieldStation.jpg")Page.Capture("EvapTanks","C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\FieldStation.jpg")delay(1)Private string LocalFile = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\FieldStation.jpg"Private string RemoteFile = "/DAQFactory/FieldStation.jpg"//? LocalFile//? RemoteFile?"Entering SendFTP"SendFTP(LocalFile, RemoteFile)delay(0.1)endwhile[/CODE]I put the delay(0.1) at the end because the watch window was reporting an endless loop - the delay fixed that.You'll notice the two comments - the watch window reported the file names correctly - so that assignment worked ok.The watch window also reported "Entering SendFTP" - ok to that point. I can also confirm that the page was captured.Next:[CODE]function sendFTP(string LocalFile, string RemoteFile)? LocalFile? RemoteFile FTP.strLocalFile = LocalFile FTP.strRemoteFile = RemoteFile FTP.upload() private starttime = systime() while (ftp.bytesToTransfer != -1) ? "To transfer: " + ftp.bytesToTransfer + ", Transfered: " + ftp.bytesTransfered delay(0.1) if (systime() - starttime > 30) FTP.Abort() break // transfer failed? endif endwhile[/CODE]I know from previous testing in the sequence that the ? LocalFile and ? RemoteFile do their job, however the watch window still only reports "Entering SendFTP" the strings are not being transferred to the function so the sequence starts all over again going around and around in circles, the watch window continuing to report "Entering SendFTP" on each passage of the sequence.There you have it!As to the solution - that's beyond me? Link to comment Share on other sites More sharing options...
AzeoTech Posted March 20, 2012 Share Posted March 20, 2012 You probably have a typo, the most likely being that you didn't name the sequence "sendFTP". Can you send the .ctl doc. Also, watch your indentation. Link to comment Share on other sites More sharing options...
hschir Posted March 20, 2012 Author Share Posted March 20, 2012 That's it. Bravo ! Link to comment Share on other sites More sharing options...
hschir Posted March 20, 2012 Author Share Posted March 20, 2012 Here's the final code: while(1)Page.Capture("EvapTanks","C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\FieldStation.jpg") Private string LocalFile = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\FieldStation.jpg" Private string RemoteFile = "/DAQFactory/FieldStation.jpg"SendFTP(LocalFile, RemoteFile)Page.Capture("LJ_Sys_Status","C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\LabJack.jpg") Private string LocalFile = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\LabJack.jpg" Private string RemoteFile = "/DAQFactory/LabJack.jpg"SendFTP(LocalFile, RemoteFile)Page.Capture("EvapCab","C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\LabStation.jpg") Private string LocalFile = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\LabStation.jpg" Private string RemoteFile = "/DAQFactory/LabStation.jpg"SendFTP(LocalFile, RemoteFile)Page.Capture("WeatherStation","C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\WeatherStation.jpg") Private string LocalFile = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\WeatherStation.jpg" Private string RemoteFile = "/DAQFactory/WeatherStation.jpg"SendFTP(LocalFile, RemoteFile)Page.Capture("LoggingPanel","C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\Logging.jpg") Private string LocalFile = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\Logging.jpg" Private string RemoteFile = "/DAQFactory/Logging.jpg"SendFTP(LocalFile, RemoteFile)Page.Capture("TO1_Graph","C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\TO1_Graph.jpg") Private string LocalFile = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\TO1_Graph.jpg" Private string RemoteFile = "/DAQFactory/TO1_Graph.jpg"SendFTP(LocalFile, RemoteFile)Page.Capture("TO1_ST_Graph","C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\TO1_ST_Graph.jpg") Private string LocalFile = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\TO1_ST_Graph.jpg" Private string RemoteFile = "/DAQFactory/TO1_ST_Graph.jpg"SendFTP(LocalFile, RemoteFile)Page.Capture("TO2_Graph","C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\TO2_Graph.jpg") Private string strLocalFile = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\TO2_Graph.jpg" Private string RemoteFile = "/DAQFactory/TO2_Graph.jpg"SendFTP(LocalFile, RemoteFile)Page.Capture("TO2_ST_Graph","C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\TO2_ST_Graph.jpg") Private string strLocalFile = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\TO2_ST_Graph.jpg" Private string RemoteFile = "/DAQFactory/TO2_ST_Graph.jpg"SendFTP(LocalFile, RemoteFile)Page.Capture("TO3_Graph","C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\TO3_Graph.jpg") Private string strLocalFile = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\TO3_Graph.jpg" Private string RemoteFile = "/DAQFactory/TO3_Graph.jpg"SendFTP(LocalFile, RemoteFile)Page.Capture("TO4_Graph","C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\TO4_Graph.jpg") Private string strLocalFile = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\TO4_Graph.jpg" Private string RemoteFile = "/DAQFactory/TO4_Graph.jpg"SendFTP(LocalFile, RemoteFile)Page.Capture("Solar_Graph","C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\Solar_Graph.jpg") Private string LocalFile = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\Solar_Graph.jpg" Private string RemoteFile = "/DAQFactory/Solar_Graph.jpg"SendFTP(LocalFile, RemoteFile)Page.Capture("RH_Graph","C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\RH_Graph.jpg") Private string LocalFile = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\RH_Graph.jpg" Private string RemoteFile = "/DAQFactory/RH_Graph.jpg"SendFTP(LocalFile, RemoteFile)Page.Capture("Wind_1_5_Graph","C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\Wind_1_5_Graph.jpg") Private string LocalFile = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\Wind_1_5_Graph.jpg" Private string RemoteFile = "/DAQFactory/Wind_1_5_Graph.jpg"SendFTP(LocalFile, RemoteFile)Page.Capture("Wind_0_1_Graph","C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\Wind_0_1_Graph.jpg") Private string LocalFile = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Pages\Wind_0_1_Graph.jpg" Private string RemoteFile = "/DAQFactory/Wind_0_1_Graph.jpg"SendFTP(LocalFile, RemoteFile) delay(0.1)endwhile[/CODE]And the function:[CODE]function sendFTP(string LocalFile, string RemoteFile) FTP.strLocalFile = LocalFile FTP.strRemoteFile = RemoteFile FTP.upload() private starttime = systime() while (ftp.bytesToTransfer != -1) delay(0.1) if (systime() - starttime > 30) FTP.Abort() break // transfer failed? endif endwhile[/CODE] Link to comment Share on other sites More sharing options...
hschir Posted March 20, 2012 Author Share Posted March 20, 2012 I had to put a delay (30) just after the while (1) statement as the sequence stopped running 2 to 3 minutes after it was started probably because of timing conflicts outside of the sequence with the sequence timing ? Link to comment Share on other sites More sharing options...
AzeoTech Posted March 21, 2012 Share Posted March 21, 2012 1) hard to say why it stopped running, but a delay(30) in your loop is a good idea. Did you get any error messages 2) you don't have to keep redeclaring localFile and remoteFile variables. Better yet, you don't even need them at all. Just put those strings in the sendFTP() call. Link to comment Share on other sites More sharing options...
hschir Posted March 22, 2012 Author Share Posted March 22, 2012 I put all of the strings into the FTP call - works fine. I found one timing issue in one of my channels which I'd set Link to comment Share on other sites More sharing options...
hschir Posted March 22, 2012 Author Share Posted March 22, 2012 Sorry about that - finger problem, As I was saying one of my channels presented a timing problem as it was set to sample 1000 at 0.001 s intervals and DF (or LJ) didn't like that much, but when I sampled at 0.1 s that problem went away. I did get a Modbus-RTU lockout message - I don't know what that's about ? Link to comment Share on other sites More sharing options...
AzeoTech Posted March 22, 2012 Share Posted March 22, 2012 Yeah, you can't really soft poll at 0.001. Its just too fast for Windows. You can get away with it on a multi-core system if you design it well, but its generally not recommended. Streaming is a better choice for high speed acquisition. As for the Modbus error message, I'm assuming its "Port Locked". That just means the system was busy trying to do a Modbus query when another came through. The system remained busy (the port locked) for the entire time out period of the port. If you just get one every once in a while its probably not an issue, though an output may not get set. If you get them all the time, you need to reevaluate your Modbus timing. Link to comment Share on other sites More sharing options...
hschir Posted March 22, 2012 Author Share Posted March 22, 2012 The Modbus is queried at 10 second intervals. Link to comment Share on other sites More sharing options...
AzeoTech Posted March 22, 2012 Share Posted March 22, 2012 Right, but if the queries are slow and take more than 1 second to complete them all (assuming your timeout is set to 1 second), then the port is blocked for too long. Link to comment Share on other sites More sharing options...
hschir Posted March 22, 2012 Author Share Posted March 22, 2012 Maybe you can advise me here ... The Modbus-RTU uses the serial port to query a Davis Vantage Pro Modbus gateway. The gateway polls the serial output of the weather station console. The weather station console outputs the current weather data at 10 second intervals. These are stored in the gateway registers each of which DAQFactory queries for data. Attached is a screen shot of the channels setup for the Modbus channels. Any suggestions ? Link to comment Share on other sites More sharing options...
hschir Posted March 22, 2012 Author Share Posted March 22, 2012 By timeout - I'm assuming you mean "Offset" - if not - where is timeout set ? Link to comment Share on other sites More sharing options...
AzeoTech Posted March 22, 2012 Share Posted March 22, 2012 You shouldn't get portLocked errors with that setup if that is the only Modbus comms you are doing (and the only comms you are doing on the port) Link to comment Share on other sites More sharing options...
AzeoTech Posted March 22, 2012 Share Posted March 22, 2012 Timeout is a comm port parameter. Link to comment Share on other sites More sharing options...
hschir Posted March 22, 2012 Author Share Posted March 22, 2012 Here's the Command/Alert window screenshot - fyi. I'm thinking that this is the reason behind my ftp upload failures even with the delayed start I have inserted into that sequence ? Link to comment Share on other sites More sharing options...
hschir Posted March 22, 2012 Author Share Posted March 22, 2012 yes it is the doing only comms I'm doing on that port ! Link to comment Share on other sites More sharing options...
AzeoTech Posted March 22, 2012 Share Posted March 22, 2012 I didn't get a screenshot. Link to comment Share on other sites More sharing options...
hschir Posted March 22, 2012 Author Share Posted March 22, 2012 That's the only Modbus I'm doing... The LabJacks are communicating via my wifi network - but I doubt that would be an issue ? Link to comment Share on other sites More sharing options...
hschir Posted March 22, 2012 Author Share Posted March 22, 2012 Oops - forgot to attached the file - duh? Link to comment Share on other sites More sharing options...
AzeoTech Posted March 22, 2012 Share Posted March 22, 2012 The LabJack isn't going to affect Modbus. Looks like you get one port locked. Just ignore it. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.