Design of a digital closed loop temperature control system for a [PDF]

The electronic dilatometer of NETZSCH-Gerätebau GmbH that is present at the faculty of mechanical engineering at the Un

0 downloads 4 Views 3MB Size

Recommend Stories


design of a closed loop control of the boost converter
Learning never exhausts the mind. Leonardo da Vinci

The Benefits of a Closed-Loop System
Never wish them pain. That's not who you are. If they caused you pain, they must have pain inside. Wish

Collaboration for a closed-loop value chain
Don't watch the clock, do what it does. Keep Going. Sam Levenson

Collaboration for a closed-loop value chain
Be who you needed when you were younger. Anonymous

Development of a Closed Loop Control System for Vibratory Milling Wael Naji Alharbi
Just as there is no loss of basic energy in the universe, so no thought or action is without its effects,

Design and Simulation of Closed-Loop Control System for Screw Oil Press
Ask yourself: What negative thought patterns do I have consistently? Next

Implementation of closed loop control technique
Just as there is no loss of basic energy in the universe, so no thought or action is without its effects,

Design system as a tool for digital brand design
Don't be satisfied with stories, how things have gone with others. Unfold your own myth. Rumi

Open for closed-loop cooling
Don't be satisfied with stories, how things have gone with others. Unfold your own myth. Rumi

Design of an Aerodynamic Attitude Control System for a CubeSat
Every block of stone has a statue inside it and it is the task of the sculptor to discover it. Mich

Idea Transcript


Design of a digital closed loop temperature control system for a dilatometer M.J. Verdonschot (533946) DCT 2008 - 032

Coach: Ing. Horacio de Rosa Supervisors: Prof.dr.ing. Fernando Audebert Prof.dr.ir. Maarten Steinbuch

Eindhoven University of Technology Department of Mechanical Engineering Dynamics and Control Technology Group Eindhoven, March, 2008

Contents 1 Introduction

1

2 Dilatometer 2.1 Measuring unit . . . . . . 2.2 Control principle . . . . . 2.3 Vacuum . . . . . . . . . . 2.3.1 Working principle . 2.4 Upgrading . . . . . . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

3 4 5 6 6 8

3 Modelling 9 3.1 Radiation theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.2 Simulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.3 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4 Control Concepts 4.1 LED control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Direct control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Concept choice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15 15 16 16

5 Data acquisition

17

6 Power supply 19 6.1 Characterization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 7 Pulse Width Modulation 23 7.1 Implementation in control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 7.2 PWM to voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 8 Control 8.1 Qbasic programming file 8.1.1 Functions . . . . 8.1.2 Design . . . . . . 8.2 Experiments . . . . . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

29 30 30 30 32

9 Conclusion and Recommendations 39 9.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 9.2 Recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

4

CONTENTS

Bibliography

41

A Expansion of sample holder

43

B Specifications Vacuum pumps 45 B.1 Specifications diffusion pump . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 B.2 Specifications rotation pump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 C C-files implemented in Simulink model 47 C.1 C-file for T1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 C.2 C-file for T2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 D Specifications Microaxial’s ADQ12-B

53

E Thermocouple amplifier

55

F Thermocouple 57 F.1 Conversion table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 F.2 m-file using least squares fit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 G PWM-to-voltage interface

61

H Qbasic: PWM test

63

I

65

Qbasic: Control programme

J m-file for analysis

73

Chapter 1

Introduction Dilatometers are widely used for measuring thermal expansion coefficients and examining phase transitions in different materials, which occur at high temperatures. For correct measurement of these coefficients and the characterization of the phase transitions at different temperatures it is important to accurately control the temperature inside the furnace and acquire the measurement data for analysis. The electronic dilatometer of NETZSCH-Gerätebau GmbH that is present at the faculty of mechanical engineering at the University of Buenos Aires, consists of a furnace heated by a power supply which is controlled by a control unit. Furthermore, the dilatometer consists of a measuring unit to acquire the thermal expansion of the sample located inside the furnace. The current temperature control unit comprises of electromechanical components. This type of control has some disadvantages, such as heat generation inside the control unit and noise sources. A digital control system would be less expensive in maintenance and far more effective. For example because of the fast response and increased accuracy. For that reason it is desired to replace the electromechanical system by a digital closed-loop temperature control. Also a digital system will increase the possibilities in the temperature profile to be followed. To be able to implement a digital closed-loop control for the dilatometer, it is required to upgrade the data acquisition system. In the current setup the data can only be read on mechanical gauges, it is not directed to a computer for analysis. For implementation of the digital control the data should be obtained digitally. In the first chapter the working principle of the complete dilatometer setup will be explained, together with an elaboration on the required upgrading of this setup. Next, in chapter 3 a model of the furnace is made to be able to compensate for the difference between the temperature of the sample and the temperature used for control. This theoretical model can then be compared to the actual situation obtained by experiments. After that chapter 4 discusses two possible control concepts, than one concept is chosen and worked out in the following chapters. First the required data acquisition is performed, after which a characterization of the power supply is performed (chapter 6). Next an explanation of the technique used for the control, Pulse Width Modulation, is given. Finally, the total closed-loop control system is implemented and tested according to a number of experiments in chapter 8.

Chapter 2

Dilatometer The development of new ceramic and powder metallurgical high-tech materials requires the exact knowledge of the thermal expansion behavior and of the reactions and phase transitions which occur in high temperature ranges. The importance of the thermal expansion coefficient can be seen in the calculations of thermal stress. The variation in length is quite temperature dependent and comprises of both reversible and irreversible changes in the sample material, for example the formation of melting phases and crystallization. For this purpose the pushrod dilatometer is an ideal tool to determine the variation in length during a controlled temperature profile, because of the good reproducibility and high accuracy. Next to measuring the variation in length, an analysis can be done regarding for example the composition of the material and the trailing of chemical reactions.

Dilatometer

Control unit

Power supply Figure 2.1: Current setup of the Dilatometer

4

Dilatometer micrometer screw

pushrod

thermostat

gas

thermocouple

sample

water cooling

optics

vacuum

glass fibre to pyrometer gas

inductive transducer

insulation

graphite heating element

Figure 2.2: Dilatometer

2.1

Measuring unit

Essentially the measurement of the variation in length of the sample is recorded by an inductive displacement transducer. A schematic setup of the measuring unit of the dilatometer is shown in figure 2.3. The sample is located in a horizontal groove of a supporting tube. At one end the sample is arrested by a platelet, while at the other side the sample is touching a push-rod which is directly connected to the core of the displacement transducer. The mechanics of the pushrod and the inductive transducer are not influenced by the furnace and sample holder. They remain at constant temperature due to the thermostatic control of the measuring part. An expansion of the sample now leads to a movement of the rod to the left, which results in a displacement of the iron core inside a coil form. This displacement leads to an inductance variation which is converted to a proportional DC voltage. [7] Protection tube Coil

DL [mV]

Supporting tube

Thermocouple [mV] Push-rod

sample

Figure 2.3: Schematic setup of the measuring unit The maximum output voltage is 50 mV and represents an expansion equal to the value of the measuring range that is set on the measuring unit. Furthermore the expansion is linear to the output voltage. However, the output voltage represents the difference between the expansion of the sample holder and the sample itself. Therefore, in order to obtain the correct value of the variation in length, D, the expansion value of the sample holder, Dh , needs to be added to the measured value, D0 (2.1).

2.2 Control principle

5

D = D0 + Dh

(2.1)

With: D = variation in length D0 = measured value Dh = expansion of the sample holder. The expansion value of the sample holder, Dh , can be obtained through calibration. Also a table with absolute reference values of the linear expansion of different materials and the expansion of the sample holder is given in appendix A. [8]

2.2

Control principle

The temperature in the furnace is currently controlled through the scheme shown in figure 2.4. The reference signal is given by a potentiometer which is fed by an electronic constant voltage source. The voltage is balanced to the thermocouple inside the furnace (platinum-rhodium platinum Pt10%Rh-Pt, range -50 o C tot 1768 o C). With the potentiometer, a voltage can be set by means of a mechanical component, which relates to a certain temperature. This voltage is compared to the voltage that is acquired by the thermocouple inside the furnace, which measures the actual temperature. The difference between the two voltages is the error that exists between the required and actual temperature. This voltage is fed to a mirror galvanometer. This electromechanical transducer produces a rotary deflection in response to a current flowing through its coil, resulting in a movement of a prism. Together with a light source beneath this prism, it is responsible for the right illumination of a photoelectric cell. As long as the galvanometer is set to zero, the photoelectric cell will be illuminated by a modulated light beam. A deflection of the galvanometer leads to a displacement of the light falling onto the photoelectric cell. According to this displacement the intensity of incident light on the photoelectric cell changes. The cell also acts as a barrier between the low currents in the control unit and the high current flowing through the power supply. controller potentiometer

+ -

galvano meter

prism

photo cell

PS

HE

temperature

control thermocouple

Figure 2.4: Current control scheme The photocell in the control unit is photoconductive, meaning that it becomes more conductive due to the absorption of light. Thus, when light falls upon the photocell, the voltage in the circuit increases by an amount proportional to the intensity of the light. The output voltage that is given by this photocell is 0 − 6 V. Using this cell the intensity of incident light controls the heating element by increasing or decreasing the input voltage for the power supply. [6]

6

2.3

Dilatometer

Vacuum

Around the sample tube a protection tube can be placed to ensure homogenous heating, but also to obtain a high vacuum for the sample. This vacuum is required when measuring metals, because otherwise the metal will oxidize and therefore, undesired, transform the structure of the sample that is being analyzed. Since mostly metals are used to observe phase transitions, the vacuum should be obtained correctly. To prevent oxidation from happening, a vacuum of 10e−4 mbar (= 75e−6 torr) is required. When analyzing materials such as ceramics, obtaining a vacuum will not be necessary since oxidation is out of the question. [1], [10], [9] The vacuum inside the protection tube is affected by a rotary and a diffusion pump. The specifications of both pumps can be found in appendix B. Next the working principle of the vacuum system and its measurement are explained.

Rotation pump

Diffusion pump

Figure 2.5: Vacuum pumps

2.3.1

Working principle

The first stage of reaching the desired vacuum inside the protection tube consists of a rotary pump. During operation air is being pumped to the vacuum connection after which it is compressed and discharged through the discharge valve at a pressure of just over one atmosphere. The vacuum that can be reached by using a rotary pump is limited by the molecular flow that will exist at pressures below 10−3 . Molecular flow exists when the mean free path of the molecules is larger than the size of the chamber, meaning that there is no interaction between the molecules. For a range up to 10−3 torr the vacuum is measured by two Pirani gauges, one is placed close to the rotary pump, the other right after the diffusion pump, which induces the second stage of the vacuum and will be explained later. [10]

2.3 Vacuum

7 gauge head

vacuum port

filament

N

Figure 2.6: Schematic view of a Pirani gauge The Pirani gauge measures the pressure according to a change in thermal conductivity. This change is affected by a rise or fall in the number of gas molecules when pressure changes in a vacuum system. A variation in thermal conductivity induces a change in the heat loss of an electrically heated filament (see figure 2.6). A lower pressure means less collisions of gas molecules and therefore less heat loss, which means that the filament heats up. As the electrical resistance of the wire is proportional to its temperature, this resistance will increase. The filament that is present inside the Pirani gauge head has a high resistance temperature coefficient, so that slight changes in the system pressure will result in useful changes in the filament resistance. Now this filament forms one arm of a Wheatstone bridge and the changing resistance results in an out-of-balance current. This current can be read as a pressure on a meter. In the current setup the Pirani gauges have a measuring range of 1 - 10−3 torr. [1], [10] After reaching a vacuum of 10−3 torr and turning on the water cooling, the diffusion pump can be engaged. It is important to have reached this vacuum, since otherwise hot oil could combust in the presence of oxygen. A reservoir at the bottom of the pump containing low vapor pressure oil is heated and the vapor oil is directed through a jet assembly. The outside of the diffusion pump is water-cooled and the impact of the vapor jet onto the cooled shell condenses the fluid, after which it is redirected to the reservoir. During this process molecules are taken out of the chamber and discarded through an outlet, resulting in a high vacuum (up to 10−5 torr). Since the range of diffusion pumps is less than 10−3 torr, the pressure is measured by a Penning gauge. [9] The Penning gauge is a type of ionization gauge, which are the most sensitive gauges for very low pressures (high vacuums), and is based on the magnetic Penning effect. This effect describes the increase of the ionization probability of gas in a low pressure electrical discharge, which results from the helical movement of electrons in a magnetic field (B-field) placed normal to an anode-cathode electrical field (E-field). These fields constrain electrons in helical paths. This gives them long free paths and therefore a high probability to ionize the residual gas. The combination of electron and ion movement induces a current, which is used to measure the pressure. A schematic view of a Penning gauge is shown in figure 2.7. The Penning gauge used in this setup has two measuring ranges, 1: 10−2 - 10−4 and 2: 10−4 - 10−5 . [1], [9]

8

Dilatometer

ceramic disc cathode magnet anode gas to be ionized

B-field E-field

Figure 2.7: Schematic view of a Penning gauge Since it is quite an old system and it had not been used for a while, it was necessary to check whether the system and measurement were still working properly. This was done by adding a high precision Penning gauge as the reference value and noting what the pressure readings of the Pirani and Penning gauges were showing. Conclusions from these measurements are that the Pirani gauge after the diffusion pump is not working properly due to a bad connection in the cable. The second Pirani gauge does measure the vacuum quite well. Also the Penning gauge is working well enough for this purpose, meaning that the measurement is not exact, but it will indicate whether the vacuum is high enough to prevent oxidation.

2.4

Upgrading

The upgrading of the dilatometer equipment consists of two main parts. First the data acquisition system needs to be upgraded. In the current setup the signals of the thermocouples and the expansion are recorded by analogical gauges. To be able to analyze the data from the sample thermocouple and the expansion, these should be recorded digitally. Furthermore, to control the temperature it is important to know the exact temperature inside the furnace, therefore the signal of the control thermocouple should also be digitalized. Next the temperature control is upgraded by replacing the current electromechanical system by a digital closed-loop control system. This replacement will greatly improve the workability of the equipment. For example, it will make it easier to define a specific temperature profile with different heating rates and the accuracy of the measurement is highly improved. Next, the accuracy of the control is significantly improved since the electromechanical components are subject to varies noise sources, such as vibrations and heat generation, which introduces non-linearities in the electrical components. The new control system should be able to control thermal cycles in the range of 5 to 20 o C/min, with an accuracy of 10 o C.

Chapter 3

Modelling A good understanding of heat transfers inside the electrical furnace is desirable when trying to control the temperature of a sample inside this furnace. The main part of the furnace is the heating element. Around the heating element a thick insulation is placed to prevent great heat losses to the environment. A water cooling installation is present around the insulation to improve its function. Inside the furnace the control thermocouple (Tc ) nearly touches the furnace wall. The temperature measured by this thermocouple is a good equivalent for the input power and therefore this is the thermocouple on which the controller will react. A ceramic protection tube is placed around the sample tube such that homogeneous heating of the sample is assured. This protection tube is also used when operating under vacuum. The vacuum then exists inside this protection tube. The sample thermocouple (Ts ) is located right above the sample. This thermocouple is solely used for the analysis of an experiment. 1 Water cooling

Insulation

Heating element

Ts

Protection tube

Tc

Sample

Figure 3.1: Schematic setup of the electric furnace

1

In current dilatometers the temperature is measured by an optical pyrometer, which measures, without contact, the temperature at the end of the sample holder by means of a lens system placed in the furnace axis. In this way the measured material always has very similar radiation behaviour to that of a black body. [2]

10

3.1

Modelling

Radiation theory

As can be seen in figure 3.1 there will exist a difference between the control temperature and the sample temperature. This difference can be determined using the equations given in (3.1). With index 1 for the sample and index 2 for the protection tube, which is equal to the control temperature. In this case only radiation has been taken into account. There will exist some convection between contact surfaces, however, the influence of this is negligible. dQ dt

= mc dT dt

dQ dt

=

(3.1)

σTs4 −σTc4 1−²1 1−² 1 + + ² A2 ²1 A1 A1 F12 2 2

Since the problem consists of an enclosure formed by two concentric cylinders, F12 = 1 and the second equation of (3.1) results in (3.2). dQ ²1 A1 = σ(Ts4 − Tc4 ) ² 1 1 dt 1 + ²2 A (1 − ² ) 2 A2

(3.2)

And with A2 >> A1 this leads to equation (3.3). dQ = ²1 σA1 (Ts4 − Tc4 ) dt

(3.3)

Adjusting these general radiation equations to the situation inside the furnace and adding the input power and a power loss factor, this results in equations (3.4) and (3.5).

mc cc

dTc = Pin − Ploss − Prad dt

ms cs

dTs = ²σAc (Ts4 − Tc4 ) dt

(3.4)

= Prad

(3.5)

With the subscript c for the protection tube, which is assumed to be equal to the control thermocouple, and the subscript s for the sample. With these equations it will be possible to describe the tracking behaviour of the heating of the sample compared to the direct heating of the protection tube. This will be done through simulations in Matlab Simulink.

3.2 Simulations

3.2

11

Simulations

Next this model is implemented as a closed-loop temperature control in Matlab Simulink (figure 3.2). In the model the power output of the heating element is controlled by a variable voltage which is determined by the error between control and reference temperature. The relation between the voltage input and power output is determined by experiments (chapter 6) and information given by the manufacturer. This information states that a voltage of 6 V will result in the maximum output of 3.5 kW.

Figure 3.2: Matlab Simulink model of the furnace The radiation equations of chapter 3.1 are implemented in the model using files that are programmed in the C language (appendix C). The main advantage of using C-files is that they improve the overview of the model. The power loss factor is defined in (3.6) and estimated to be 0.1. This is based on the fact that there are only few connections that can induce convection and the isolation of the furnace is quite good. gain ∗ (Tref − Ts )

(3.6)

The tracking behaviour of both the sample and control temperature is shown in figure 3.3 for different profiles and in figure 3.4 for equal profiles, but with different initial temperatures.

12

Modelling

o

o

temperature [ C]

Tracking behaviour

temperature [ C]

Tracking behaviour

time [s]

time [s] o

(b) Profile with heating rate: 20o C/min

(a) Profile with heating rate: 5 C/min Error during simulation

Error during simulation error Tc error Ts

o

temperature [ C]

o

temperature [ C]

error Tc error Ts

time [s]

time [s]

(d) Thermocouple errors, 20o C/min

Error between Tc and Ts, during simulation

Error between Tc and Ts, during simulation

o

o

temperature [ C]

(c) Thermocouple errors, 5 C/min

temperature [ C]

o

time [s]

(e) Difference Tsample - Tcontrol, 5o C/min

time [s]

(f) Difference Tsample - Tcontrol, 20o C/min

Figure 3.3: Results of simulations with different profiles

3.2 Simulations

13 Tracking behaviour

o

o

temperature [ C]

temperature [ C]

Tracking behaviour

time [s]

time [s] o

(b) Initial temperature: 520o C

(a) Initial temperature: 20 C Error during simulation

Error during simulation error Tc error Ts

o

temperature [ C]

o

temperature [ C]

error Tc error Ts

time [s]

time [s] o

(d) Initial temperature: 520o C

(c) Initial temperature: 20 C

Error between Tc and Ts, during simulation

o

temperature [ C]

o

temperature [ C]

Error between Tc and Ts, during simulation

time [s]

(e) Initial temperature: 20o C

time [s]

(f) Initial temperature: 520o C

Figure 3.4: Results at different initial temperatures

14

3.3

Modelling

Experiments

In order to verify the model a number of experiments should be done. This includes measuring both the control and sample thermocouple for a specified reference signal. These reference signals are also used in the simulations. After obtaining the measurements, the results can be compared with the simulations from where some conclusions can be drawn concerning the correctness of the model. Unfortunately the sample thermocouple is not functioning properly and a new thermocouple will not be available on time. Therefore it will not be possible to actually perform the measurements to verify the model.

Chapter 4

Control Concepts 4.1

LED control

Currently the power supply is driven by a voltage that is the output of the photoelectric cell. The output voltage is proportional to the intensity of the light falling onto the photocell. One of the first ideas to control the power supply digitally was to use a LED as illumination source, instead of the galvanometer and prism. The control scheme for this case is shown in figure 4.1. controller potentiometer

+

C

LED

-

photo cell

PS

HE

temperature

control thermocouple

Figure 4.1: LED control scheme By changing the intensity of the LED, the output voltage given to the power supply can be controlled and therefore also the temperature inside the furnace. The intensity of the LED can be controlled using Pulse Width Modulation (PWM). Using this technique, analog outputs can be controlled digitally without using digital-to-analog conversion. The advantage of not having to use analog circuits is that they tend to drift over time, since the analog output signal is updated at uniform sampling intervals. Meaning that an output voltage is held in time at the current value until the next input number is given.

(a) Ideally sampled

(b) Zero-order hold

Figure 4.2: a) ideally and b) DAC output sampling of a signal

16

Control Concepts

This results in a piecewise constant output, equivalent to a ’zero-order hold’ operation (figure 4.2), making it difficult to tune the output. [3] Finally analog circuits have an infinite resolution, which makes them sensitive to any perturbation or noise because this necessarily changes the current value.

4.2

Direct control

The second option is to control the power supply directly. In this case a variable voltage from 0 − 6 V is controlled using a computer. This can also be done by using Pulse Width Modulation. This signal can be created from the error between the reference and actual temperature, which is then converted to a variable voltage using a PWM-to-voltage interface. A control scheme for this direct control is shown in figure 4.3. controller potentiometer

+

C

DAC

PS

HE

temperature

-

control thermocouple

Figure 4.3: Direct control scheme

4.3

Concept choice

Both of the control concepts can be implemented in the current setup to create a digital control for the temperature. However, there are some advantages and disadvantages for both concepts. LED control The main advantage of LED control is that there is no need for digital-to-analog conversion, which is responsible for a ’zero-order hold’ output. Thus the output can be controlled like an ideally sampled signal. As said before, this makes it easier to tune the output. However, a disadvantage of LED control compared to direct control is that it involves more components, which usually means less accuracy because of more possible noise sources. Direct control A big advantage of direct control is that it consists of little components and therefore noise effects are minimized. Also, the control will be easier to implement because there is no need to characterize the photocell. On the other hand, the main disadvantage is that it is not possible to control the temperature without a digital-to-analog conversion, of which the disadvantages have been mentioned earlier. However, since the system is not high precision, these disadvantages are less important then noise effects. In effect, the choice of control concept is dictated by the noise that is created by the system and therefore the direct control is chosen as the method to control the temperature.

Chapter 5

Data acquisition To be able to control the furnace according to the input signal it is essential to acquire the data from the control thermocouple. For this purpose an acquisition card ADQ12-B manufactured by MicroAxial is used. The specifications of this card can be found in appendix D. Unfortunately this type of card is quite antique and it is therefore not possible to use Matlab for the acquisition and control. For this reason the acquisition of the data and the temperature control are designed in the language Qbasic. The control of the temperature is affected by comparing the reference signal to the actual temperature inside the furnace. This temperature is measured by the control thermocouple (see figure 3.1, T2). The output of the thermocouple is given in millivolts which can be converted to the actual temperature. However, first the signal of the thermocouple is amplified to improve the resolution of the reading and therefore the accuracy of the measurement. The amplifier that has been created for this purpose is shown in appendix E. The amplification factor is determined using the table shown in appendix F.2, from this table it is concluded that the temperature increases proportional to the voltage. The original output of the thermocouple was determined at 6.4 µV/o C. This signal is amplified by a factor 781, resulting in an output of 5 mV/o C. Since the sample thermocouple is of the same type as the control thermocouple, two equal amplifiers are made. Amplifier 1 is calibrated at a temperature of 22 o C. This means that if for example the output of the amplifier reads 120 mV, the measured temperature equals 22 + 120/5 = 46 o C. Amplifier 2 has an offset of 0.110 V. Meaning that it is calibrated at a temperature of 0 o C. In this case a voltage reading of 120 mV will result in a temperature of 120/5 = 24 o C. A disadvantage of amplifying the thermocouple signals is that also the noise on these thermocouples is amplified. Next the expansion of the sample is acquired in the same way as explained in chapter 2.1. The output voltage is digitalized using MicroAxial’s acquisition card and converted to the correct expansion value according to the measurement range set on the dilatometer. Figure 5.1 shows the connection scheme to correctly acquire the necessary signals.

-

connection power supply

+

6 Volt -

pwm-voltage circuit

pwm-voltage interface

+

6 Volt GND

+

Figure 5.1: Connection scheme for data acquisition sample thermocouple

GND

OUT1

-15 V GND +15 V

-

15.00 V

control thermocouple

+

19

18

17

16

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

37

36

35

34

33

32

31

30

29

28

27

26

25

24

23

22

21

20

connection acquisition card

expansion signal

input signals input signal (pwm) input signal (pwm) output signal (voltage) output signal (voltage)

amp circuit

OUT2

amplifier interface

-

15.00 V

voltage source voltage source voltage source

reading control thermocouple reading sample thermocouple reading expansion output (pwm) output (pwm)

18 Data acquisition

Chapter 6

Power supply To be able to send the correct voltage to the power supply for a certain heating rate, it is required to understand the characteristics of this power supply. Unfortunately the manufacturer cannot supply these characteristics, therefore it is necessary to perform experiments to acquire them. What is known about the power supply is that essentially it is controlled by an input voltage between 0 − 6 V. Next this input voltage is amplified, with a maximum output voltage of 50 V. The control characteristic line is S-shaped, because a phase angle modulated power is used.

6.1

Characterization

The input for the power supply is currently delivered by the control unit (chapter 2.2) and consists of a variable voltage between 0 − 6 Volts. To understand the relation between the input voltage and the output power it is possible to set a specific input voltage to the power supply and measure the thermocouple output. First the thermocouple is read while the input voltage is set between 0 and 6 Volts with a stepsize of 0.5 V. From these measurements it was clear that it was not necessary to measure the heating rate with an input voltage of over 3.0 V. Since 3.0 V results in a heating rate of approximately 47 o C/min and the relevant range was determined to be 5 - 20 o C/min. The results of the measurements can be found in figure 6.1. Next a relation between input voltage and heating rate is determined by measuring the temperature of the control thermocouple for 10 minutes in a range from 0.5 - 3 Volt, with a stepsize of 0.2 V. From these measurements a fit can be obtained to determine the average heating rate during these 10 minutes. The variation in measured heating rates appeared to be quite large, enlarging the measuring time did not make any difference. Therefore a number of measurements have been done per input voltage to determine an average heating rate. From these average heating rates the range of interesting voltages has been determined to be between 1.9 and 2.6 V.

20

Power supply

Figure 6.1: Input voltage versus heating rate Although the control characteristic of the power supply is S-shaped, a linear least squares fit can be used to obtain an exact relation between voltage and heating rate. This because the range of interest is quite small and lies somewhat in the middle of the total range. Thus, a least squares fit is performed for the range between 1.9 and 2.6 V (figure 6.2). From this fit equation (6.1) is obtained to convert a desired heating rate to the required input voltage. This equation is used in the control programme (appendix I). Vin = hrate3 · y(1) + hrate2 · y(2) + hrate · y(3) + y(4)

(6.1)

With: 

 −1.075695753723490e − 005  −4.766040929428955e − 004   y=  5.235493579648845e − 002  1.768217459242615e + 000 Now it is possible to convert a desired heating rate to a required voltage. This required input voltage can be created using pulse width modulation.

6.1 Characterization

Figure 6.2: Relevant characteristic of the power supply

21

Chapter 7

Pulse Width Modulation Pulse Width Modulation is essentially a method to digitally encode analog signal levels. This is done by modulating the duty cycle of a square wave to acquire a specific analog signal level. The modulation consists of switching between discrete on and off states which control the voltage through the load. The on-time is the time during which a voltage is applied to the load and the off-time is the period during which there is no voltage supply. The duty cycle is defined as the amount of on-time during one time period and is equivalent to the actual voltage output. T 1

10%

0 1

50%

0 1

90%

0

Figure 7.1: PWM signals with different duty cycles Figure 7.1 shows a PWM output for different duty cycles, respectively 10%, 50% and 90%. These three PWM outputs encode three different analog signal values, being different percentages of the full strength. If, for example, the supply voltages should be 6V, then an analog signal of 0.6V results when using a duty cycle of 10%, while a duty cycle of 50% results in an analog signal of 3V. A major advantage of this technique is that the switches are either off and not conducting current, or they are fully on and have, ideally, no voltage drop across them. Since the dissipated power is calculated by multiplying the voltage and current, this means that ideally no power is dissipated. [11]

24

Pulse Width Modulation

One of the most important parameters in PWM is the modulating frequency, defined as the number of times a cycle is repeated within 1 second. In order for the output to actually return a percentage of the maximal voltage proportional to the duty cycle, the time period should be very short. For example, when using a light source at a modulating frequency of 1 Hz and a duty cycle of 50%. This would mean that the light would be lit for 0.5 seconds and next off for 0.5 seconds. In order for the light to see 50% of the output voltage, the cycle period should be short relative to the loadŠs response time to change in the switch state. However, in this project a furnace is used that cannot be turned on and off at such high frequencies. Therefore the pwm signal needs to be converted to a variable voltage which can be used as the input for the power supply.

7.1

Implementation in control

A PWM signal can be generated using different methods. The one that is used in this project is called the intersective method (figure 7.2). This method only requires a sawtooth or triangle waveform and a reference signal. When the value of the reference signal is greater than the modulation waveform, the PWM signal will be in a high state (1). If the reference signal is less than the modulation waveform, the PWM signal is in a low state (0). [4]

source signals

Intersective method 1

0

PWM signal

1

0 Time

Figure 7.2: Intersective method to generate PWM signal Unfortunately programming in Qbasic brings some disadvantages with it. For example, the modulating frequency is dependent on the processing time of the program and computer. The maximal modulating frequency possible using Qbasic is 170 Hz. This is determined by implementing a loop that will change from high to low state every cycle and measuring the output signal with an oscilloscope. 170 Hz seems like a low modulating frequency, but it will be enough to control the furnace correctly, since the response time of the furnace is quite high.

7.2 PWM to voltage

7.2

25

PWM to voltage

As mentioned earlier, the furnace cannot be turned on and off at high frequencies and therefore the pwm signal needs to be converted to a variable voltage. This can be done using a series RC circuit (figure G.1). This circuit can be described by differential equations (7.1) and (7.2). pc V 4.8

VR

0

I

0 time

time

input voltage

1.2K

pwm signal

Vin

power supply

V 4.8

47 mF

A

VC

Figure 7.3: RC circuit

Vin − VC dVC =C R dt

(7.1)

VR = Vin − VC

(7.2)

In this circuit it is important to set the time constant (τ = RC) of the RC-circuit higher than the minimal pulse width (PWmin ), which has earlier been determined to be 5 ms. The time constant is defined as the time it takes the system’s step response (charging the capacitor through the resistor) to reach approximately 63% of full charge or to discharge it to 37% of its initial value. These percentages are determined by solving equation (7.1) using an integrating factor, with implementation of equation (7.2). This results in equations (7.3) and (7.4). t

VC (t) = V (1 − e(− RC ) ) t

VR (t) = V e(− RC )

(7.3) (7.4)

With these equations it is possible to determine the exact voltage across the capacitor and resistor during charging, for discharging the equations are vice-versa. Also, the rate of change is shown to be a fractional 1 − 1e per τ , which leads to a fully charged capacitor after 5τ . The equations also show that as time passes the voltage across the capacitor goes to V, while the voltage across the resistor tends to 0. The choice for the time constant is dependant on the minimal pulse width. Choosing the time constant higher than PWmin will result in a more constant output voltage, since the slope of charging the capacitor is less. This effect is shown in figure 7.4.

26

Pulse Width Modulation PW min

PW max

t = PW min

Vout

time t = 5 PW min

Vout

time t = 10 PWmin

Vout

time

Figure 7.4: Vout for different time constants τ With the duty cycle of the pwm signal not at 100%, the capacitor has insufficient time to charge up, resulting in a small voltage (this can also be seen in figure 7.4) and a high frequency output 1 across the capacitor (ω >> RC ). With the expression for I given in (7.5) and Ohm’s Law, the voltage across the capacitor can be described by (7.6). This expression shows an integrator across the capacitor, meaning that the input signal of the capacitor is integrated and given as an output (respectively the solid and dashed line in figure 7.4). [5]

I=

Vin R + 1/jωC

1 VC = RC

Z 0

(7.5)

t

Vin dt

(7.6)

Finally the interface is tested to confirm correct conversion and determine the amount of variation present in the output voltage. Herefore a Qbasic programming file (appendix H) is written in which the desired input voltage for the power supply is the input parameter and the actual voltage given is measured with a multimeter and compared with that desired voltage. The setup of this measurement is shown in figure 7.5.

7.2 PWM to voltage desired input for power supply

27

Qbasic file

pwm

pwmvoltage

variable voltage

2.421

multimeter

Figure 7.5: Schematic setup of the measurement From these measurements it can be concluded that conversion from pwm to voltage works properly. With the current circuit an output voltage with a maximum of 2.6 Volt can be created. Meaning that a pwm signal with a duty cycle of 100% will result in an input voltage for the power supply of 2.6 V. According to figure 6.2 this will be sufficient to reach a heating rate of 20 o C/min. There did exist a variation in the voltage of about ±5 mV. This variation can be decreased by placing the interface in a decent box, with decent connections. Furthermore, this variation will be acceptable.

Chapter 8

Control The final control is performed following the control scheme shown in figure 8.1. The controller creates a PWM signal from the error between the reference and actual temperature, which is then converted to a variable voltage using a PWM-to-voltage interface (appendix G). This is the feedback part of the control. Next, a feedforward can be implemented by analyzing the characteristics of the furnace according to the input voltage of the power supply. During characterization of the power supply, the required input voltages for specific heating rates are determined. In this way the error is minimized beforehand. Finally both voltages are added, resulting in a total voltage that is send to the power supply. FF

reference signal

+

C -

pwm

pwmvoltage

voltage

pwm

pwmvoltage

voltage +

+

PS

HE

temperature

control thermocouple

Figure 8.1: New control scheme Now this control scheme is implemented in a Qbasic programming file that will acquire the necessary data from the system and from there determines the required control voltage. The control voltage is defined as the voltage that is created according to the pwm signal from the error. Also the required feedforward voltage is determined in this programming file. The feedforward voltage is defined as the voltage required to obtain the desired heating rate and is also created using a pwm signal. The creation of a general pwm signal has already been explained in chapter 7.1. For the control pwm signal, the error signal is compared to the sawtooth and when the error is greater than the sawtooth, the pwm signal will be in a high state. When the error is smaller than the sawtooth, the signal will be in low state. This results in a pwm signal with varying duty-cycle. Now the biggest challenge is to find a relation between the value of the error and the necessary increase in the input voltage, this is done through a number of experiments. The pwm signal for the feedforward voltage is created by a preset duty-cycle proportional to the desired input voltage, related to the desired heating rate according to equation (6.1). Finally, after conversion from pwm to voltage, the feedforward voltage and control voltage are summarized and led to the input of the power supply (figure 8.1).

30

8.1

Control

Qbasic programming file

Some parts of the Qbasic programming file (appendix I) used to control the temperature of the furnace and analyze the acquired data might need some explanation. Here a summary of important functions and an explanation of the design of the programme are given:

8.1.1

Functions

INP: Command to read the bit pattern of a port. OUT: Command to send data to a parallel port, Requires the port adress and the value to be send, in decimal or hexadecimal. In the file hexadecimal numbers are used. CTREG: Control register, controls the state of the processor. It can issue resets, enable the processor or halt it. STINR: Status register, shows the current status of conversion (EOC) and of input lines IN0 - IN4. But in this file it is only used to register the status of conversion (End Of Conversion: 1). OUTBR: 8 bit output port, specifies the location of the memory. This function can put a voltage of 4.8 V (maximum output voltage defined by the card) at a specified output when it is used in combination with OUT. For example, OUT OUTBR, H1 puts a 0 at outport 1. H1 is hexadecimal 1 which equals binary 0001. The first binary number determines whether a 0 or a 1 is send and the other three determine the number of the outport. Thus, the command OUT OUTBR, HA will put 1 at outport 2 (hexadecimal A = decimal 10 = binary 1010). Putting a 1 on an outport means sending a voltage of 4.8 V.

8.1.2

Design

Definition of global variables and directions: Here the global variables are defined together with the directions that are specified by the acquisition card. Constants: Definition of the constants used in this file. Reference signal: the reference signal is created by entering the desired heating rate, final temperature and the desired time to keep the temperature constant. The initial temperature is obtained through a measurement at the beginning of the programme. Herefore a number of measurements are averaged to eliminate the noise effects that are present in the acquired signal. Control: This part of the file actually implements the control. First the required files are opened to save data and a number of time-dependent variables are introduced. Next the control loop starts.

8.1 Qbasic programming file

31

In the control loop first the single ramp part of the signal is controlled, starting with acquiring the control temperature, sample temperature and expansion value. After that the sample temperature and expansion value are written to the ’analysis’-file to be used for further analysis of the behaviour of the sample. Also the time, reference signal and control temperature are written to the ’data’-file to be able to analyze the control system. Next the pulse width modulation is implemented by creating a sawtooth and comparing this with the existing error. This results in a required control voltage at output pin 17. As can be seen in the file, a voltage will only be applied when the error is greater than 0. However, the range of the sawtooth can be adjusted in order to create a specific treshold for the error, meaning that a certain error is allowed and that value can be set by the lower bound of the sawtooth (if the error is smaller than the lower bound there will be no control voltage). The amount of heating at certain errors is determined by both the lower and upper bound of the sawtooth. For example, when a sawtooth is applied between 1 and 6, an error of 5 o C will result in a pwm signal with a duty-cyle of 80%, equation (8.1). The optimal bounds for the sawtooth can be determined by experiments. At almost the same time the feedforward signal is implemented. Therefore, first the voltage necessary to obtain the required heating rate is determined through equation (6.1), which is obtained by a least squares fit through measurement data (chapter 6). This voltage is then converted to a desired duty-cycle by equation (8.2), with Vmax = 4.8 V. Finally pin 15 will output the pwm signal created for this feedforward signal. YU B − YLB error − YLB

duty-cycle =

(8.1)

Vdesired ∗ (YU B − YLB ) + YLB Vmax

(8.2)

With: YU B = upper bound of the sawtooth YLB = lower bound of the sawtooth Vmax = 4.8 V

The second part if the control consists of keeping the temperature constant. For this purpose the control voltage will be used and the feedforward signal will be stopped. Thus the control relies solely on feedback.

32

Control

8.2

Experiments

First the control is tested without using the feedforward determined in chapter 6. This can be done by giving a desired heating rate and final temperature as the input and acquire the data necessary to analyze the experiment (time, reference signal, measured temperature). The data is analyzed using the Matlab m-file given in appendix J. This m-file will plot a figure that shows the tracking behaviour of the actual temperature. For a standard sawtooth of 0 − 1 this leads to the tracking behaviour shown in figure 8.2, in which the blue line represents the reference signal and the red line the tracking behaviour. o

o

Saw: 0 - 1, heating rate 15 C/min

o

temperature [ C]

o

temperature [ C]

Saw: 0 - 1, heating rate 5 C/min

time [s]

(a) heating rate: 5o C/min

time [s]

(b) heating rate: 15o C/min

Figure 8.2: Tracking behaviour without feedforward, heating rates: 5 o C/min and 15 o C/min

This tracking behaviour can be optimized by determining the desired input voltage according to the size of the error. This can be done by varying the range of the sawtooth, as explained earlier. To give an idea about the difference these boundaries can make, some simulations have been done showing the output voltage given with a fixed error signal and varying boundaries. The results are shown in figure 8.3. Optimization can than be performed by changing these parameters according to a positive change in the tracking behaviour. Experiments have shown that a sawtooth of 0 − 1.5 will give the best results in tracking behaviour. As mentioned in chapter 7 the principle of control has proved to be working. Without any feedforward there might be some delay present in the tracking. This delay is not a big problem, since the sample thermocouple will acquire the actual temperature to analyze the phase transitions and point them at the right temperature. Most important is that the desired heating rate is followed.

8.2 Experiments

33 Sawtooth: 0 - 4

Sawtooth: 0 - 8 sawtooth error signal

o

error [ C]

o

error [ C]

sawtooth error signal

time [s]

time [s]

Output voltage

Output voltage pwm signal output voltage

pwm state

pwm state

pwm signal output voltage

time [s]

time [s]

Figure 8.3: Results of simulations with different boundaries Next the feedforward determined from the characterization in chapter 6.1 is implemented in the control. Again the tracking behaviour can be analyzed using the earlier mentioned mfile. This feedforward is optimized by adjusting the prescribed input voltage according to the actual measured heating rates. Also the effect of the feedforward is improved by changing the range and location of the sawtooth. Because changes in the sawtooth will also affect the error control, a separate sawtooth is used for the feedforward. From experiments it was concluded that a sawtooth of 1 − 5 for the feedforward signal gives the best results (figure 8.4). With the separate sawtooths designed for the error control and the feedforward signal, the control file for the closed-loop temperature control is finished. Figure 8.5 shows the tracking behaviour of the control for different heating rates. As can be seen from table 8.1 the mean error during operation increases with increasing heating rate. Also the standard deviation, σ, increases. Another conclusion that can be drawn is that the control is more accurate during the constant temperature part of the profile. However, there does exist quite a difference in the mean errors. This can be explained by the fact that a higher heating rate implies more delay and therefore the mean error increases. Comparing these errors to the required accuracy of 10 o C, these results are quite good.

34

Control

o

o

temperature [ C]

Saw 0 - 5

temperature [ C]

Saw 0 - 3

time [s]

time [s]

(a) Feedforward sawtooth: 0 − 3

(b) Feedforward sawtooth: 0 − 5

o

o

temperature [ C]

Saw 1 - 8

temperature [ C]

Saw 1 - 5

time [s]

time [s]

(c) Feedforward sawtooth: 1 − 5

(d) Feedforward sawtooth: 1 − 8

Figure 8.4: Results of feedforward experiments with varying sawtooth

heating rate 5o C/min 10o C/min 15o C/min 20o C/min

with FF, constant T mean error [o C]

0.7736 0.9716 1.1073 1.0965

[o C]

σ 0.9666 1.2207 1.3628 1.2763

with FF, heating mean error [o C]

0.8743 1.0663 1.4824 1.3042

[o C]

σ 1.1110 1.3012 2.0078 1.6343

without FF, heating mean error [o C]

1.6620 1.8022 1.5549 ...

Table 8.1: Mean error and standard deviation σ during control

σ [o C] 1.7575 1.3912 0.9506 ...

8.2 Experiments

35 Error

o

temperature [ C]

o

temperature [ C]

Tracking behaviour

time [s]

time [s] o

(a) Heating rate 5 C/min

(b) Error Error

o

temperature [ C]

o

temperature [ C]

Tracking behaviour

time [s]

time [s] o

(c) Heating rate 10 C/min

(d) Error Error

o

temperature [ C]

o

temperature [ C]

Tracking behaviour

time [s]

time [s] o

(e) Heating rate 15 C/min

(f) Error Error

o

temperature [ C]

o

temperature [ C]

Tracking behaviour

time [s]

(g) Heating rate 20o C/min

time [s]

(h) Error

Figure 8.5: Tracking behaviour of the designed control

36

Control

Additional points of interest are examining the effect when the heating rate exceeds the maximal possible heating rate due to limitations of the power supply and determine the maximal cooling rate when requiring a negative temperature slope is interesting. Therefore, heating rates of 100 o C/min, 75 o C/min and 50 o C/min are applied to the furnace. This leads to the tracking behaviour shown in figure 8.6. From this it can be concluded that a heating rate up till approximately 75 o C/min is possible, however, the settling time in that case is about 30 seconds. Again, for the current application this is acceptable. The overshoot present in these measurements can be explained by the enormous amount of heat applied and the cooling rate when the power supply is turned off. Tracking behaviour

o

o

temperature [ C]

temperature [ C]

Tracking behaviour

time [s]

time [s]

(a) Heating rate 50 o C/min

(b) Heating rate 75 o C/min

o

temperature [ C]

Tracking behaviour

time [s]

(c) Heating rate 100 o C/min

Figure 8.6: Tracking behaviour with high heating rates

8.2 Experiments

37

The cooling rate is determined from different starting points, the results are shown in figure 8.7. This figure shows that the cooling rates are approximately equal while starting at different temperatures. When a negative temperature slope is desired in the profile, this information can be used to determine for example the maximum cooling rate.

o

temperature [ C]

Cooling curves

time [s] Figure 8.7: Cooling curves at different temperatures

Finally, a second feedforward could be applied to the control system. This would be the feedforward acquired through the model and verified by measurements (chapter 3). This feedforward would compensate for the difference in temperature between the control thermocouple and the actual sample temperature. This known error can than be added to the actual error and from there the necessary control voltage can be adjusted. Unfortunately it was not possible to implement this feedforward, since the model could not be verified.

Chapter 9

Conclusion and Recommendations 9.1

Conclusion

A digital closed loop temperature control has been designed for the dilatometer that is present at the University of Buenos Aires. The design of this control is based on pulse width modulation. The PWM signal is constructed from the error signal obtained by the thermocouple. From there the signal is converted to a variable voltage and send directly to the power supply. This direct control is a replacement for the current electromechanical control. This will eliminate a number of noise sources that were present in the electromechanical control, resulting in a more accurate control. Next to the feedback control, a feedforward is applied to decrease the error. Finally, the replacement makes it easier to adjust the desired temperature profile and to obtain and analyze the required data.

9.2

Recommendations

Although the new control is working properly, there are a number of recommendations to improve the control. Also, to perform actual measurements for which the dilatometer was built, some future work needs to be done. • optimization First of all, the implemented control has not yet been fully optimized. Ideas to optimize the control are to determine the ideal range for the sawtooth, how many increments (to go from LB to UB) are necessary to obtain a smooth sawtooth but not influence the calculation time too much (accuracy versus calculation time). Also the model made in chapter 3.2 should be verified, after which a second feedforward can be constructed using this information. • characterization For the current feedforward, the characterization of the power supply has been done by changing the input voltage which is created by the old electromechanical control. A more accurate feedforward can be created by using a PWM signal constructed in Qbasic as the input voltage, in this way confirming the actual dynamics between what the computer sends out and the power supply receives. Also measuring more samples at at smaller intervals will increase the accuracy of the feedforward control.

40

Conclusion and Recommendations • Electronics The two amplifiers and the pwm-to-voltage interface are currently placed in open air with weak connections. Therefore they should be soldered properly and then be put in a decent housing with decent connections. This will significantly decrease the noise on the signal of the thermocouple. • Power supply The power supply that is currently used in the setup is very old. Therefore there is no information available about the exact working of the supply and there are no specifications available. This makes it hard to tune the pwm-to-voltage interface. Therefore it is recommended to acquire a new power supply. This will make it easier to implement the pwm-to-voltage interface and it will last longer. • Thermocouple To be able to verify the model and know the exact temperature of the sample for analysis, a new thermocouple is required. This thermocouple should be placed next to the sample. When replaced, it will be best to also replace the control thermocouple, such that the two thermocouples used are identical. • Measurement unit The output signal of the measurement unit is not yet digitalized. To do this the amplifier that is present in the measurement part of the control unit needs to be connected and the output signal can be obtained by the data acquisition card.

Bibliography [1] http://en.wikipedia.org/wiki/Pressure-measurement. [2] http://www.netzsch-thermal-analysis.com. [3] http://en.wikipedia.org/wiki/Digital-to-analog-converter. [4] http://en.wikipedia.org/wiki/Pulse-width-modulation. [5] http://en.wikipedia.org/wiki/RC-circuit. [6] “Control unit for dilatometer type 402/3E”. NETZSCH-Gerätebau GmbH, 1966. [7] “Measurement unit for dilatometer type 402/3E”. NETZSCH-Gerätebau GmbH, 1966. [8] “Recording unit for dilatometer type 402/3E”. NETZSCH-Gerätebau GmbH, 1966. [9] “Manual EDWARDS 3-stage ’Speedivac’ diffusion pump”. EDWARDS high vacuum, 1971. [10] “Manual EDWARDS ’Speedivac’ rotary pump”. EDWARDS high vacuum, 1971. [11] Michael Barr. “Introduction to Pulse Width Modulation”. Embedded Systems Design, 2001.

Appendix A

Expansion of sample holder

oC

T

quartz ∆l l0

platinum ∆l l0

x10−4 20 20 - 100 - 200 - 300 - 400 - 500 - 600 - 700 - 800 - 900 - 1000 - 1100 - 1200 - 1300 - 1400 20 - 1500

0 0.41 1.00 1.62 2.25 2.86 3.46 4.04 4.60 5.15 5.69 -

x10−3 0 0.706 1.613 2.545 3.508 4.490 5.498 6.542 7.600 8.69 9.81 10.94 12.08 13.30 14.53 15.77

chronin ∆l l0

sample holder AL2 O3 Dh ∆l l0 = l0

x10−3 0 1.044 3.643 5.153 6.741 8.433 10.216 12.082 14.019 16.03 18.12 -

x10−3 0 0.400 0.963 1.629 2.275 3.020 3.808 4.638 5.44 6.29 7.16 7.99 8.83 9.75 10.68 11.62

Table A.1: Absolute values of linear expansion, divided by ambient length l0

Appendix B

Specifications Vacuum pumps B.1

Specifications diffusion pump

Number of stages:

.... ....

3

Speed: unbaffled: .... .... 70 − 80 L/s at baffle-valve inlet: .... .... 50 − 55 L/s at complementary baffles (einbau-baffles): 30 − 40 L/s Ultimate vacuum, at 15o C:

.... ....

> 5e − 6 torr

Maximum backing pressure for specified ultimate, at standard heater input: .... .... 0.5 torr Recommended suction:

.... ....

Recommended "Speedivac" backing pump:

3 m3 /h 1SC50B

Backing connection:

.... ....

"Speedivac" vacuum coupling NW12

Fluid charge:

.... ....

50 ml

Heater loading:

.... ....

250 Watt

Water connection:

.... ....

1/4 inch

Baffle-valve type:

.... ....

5L2

46

B.2

Specifications Vacuum pumps

Specifications rotation pump

Ultimate vacuum without gas ballast:

.... ....

> 5x10−3 torr (McLeod)

Ultimate vacuum with gas ballast: (air is a suitable ballast for most applications)

.... ....

> 5x10−3 torr (McLeod)

Speed of rotation:

.... .... .... 480 rev/min

Displacement (swept volume):

.... .... .... 158 L/min

Maximum inlet pressure of water vapour at full gas ballast at pump temperature 60o C:

.... ....

20 torr

Maximum gas ballast flow:

.... .... ....

15 L/min

Safe water vapour pumping rate:

.... .... ....

+/- 0.18 kg/hr

Power of motor:

.... .... ....

1/3 hp

Normal oil charge:

.... .... ....

1.8 L

Grade of pump oil for maximum protection against corrosion: "Speedivac" No.18 oil Grade of pump oil for highest ultimate vacuum: .... .... Weight of pump only, with pulley: .... .... .... Weight of pump outfit, less motor:

"Speedivac" No.16 oil

27.2 kg

.... .... ....

Weight of pump outfit, with standard motor:

34.8 kg .... ....

Approximate operating temperature of the pump, at ultimate vacuum and ambient temperature 20o C: without gas ballast: .... .... .... 46o C with gas ballast: .... .... .... 65o C Approximate operating temperature of the motor at ambient temperature 20o C: .... .... ....

56o C

46.4 kg

Appendix C

C-files implemented in Simulink model C.1

C-file for T1

/* Radiation equations for Furnace Model, sample temperature */ /* by Mariska Verdonschot */ /* 25 sept 2007 */

#define S_FUNCTION_NAME T1 #define S_FUNCTION_LEVEL 2 #include "simstruc.h" #include #define #define #define #define

NSTATES NINPUTS NOUTPUTS NPARAMS

#define T1(element) #define T2(element)

0 2 1 0 (*uPtrs0[element]) /* Temperature sample */ (*uPtrs1[element]) /* Temperature tube */

/* definition of constants */ #define A 5.67e-8 #define B 0.8 #define C 0.0490 #define mc1 1.9580 #define mc2 101.2449

/* /* /* /* /*

Stefan-Boltzmann constant */ emissivity coefficient of the tube */ Area of the tube [m2]*/ m*c of the sample */ m*c of the tube */

static void mdlInitializeSizes(SimStruct *S) {

48

C-files implemented in Simulink model ssSetNumSFcnParams(S, NPARAMS); if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) { return; /* Parameter mismatch will be reported by Simulink */ } ssSetNumContStates(S,NSTATES); ssSetNumDiscStates(S,0); if (!ssSetNumInputPorts(S, NINPUTS)) return; ssSetInputPortWidth(S, 0, 1); ssSetInputPortDirectFeedThrough(S, 0, 1); ssSetInputPortWidth(S, 1, 1); ssSetInputPortDirectFeedThrough(S, 1, 1); if (!ssSetNumOutputPorts(S, NOUTPUTS)) return; ssSetOutputPortWidth(S, 0, 1); ssSetNumSampleTimes(S, 1);

/* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, SS_OPTION_WORKS_WITH_CODE_REUSE | SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_USE_TLC_WITH_ACCELERATOR); /* This option should not be set for device driver blocks (A/D) */ }

static void mdlInitializeSampleTimes(SimStruct *S) { ssSetSampleTime(S, 0, INHERITED_SAMPLE_TIME); ssSetOffsetTime(S, 0, 0.0); ssSetModelReferenceSampleTimeDefaultInheritance(S); }

/* ============== */ /* Define outputs */ /* ============== */ static void mdlOutputs(SimStruct *S, int_T tid) { real_T *Temp1 = ssGetOutputPortRealSignal(S,0); InputRealPtrsType uPtrs0 = ssGetInputPortRealSignalPtrs(S,0); InputRealPtrsType uPtrs1 = ssGetInputPortRealSignalPtrs(S,1); *Temp1 = A*B*C*(pow(T2(0)+273,4) - pow(T1(0)+273,4))/mc1; }

C.2 C-file for T2

49

/* ========= */ /* Terminate */ /* ========= */ static void mdlTerminate(SimStruct *S) { } #ifdef MATLAB_MEX_FILE #include "simulink.c" #else #include "cg_sfun.h" #endif

C.2

/* Is this file being compiled as a MEX-file? */ /* MEX-file interface mechanism */ /* Code generation registration function */

C-file for T2

/* Radiation equations for Furnace Model, control temperature */ /* by Mariska Verdonschot */ /* 25 sept 2007 */

#define S_FUNCTION_NAME T2 #define S_FUNCTION_LEVEL 2 #include "simstruc.h" #include #define #define #define #define

NSTATES NINPUTS NOUTPUTS NPARAMS

0 3 1 0

#define T1(element) (*uPtrs0[element]) /* Temperature sample */ #define T2(element) (*uPtrs1[element]) /* Temperature tube */ #define Pin(element) (*uPtrs2[element]) /* Variable Power Input */ //#define Ploss(element) (*uPtrs3[element]) /* Variable Power Loss */

/* definition of constants */ #define A 5.67e-8 #define B 0.8 #define C 0.0490 #define mc1 1.9580 #define mc2 101.2449

/* /* /* /* /*

Stefan-Boltzmann constant */ emissivity coefficient of the tube */ Area of the tube [m2] */ m*c of the sample */ m*c of the tube */

50

C-files implemented in Simulink model

static void mdlInitializeSizes(SimStruct *S) { ssSetNumSFcnParams(S, NPARAMS); if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) { return; /* Parameter mismatch will be reported by Simulink */ } ssSetNumContStates(S,NSTATES); ssSetNumDiscStates(S,0); if (!ssSetNumInputPorts(S, NINPUTS)) return; ssSetInputPortWidth(S, 0, 1); ssSetInputPortDirectFeedThrough(S, 0, 1); ssSetInputPortWidth(S, 1, 1); ssSetInputPortDirectFeedThrough(S, 1, 1); ssSetInputPortWidth(S, 2, 1); ssSetInputPortDirectFeedThrough(S, 2, 1); if (!ssSetNumOutputPorts(S, NOUTPUTS)) return; ssSetOutputPortWidth(S, 0, 1); ssSetNumSampleTimes(S, 1); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, SS_OPTION_WORKS_WITH_CODE_REUSE | SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_USE_TLC_WITH_ACCELERATOR); }

static void mdlInitializeSampleTimes(SimStruct *S) { ssSetSampleTime(S, 0, INHERITED_SAMPLE_TIME); ssSetOffsetTime(S, 0, 0.0); ssSetModelReferenceSampleTimeDefaultInheritance(S); }

/* ============== */ /* Define outputs */ /* ============== */ // #define T1t4 // #define T2t4

double pow(double T1(0), double 4) double pow(double T2(0), double 4)

C.2 C-file for T2

51

static void mdlOutputs(SimStruct *S, int_T tid) { real_T *Temp2 = ssGetOutputPortRealSignal(S,0); InputRealPtrsType uPtrs0 = ssGetInputPortRealSignalPtrs(S,0); InputRealPtrsType uPtrs1 = ssGetInputPortRealSignalPtrs(S,1); InputRealPtrsType uPtrs2 = ssGetInputPortRealSignalPtrs(S,2); *Temp2 = (A*B*C*(pow(T2(0)+273,4) - pow(T1(0)+273,4))+Pin(0))/mc2; }

/* ========= */ /* Terminate */ /* ========= */ static void mdlTerminate(SimStruct *S) { } #ifdef MATLAB_MEX_FILE #include "simulink.c" #else #include "cg_sfun.h" #endif

/* Is this file being compiled as a MEX-file? */ /* MEX-file interface mechanism */ /* Code generation registration function */

Appendix D

Specifications Microaxial’s ADQ12-B 12 bit A/D converter, input-output, timer 12 bit A/D converter Unbalanced inputs (single-end): 16 channels Balanced inputs (differential): 8 channels Input range, linear (unipolar): +5, +2, +1, +0.5 V Input range, linear (bipolar): ±5, ±2, ±1, ±0.5 V Max. input current: 10 mA Max. input tension at 10 mA (RS = 390 ohm): 16/18 V Max. input tension in normal mode (non-linear): ±12 V Input impedance: balanced 20 Mohm,. unbalanced 10 Mohm Total resistance, 390+ RMUX (on): typical 740 ohm Offset current (inputs): ±5nA at 25o C, 90nA at 70o C Converter A/D, resolution 1/4096: 12 bit Coding: binary for unipolar, binary-desplazado for bipolar Conversion time: typical 10 µs Acquisition speed: 64000 samples/second Max. sampling speed: 7000 samples/second Programmable gain software: 4 ranges Digital input-output 8 bit output port, bit by bit programmable 5 bit input port Inputs: VIL = 0.8V, VIH = 2.0V, VH = 0.4V, IIL = 200µA, IIH = 20µA Outputs: VOL = 0.35V, VOH = 2.7V, IOL = 8µA, IOH = −400µA Min. writing time, CTREG, OUTBR: 650 ns Min. reading time, STINR: 650ns Timer 16 bit counter, internal or external clock 32 bit pacer, clock 16 µs for 2h and 23m

54

Specifications Microaxial’s ADQ12-B

Pin 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

Function C7+ C5+ C3+ C1+ C7− C5− C3− C1− AGND +12V IN3 IN2 G2 CLK2 OUTB6 OUTB5 OUTB2 +VREF +5V

Pin 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

Function C6+ C4+ C2+ C0+ C6− C4− C2− C0− −12V IN4 IN1 IN0 OUT2 OUTB7 OUTB4 OUTB3 OUTB1 PDGND

Table D.1: Functions of the input-output pins

Appendix E

Thermocouple amplifier 100K

220K

4.7K +15 V

680K 10K

LM335

R2

R1 10K

LM336-5

10K 68W

100K

R7

R6

5K

R3

-15 V 5K

7

+15 V 2

Vin = a*(Tm-Tr)

6

R4

+

Vout

-15 V

Vout / Vin = 780 V2=(V1*R5) / (R4+R5)

OP17 -

4

3

Tm

R5

Vin Tr

V1

Figure E.1: Electric circuit of the amplifiers

V2

Appendix F

Thermocouple F.1

Conversion table T/o C 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 160 180 200 225 250 275 300 350 400 450

U/mV 0.000 0.055 0.113 0.173 0.235 0.299 0.365 0.432 0.502 0.573 0.645 0.719 0.795 0.872 0.950 1.109 1.273 1.440 1.654 1.873 2.096 2.323 2.786 3.260 3.743

T/o C 500 550 600 650 700 750 800 850 900 950 1000 1050 1100 1150 1200 1250 1300 1350 1400 1450 1500 1550 1600 1650 1700

U/mV 4.234 4.732 5.237 5.751 6.274 6.805 7.345 7.892 8.448 9.012 9.585 10.165 10.754 11.348 11.947 12.550 13.155 13.761 14.368 14.973 15.576 16.176 16.771 17.360 17.942

Table F.1: Conversion table Thermocouple type S

58

Thermocouple

F.2 % % % % %

m-file using least squares fit

Conversion of millivolts to temperature using a least squares fit through the given data y = ax^3 + bx^2 + cx + d y = temperature; x = voltage y = inv(A’A)A’B (is equal to y = A/B)

clear all close all clc

% given data to convert mV to degC Th = [0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 160 180 200 ... 225 250 275 300 350 400 450 500 550 600 650 700 750 800 850 ... 900 950 1000 1050 1100 1150 1200 1250 1300 1350 1400 1450 ... 1500 1550 1600 1650 1700]; mV = [0.000 0.055 0.113 0.173 0.235 0.299 0.365 0.432 0.502 0.573 ... 0.645 0.719 0.795 0.872 0.950 1.109 1.273 1.440 1.654 1.873 ... 2.096 2.323 2.786 3.260 3.743 4.234 4.732 5.237 5.751 6.274 ... 6.805 7.345 7.892 8.448 9.012 9.585 10.165 10.754 11.348 ... 11.947 12.550 13.155 13.761 14.368 14.973 15.576 16.176 ... 16.771 17.360 17.942]; Digit = [0 61 126 193 262 333 407 482 560 639 719 801 886 972 ... 1059 1236 1419 1605 1844 2088 1336 2589 3106 3634 4172 ... 4720 5275 5838 6411 6994 7586 8187 8797 9417 10046 10684 ... 11331 11988 12650 13317 13990 14664 15339 16016 16690 ... 17363 18031 18695 19351 20000];

% Least squares fit, 4th order and 10th order A = [mV.^3’,mV.^2’,mV’,ones(50,1)]; A10 = [mV.^9’,mV.^8’,mV.^7’,mV.^6’,mV.^5’,mV.^4’,mV.^3’,mV.^2’,mV’,ones(50,1)]; B

= [Th’];

Y = A\B; Y10 = A8\B; figure(1) subplot(211) plot(mV,Th,’bo’) hold on plot(mV,mV.^3*Y(1)+mV.^2*Y(2)+mV.*Y(3) + Y(4),’r’)

F.2 m-file using least squares fit

59

plot(mV,mV.^9*Y10(1)+mV.^8*Y10(2)+mV.^7*Y10(3)+mV.^6*Y10(4)+mV.^5*Y10(5)+ ... mV.^4*Y10(6)+mV.^3*Y10(7)+mV.^2*Y10(8)+mV.*Y10(9)+Y10(10),’g’) grid legend(’data’,’4th order fit’,’10th order fit’) ylabel(’Temperature [C]’) xlabel(’Voltage [mV]’) title(’Characteristics Thermocouple’) subplot(212) ylabel(’residual Temperature [C]’) xlabel(’Voltage [mV]’) plot(mV,Th-(mV.^3*a+mV.^2*b+mV.*c + d),’ro-’) hold on plot(mV,Th-(mV.^9*Y10(1)+mV.^8*Y10(2)+mV.^7*Y10(3)+mV.^6*Y10(4)+mV.^5*Y10(5)+ ... mV.^4*Y10(6)+mV.^3*Y10(7)+mV.^2*Y10(8)+mV*Y10(9)+Y10(10)),’go-’) legend(’4th order’,’10th order’) grid

Characteristics of the thermocouple 1800 1600 1400

temperature [oC]

1200 1000 800 600 400 data

200

10th order fit 0

0

2

4

6

8 10 voltage [mV]

12

14

16

Figure F.1: Relation voltage to temperature

18

Appendix G

PWM-to-voltage interface +6 V

27K

+6 V

BC337 2.2KW

100nF

V1

LN4005 100nF 7

1W 2

2.2KW

3

6

Vout

+ 4

V2

-

47mF

1W LN4005 100nF BC327

27K

Figure G.1: Electric circuit of the pwm-to-voltage interface

Appendix H

Qbasic: PWM test ’***************************************************************** ’* Definition of global variables and directions * ’***************************************************************** DEFINT A-Z ’* All variables in 16 bits DirBas = &H300 ’* Base direction of the card: 300h CTREG STINR OUTBR ADLOW ADHIG CONT0 CONT1 CONT2 COWOR

= = = = = = = = =

DirBas DirBas DirBas DirBas DirBas DirBas DirBas DirBas DirBas

+ + + + + + + + +

0 0 4 8 9 &HC &HD &HE &HF

’* I/O directions relative to DirBas

’****************************************************************** ’* Reference Signal * ’****************************************************************** TIMER ON INPUT INPUT INPUT INPUT

"Heating rate: ", heatingrate! "Final temperature: ", Tfinal! "Time constant temperature: ", tc! "Desired Vout: ", Vout!

hrate! = heatingrate! / 60 Ti! = 20 tf! = (Tfinal! - Ti!) / hrate! tf2! = tf! + tc! OPEN "pwm.mat" FOR OUTPUT AS #1 OPEN "pwmsaw.mat" FOR OUTPUT AS #2

’* ’* ’* ’* ’* ’* ’* ’*

define define define define

heating desired desired desired

rate in degC/min final temperature time to keep T constant output voltage [V]

heating rate in degC/sec initial temperature final time ramp final time

64

Qbasic: PWM test

’****************************************************************** ’* PWM implementation, for testing the pwm-to-voltage interface * ’****************************************************************** OUT CTREG, 1 ’* select channel 1, FE: +5V e = INP(ADLOW) ’* Dispara el conversor AD. t0! = TIMER t01! = TIMER time! = t0! n! = 2 Vmax! = 4.8

’* maximum output voltage of the acquistion card

x = Vmax!/Vout!

’* Vout = 1/x*Vmax

DO e = INP(STINR) AND &H20 LOOP WHILE e = 0

’* Wait till end of conversion

’* single ramp WHILE t01! < (t0! + tf!) IF n! MOD x = 0 THEN OUT OUTBR, &HA y! = 1 ts! = TIMER - t0! WRITE #2, ts!, y! ELSE OUT OUTBR, &H2 y! = 0 ts! = TIMER - t0! WRITE #2, ts!, y! END IF WRITE #1, tr!, y! n! = n! + 1 t01! = TIMER WEND WEND TIMER OFF CLOSE #1 CLOSE #2

’* set max voltage

’* write sawtooth to pwmsaw.mat ’* set voltage to 0

’* write sawtooth to pwmsaw.mat

’* save time and y to pwm.mat

Appendix I

Qbasic: Control programme ’************************************************************************ ’* ADQ12-B AD convertor: balanced, unipolar connection * ’************************************************************************

’************************************************************************ ’* Definition of global variables and directions * ’************************************************************************ DEFINT A-Z ’* all 16 bits variables DirBas = &H300 ’* Base direction of the card: 300h CTREG STINR OUTBR ADLOW ADHIG CONT0 CONT1 CONT2 COWOR

= = = = = = = = =

DirBas DirBas DirBas DirBas DirBas DirBas DirBas DirBas DirBas

+ + + + + + + + +

0 0 4 8 9 &HC &HD &HE &HF

’* I/O directions relative to DirBas

’************************************************************************ ’* Programming of port OUTBR * ’************************************************************************ OUT OUTBR, &H9 ’* Put OUTBIT1 at 1. OUT OUTBR, &HF ’* Put OUTBIT7 at 1 OUT OUTBR, &H7 ’* Put OUTBIT7 at 0 ’****** function OUT **************************************************** ’* * ’* OUT OUTBR, &H1 Out() is the function, OUTBR is the location * ’* of the memory, &H1, is hexidecimal (H), 1, * ’* which is 0001 and puts a 0 at outport 1 *

66

Qbasic: Control programme

’* OUT OUTBR, &5 5, decimal, 0110 and puts a 0 at outport 5 * ’* OUT OUTBR, &HA A = 10, 1010 put a 1 at outport 2 * ’* * ’* so the first bit from the left determines whether to put a * ’* 0 or a 1 the other 3 bits determine the outport * ’* * ’* 1 1 1 1 bits * ’* 8 4 2 1 numbers * ’* * ’************************************************************************ ’************************************************************************ ’* Constants * ’************************************************************************ v0! = 23 ’* offset in amplifier 1: OUT1 = 23 v1! = 0 ’* offset in amplifier 2: OUT2 = 0 Yff1! Yff2! Yff3! Yff4!

= = = =

-.000010756958# -.000476604093# .0523549357965# 1.7682174592426#

’* for implementation of the heatingrate ’* vs input voltage constants determined ’* through 4th order least squares fit, analysisVall.m

x = 100 voltmax! = .05 Vmax! = 4.8

’* every x cycles the data is saved to compare with reference ’* maximum voltage possible for measuring expansion ’* maximum output voltage of the card

n! = 140 p! = 0 i! = 1

’* for designing of sawtooth, start at 2 to make ’MOD’ work ’* counter to average the initial temperature

’************************************************************************ ’* Reference Signal * ’************************************************************************ TIMER ON OUT CTREG, 1 e = INP(ADLOW)

’* select channel 1, FE: +5V ’* initiate the AD convertor.

’* reading of the inital temperature WHILE p! < 300 a = INP(ADHIG) ’* read byte high b = INP(ADLOW) ’* read byte low c = a * 256 + b ’* convert to 12 bits v! = c * 5 / 4096 ’* Vout of amplifier Ti! = v0! + v! / .005 ’* initial temperature, offset + 5 mV/degC Ttot! = Ttot! + Ti! ’* summarize p values p! = p! + 1 ’* counter

67 WEND Ti! = Ttot! / 300 ’* determine average initial temperature PRINT "Initial temperature: "; Ti! ’* required information to determine reference signal INPUT "Heating rate: ", hrate! ’* define heating rate in degC/min [degC] INPUT "Final temperature: ", Tfinal! ’* define desired final temperature [degC] INPUT "Time constant temperature: ", tco! ’* define desired time for constant T [s] ’* INPUT "Measuring range: ", mrange! ’* set measuring range [m]

heatingrate! = hrate! / 60 tf! = (Tfinal! - Ti!) / heatingrate! tf2! = tf! + tco!

’* heating rate in degC/sec ’* final time ramp ’* final time total

’******************************************************************** ’* Control * ’******************************************************************** OPEN "TOTAL5.mat" FOR OUTPUT AS #1 OPEN "ANA5.mat" FOR OUTPUT AS #2 OPEN "PWMFF5.mat" FOR OUTPUT AS #3 OPEN "PWMERR5.mat" FOR OUTPUT AS #4 t0! = TIMER t01! = TIMER tr! = TIMER - t0!

’* used as starting time of the measurement ’* used as current time during measurement ’* used as time for analysis, starting at 0

Tref! = Ti! Treal! = Ti!

’* set starting point of reference at initial temperature ’* set real temperature to initial temperature

DO e = INP(STINR) AND &H20 LOOP WHILE e = 0

’* Wait for end of conversion (EOC)

’* single ramp WHILE t01! < (t0! + tf!)

’* reading of the control thermocouple OUT CTREG, 1 ’* select channel 1, FE:+5V, PIN8:OUT1, PIN4:GND a = INP(ADHIG) ’* read byte high b = INP(ADLOW) ’* read byte low c = a * 256 + b ’* convert to 12 bits

68

Qbasic: Control programme va! = c * 5 / 4096 Treal! = v0! + va! / .005

’* Vout of amplifier ’* determine control temperature, offset:5 mV/degC

tr! = TIMER - t0! Tref! = heatingrate! * tr! + Ti!

’* real time from start of measurement ’* function for reference signal

tc! = tc! + Treal!

’* Tc used for averaging each x measurements, Tc/x

dif! = Tref! - Treal!

’* error

’* ’* ’* ’* ’* ’* ’*

reading of the sample thermocouple OUT CTREG, 2 ’* CH2, FE:+5V, PIN26:OUT2, PIN22:GND a = INP(ADHIG) ’* read byte high b = INP(ADLOW) ’* read byte low c = a * 256 + b ’* convert to 12 bits vs! = c * 5 / 4096 ’* vs is amplified voltage of the sample Tsample! = v1! + vs!/.005 ’* determine Tsample, offset + 5 mV/degC

’* ’* ’* ’* ’* ’* ’*

reading of the expansion measurement OUT CTREG, 3 ’* CH3, FE:+5V, PIN7:output expansion, PIN3:GND a = INP(ADHIG) ’* read byte high b = INP(ADLOW) ’* read byte low c = a * 256 + b ’* convert to 12 bits vexp! = c * 5 / 4096 ’* vexp is the voltage of the expansion Expansion! = vexp! * mrange! / voltmax! ’* conversion from mV to expansion

WRITE #2, Tsample!, Expansion!

’* write data to #2 for analysis

’* write important parameters to file data.mat IF i! MOD x = 0 THEN Tcontrol! = tc! / x ’* Tcontrol = avg of x measurements WRITE #1, tr!, Tref!, Treal!, Tcontrol! ’* save time,Tref,Treal,Tcontrol tc! = 0 ’* set Tc to 0 END IF dif2! = Tcontrol! - Tref! dif3! = Tref! - Tcontrol!

’* designing of the sawtooth IF n! MOD 140 = 0 THEN y! = 1 END IF IF n! MOD 141 = 0 THEN

69 y! = 1.05 END IF . .. etc .. . IF n! MOD 199 = 0 THEN y! = 4.95 END IF IF n! MOD 200 = 0 THEN y! = 5 n! = 139 END IF ’* implementation of heating rate feedforward: Vout! = hrate! * hrate! * hrate! * Yff1! + hrate! * hrate! * Yff2! ... ... + hrate! * Yff3! + Yff4! ’*function obtained by least squares fit, analysisVall.m, 4th order dutycycle! = Vout! / Vmax! * (5 - 1) + 1 ’* determine the desired dutycycle for the heatingrate, feedforward! ’* y! is integrated because this value can change according to the allowed error ’*WRITE #3, Vout!, dutycycle! IF dutycycle! > y! THEN IF dif2! > 0 THEN OUT OUTBR, &H6 WRITE #3, 0 ELSE OUT OUTBR, &HE WRITE #3, 1 END IF ELSE OUT OUTBR, &H6 WRITE #3, 0 END IF

’* if Treal > Tref, do nothing ’* send 0 V to outport 2 (0110): OUTB6 =pin15

’* send 5 V to outport 2 (1110): OUTB6 =pin15

’* send 0 V to outport 2 (0110): OUTB6 =pin15

’* actual PWM implementation IF dif3! > y! THEN IF dif2! > 0 THEN OUT OUTBR, &H2 WRITE #4, 0 ELSE OUT OUTBR, &HA ’* send 5 V to outport 2 (1010): OUTB2 =pin17 WRITE #4, 1 END IF

70

Qbasic: Control programme ELSE OUT OUTBR, &H2 WRITE #4, 0 END IF i! = i! + 1 n! = n! + 1 t01! = TIMER

’* send 0 V to outport 2 (0010): OUTB2 =pin17

’* counter for designing sawtooth and averaging data ’* reset current time

WEND OUT OUTBR, &H6 ’*i! = 1 ’*Tc! = 0 n! = 130

’* reset i to 2 to make ’MOD’ work

’* constant temperature WHILE t01! < (t0! + tf2!) ’* reading of the control thermocouple OUT CTREG, 1 ’* select channel 1, FE: +5V, PIN8: OUT1, PIN4: GND a = INP(ADHIG) ’* read byte high b = INP(ADLOW) ’* read byte low c = a * 256 + b ’* convert to 12 bits va! = c * 5 / 4096 ’* Vout of amplifier Treal! = v0! + va! / .005 ’* determine Tcontrol, offset + 5 mV/degC tr! = TIMER - t0! Tref! = Tfinal!

’* real time from start of measurement ’* reference signal

tc! = tc! + Treal!

’* Tc used for averaging each x measurements, Tc/x

dif! = Tref! - Treal!

’* error

’* ’* ’* ’* ’* ’* ’*

reading of the sample thermocouple OUT CTREG, 2 ’* CH2, FE:+5V, PIN26:OUT2, PIN22:GND a = INP(ADHIG) ’* read byte high b = INP(ADLOW) ’* read byte low c = a * 256 + b ’* convert to 12 bits vs! = c * 5 / 4096 ’* vs is amplified voltage of the sample Tsample! = v1! + vs!/.005 ’* determine Tsample, offset + 5 mV/degC

’* ’* ’* ’*

reading of the expansion measurement OUT CTREG, 3 ’* CH3, FE:+5V, PIN7:output exp, PIN3:GND a = INP(ADHIG) ’* read byte high b = INP(ADLOW) ’* read byte low

71 ’* c = a * 256 + b ’* convert to 12 bits ’* vexp! = c * 5 / 4096 ’* vexp is the voltage of the expansion ’* Expansion! = vexp! * mrange! / voltmax! ’* conversion from mV to expansion WRITE #2, Tsample!, Expansion!

’* write data to #2 for analysis

’* write important parameters to file data.mat IF i! MOD x = 0 THEN Tcontrol! = tc! / x ’* Tcontrol = avg of x measurements WRITE #1, tr!, Tref!, Treal!, Tcontrol! ’* save time,Tref,Treal,Tcontrol tc! = 0 ’* set Tc to 0 END IF dif2! = Tcontrol! - Tref! dif3! = Tref! - Tcontrol! ’* designing of IF n! MOD 130 = y! = 0 END IF IF n! MOD 131 = y! = .05 END IF . .. etc .. . IF n! MOD 149 = y! = 1.45 END IF IF n! MOD 140 = y! = 1.5 n! = 129 END IF

the sawtooth 0 THEN

0 THEN

0 THEN

0 THEN

’* actual PWM implementation IF dif3! > y! THEN IF dif2! > 0 THEN ’* if Treal > Tref, do nothing OUT OUTBR, &H2 ’* send 0 V to outport 2 (0110): OUTB6 =pin15 WRITE #4, 0 ELSE OUT OUTBR, &HA ’* send 5 V to outport 2 (1010): OUTB2 =pin17 WRITE #4, 1 END IF ELSE

72

Qbasic: Control programme OUT OUTBR, &H2 WRITE #4, 0 END IF i! = i! + 1 n! = n! + 1 t01! = TIMER

WEND OUT OUTBR, &H6 OUT OUTBR, &H2 TIMER OFF

CLOSE CLOSE CLOSE CLOSE

#1 #2 #3 #4

’* send 0 V to outport 2 (0010): OUTB2 =pin17

’* counter for sawtooth and avg data ’* reset current time

Appendix J

m-file for analysis % m-file for the analysis of the measurement data % define saved data time = DATA(:,1); Tref = DATA(:,2); Treal = DATA(:,3); Tcontrol = DATA(:,4); Tsample = ANALYSIS(:,1); Expansion = ANALYSIS(:,2); % plot tracking behaviour figure(1) plot(time,Tref,’b’) hold on plot(time,Tcontrol,’r’) xlabel(’time [s]’) ylabel(’temperature [^oC]’) title(’Tracking behaviour of the Control Thermocouple’) legend(’Tref’,’Tcontrol’) hold off grid % plot sample temperature against expansion value figure(2) plot(Tsample,Expansion) xlabel(’Sample temperature’) ylabel(’Expansion value’) title(’Sample temperature vs. expansion value’) grid

Smile Life

When life gives you a hundred reasons to cry, show life that you have a thousand reasons to smile

Get in touch

© Copyright 2015 - 2024 PDFFOX.COM - All rights reserved.