• No results found

Control and Modeling of Plant Growth

N/A
N/A
Protected

Academic year: 2021

Share "Control and Modeling of Plant Growth"

Copied!
77
0
0

Loading.... (view fulltext now)

Full text

(1)

Degree project in A versatile system for mineral nutrient addition and feed-back

monitoring

BENJAMIN WIESE

Stockholm, Sweden 2011 Automatic Control

(2)

This page is dedicated to those who have helped and sup-ported me in developing and completing my thesis.

Firstly, it would not have been possible for me to work out this thesis if it was not for the thorough and well-founded academic education given to me. Therefore I would like to thank the University of Erlangen-Nuremberg and the Royal Institute of Technology Stockholm, where I conducted this thesis.

Especially, I want thank my professors Dr. H˚akan

Hjalmars-son and Dr. Per-Olof Lundquist (The Swedish University of Agricultural Sciences) for providing me with such an interesting and interdisciplinary topic for my thesis. Through this I was offered the chance to acquaint myself with an application that productively combines the disciplines of biology and engineering.

I also wish to give thanks to my professor Dr. Michael Hanke who guided me in the formal process of aligning my exceptional topic with the requirements of my study program. Without my friend Wim I would have missed some very interesting and helpful discussions and The Godfather - so thanks a lot Wim.

(3)
(4)

Contents

1 Introduction 1

1.1 Motivation and Background . . . 1

1.2 Problem Statement . . . 3

1.3 Outline of the report . . . 6

2 Hardware 7 2.1 Overview . . . 7

2.2 Electromechanical and Mechanical Components . . . 9

2.2.1 Peristaltic Pump . . . 9 2.2.2 Metering Pumps . . . 9 2.2.3 Mixing Pumps . . . 10 2.2.4 Pinch Valves . . . 10 2.2.5 Tubing . . . 10 2.3 Electrical Components . . . 11 2.3.1 PC . . . 12 2.3.2 Power Supply . . . 12 2.3.3 RCD . . . 13 2.3.4 I/O Devices . . . 13 2.3.5 Manual Controls . . . 15

2.3.6 EC Transmitter and Probe . . . 16

2.3.7 pH Transmitter and Probe . . . 17

3 Software 19 3.1 Overview . . . 19

3.2 Algorithm . . . 20

3.3 Operation . . . 21

3.3.1 Calibration . . . 21

3.3.2 Specifying Mixture Ratios . . . 23

(5)

3.3.5 General Program Parameters . . . 26

3.3.6 Plant Configuration Parameters . . . 26

3.4 Program Internals . . . 27

3.4.1 Overview . . . 27

3.4.2 States . . . 29

3.4.3 SubVIs . . . 33

3.5 Setup and Requirements . . . 34

4 Modeling and Simulation 36 4.1 Introduction . . . 36

4.2 Model of Plant Growth . . . 36

4.2.1 Basic Structure . . . 37

4.2.2 Governing Equations . . . 38

4.2.3 Osmotica Balance . . . 38

4.2.4 Fluxes . . . 39

4.2.5 Correlation between States and Measurement Values . . . 40

4.3 Modification of the Model . . . 41

4.4 Implementation . . . 41

4.5 Simulation Results . . . 43

4.5.1 Conditions and Reference Case . . . 43

4.5.2 Examined Application Cases . . . 44

5 Conclusion and Outlook 50

A List of used Components 52

B Circuit Diagrams 55

C Multicable Pin Assignments 58

D File Formats 59

E Step-by-Step Instructions 61

F Datasheets 62

G Model Parameters 68

(6)

List of Abbreviations

C . . . Carbon c . . . concentration

DAQ . . . Data Acquisition Device from National Instruments used for I/O DAS . . . Days After Sowing

EC . . . Electrical Conductivity N . . . Nitrogen

N1 . . . Nutrient stock solution 1 N2 . . . Nutrient stock solution 2

NDS . . . Nutrient Dosing and Delivery System PEC . . . Conductivity Probe

PM1 . . . Mixing Pump 1 PM2 . . . Mixing Pump 2 PN1 . . . Nutrient Pump 1 PN2 . . . Nutrient Pump 2 PPH . . . pH Probe PW . . . Water Pump

RGR . . . Relative Growth Rate RUR . . . Relative Uptake Rate TM . . . Mixing Tank

TN1 . . . Nutrient Solution Tank 1 TN2 . . . Nutrient Solution Tank 2 TP . . . Measuring Tank

VD1 . . . Drain Valve 1 VD2 . . . Drain Valve 2

(7)

Chapter 1

Introduction

1.1

Motivation and Background

The growth of plants is an extremely complex process which is not yet understood in every detail. The basic concepts however are quite well documented and shall be briefly presented before putting forward the aims of this thesis. Please note that details irrelevant for the study at hand are left out for clarity and brevity.

Plant growth depends on both internal genetic factors and external environmental fac-tors. Here only external factors will be considered because they can, to some degree, be

influenced. The most important factors are light, water, carbon dioxide (CO2)

concen-tration, temperature and mineral nutrients (see [TZ10]). When enough light is absorbed

by the leaves of the plant the energy of this absorbed light is used to store CO2 in

car-bohydrates in a process called photosynthesis. These carcar-bohydrates can either be kept in the cell or transported to other parts of the plants. The energy in the carbohydrates can later be released and used. Carbohydrates are also major constituents of the plant cell walls thus allowing the plant to build large structures.

The carbon atoms used in the photosynthesis are taken from the ambient air, which

is why the CO2 concentration in the air is an important factor. During the uptake

of CO2 from the atmosphere through openings in the leaves called stomata there is a

simultaneous loss of water. The relative humidity of the surrounding air therefore plays an important role in the plant’s inevitable trade-off between CO2 uptake and loss of water.

Growth and many other processes in the plant are influenced by temperature since many chemical reactions require a certain temperature in order to work.

(8)

nutrients occur in various inorganic forms dissolved in water. Water is needed because most processes in the plant take place in solution and is also used as a vehicle for mass transport in vessels within the plant.

The role of the mineral nutrients is quite versatile. Nitrogen is a key component together with C, O and H in amino acids that make up proteins of which some act as enzymes to catalyze biochemical reactions. N is also an essential component of DNA, RNA and other macromolecules that make up the cellular machinery.

Among all the above factors, only the factor of available nutrients will be used as a variable in this thesis while all other factors will be regarded as given. The natural growth of a plant assuming abundant nutrients is that after a certain build-up phase the plant starts growing exponentially. However this exponential growth cannot be kept up infinitely. At some point due to self shading, aging and possibly shading of other plants the growth rate declines until at some point the plant stops growing altogether or growth just becomes very slow.

One means of measuring the growth rate, however sometimes criticized, is the Relative

Growth Rate (RGR), e.g. as in [I˚A88]. It is defined as

RGR:= ln(WF(t2)) − ln(WF(t1))

t2− t1

(1.1)

accounting for the biomass (WF) gained between two points in time t1 and t2 relative to

the total biomass. Typically it is calculated per day, having the unit g g-1d-1. The RGR

can be seen as the exponential rate λ if the growth could be described by

WF(t) = WF(0) · eλ·t. (1.2)

Similar to the RGR the Relative Uptake Rate (RUR) is defined as

RU R:= ln(MN(t2)) − ln(MN(t1))

t2− t1

(1.3)

accounting for the relative increase in nitrogen content of the plant (MN).

Both, RGR and RUR, are in practice determined by growing several plants under the same conditions and harvesting representative samples at regular intervals.

(9)

By controlling the addition of nutrients it is thus possible to control the development of the traits under study. The use of a well-controlled system to add nutrients is there-fore a highly interesting task and necessary for obtaining controlled and reproducible treatments in experimental biological research.

One typical type of plant growth experiment includes trying to keep up the exponen-tial part of growth as long as possible or for a certain amount of time. The goal with growing plants at an exponential rate is that it is thought to keep the cellular content of metabolites at a constant concentration so that the cells do not start to perceive any nutrient limitation and begin to produce hormones or express genes in response.

One special case for plant growth at an exponential rate is the so called steady-state

growth, e.g. as defined by Ingestad in [I˚A88]. If the plant is in steady state the RGR

is constant and equal to the RUR. Through controlled nutrient limitation this type of growth is sought to be controlled, usually meaning to be kept up for as long as possible. One important aspect to also consider is the addition of water. Since water is the solute of the mineral nutrients water availability is often excessively high. However, excess water such as prolonged submersion in water can also be negative for the plants and induce new and unwanted developmental processes. For example, excess water is found to inhibit

development of certain root symbioses (N2-fixing root nodule symbioses and arbuscular

mycorrhiza symbioses) that are beneficial for plants.

In order to study plants under nutrient limiting conditions the ability to control the nu-trient supply of a plant in terms of quantity and frequency is indispensable. This poses the motivation for designing a laboratory system with which precisely dosed nutrient solutions can be supplied to several plants independently while keeping the need for hu-man interaction as low as possible.

Furthermore, since plant growth experiments have durations of days to weeks or even months, information about possible results beforehand is valuable. Model-based simu-lation of plant growth promises to give estimates on experiment outcomes as well as provides the possibility to determine suitable parameters in order to obtain a desired outcome.

1.2

Problem Statement

(10)

conclu-sions about nutrient uptake. Moreover possible effects of the treatments carried out with the dosing system on plant growth are to be investigated in simulation. Specifically a potential impact on steadiness of RGR and steady-state growth is to be determined. More precisely, the main objectives are:

• To design and construct a prototype for a device composed of tubes, valves, vessels and pumps capable of mixing nutrient solution with water to obtain a specific concentration and distributing the dilution to a number of up to six individual plant pots.

• To develop a program running on a PC in the software National Instruments

Lab-VIEW to control the setup regulating flow of nutrient solutions to plants. Control

should include mixing of various dilutions and distribution of the diluted solutions to the plants. The control program must offer an easy to use interface allowing the precise prescription of arbitrary time-dependent functions describing concentration and frequency of the nutrient supply of each individual plant. The whole dosing and distribution process must be fully automated without the need for human assistance.

• To include measurement of conductivity of the nutrient solutions to monitor the actual concentrations of the solutions.

• To measure feedback information reflecting how much of the nutrients is taken up (as indicated by conductivity and pH in the water outflow of the substrate of the pot).

• To utilize a dynamic model of plant growth and investigate through simulation how growth can be influenced by the designed dosing system. It shall be determined whether and how RGR and steady-state growth can be effected by the kind of treatments supported by the system.

1.2.1

Hardware Requirements

The hardware setup of the system must fulfill the following criteria:

• Mixed nutrient solution can be delivered to up to six plant pots. For every plant a different solution is mixed.

• The solution can be mixed from two different nutrient stock solutions and water, each stored in a separate container.

(11)

• Measurements are taken in outflow as well as the mixed solution. pH values are measured in a range of at least 4 to 7 and EC values in the range of at least 0.2

mS cm-1 to 10 mS cm-1.

• The user has the possibility to control all valves and pumps via mechanical switches, overriding the signal from the PC. The status of each device is indicated by an LED. • The system features a modular design, i.e. the different components are not per-manently mounted into one housing, but rather movable independently. This way the system can be used in environments of varying geometry.

1.2.2

Software Requirements

These requirements must be met by the system: • Only NI LabVIEW is to be deployed.

• After configuration the program runs fully automatic. No further user interaction is required.

• The user has the possibility to manually set the values of the digital outputs via the interface.

• Parameters are stored in files so that they do not have to be newly defined after every reboot.

• Errors in the program are reported to the user via email and additionally displayed in the interface.

• The program keeps logfiles of measurements and the state of the outputs on a regular, adjustable, basis.

• Parameterized, s-shaped, nutrient-time curves can be used for the treatment of each plant. The curve first starts as constant, then goes into exponential increase and then declines proportional to 1/x. Finally it stays constant again. Each nutrient stock solution has its own parameterized curve.

• Alternatively arbitrary curves can be defined for each nutrient stock solution of each plant. Discrete points of time and corresponding concentration value are listed in a file which is read by the program. The file format should be an easy to use standard format.

1.2.3

Simulation Requirements

(12)

• The model must feature an explicit dependence on the concentration of nutrients in the solution surrounding the roots.

• The simulation has to be able to correctly incorporate the dynamic influence of the designed system on nutrient concentration.

• The simulation should be implemented in Matlab using an appropriate solver.

1.3

Outline of the report

The second chapter gives a description of the hardware setup of the NDS. All main components are described in detail in terms of functionality and interaction with other components. Relevant technical specifications are given along with notes about configu-ration, operation and maintenance where needed.

A discussion of the control software follows in the third chapter. Here the basic structure of the program is explained as well as some implementation details. Used file formats are specified along with installation and configuration notes where required. Information needed for calibrating and operating the system are provided as well.

In the fourth chapter the employed dynamic model is presented along with alterations made to it. Subsequently simulation results are put forward and discussed after specifying model and simulation parameters. Notes on implementation are also given.

The concluding chapter contains a summary of the results obtained during the Master project as well as an outlook on possible future work.

Finally an appendix is provided containing data sheets, connection diagrams, pin tables, component lists, operation instructions and parameters.

(13)

Chapter 2

Hardware

This chapter contains information about all hardware components of the NDS, compris-ing electrical as well as electromechanical and mechanical elements. First an overview will be given, describing the system as a whole and the basic interaction between the components. Then the components will be discussed individually, while technical details will be given in the appendix if required. Note that hardware calibration is discussed mostly in 3.3.1

Many components are assigned a short identifier for simplicity, e.g. PN1 refers to the metering pump transporting the nutrient stock solution in the first storage tank.

A list of all used components together with supplier information is given in Appendix A.

2.1

Overview

The hardware setup of the NDS is made up of a system of pumps and valves connected by tubing. The pumps and valves can either be controlled manually with toggle switches and push buttons (i.e. entirely without the PC) or from the PC using the two I/O devices, called DAQs, which offer digital and analog in- and outputs.

(14)

tank electric pump probe plant pot pinch valve Symbol Table TN1 TN2 TW PM1 PN1 PN2 PW VP0 VP1 VP5 VD1 P0 P1 P5 drain TM storage tanks dosing mixing individual distribution plants EC and pH measurement PPH PEC TP VD2 PM2

Figure 2.1: Schematic diagram of the hydraulic setup

The two nutrient stock solutions (N1 and N2) are stored in the two tanks (TN1 and TN2) located at the top of the diagram. Next to those tanks the storage tank for the water (TW) is depicted. The fluid from each of those three tanks is transported to the mixing tank (TM) by a pump. The pump for the water tank is a peristaltic pump (PW, see Section 2.2.1), while the two nutrient stock solutions are each pumped with small metering pumps (PN1 and PN2, see Section 2.2.2).

A precisely defined amount of each fluid is pumped into TM, where the three fluids mix by means of a mixing pump (PM1). The resulting mixed solution can then be directed to several locations, depending on which valves are opened. This flow is driven by gravity only.

If the drain valve VD1 is opened the solution will flow into the lower measuring tank (probe tank, TP) where pH and EC values are measured by a pH probe (PPH) and a conductivity probe (PEC) respectively.

The other alternative is for the solution to flow to one of the six plant pots, depending on which of the plant valves VP0 to VP5 is opened. Fluid flowing out of the plant pots (outflow) will flow into TP where it can be measured as well.

In order to have a reliable measurement, the solution in TP has to be homogeneous. This is accomplished with another mixing pump (PM2) also located in the measurement tank.

(15)

2.2

Electromechanical and Mechanical Components

2.2.1

Peristaltic Pump

For transporting water from the water tank to the mixing tank the peristaltic pump WP

1000 from Welco was chosen (identifier PW ). It is able to pump 1.95 ml per rotation

while the attached DC motor has a maximum rotational speed of 150 rpm for a supply voltage of 24 V DC at 300 mA. With this the theoretical maximum pumping capacity

accounts for 150 rpm · 1.95 ml = 292.5 ml min-1.

This kind of pump was chosen, because precision requirements for pumping water are only moderate while large amounts will have to be pumped leading to the demand for a relatively large pumping capacity.

The selected internal tubing material of the pump is Pharmed silicon tubing which offers a long service life along with good chemical resistance properties. The inner diameter for the attached suction line of the pump has to be identical to the inner tubing (4.8 mm), whereas that of the outgoing line does not have a big influence (1.6 mm tubing was used). Both, the tubing for the suction line and that for the outgoing line is made of silicone as well.

2.2.2

Metering Pumps

For the nutrient solutions the needs for dosing accuracy are much higher, which is why here the very precise metering pump MCP-50 from Takasago was chosen - one for dosing N1 and one for N2 (identifiers PN1 and PN2 ).

The metering pump works differently from the peristaltic pump: the fluid is pumped in strokes, where each strokes transports a fixed amount of fluid. One stroke is triggered by applying 0 V voltage to the pump for at least 0.125 s and then applying 24 V voltage for at least another 0.125 s. With this the maximum stroke-frequency for the pump adds up to 4 Hz.

The volume transported per stroke can be adjusted between 0.005 ml stroke-1 and 0.050

ml stroke-1 with a screw that’s attached to the pump. Because the pumping capacity of

this pump is quite low, the maximum volume per stroke, 0.050 ml stroke-1, was chosen.

This leads to a maximum pumping capacity of 4 Hz · 0.050 ml stroke-1 · 60 = 12 ml

min-1.

As goes for the peristaltic pump, silicon tubing was also selected for the metering pumps. The tubing with an inner diameter of 1.6 mm is connected to the pumps with thread-to-tube fittings.

(16)

Some more technical specifications about the pump can be found in the data sheet in Appendix F.

2.2.3

Mixing Pumps

For the two mixing pumps PM1 and PM2 a no-name brand pump called Mikro 300 was employed. This pump runs on AC voltage and comes with an own AC/AC converter for 12 V.

The mixing pump PM2 not only serves the purpose of mixing the solution for a stable measurement. It also assures that no air bubbles stick to the electrodes of the EC and the pH probe because the outlet of the pump points directly at the electrodes. Air bubbles could influence the measurement and are thusly unwanted.

2.2.4

Pinch Valves

For controlling the flow through the tubing, solenoid pinch valves were chosen, as they are very simple to attach and replace. But most of all they do not come into contact with the fluid, preventing influence on chemical properties of the fluid and on the material of the valve. The valves were not freely chosen, but were given.

Table 2.1 gives information on which valves were used for which purposes and for which tubing they are suited. All valves require a supply voltage of 12 V DC and are

normally-Identifier Model Manufacturer ID (mm) OD (mm) Power (W)

VP0, VP1 TPV-N040 Takano 1 3 3.6

VP2, ..., VP5 PS-1615W Takasago 1.6 3.2 3

VD1, VD2 PK-4805-NC Takasago 4.8 8 10

Table 2.1: Used valves

closed, meaning that they block the flow when zero voltage is applied and allow free flow when the supply voltage is applied. However, the valves TPV-N040 and PS-1615W also feature a second, normally-open opening. A small piece of tubing should be inserted into these openings in order to ensure proper operation of the valve.

2.2.5

Tubing

(17)

2.3

Electrical Components

The electrical components of the NDS comprise

• devices serving as power supply of other components • devices ensuring personal safety

• devices used for taking measurements in the fluid • devices serving signal processing and control

• electrical circuits driving or connecting other electrical or electromechanical com-ponents

• switches and buttons providing manual control of the system

PC DAQ2 DAQ1 EC transmitter pH transmitter pH probe EC probe valves and pumps manual controls status LEDs power supplies information electric power

Figure 2.2: Schematic diagram of the electrical setup

Figure 2.2 schematically illustrates the interaction between the electrical components. Most electrical circuits however are not represented explicitly. Flow of electrical power as well as flow of information are depicted, indicated by solid and dotted arrows respec-tively. Please note that only schematic connections are shown - the physical connections differ in some cases.

As the figure shows, most devices are powered by external power supplies. However the DAQs are powered by the PC via USB and the probes are powered by their correspond-ing transmitter.

(18)

As mentioned before the pumps and valves are controlled by the DAQs (and thus by the PC) or alternatively via manual toggle switches and push buttons. The DAQ outputs, however, do not drive the pumps and valves directly, but indirectly using transistors. The status of the pumps and valves (on or off) is indicated to the user by red LEDs which are mounted inside plastic cases along with the manual controls and the transistor circuits. The two external power supplies (see below), the RCD (see below), the trans-mitters and terminal blocks for wiring are mounted on a DIN mounting rail which is connected to earth for safety.

2.3.1

PC

Not many details will be given about the used PC as it is not of much importance which PC is used. The only requirements are:

• Microsoft Windows as operating system

• A working version of NI LabVIEW 10.0 installed • Microsoft .NET installed

• Two USB ports

2.3.2

Power Supply

Two external AC/DC power supplies, one 24 V and one 12 V, were used to power the water and dosing pumps, the valves and all external circuitry and the transmitters. The mixing pumps, however, each have their own AC/AC power supply while the DAQs are powered via USB by the PC which has its own power supply.

The negative terminals of both external power supplies and the GND terminals of the two DAQs are connected, creating one common ground, which is also the ground used for the transistors.

24 V DC power supply

The 24 V power supply DR-4524 from Mean Well is used for powering the water pump and the two dosing pumps including the connected driving circuitry. The power supply, featuring 45 W, is sufficient for reliably powering the above components.

12 V DC power supply

(19)

2.3.3

RCD

In order to ensure personal safety, given that the NDS might be used in a building with insufficient residual current protection and given that the power supply might be operated relatively close to the hydraulic part of the NDS, a residual-current device (RCD) was built into the circuit between the mains supply and the two AC/DC power supplies. A two-pole device from Legrand was chosen, featuring a trip current of 30 mA (which is common for personal protection).

Note: the test button should be operated regularly to verify proper operation!

2.3.4

I/O Devices

Two USB I/O devices from National Instruments (Data Acquisition Devices, also called DAQs) were deployed for controlling the pumps and valves from the PC. Furthermore they serve the purpose of transferring EC- and pH measurement values to the PC.

Characteristics

Two different models, only having slightly different features, were chosen: the NI

USB-6009 (identifier DAQ1) and the NI USB-6008 (identifier DAQ2). Both offer two analog

outputs (which are not used), twelve digital I/O ports, which can be configured individ-ually to be in- or outputs, and eight analog inputs.

One difference between the models, although irrelevant here, is the sample rate, which accounts for 10 kS/s in case of the NI 6008 and 48 kS/s in case of the NI

USB-6009. The more significant distinction lies in the resolution of the analog inputs, which

is 12-bit for the NI USB-6008 and 14-bit for the NI USB-6009.

The analog inputs can be operated in single ended or differential mode, where in the latter case voltages in the range of ±20 V can be detected.

The digital ports, when operated as outputs, can be configured as open collector or active

drive. For the open collector configuration an external pull-up resistor can be added to

the internal 4.7 kΩ pull-up resistor of each output to allow a maximum source current of 8.5 mA at 5 V DC. In the active drive mode only 3.3 V DC are provided by the output. Furthermore, the DAQs feature a 5 V DC output which can be used to power external components (in this case some of the transistors).

As mentioned before, the DAQs need no external power supply as they are connected to the PC via USB and are powered solely over this bus. This is why the total current of all digital outputs is limited to 102 mA.

(20)

Usage of the analog ports

Due to the higher resolution, the NI USB-6009 serves as the input for the analog outputs of the EC and pH transmitters (which also feature a resolution of 14-bit). Thus the analog inputs of the NI USB-6009 remain unused. For the assignments of the used analog ports please refer to Table 2.2 and Table 2.4. The inputs are operated in differential mode to detect voltages in the range from 0 V to 10 V.

Usage of the digital ports

In the application at hand all used ports are operated as outputs in open collector mode, allowing 5 V operation.

The digital outputs, which have the peculiarity of outputting a high signal after power-up, are used to switch the pumps and valves on and off. Since the maximum current output is 8.5 mA per port, the devices cannot be switched directly, not even with relays. For this reason transistors are used for switching. To circumvent the problem of the high outputs after power-up (the pumps and valves would all be powered unintentionally in the case of all power supplies being switched on and the control software not yet

being executed) most outputs1 are inverted by using two transistors, with the first one

switching the second. Since the Gate of the second of the two transistors is connected to the 5 V supply over a pull-up resistor the pumps and valves will also not be powered in the case of the DAQs being switched of.

As transistors MOSFETs were chosen, because they offer high flexibility and require less complex circuitry than bipolar transistors. The first transistor directly connected to the DAQ is a small signal MOSFET of the type 2N7000, while the second transistor, offering a maximum drain current of 10 A, is a power MOSFET of the type IRLZ 14PBF. In order to protect the transistors (and also the manual switches) from overcurrent caused by the inductive loads flyback diodes (type 1N 4001 ) were connected in parallel with the loads.

The only output not inverted is P0.1 of DAQ2 - this output switches a change-over relay which is responsible for changing the pumping capacity of PW. This was realized by connecting a potentiometer in series with the pump over one switching path of the relay. Thus, depending on the state of the relay, PW either has the full 24 V available (full speed), or a lower voltage (slow mode) adjustable between 8 V and 24 V via the potentiometer. The output low corresponds to full speed, while a high output will cause the relay to switch, causing the pump to operate in slow mode.

The assignments of the digital outputs are listed in Table 2.3. The circuits connecting the pumps and valves can be found in Appendix B.

1

(21)

DAQ1 pin Device P0.0 VP0 P0.1 VP1 P0.2 VP2 P0.3 VP3 P0.4 VP4 P0.5 VP5 P0.6 PM1 P0.7 VD1 P1.0 VD2 P1.1 PM2 P1.2 (not used) P1.3 (not used) (a)

DAQ2 pin Device

P0.0 PW P0.1 PW speed P0.2 PN1 P0.3 PN2 P0.4 (not used) P0.5 (not used) P0.6 (not used) P0.7 (not used) P1.0 (not used) P1.1 (not used) P1.2 (not used) P1.3 (not used) (b)

Figure 2.3: Connection table for DAQ1 (a) and DAQ2 (b)

2.3.5

Manual Controls

A number of toggle switches and push buttons are available to the user for controlling the pumps and valves independently of the PC. The controls are mounted into two plastic boxes (control boxes) - one for each DAQ - along with the circuits connected to the controls and connecting the DAQ outputs to the pumps and valves. Red LEDs are also mounted inside the control boxes to indicate whether a device is currently turned on or off.

The pumps and valves are connected to the control boxes through pluggable multicables. The pin and color assignments of the plugs and cables can be found in Appendix C. For each of the valves, PM1, PM2, and PW there is a 3-way toggle switch to choose between Automatic, On and Off. In the Off /On position the respective device is turned off/on permanently, independent of the DAQ output. In the Automatic position only the DAQ output controls the device. Additionally there is a 2-way toggle switch for PW, with which the mode can be switched between full speed or slow (see Section 2.3.4) when the 3-way switch is not in the Automatic position.

The metering pumps each have a 2-way switch for choosing between Automatic and

Manual. Additionally each pump has a push button with which strokes can be triggered

(22)

2.3.6

EC Transmitter and Probe

For measuring the electrical conductivity (EC) a 2-electrode conductivity cell from the

BlackLine Lf-GT series in combination with a transmitter of the type ecoTRANS Lf 01,

both from JUMO, are used.

Characteristics and Connection

The electrode features graphite as the electrode material and a cell constant of K = 1.0. Incorporated into the shaft of the electrode is a pt100 temperature sensor. The cable attached to the electrode has consequently four wires: two for the conductivity electrode and two for the pt100. The cable is connected directly to the transmitter. The corresponding connection table is given in Table 2.2.

Terminal Connected to Description

1 AI 0+ of DAQ1 Analog output +

2 - (not connected)

3 AI 0− of DAQ1 Analog output

-4 yellow wire of the electrode cable pt100

5 connected to terminal 6 pt100 (3-wire circuit)

6 green wire of the electrode cable pt100

7 brown wire of the electrode cable Inner electrode

8 white wire of the electrode cable Outer electrode

L− negative terminal of the 24 V supply Supply Voltage

L+ positive terminal of the 24 V supply Supply Voltage

Table 2.2: Connection table for the ecoTRANS Lf 01

The transmitter is responsible for driving the probe. An AC voltage is applied across the conductivity electrodes and the resulting current gives information about the conduc-tivity of the fluid. The pt100 works similarly, only with a DC voltage. The transmitter itself is powered by the external 24 V DC power supply.

Because conductivity depends on temperature, the transmitter performs a so called

tem-perature compensation based on the temtem-perature measured by the pt100. The

compen-sated conductivity value is then passed to the analog output (resolution: 14-bit) of the transmitter, which is connected to one of the analog inputs of DAQ1. Refer to Table 2.2 for the connection table of the transmitter.

Configuration

(23)

be changed with the JUMO ecoTRANS Lf 01/02 setup software. Table 2.3 gives the values of the most important parameters and the values of those parameters that were changed from the factory setting. On the enclosed CD-R the setting files (file ending: .188) for the factory configuration and the actually used configuration can be found.

Category Parameter Value Note

Analog input for conductivity

Meas. range / cell constant

0..2 mS/cm;

K= 1.0

0..20 mS/cm would also be possible with the used electrode

Analog input for temperature

Probe type PT100

Connection circuit 3-wire The 3-wire arrangement reduces noise Analog output

Standard signal 0..10 V Important for compatibility with the DAQ

Scaling start value 0.00 mS/cm This value has to be identical to the value of min ecin the control program*

Scaling end value 2.00 mS/cm This value has to be identical to the value of max ecin the control program*

*

see Section 3.3.5

Table 2.3: Settings for the ecoTRANS Lf 01

Please note that the PC should not be connected to the same power grid as the trans-mitter as long as both are connected by the USB cable (see [JUM07b, p. 12]!

Some more technical specifications about the transmitter and the probe can be found in Appendix F and in [JUM07b], [JUM09], and [JUM10].

2.3.7

pH Transmitter and Probe

The pH measurement is carried out by a transmitter of the type ecoTRANS pH 03 and a single-rod pH electrode from the series 201030. Again both devices are from the manufacturer JUMO.

Characteristics and Connection

Although pH, like conductivity, depends on temperature, there is no temperature sensor used along with the pH electrode. This is because the working temperature range for the application at hand is relatively small (about 18 to 25 degrees Celcius) and the temper-ature used for compensation can be entered manually in the settings of the transmitter. If this value is chosen as the mean value of the range the error will be minimal.

(24)

external 24 V power supply. See Table 2.4 for the terminal assignment of the transmitter. Some more technical information about the transmitter is contained in Appendix F.

Terminal Connected to Description

5 AI 1+ of DAQ1 Analog output +

6 AI 1- of DAQ1 Analog output −

13 Inner Conductor of Probe electrode (reference system)

16 Braiding of Probe electrode (glass electrode)

L− negative terminal of the 24 V supply Power Supply

L+ positive terminal of the 24 V supply Power Supply

All other terminals - (not connected)

Table 2.4: Connection table for the ecoTRANS pH 03

Note that the pH electrode may not run dry, i.e. not be surrounded by fluid for more than a couple of minutes. Otherwise the electrode may be damaged!

Configuration

Unlike the EC transmitter, the pH transmitter can be configured directly using the keys on the device. Settings are changed by navigating through the menu and changing the values of certain parameters. The easiest way to change the parameter values is via the

ADMIN menu. A detailed description of how to accomplish this is given in [JUM08b,

20ff].

Table 2.5 lists the values of those parameters whose values were altered from the default values.

Parameter* Value Description

SENS.T 0 Probe type, set to manual temperature entry

OUT.PH 0..10 V Type of unit signal

SCL.PH 2.00 pH Initial value of scaling. This value has to be identical to the value of min ph in the control program** SCH.PH 8.00 pH Final value of scaling. This value has to be identical

to the value of max ph in the control program** *

as the name is indicated on the display of the device **

see Section 3.3.6

Table 2.5: Settings for the ecoTRANS pH 03

(25)

Chapter 3

Software

The control program for the NDS is implemented in the visual programming platform

NI LabVIEW by National Instruments.

This chapter first gives a brief overview of the program. Then the basic algorithm is presented after which the user interface is explained as well as adjustable parameters and used file formats. Also calibration of some of the hardware components is discussed. Afterwards the internal structure of the control program is explained along with im-plementation details relevant for making changes to the program. Finally the chapter is completed by some notes about requirements and setting up and configuring the software.

3.1

Overview

The control program features two operation modes, Manual and Automatic, which offer different functionalities.

In the Manual mode the user can:

• change the configuration of each plant individually

• change program parameters and parameters of the hardware setup • control and view the status of the digital outputs

In the Automatic mode it is possible to:

• carry out plant treatments fully automatically • keep log files for the treatment of each plant • send notification emails

(26)

3.2

Algorithm

The program follows a strict algorithm for carrying out the plant treatments. It consists of two parts, which are repeated one after another until all plant treatments are finished. The first step, the preparation step, also called scheduling, is the part in the algorithm where the decision is made which plant is to receive a new nutrient dose and when. The second part, called dosing cycle, is the part where the solution for a single plant is mixed, measured and given to the plant. The whole process of conducting the treatments for all six plants in an alternating manner is called treatment sequence.

Since the pH probe must not run dry (see Section 2.3.7) the program takes care that this does not happen. For this a small amount of water is given into the measuring tank whenever necessary (water probes).

In order for one mixed solution or outflow not to influence the measurement of the next one, the tanks are flushed with water in between measurements.

The steps of the algorithm are listed below with the states (see Section 3.4.2) responsible for each step given in parentheses.

Preparation (schedule):

1. If next cycle too far away: water probes

2. Wait for next dosing cycle and if required, drain measuring tank Dosing Cycle for plant X:

1. Flush plant X and measure outflow (flush plant) 2. Drain measuring tank from outflow (drain TP)

3. Flush measuring tank with water and drain it (flush TP) 4. Water probes (water probes)

5. Calculate new dose and mix solution accordingly (mix solution) 6. Drain measuring tank from probe-water (drain TP)

7. Let some of the solution flow into TP and measure (measure solution) 8. Deliver dose to plant X and drain TP at the same time (deliver dose) 9. Flush mixing and measuring tank (flush tanks)

10. Go to Preparation

The Preparation step, also called scheduling, is the part in the algorithm where the decision is made which dosing cycle of which plant to start and when. The program divides the treatment sequence into base steps, where the length of one step is as long as the base interval. While each plant is assigned a dosing interval, which is the time between two dosing cycles of that plant, the base interval is always the smallest of the six dosing intervals. Because the program has the restriction that all dosing intervals must be a multiple of the base interval, it is possible to divide the schedule into steps of the length of the base interval.

(27)

third), but it is important that the time between two cycles for one plant is always the same, the scheduling algorithm inserts waiting periods where plants are not scheduled. The length of these waiting periods is always the time that the last cycle of the plant lasted.

The procedure for determining which plant’s dosing cycle is next is given in pseudocode below:

step = 0;

Do while (not all plants finished) {

Do for plants P = 0 to 5 (skip if not activated) { If (P is scheduled) {

start cycle of P; }

else {

wait for the time the cycle of P would take; }

}

Wait for current step to finish; step = step + 1;

}

3.3

Operation

Everything relevant for using the control program together with the rest of the NDS is explained in this section. For step-by-step operation instructions refer to Appendix E.

3.3.1

Calibration

Before operating the NDS, it should be calibrated properly. Generally, there are two things to be done: calibration of the pumps and determination of the drain-curves of the containers.

Calibration of the pumps

(28)

corresponding parameter is ps water fast. Please note that the temperature of the pump as well as the suction height and tubing material and diameter can influence the pumping capacity.

The capacity of the nutrient pumps is determined in the same way, only instead of time the number of strokes is used. The corresponding parameters are ps nutrients1 and ps nutrients2. The pumping capacity of the metering pumps can be adjusted with the attached adjustment screw. Please refer to the website of the manufacturer for how to use the screw. Just as for the peristaltic pump the suction height and tubing material and diameter can also influence the pumping capacity of the metering pumps.

Determining drain-curves

A drain-curve is a function that for each value of volume (ml) to drain from a specific container gives the time it takes for the volume to drain. A drain-curve has to be created for all six plant valves (to drain from TM), for VD1 (to drain from TM) and for VD2 (to drain from TP). The purpose of a drain-curve is to give the control program information about how long a certain amount of water takes to drain from a certain container through a certain valve.

To determine the drain-curve for a specific container and valve, measure the drain time

t of different volumes V of water (e.g. 100 ml, 200 ml, 300 ml, 400 ml). Then assume V

over t to be a quadratic function and calculate the polynomial of second order that fits it best. The polynomial should look like this

V(t) = a · t2+ b · t + c (3.1)

where the coefficients a, b and c have to be calculated.

This type of equation was chosen, because it turned out to fit the measured data suffi-ciently well.

You can subtract a certain offset from the c-value to obtain a certain safety tolerance (it’s better to assume a too long time than a too short time).

The following formula will finally be used by the control program to calculate t from a given V (reverse function)

t(V ) = −b +

q

b2− 4a(c − V )

2a (3.2)

Please note that tubing diameter has a heavy influence on the drain-curves. Also con-tainer geometry can affect the curves.

(29)

3.3.2

Specifying Mixture Ratios

There are two ways of prescribing the mixture ratio for the mixed nutrient solution of each plant. The most flexible way is to use a custom curve where for each point in time the concentration c(t) of each of the two nutrient stock solutions is given. The second way is to choose the parameters for a so called s-curve. Both methods are described below.

Common to both methods is, that for each nutrient stock solution the percentage in the

mixed solution, cdN 1 and cdN 2 respectively, is given. Formula 3.3 is then used to calculate

the volumes of nutrient stock solution 1, VN1, nutrient stock solution 2, VN2, and water,

VW, which will be pumped into TM and mixed. The parameters amount, c n1 and c n2

are explained in Table 3.2.

VN1 = cdN1·amount c n1 VN2 = cdN2·amount c n2 (3.3) VW = amount − VN1− VN2 S-curve

The standard way of specifying the nutrient concentration depending on time is to use an s-shaped function. This s-curve consists of four phases. The concentration in % (between 0 and 100) is given over the time in seconds.

The four phases are parameterized by the plant configuration parameters (see Section 3.3.6) and are as follows:

• First phase (constant phase): This phase starts at t = 0 with the concentration having the constant value specified in c start

• Second phase (exponential phase): This phase starts at t = t switch1 at the value c start. The concentration then increases exponentially with the rate lambda. This is the formula

c(t) = c start · elambda·(t−t switch1) (3.4)

• Third phase (declining growth rate): This phase starts at t = t switch2 at the final value of the second phase. The concentration still increases, but the first derivative decreases. The formula has three parameters, for which only k can be chosen freely. The other two parameters, C and α, are calculated to fulfill the following constraints:

(30)

2. continuity at t = t switch3 (see fourth phase) This is the formula

c(t) = C − k

t− t switch2 + α (3.5)

• Fourth phase (constant phase): This phase starts at t = t switch3 and has the constant value specified with c final. It ends at t = t end.

Custom curve

If the user chooses to use a custom curve, a file has to be created where the mixture ratios for both nutrient stock solutions are given at different time points. The file is a tab-separated CSV file (see Appendix D) which contains three rows: the first row lists the time points in seconds separated by tabs. The second row contains the amount of the first nutrient stock solution in percent (a value between 0 and 100) corresponding to the time point. The third row contains the values for the second stock solution.

The program will interpolate linearly between time points. An example of a custom curve file is the following:

0 3600 18000 36000

5 5 5 5

0 1 2 7

The curve generated by this file is illustrated in Figure 3.1, where the datapoints defined in the file are displayed as well as the linearly interpolated values.

0 0.5 1 1.5 2 2.5 3 3.5 4 x 104 0 1 2 3 4 5 6 7 time (s) concentration (%) Stock solution 1 Stock solution 2

Figure 3.1: Example of a custom curve

3.3.3

Graphical User Interface

(31)

The first tab Plant configuration lets the user set the parameters for the configuration of each plant (see Table 3.3) individually. This can be done by entering the values manu-ally into the text fields, or by selecting an INI-file (see Appendix D for details about the INI file format) via the Browse button and then clicking on Load Configuration File. You can choose not to use the S-curves specified by the parameters for a plant, but rather use custom curves stored in a CSV file. To do this, set the switch below the parameter fields from s-curve to custom. Then click on Load custom curve to select the file. In order to decide which plants to use in the next experiment, you can activate and deactivate each plant via the Activate buttons.

The second tab General Parameters lets the user change the general parameters of the program (see Table 3.2). Here it is also possible to send a test email to check whether the email settings are correct. All general parameters are stored in the INI-file (see Appendix D) parameters.ini and are loaded automatically when the program is started. They can be changed and then saved to the file via the Save Parameters button. They can also be reloaded from the file with the Reload Parameters button.

In the third tab Manual Controls & Measurement the pumps and valves can be controlled manually via the digital outputs of the two DAQs. In the lower part of the tab the currently measured pH and EC values can be seen in realtime.

The fourth tab Debug gives some debug information about internal variables. Further-more it offers the possibility to run the program in Virtual Mode. When this mode is activated, the program uses a virtual DAQ, meaning that the real DAQ does not have to be connected. Furthermore the user has the option to turn off the email function. This might be useful in case the computer is not connected to a network.

Above the tabs there are two buttons. The button Start Sequence will initiate the au-tomatic mode and start the sequence. With the same button the sequence can also be stopped. The other button Stop Program should be used to terminate the execution of the program. It is recommended to stop the sequence (if it is running) before stopping the program, because then all outputs are set to low.

(32)

3.3.4

Errors, Warnings and Status Messages

There are only few cases where an error message will be displayed. An error occurs in the following situations:

• the last base interval was too short for all plant cycles, causing the whole schedule to be delayed

• an email could not be sent

If the plant cycles took too long (error message: base interval overshot) an email will be sent.

Warnings are displayed in a different text field and are less critical. Warning messages are, if at all, generated during manual mode. If there are any warnings, the user will be notified of this when trying to switch to automatic mode. However, the user can choose to start the sequence anyway.

Warnings are generated for each plant and there are two types of warnings:

• Custom curve for plant X not set: this warning occurs when the switch for plant X has been set to custom curve but no custom curve has been loaded from file • Interval of plant X not a multiple of the base interval: this warning occurs when

the interval of plant X is not a multiple of the base interval

The different possible status messages are listed in Table 3.1. A status message can either be one of those listed in the table or a combination of them.

3.3.5

General Program Parameters

Parameters concerning the treatment of all plants and the hardware setup are listed in Table 3.2.

3.3.6

Plant Configuration Parameters

(33)

Status Message Explanation

Manual Operation The program is in manual mode

Waiting for end of base interval The last active and scheduled plant in the current base step has been treated. The next plant cycle will start with the next base step.

Waiting for end of cycle of plant X Plant X is active, but not scheduled. No treatment is carried out until the virtual end of the cycle.

Draining TP The measuring tank (TP) is being drained from water through VD2.

Watering Probes Water is pumped into the measuring tank through TM and

VD1 in order to keep the probes wet.

Flushing plant X Plant X is being flushed with water.

Flushing TP from plant X TP is being flushed with water to clean it from the outflow of plant X.

Mixing solution for plant X The mixed solution for plant X is being made.

Measuring solution for plant X Some of the mixed solution for plant X is given to TP and pH and EC are measured.

Delivering solution to plant X The mixed solution is delivered to plant X through VPX.

Flushing tanks from plant X Both TM and TP are flushed with water to rinse them from remains of the mixed solution of plant X.

Table 3.1: Status messages

3.4

Program Internals

3.4.1

Overview

The program is basically structured as a state machine. The main states have letter-names like drain TP, while some main states have sub-states enumerated with integers starting from 0.

The state machine is realized by a while-loop that only terminates when the Stop

Pro-gram button is pressed. Inside the while-loop is a case-structure that distinguishes the

different main states. Inside this case-structure is (only for some main states) another case-structure that distinguishes the sub-states. The current main state and sub-state are passed from one iteration to the next through two shift registers in the while-loop. In order for the while-loop to execute at regular intervals, a Wait (ms) block was placed into the loop with the milliseconds to wait parameter set to 10. This makes sure that the execution of one iteration of the loop takes at least 10 ms. It will take more than 10 ms if the rest of the code executed in the loop takes longer than 10 ms. This will usually not happen, besides in those iterations where an email is sent, which might take a few seconds.

(34)

Name Unit Description Pumps

ps water fast ml s-1 Speed of the water pump (PW) in full speed mode

ps water slow ml s-1 Speed of the water pump (PW) in slow mode (not used)

ps nutrients1 ml stroke-1 Amount of fluid pumped by PN1 per stroke

ps nutrients2 ml stroke-1 Amount of fluid pumped by PN2 per stroke

t run pm1 s how long the solution should be stirred with PM1 (after it is completely mixed)

t run pm2 s how long the solution should be stirred with PM2 Flushing

vol flush pX ml Amount of water used to flush plant X vol flush tanks ml amount of water to use to flush TM and TP t flush pX s Time to wait after flushing plant X

Drain-curves

dc pX a - Parameter ’a’ for the quadratic drain-curve of plant X dc pX b - Parameter ’b’ for the quadratic drain-curve of plant X dc pX c - Parameter ’c’ for the quadratic drain-curve of plant X dc tm a - Parameter ’a’ for the quadratic drain-curve of TM with VD1 dc tm b - Parameter ’b’ for the quadratic drain-curve of TM with VD1 dc tm c - Parameter ’c’ for the quadratic drain-curve of TM with VD1 dc tp a - Parameter ’a’ for the quadratic drain-curve of TP with VD2 dc tp b - Parameter ’b’ for the quadratic drain-curve of TP with VD2 dc tp c - Parameter ’c’ for the quadratic drain-curve of TP with VD2

Scaling Parameters for Measurement

min ec mS cm-1 lower end of the range of conductivity (corresponds to the setting of the

analog output of the ecoTrans)

max ec mS cm-1 higher end of the range of conductivity (corresponds to the setting of the

analog output of the ecoTrans)

min ph - lower end of the range of pH (corresponds to ecoTrans parameter SCL.PH) max ph - higher end of the range of pH (corresponds to ecoTrans parameter

SCH.PH)

Email Parameters email sender address - Address of the sender’s account email sender name - Name of the sender

email password - Password for the sender’s account email user id - User ID for the sender’s account email smtp server - SMTP server for the sender’s account email port - Port for the SMTP server (e.g. 587) email recipient address - Address of the recipient

email recipient name - Name of the recipient Other Parameters

vol probes ml amount of water to prevent the probes from drying out vol measurement ml amount of solution to measure in the measurement-tank

t measurement s time to wait until measurement stabilizes (EC/pH and temperature) t vd1 boost s the time that VD1 will be opened in order to help initiate the water flow

through the plant valves (needed due to a too small tube diameter) t log outputs ml s-1 interval at which to log the states of the digital outputs (and the

measure-ments) to a file

c n1 % concentration of stock solution in tank 1 c n2 % concentration of stock solution in tank 2

(35)

Name Unit Description

interval s Dosing interval for the plant (time between two dosing cycles). The small-est of all the dosing intervals (base interval) must be a divisor of all other dosing intervals.

amount ml Amount of mixed nutrient solution to give to the plant

t start s The offset to add to the treatment time of the plant. This can be used to continue an aborted experiment.

t end s The treatment time at which the treatment of the plant finishes.

S-curve Parameters

c start nY % Concentration of NY (Y = 1,2) in the final solution in the first (constant) phase

c end nY % Concentration of NY (Y = 1,2) in the final solution in the fourth (constant) phase

lambda nY - Exponential growth factor in the second phase for NY (Y = 1,2)

k nY - Factor for the third phase for NY (Y = 1,2)

t switchZ nY s t switchZ (Z = 1,2,3) for the s-curve of NY (Y = 1,2)

Table 3.3: Plant Configuration Parameters while-loop:

• The Elapsed Time block outputs the time passed since the start of the sequence. It is reset in every iteration when the state manual is active.

• There is a case-structure that, when not in the manual state disables all controls in the tabs.

• There is a block for the data acquisition of the two analog inputs (EC and pH). • Furthermore the code for the logfile keeping track of the outputs and measurements

is inside the loop.

• The controls of the digital outputs are grouped into arrays and written to the digital outputs

There are also some blocks outside the while-loop which perform some initializations and set up the digital output channels.

3.4.2

States

The following lists all states of the state machine along with a description of each state.

State manual

(36)

contain references to some of the controls like the plant config array, which contains references to the clusters containing the configuration parameters for each plant. The purpose of theses arrays of references is that the referenced controls can be used in loops inside other states. This way the code does not have to be written for every plant individually, but the plants can be handled one after another in loops. The manual state also contains the functionalities for loading and saving parameters. Furthermore it contains some checks that may output warnings in the corresponding text field. When the Start Sequence button is pressed it checks if there are warnings and asks the user whether to proceed. If the user confirms, the next state, schedule, is called.

State schedule

This state takes care of the scheduling of the plant treatments, i.e. it is responsible for determining which plant dosing cycle is to be started and at which point. In between the cycles it takes care that the EC and pH probes do not run dry, i.e. if there is enough time between two cycles it will water the probes and drain the water before the next cycle begins.

The whole treatment process is structured into intervals or steps called base steps. Each base step has the length of the base interval and each step contains none or one cycle for each plant. At the beginning of each base step the scheduler goes through the plants in order 0 to 5 and will perform one of these actions:

1. if the plant is not activated, skip it

2. if the plant is activated and scheduled start its cycle

3. if the plant is activated, but not scheduled in this step, wait for the time that the last cycle of that plant took (measured using the variable plant duration counter) and then go to the next plant.

’Scheduled’ means that the parameter interval specified for that plant dictates a cycle to be carried out in the current base step.

If a plant is activated and scheduled its cycle is started by calling the state flush plant. In order for the states to know which plant is currently being treated, there is a variable named current plant that contains the index of that plant.

(37)

State wait

This state is an auxiliary state called by other states in order to wait for a certain time. The calling state writes the time to wait in seconds into the variable wait time. Before calling the wait state the calling state also writes the state and the sub-state that should be called after waiting into the variables return state and return substate respectively.

State water probes

Since the need for watering the probes appears several times in the algorithm this action has its own state called water probes. This state is called just like the wait state by passing it the return state and substate. First the VD1 is opened and PW is turned on. PW is turned off after having pumped the volume specified in the parameter vol probes. Then VD1 is kept open for three more seconds in order for the water to drain completely from TM. Then it is closed and the return state is called. Furthermore it is indicated through the variable TP full that TP is filled with water.

State drain TP

As goes for watering the probes, the draining of TP from that water is carried out several times in the algorithm. That’s why this state is also called like water probes, meaning that it returns to a specified state after completion. In this state the amount of water specified in vol probes is drained through VD2. After this the return state is called.

State flush plant

(38)

State flush TP

In order to cleanse TP from the remains of the outflow the volume which is specified in

vol flush tanks is pumped into TM with VD1 opened, so the water can flow directly

into TP. Then also VD2 is openend to drain out the water from TP. During the whole process PM2 is turned on in order to also clean the pump itself and to better rinse the tank. When TP is completely drained VD1 and VD2 are closed and the next state

water probes is called. This is done, because the following mixing of the solution might

take too long for the probes to be dry. The return state passed to water probes is the state representing the next step mix solution.

State mix solution

In this state the final solution for the plant is mixed from water and the two stock nutrient solutions. First the exact amounts needed are calculated based on either the s-curve parameters or a custom curve. The total amount that is mixed is the volume needed by the plant (specified in amount) and the volume needed for the measurement (specified in vol measurement). For the nutrient pumps the amount of strokes needed is calculated. Then the three volumes are pumped into TM and PM1 is turned on for mixing. After pumping PM1 is run for some more time (specified in t run pm1) and after that the next state measure solution is called right after calling drain TP in order to drain TP from the water to keep the probe wet.

State measure solution

This state is responsible for letting some of the final dilution flow into TP and recording the measurement. Moreover it keeps a logfile for every plant where for every cycle data like the measured pH and EC or the desired nutrient concentrations are stored. First the amount of water specified in vol measurement is lead into TP through opening VD1. At the same time PM2 is turned on. After closing VD1 again the program waits the number of seconds specified in t measurement and then turns off PM2 and stores the measurement and other data to the logfile. After that the next state deliver dose is called.

State deliver dose

(39)

whole process VD2 is opened in order for TP to drain (to make room for the flushing in the next step). The next state that is called is flush tanks.

State flush tanks

This state flushes TM and TP. First, TM is filled with a certain amount of water specified in vol flush tanks. Then this water is lead into TP completely. After that it is drained from TP. PM1 and PM2 are run in order to flush them as well.

3.4.3

SubVIs

In order to increase readability and to avoid redundancy some parts of the code were encapsulated by SubVIs. Below is a list with a brief description of each SubVI.

SubVI drain time

The task of this SubVI is to calculate the time it takes for a certain volume to drain through a certain valve. For this the drain-curves passed in the general parameters are used. In order for the SubVI to be able to access the parameters, they are stored in a global varibale called global variable.vi. The input for the SubVI are the amount of water for which the time, which is also the output, has to be calculated as well as an index specifying the valve. The indexes 0 to 5 refer to the six plants. The index 6 refers to draining TM through VD1 and the index 7 refers to draining TP through VD2.

SubVI email

This SubVI is responsible for sending emails over a specified SMTP-server using Mi-crosoft .NET. Most of the code was taken from an example from the National Instru-ments website. All relevant parameters for sending the email are contained in the general parameters. They are passed to the SubVI in a cluster. The second input for the SubVI is the message body of the email and the third input is an enable switch, which can be used to suppress the sending of the email (for the option in the debug tab see above).

SubVI load custom curve

(40)

SubVI load parameters.vi

Here the general parameters are loaded from the file ’parameters.ini’ in the same di-rectory as the VI and written to the corresponding controls. Some of the controls for the parameters are passed as arrays of references to the SubVI, so the values can be set directly, while some values are returned as outputs of the SubVI and written to the controls from the calling VI.

SubVI load plant configuration

This SubVI loads the configuration file for a plant and writes the parameter values to the corresponding controls. One parameter passed to the SubVI is the path of the file while the other parameter is an array of references to the controls.

SubVI s-curve

This SubVI calculates the concentration values depending on the passed time in seconds according to a given s-curve. The parameters of the s-curve are passed to the SubVI and the calculated percentage is passed to the output.

SubVI save parameters

Here the general parameters are stored in the file ’parameters.ini’ in the same directory as the VI. The values of the corresponding controls are passed either as a reference or by value to the SubVI.

3.5

Setup and Requirements

The program was developed with NI LabVIEW Professional Development System Ver-sion 10.0 (32-bit) running on Microsoft Windows 7 ProfesVer-sional (64-bit). However the

Base version of LabVIEW is sufficient for running the program.

For the email functionality to work, the Microsoft .NET Framework has to be installed as well. While LabVIEW does offer direct support for sending emails via SMTP, it does not support authenticated SMTP. This is why this workaround using .NET had to be used.

Hardware Configuration

(41)

the installation disc of the DAQs. The NI USB-6009 should be named Dev1 and the NI

USB-6008 should be named Dev2.

If support for the virtual mode is desired then there should be a virtual USB device installed in addition to the two real DAQs. Since there exists no virtual version of the DAQs the NI USB-6509 was used and named VirtualDev.

Configuration of LabVIEW

The only setting whose value was changed from the default value was the Use localized

decimal point option which can be found under Tools → Options → Front Panel. The

(42)

Chapter 4

Modeling and Simulation

4.1

Introduction

In order to investigate the possibilities of influencing plant growth with the designed NDS, numerical simulation was used. A dynamic model of plant growth called NiCoLet proposed by Seginer in [Seg03] was extended to incorporate the effect of the NDS on nutrient concentration in the nutrient supply of the plants. Although the NiCoLet model is specifically designed for investigating growth of lettuce, a certain universality can be assumed, however its examination is not subject of this work. Several models were viewed, however only this model included the explicit dependence of growth on nutrient concentration. Moreover only this model seemed to be comprehensive while featuring a reasonably level of abstraction.

The following sections describe the model, as well as the adaptation of it. Furthermore simulation results and interpretations are presented along with notes on implementation.

4.2

Model of Plant Growth

The NiCoLet model is designed to predict the content of carbon (C), nitrogen (N) and water in the plant. It does however not model the exact physical appearance of the plant. It rather treats the whole plant as having three compartments, which is an abstraction from the actual partitioning of a plant.

References

Related documents

Coad (2007) presenterar resultat som indikerar att små företag inom tillverkningsindustrin i Frankrike generellt kännetecknas av att tillväxten är negativt korrelerad över

a) Inom den regionala utvecklingen betonas allt oftare betydelsen av de kvalitativa faktorerna och kunnandet. En kvalitativ faktor är samarbetet mellan de olika

1) Each PSC-instruction and CEUA-transcript’s different agenda items are units of observation. They are the separate text units that will be asserted the variable values below

To conclude the results support that a feasible routine for decisions of driving, after the first intermission to drive after stroke, could be that all patients in need of

The long-run fundamentals that we attempted in our estimation are; terms of trade, investment share, government consumption, the growth rate of real GDP, openness, trade taxes as

The upshot is that even though the concept of a theorem is more com- plex for experimental logics than for ordinary formal theories (∆ 0 2 rather than Σ 0 1 ) the

When considering the skilled labor out-migration, the calibration results show that an increased probability of migration or wage differen- tial between two countries could improve

The addition of IGF-1/IGFBP-2 to cultured hippocampal neurons did not show any increase in neurite numbers per area, but rather showed a decrease compared with the controls and in