glaw54 Posted March 1, 2017 Share Posted March 1, 2017 Hi Guru We are trying to calculate the volume of a horizontal tank from the height of the liquid in Daqfactory. I started off with the following simple sequence; global x=0 global h=950 global R=950 While(1) x= 5700 * (R * R * ACos(((R - h)/ R)) - (R - h) * (2 * R * h - h * h)^.5) ?Floor(x/1000000) delay(5) endwhile The sequence initially runs fine (the dimensions are in millimeters, it is a 1600 ltr tank with a radius of 950mm and the fuel height is 950mm ie: its half full and the formula returns 8000 Ltrs. but after 3 or four loops it returns NotaNumber continuously. I am sure its is something simple but why should an identical loop run OK and then change its output. ? Thanks for your help. Link to comment Share on other sites More sharing options...
AzeoTech Posted March 1, 2017 Share Posted March 1, 2017 I don't get that when I try from a blank document. There must be something going on elsewhere in your app that is doing it. Link to comment Share on other sites More sharing options...
glaw54 Posted March 1, 2017 Author Share Posted March 1, 2017 Ok, I tried a blank document and it works fine, so something must be changing a variable value to go outside of whats valid for ACos (0-1?), only using x h & R for testing so changed to longer sensible names and everything work fine in the main app. Just out of interest tried to find what was causing the problem but cannot find reference to those variables anywhere else, is there a way to list all variables and values without going through every sequence and page etc. Main thing is its working so thanks for your prompt help once again. Link to comment Share on other sites More sharing options...
AzeoTech Posted March 3, 2017 Share Posted March 3, 2017 In the newer releases of DAQFactory there is the script dump feature that will dump all your script to a text file that you can open in notepad. Then you could search for those variables. But that could still be tricky since there will be those individual letters inside other words throughout your script. That's why I only use single, and really two letter variable names when they are private and thus local to the running script. I don't use short variable names for global variables ever. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.