UBC Flume

From UBC Wiki

Introduction

Motivation

The purpose of this page is to troubleshoot instrument, software, and hardware issues in the UBC Mountain Channel Hydraulics Experimental Laboratory.

18m Flume: General Operating Notes

Check the level of the main sump tank every 1 or 2 weeks. This is accessed through the locked floor hatch. Water is continually be lost to leaks and evaporation. Water is added to the system by attaching one end of the 2 fire hoses to the large valve at the back of the lab and the other to a short diverter pipe that is clamped to the edge of the discharge tank. Check the level in the large sump tank as water is added.

When turning on the flow at the beginning of each run, start at a low flow rate<5 l/s (~19.0Hz on controller), then slowly increase flow until desired flow is achieved (5 l/s every 30 s, 0.5 Hz on controller). The flow rate tends to creep upward over the initial 5 to 10 minutes, so the frequency on the controller will need to be adjusted every 30 to 60 sec.

Use a timer on the screen to monitor start and stop times. Get the light table software running, but not collecting, when starting a run. It can be useful to have 2 people during the run, 1 can be adjusting the flow, while the other is doing water surface measurements.

When turning off flow, ramp down the flow (1.0 Hz every 30s). When flow is below ~25 l/s, hit the 'Stop' button.

Instrument

Vectrino (ADV)

Ethernet Allied Cameras

To set up camera need a designated ethernet port and that needs a pile of settings. Go to http://www.alliedvisiontec.com/fileadmin/content/PDF/Products/Technical_Manual/GigE_Install_Manual/AVT_GigE_Installation_Manual.pdf

CORRECTION TO GX CAMERA SET-UP (Note made on 6-11-2014 by SMC)

The instructions from the AVT website are not correct for GX3300 series cameras. Not clear if this correction applies to other series. When specifying the IP Configuration mode under the Vimba Viewer/config portal, specify LLA (link-local address) vs DHCP or persistent. This setting permits the OS to automatically assign an IP address to the camera when it is in use. As a result it is not necessary to assign an IP address; you will see in the Vimba Viewer/config portal that the IP address is greyed out - i.e. being dealt with in the background.

Software

This section includes issues with codes written in LabVIEW.

Light Table

Camera is positioned 95 cm above Light Table

Image Capture

To capture images we use the image_capture_table_tiff.vi. This records the images as tiff in a folder. Each image is a tiff with the file name = capture time. A slider is used to set the frame rate. We store this on a raid drive with all the images typically going in a /images/exp/ folder.

Click "current folder" to start acquisition.

Image Analysis

table_particle_analyzer.vi is the code that processes the images. The main changes to the code since it was set up are the removal of two erosions of the particles, and the removal of the filter. It runs better now.

Things you need are : - A calibration image (tiff with dots on it). About 50 * 50 dots. Same spacing. See labview manual for description of dots and calibration. AEZ finds their dot density a bit high.

- A background image (used to subtract all subsequent images from, should have no particles, but otherwise be identical to the ones collected during testing). Take image with water flowing. Make sure the light table is clean of streaks when you take this image.

- The path to the images.

- The path to the data output. Put this on a drive that will be backed up, as this is what you will keep. The images need to be deleted as they will take up too much hard drive space.

The first time you run it you will need to run the 'select ROI' code. Then draw the area of good data in the window that pops up. This sets the area used for the spatial calibration. It uses a perspective calibration so lens distortion isn't accounted for. This shouldn't be an issue unless the dots are obviously bent in the image.

Another way you can draw the area of good data is within the table_particle_analyzer.vi code itself. You need to draw a new ROI around the points on the calibration grid (it doesn't need to be a square, so you can use the eighth tool down and double click to close). After you process some images, right click and save the image with the new ROI when the VI isn't running. This ROI is then fed to the other one.

There are a bunch of settings on the front panel that need to be set. These should be discussed for each project.

There are also a bunch of rules of thumb about lighting. You want the brightest part of the image to have a pixel value just under 255 when running the capture. You do not want pixels with a value of 255 as these will be saturated. You also need an image as uniformly lit as possible. In reality this is really hard and you just need to get it good enough. See the one in this paper.

Outputs

When processing the code the first bit of code converts the images to text files that have the particle data. At the same time a text file with particle velocities is created. The second bit of code, Qs_calcusubvi_direct.vi takes the particle and velocity data and calculates the sediment transport rates. Then, table_particle_analyzer.vi calls the second bit, or it can be run directly.

The outputted text files include allpartilcesallframes.txt, filenames.txt, image_coordinates.txt, qs_grainsizesummary.txt, and vel_particle.txt.

If the run is particularly long and transport rates are particularly high the number of particles exceeds what can be read into RAM. In this case the first part of the code starts new output files (called 2allparticlesallframes.txt and 2vel_particle.txt). If this happens the qs_batchprocessor.vi can be used to process these text files by calling Qs_calcusubvi_direct.vi.

The 'Qs.txt' file contains the following data: time in seconds (column 1), missing ratio (col 2), velocity in ? (col 3),sd velocity (col 4), number velocity (col 5), bedload transport in g? (col 6), fractional transport (col 7 to 20 with the finest fraction in the left), count stones (col 21), fractional count stones (col 22 to 35 with the finest fraction in the left), D10, D16, D25, D50, D75,D84, D90, D95, Dmax(col 36 to 44). Statistics need to be reviewed. Dmax doesn't agree with largest size fractions measured or counted.

The 'qs_grainsizesummary.txt' file contains bedload transport in grs(col 1), fractional transport (col 2 to 15),D10,D16,D25, D50, D75, D84, D90, D95, Dmax (col 16 to 24), percent finer than (col 25 to 39 from coarsest to finest). There are two extra coarse fractions, coarser than 45 mm.

The vel_particle.txt file contains time in seconds (col 1), coordinates (col 2 and 3, Center mass Y and Center mass X), area of the particle in mm (col 4), baxis (col 5) and particle velocity in mm/sec (col 6).

Batch processor

To speed up the analysis qs_batchprocessor.vi can be used. This program can call one of three programs. It also includes a delay timer (milliseconds to wait) that can be used if you don't want the processing to start until after some specified time (like after a bed scan is finished).

Then the program runs as many times as there are valid data in all eight (8) 1-D arrays. There are four on the left, and four on the right. The program that is called is specified by typing in a number in the bottom right array (Program chooser). A value of 1 will call Qs_calc_subvi_direct.vi, which takes the particle text files and converts them into bedload transport rates. A value of 2 will call table_particle_analyser.vi, as described above A value of 3 will call qs_totalizer, which determines the grain size of the material passing over the light table, but not the amount. This option was added for D. Lutzi, but never used that much.

TO START MAKE SURE ALL THE ARRAYS ARE AT INDEX ZERO. By default they do not appear to be this way.

Select the program you want to call, and fill in the arrays with the necessary information. The four arrays on the left specify the information required for the qs_calc_subvi_direct.vi, while the three upper ones specify the information required for table_particle_analyser.vi. Note that the other information on the front panel also needs to be correct (e.g. max particle size, calibration image path, grain size class breaks.

You need to fill in as many values in the array as you want the program to run. For example, if you want to process three sets of data, all 8 1-D arrays need to have at least 3 inputs. The arrays that are not being used can have anything in them as they won't actually be called. This is because the program indexes through the arrays in a loop and the loop only runs as many times as there are inputs.

Grain Size Based on Coloured Grains

This code enables the user to click on a colored button that matches the color of a grain in the image that has a dot on it. The dot is first randomly located in the image, and then offset from this random location at a fixed grid interval. Key variables are described below.

All of the variables need to be specified before you hit run To run the folder with the images can only have image files.

Rotate Raw Image: This specifies whether or not to rotate the raw image. The dimensions here need to match the description below for number of pixels in the horizontal and vertical. If the code doesn't display an image, try changing this by 90 degrees.

Vertical Offset from flume wall Specifies a distance to buffer the image so the flume wall doesn't get sampled. (in mm)

Along channel offset Specifies a distance along the channel to offset the sampling so edges don't get sampled.

Distance from cart zero to center of image Specifies the difference between the cart position and the center of the camera

Pixels/mm This translates pixels to mm, it is used for roughly locating the images and getting a sense the spacing between the sampling points. It is not used to actually determine the grain size of the images, but only to place the sampling points in about the right location.

number of pixels horizontal (across the flume) This is the dimension of the image across the flume

number of pixels vertically (along the flume) This is the dimension of the image along the flume.

Number of images This is the number of images you plan on processing.

Channel width (mm) This is the width of area across the channel that the sampling should be done in.

Spacing between points This is the spacing between adjacent points. it should be larger than your D100

Distance along flume that will be analyzed This is the length of area along the flume that will be analyzed for the image.

Height/width of window for sub sample image with red dot The original image is sub sampled and a red dot is stuck in the middle. This specifies the size of the subsampled image. It is sub sampled to make it easier to see the red dot quickly.

The number of points across the flume that will make up the grid is determined by: (Channel width-vertical offset from walls)/spacing between points As an example, (1000-50)/70 = 13.57 which is rounded down to 13

The number of points along the flume that will make up the grid is determined by: (Channel length-along channel offset)/spacing between points As an example, (700-100)/70 = 8.57 which is rounded down to 8. For this example there will be 8*13 points per image = 104, which is quite a lot.

Number of images This is the number of images that will be processes. It needs to be correct as it sets the number of times the code loops through images Cart position each image (mm) is the position of the carts when the image was collected. It doesn't have to be correct for the code to run, but it does need to have at least as many values as there are images.

Grainsize.txt gives the image names and the counts for each grain size class starting with the largest, the number of no good is not recorded. Grainsize_linedata.txt is the grain size distribution data for each position along the length of the flume. The first column is the distance along the flume, and after that is the count for each grain size bin. If the order is wrong, try rotating images 180 degrees. The assumption is that images are oriented with the camera bottom at the downstream end of the images. The code starts with the top row in the image, so that is why the data progress down, and then jump up at the next image.

GrainsizeDx.txt is a summary of all the images. The head is below.

Folder name Count less than 64 Count less than 45 Count less than 32 Count less than 22 Count less than 16 Count less than 11 Count less than 8 Count less than 5.6 Count less than 4 Count less than 2.82 Count less than 2 Count less than 1.14 Count less than 1 Count less than 0.71 Count less than 0.5 D10 D16 D25 D50 D75 D84 D90 D95 D99 Cumulative % less than 64 Cumulative % less than 45 Cumulative % less than 32 Cumulative % less than 22 Cumulative % less than 16 Cumulative % less than 11 Cumulative % less than 8 Cumulative % less than 5.6 Cumulative % less than 4 Cumulative % less than 2.82 Cumulative % less than 2 Cumulative % less than 1.14 Cumulative % less than 1 Cumulative % less than 0.71

Scanners

18 m Scanner

For the least troubles with the Parker Motor Control try this. Use ACr-View to move the cart to -50 mm. This is done by connecting to it and enabling it. If you can't connect or enable. Cycle the power and disable and then re-enable ethernet port 7. Then you should be able to connect to it and jog it towards home. Since it will have lost it's location reference when you get close to home use the find home functionality to re-set its location. Then jog it to a position of -50. Next disconnect from the controller and close ACR-View. You should then be able to start a scan in labview.


To calibrate the scanner align the laser so that the laser beam is a single line and the beam being reflected off the glass walls is being reflect back upon itself. Make sure the laser beam is perpendicular to the rails in both the across channel and vertical dimensions. laser power should be fully on.

mount calibration template in flume. Before installing mark where laser line is on floor. Then put calibration template in parallel to laser. Use a light to light up the calibration template so there are no large shadows. See previous ones. Using Measurement and Automation explorer save the calibration image in D:\btsync-worker\18m_Flume\scannerdetails with the file name yyyy_mm_ddcalibrationimage.tif Make sure it is a tif. You may need to adjust the exposure to get a good image. Set it back to 5000 usec when done (this is the exposure used for the scans).

Next start the scanner program. Make sure to select that you need to collect a new ROI. You will also need to change the path of the calibration image and the ROI. To define the ROI you will need to open the sub.vi where the ROI is defined while running the main code, so you are able to see the calibration image in the sub.vi. Stop the main code. Define ROI in sub.vi (manually draw or adjust the polygon on the image with red dots) and run the sub.vi so it will write the new ROI in the existing ROI.txt file provided in the ROI path. Also check that the grid spacing matches the spacing used on the calibration grid. You may want to change the calibration image and ROI default values in main code. This isn't easy though... Need to get to window when code not running and right click on the correct value and select make current value default value.


Outputs include text files.

For example, beddatafinal.txt is a 2D matrix of data with the spacing set by the options in the scan. They are 2 mm* 2mm grids in the CvF case.

The labview scanner plotter programs by AEZ include some useful bits of code for calculating mean slopes and examining the data, but other tools could likely be used.

Stream Table Scanner

Calibrating Scanner

Make sure all three lasers are aligned Mark with a pencil where the laser intersects the bed and the walls. Align the calibration template so the front of the template is in line with the laser and on the edge of the pencil marks. The template is on a piece of foam board. Turn lasers off and add additional light so the image is like the existing calibration templates. To see the image. Open National Instruments MAX (Tools\Measurement and Automation Explorer). Under Devices and Interfaces select NI-IMAQdx Devices. It will take a few seconds to load. Cam0 is upstream and Cam2 is downstream. Adjust the exposure as necessary to get a well lit image with clear dots.

To zoom in and out in labview left click on the mouse to zoom in, shift-left-click to zoom out

Save calibration image in 'Scanner Details' folder with date as per existing.

Do the same for the other camera.

Turn off lights, align a 4' level so it is level at a location in the flume with cover on cart.

Exit out of MAX.

Go to desktop and open Streamtable_scanner_V2_June_2014_2cam.vi. Also open scanner_variables.vi. This stores the global variables. In the Scanner_Project.Lproj expand the dependencies tab and open both Downstream_image_calibration.vi and upstream_image_calibration.vi. These are where the ROI (calibration region of interest) will be set.

In Streamtable_scanner_V2_June_2014_2cam.vi select RUN and select new ROI (Region of Interest). Fill in the necessary details. You should make a copy of an existing ROI file (upstream and downstream) with today's date that will be updated when you set the ROI.

Once the program is running you will need to go the downstream_image_calibration.vi and the bottom left image (red and black; binary). Right click in image and select clear ROI. This will get rid of the existing ROI. Then select the closed polygon tool on the left (9th from top). Start at one boundary and make a polygon that encloses all of the calibration dots, but nothing else. If you need to skip 1/2 dots or some boundary dots because there is other noise issues, that is ok. NIblack deviation factor and the window size can be tweaked to get the dots out of the image, but shouldn't have to. Might need to get better lighting on calibration template. Once the polygon is closed you will see it on the top left image as well and you can confirm it is correct using the pan tool.

you can use the select pointer to adjust points after the ROI is made. Make sure they stay in the window Once you are happy with the ROI push the go and Take ROI (stop) Button. It will then apply the calibration and update the ROI txt file (make sure this is backed up offsite in case of hardware/theft).

The code will then jump to the other upstream_image_calibration.vi. Do the same. Record the Calibration Quality. It should be 1000.00

You can close

5-m Flume Scanner

You can use the instructions in Stream Table Scanner for calibration of 5-m flume scanner.

Notes:

To open the downstream_image_calibration.vi you should open the block diagram (Go to Window and select Show Block Diagram). Click on the icon next to downstream_image_calibration.vi .

When you collect ROI, be sure that the X step and Y step in grid descriptor matches the spacing between the dots of your grid.

The 5-m flume has only a downstream camera so omit instructions regarding an upstream camera.

Flow Meter

Stream table flow Meter

manual at C:\Streamtable\flowmeter\Ultrasonic_flow_meter\Ultrasonic_flow_meter. Settings are M11:60.5 M13:52 M14:PVC M20:0 M23:19 (TS2 trandsucer) M240 (v method) M25: 37.9mm output from system M40 : 1 averages data for 1 second M42L: set with zero flow.

totaliser turned off.

Had a general under prediction of about 12 % at 0.6 L/s initially. Tried W transducer mounting arrangement, but not change and signal strength dropped. Speed of sound checks out. Diameters can't be out 12%. Did a full calibration to develop calibration relation


Set to output 20 mA at 10L/s and 4 mA at 0 L/s;

Carts

18 m Cart

Positive Software Limit

default value for 18 m flume is 14,620 mm

Move Cart

To move cart outside of Labview software, run ACR-View. You will need the admin pwd for this.

New/Open Project: Open Existing Project cart_2

Connect to controller

Select cart_2 | AR-13CE
Click the Connect button. Sometimes this needs to be repeated. If not successful, may need to cycle the power of the controller unit under the platform.

Enable controller

Option 1:
Select cart_2 | AR-13CE | Configuration Wizard | Master 0 | (X) axis 0 | Jog/Home/Limits
Click Enable Drive button. Drive Enabled indicator should be green.

Option 2:
Select cart_2 | AR-13CE | Tools | Jog/Teach Panel | (X) axis 0
Click Enable button. Enabled light should be green

Move cart

Upstream: click and hold Jog Positive button.
Downstream: click and hold Jog Negative button.
Note: The Home position is at the downstream end of the flume.

The cart will move until you release the Jog button or until it detects the physical limit switch at each end of the flume.

Stream Table Cart

Motion Control Wiring

AC120V white to wire 1 going to cart
AC120V black to wire 2 going to cart
AC120V green to wire 3 and shield going to cart
D15pin6 from controller is grd to wire 6
D15pin7 from controller is b1 to wire 7
D15pin8 from controller is b2 to wire 8
D15pin14 from controller is a1 to wire 9
D15pin15 from controller is a2 to wire 10
D15pin1 from controller is +V5Dc and is white
D15pin13 from controller is ground and is black
D15pin3 from controller is C: close limit switch. and is red
D15pin4 from controller is Away: far limit switch. and is green
D15pin5 from controller is Home: home switch. and is green

Limit switches

Uses Zaber NM-T4 home sensors. Wiring is as follows:

Blue wire, limit switch pin 3 goes to controller pin 6 (grd)
Brown wire, limit switch pin 1 goes to controller pin 1 (+5 V)
Black wire, limit switch pin 4 goes to controller pin 2 through 5 depending on which limit is being used.

On controller Home is pin 5, Away limit (upstream end) is pin 4, and back limit (downstream end) is pin 3.

For zaber controller home needs to be negative limit. So green wire heading out to limit switch is connected to home sensor and pin 5 (yellow in break out box near computer). The red wire at the zero end of the flume is connected to the C terminal (pin 3), which will be used to set the zero position. (red wire in break out box near computer). The green wire at the upstream end of the flume is connected to the away limit switch (pin 4) (orange in break out box near computer).