Comp3132 Advanced 3D Modelling and Simulation. Worksheet 7. Purpose (a) To investigate the modelling of a hydrodynamic system, (b) To verify and validate the model, (c) To conduct simulations of a single-tank and a two-tank model. This is a preparatory step for a full modelling of a hydroelectric power station (next week!!) Files Required Level and Assets: in the folder CBP55_Assets Code: All .uc classes in the folder CBP55 In particular, you will need the script files CBP55_Euler_SingleTank.uc and CBP55_Euler_TwoTank.uc and the UDK levels CBP55_Euler_Lab_SingleTank.udk and CBP55_Euler_Lab_TwoTank.udk. Background This workshop is designed to explore a more abstract system, water flow between tanks. It will provide you with sufficient background to understand the modelling of a hydro-electric power station which we shall cover in the following worksheet. The activities associated with this task are split into two groups (i) A study of a single tank, (ii) a study of two coupled tanks. The theory of these systems is explained in the associated reading material. The material presented here is quite comprehensive, and I expect some of the activities will spill-over into next week. Associated Reading Reservoirs and HydroPower. Activities 0 Setup. Install the code for the single tank and the associated level. Compile the code. Note that complete code for the computation() function has not been included. 1 Writing code Working from the lecture notes and/or the associated reading material, translate the mathematical model for the single tank system into computer code. Take care to add your code into the correct place in the computation() function. Look at the variables which are declared at the top of the class (global variables). Compile. 2 Verification. Load the single tank level and play the level. Observe the change in height of the water in the tank. If it does not behave in a reasonable way, then your code has failed verification. You have probably made an error somewhere. 3 Validation. As explained in the reading material, the height of water in the tank should reach a stable equilibrium value. Make a note of this. (a) How do you think the in and out flows are related in this equilibrium. Look at your log file to check your idea. Calculate the percentage error between the expected and observed outfows (as in previous tasks). (b) The height of the water in the tank when it has reached equilibrium is given by the expression 1 π 2 ππ βπππ’ππππ = 2π ( πΆπ ) Compare this value with your observed experimental value. Calculate the percentage error between these. Are you happy with this? Has the model been validated? (c) [optional] You may wish to repeat (b) for a larger value of deltaT. Does this affect the result? 4 Plan your simulation study. Keep this short! There are several approaches to an interesting simulation study of a single tank. Here are some suggestions. (a) You could change the values of the parameters. Two crucial ones are the in-flow πππ and the exit pipe area a. What effect do these have on the time needed for the height to reach equilibrium? (b) You could investigate what happens if the in-flow suddenly changes, e.g. πππ suddenly doubles or suddenly halves. You would run your simulation until it approaches equilibrium and then change the in-flow at the command line. 5 Prepare for your study. Decide which variables and parameters you need to display on the HUD. Decide which parameters you want to change at the command line. Decide which variables you need to add to the log file. Add code into the appropriate functions to do this. 6 Conduct your simulation study and attempt to make some conclusions from the data you record. You may wish to look at plotting the following graphs: (i) Height of water against time (ii) Outflow against time. Finally, you should make some conclusions from the results of your simulations. 7 Setup the Two-Tanks assets. Install the code for the two-tank and the associated level. Compile the code. Note that complete code for the computation() function has not been included. 8 Writing Code. Working from the lecture notes and reading material, translate the mathematical model for the two-tank system into computer code. Use the single tank code to guide you. Take care to add your code into the correct place in the computation() function. Look at the variables which are declared at the top of the class (global variables). Compile. 9 Verification. Load the two-tank level and play the level. Observe the change in height of the water in the tanks. If they do not behave in a reasonable way, then your code has failed verification. You have probably made an error somewhere. 10 Validation. As explained in the reading material, the heights of water in the tanks should reach stable equilibrium values. Make a note of these. (a) How do you think the in and out flows to each tank are related in this equilibrium. Look at your log file to check your idea. Calculate the percentage error between the expected and observed outfows for each tank (as in previous tasks). (b) The equilibrium heights in the two tanks are given by the expressions β1πππ’ππππ 2 πππ 1 1 = [ 2 2 + 2 2] 2π πΆ12 ππ πΆ2 ππ β2πππ’ππππ 2 πππ 1 = ( 2 2) 2π πΆ2 ππ Calculate the values from these expressions and compare with your experimental results. Calculate the percentage errors. Is the model validated? 11 Plan your simulation Study. Here are a couple of suggestions. (a) Find out what happens if πππ suddenly drops to zero. What happens to the heights and the flows? This corresponds to reservoirs in a drought. (b) You could investigate what happens if the in-flow πππ suddenly changes several times. You would run your simulation until it approaches equilibrium and then change the in-flow at the command line, waiting for a little while before you change it again. 12 Prepare for your study. Decide which variables and parameters you need to display on the HUD. Decide which parameters you want to change at the command line. Decide which variables you need to add to the log file. Add code into the appropriate functions to do this. 13 Conduct your simulation study and attempt to make some conclusions from the data you record. You may wish to look at plotting the following graphs: (i) Height of water in each tank against time (ii) Outflow from each tank against time. Finally, you should make some conclusions from the results of your simulations.