...
The Measuring VI code uses the reading of the valve position from the Response VI (which will be described later in this link), and uses that position to change the level in the "tank".
Incoming File IO
In order to read the valve position for a specific iteration, it must be read into the Measuring VI through a text file. The file that contains the valve position data must be accessed, and it is opened outside the while loop in order to keep the VI running as smoothly as possible (when the file is opened inside the while loop with each iteration, the VIs tend to communicate slower and therefore do not have as long of a run time). When the file is accessed, it takes the last 8 characters from the txt file, which include the width of the number string itself and two end of file characters. The width must be carefully looked at before running, as it is sometimes difficult to get the correct one. If you are receiving an error about how one of the characters is unrecognizable, then it is likely that the width is off. Also, if you check and see while the VIs are running that the valve positions displayed in both VIs do not match, the same issue is present and the width should be altered.
Once the correct valve position string is recorded, it should be converted into a usable number so it can be used in the equations to follow. Finally, the file should be closed when the loop has completed, preferably outside the loop as to not slow things down, but if you want to be able to access the data easier while its running then you can put it back inside the loop.
...
While any equation would work, the equation in place (while the valve is open) for the flow rate is y = 1/4*ex - 2/5, where y is the flow rate in m/s and x is the valve position in turns. 1/4 was chosen as a constant coefficient for leveling out how much the flow increases, and 2/5 is the constant rate of evaporation of the liquid helium.
...
After this equation is performed in LABView, the randomness generator changes the flow rate from the theoretical to a more realistic one, in order to account for viscosity or variations in amounts, etc.The randomness generator uses a standard deviation to return a number that is around the theoretical flow rate, where the average of all the flow rates for each iteration is close to the theoretical.
Note that the when the valve is closed, the case structure is activated and the level decreases at a constant rate of .4 m/s.
Changing the Level
Once the realistic flow rate has been calculated, it is used to change the level of the tank for that iteration. Since the flow rate is calculated in units of m/s, and the time that each iteration lasts is 1 second, the value for flow rate is the same as the amount change of the level for that iteration. This number is then added to the last level of the tank, to become the new level. The new level is then written to the tank, and is also constantly checked to ensure that it is not too high or too low. For instance, if the value becomes less than or equal to zero, the VI stops as the tank is empty. Likewise, if the level is greater than 100, the VI shuts down completely and the level stops changing.
Text File Assembly
Lastly, the text file assembly conveys the data recorded by the Measuring VI into a clear and concise file. At the top of the VI, the text file heading is assembled to indicate the Date, Time, Iteration, Flow Rate, Valve Position and Level. These indicators are collected into a string concatenator and seperated by tabs, and finally followed by a return carriage, which basically enters data into the following line.
Also a part of the text file assembly is the actual collection of the data from the VI. First, the time stamp is recorded and then converted into a string to fill the first two "columns" of data. Next, the iteration number is taken, converted into a string, and fills the third. Then the flow rate is recorded into the fourth column, followed by the valve position, which makes up the fifth. Finally, the new level is recorded into the last column after being converted into a string.
Once the text file has been created and written, and the VI is done running, the text file is closed outside of the loop. It is possible to open the text file while it is still running, but it will only contain the data up to the time you opened it, and will not keep updating while open.
Response VI:
Interface
This is an example of what the Response VI Interface will look like when first opened.
...
Lastly, in the bottom left hand corner of the VI is the option to enable advanced controls for the PID loop. If this icon is selected, the PID gains table will appear to its right. The pid loop uses a PID controller and equation constants to run and maintain the level. Unless you have a deep understanding of these coeffecients and need to make edits to them to increase the VI's efficiency, do not try to change these values. If advanced controls are enabled, .............. At the bottom there is the developer table which ................
Code
...
The entirety of the Response VI code is contained within a while loop, in which each iteration lasts 1 second and which can only be stopped by either an error in either VI (while they are running simultaneously) or if the VI is stopped with the use of the stop bool in the developer box.
Incoming File IO
Connecting to Machinery
Creating the Proportional-Integral-Derivative (PID) Response
- understand all the sections
- visas
...