Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To Simulate The Water System a System Simulator is created. The Simulator simulates all the valves, pumps and their respective levels in the tanks. The main thing to consider is that the calculated water levels in the water tanks are based on TorrIcelliTorricelli's Law and the Volumetric Flow Rate Equation, (White, 2011). Simplified these two equation were utilized:

...

Since the simulator is supposed to simulate the system the inputs on the simulator is going to be the samme as the real system. Additionally there has been added the posibility of adding addatives and fertilzers to the main tank, to simulate the addition of those. Reduce the amount of inputs, all valves are added togheter as an array before being sendt to the simulator.  To stop, start or reset the simulator three boolean inputs are needed.

To make the simulator run consistently, delta time is utilized. 


This gives the following inputs, 

...

  • valvePos → ARRAY [0..8] OF BOOL
  • mainTankLevel → REAL
  • growthTankLevels → ARRAY [0..1] OF REAL
  • growthTankLevelSensor → ARRAY [0..1] OF BOOL
  • addativesLevels → ARRAY [0..3] OF REAL
  • pumpAnimator → INT



Coded Solution

Variable Decleration:

Image Added

Image Added


Code:

Image Added

Image Added

Image Added

With the final function block looking like this:


Image Added



References:

White, F.M., 2011. Fluid Mechanics. 7th ed. New York: McGraw-Hill Education. Available at: http://ftp.demec.ufpr.br/disciplinas/TM240/Marchi/Bibliografia/White_2011_7ed_Fluid-Mechanics.pdf [Accessed 27 May 2024].