You are on page 1of 77

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 3
2.1 Measuring unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Control principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Vacuum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3.1 Working principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.4 Upgrading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3 Modelling 9
3.1 Radiation theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2 Simulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

4 Control Concepts 15
4.1 LED control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.2 Direct control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.3 Concept choice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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 29
8.1 Qbasic programming file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
8.1.1 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
8.1.2 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
8.2 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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 Microaxials 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 Qbasic: Control programme 65

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 mea-
surement 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-Gertebau 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 effec-
tive. 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 temper-
ature 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 temper-
ature 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 water
screw thermostat pushrod thermocouple sample cooling optics

gas vacuum

glass fibre
to pyrometer

gas

inductive insulation graphite


transducer 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 Thermocouple [mV]


Coil Push-rod

Supporting tube sample


DL [mV]

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 photo temperature


prism PS HE
- meter cell

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 con-
trols the heating element by increasing or decreasing the input voltage for the power supply. [6]
6 Dilatometer

2.3 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
10e4 mbar (= 75e6 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 com-
pressed 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 103 . 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 103 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

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 - 103 torr. [1], [10]

After reaching a vacuum of 103 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 105 torr). Since the range of diffusion pumps is less than 103 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: 102 - 104 and 2: 104 - 105 . [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 tem-
perature 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 instal-
lation 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 ther-
mocouple 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

Tc
Ts

Protection tube 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 Modelling

3.1 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
(3.1)
dQ Ts4 Tc4
dt = 11 1 1
1 A1
+ A1 F12
+ A2
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 ) (3.2)
dt 1 + 2 A
1 1
A2 (1 2 )

And with A2 >> A1 this leads to equation (3.3).

dQ
= 1 A1 (Ts4 Tc4 ) (3.3)
dt
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).

dTc
mc cc = Pin Ploss Prad (3.4)
dt

dTs
ms cs = Ac (Ts4 Tc4 ) = Prad (3.5)
dt
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 11

3.2 Simulations
Next this model is implemented as a closed-loop temperature control in Matlab Simulink (fig-
ure 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

Tracking behaviour Tracking behaviour


temperature [ C]

temperature [ C]
o

o
time [s] time [s]
o
(a) Profile with heating rate: 5 C/min (b) Profile with heating rate: 20o C/min
Error during simulation Error during simulation
error Tc error Tc
error Ts error Ts
temperature [ C]

temperature [ C]
o

time [s] time [s]


o
(c) Thermocouple errors, 5 C/min (d) Thermocouple errors, 20o C/min
Error between Tc and Ts, during simulation Error between Tc and Ts, during simulation
temperature [ C]

temperature [ C]
o

time [s] time [s]

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

Figure 3.3: Results of simulations with different profiles


3.2 Simulations 13

Tracking behaviour Tracking behaviour

temperature [ C]
temperature [ C]

o
o

time [s] time [s]


o
(a) Initial temperature: 20 C (b) Initial temperature: 520o C
Error during simulation Error during simulation
error Tc error Tc
error Ts error Ts
temperature [ C]

temperature [ C]
o

time [s] time [s]


o
(c) Initial temperature: 20 C (d) Initial temperature: 520o C
Error between Tc and Ts, during simulation Error between Tc and Ts, during simulation
temperature [ C]

temperature [ C]
o

time [s] time [s]

(e) Initial temperature: 20o C (f) Initial temperature: 520o C

Figure 3.4: Results at different initial temperatures


14 Modelling

3.3 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 thermocou-
ple 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 + photo temperature


C LED PS HE
-
cell

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 pertur-
bation 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 Modula-
tion. 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 + temperature
C DAC PS HE
-

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 disadvan-
tages 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 man-
ufactured 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 con-
verted 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 ther-
mocouple 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 thermo-
couples 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 MicroAxials 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.
18

reading control thermocouple input signals


reading sample thermocouple input signal (pwm)
reading expansion input signal (pwm)
output (pwm) output signal (voltage)
output (pwm) output signal (voltage)

voltage source voltage source voltage source

15.00 V 15.00 V
6 Volt 6 Volt

+ - + - - GND + - GND +

pwm-voltage amplifier connection


interface interface acquisition card
connection
1
20
power supply 2
21
3
22
4
23
5
-15 V GND +15 V 24
6
25
7
pwm-voltage 26
8
27
circuit OUT2 OUT1 9
28
10
29
11
30
12
31
13
32
14
amp circuit 33
15
34
16
35
17
36
18
37

Figure 5.1: Connection scheme for data acquisition


19

sample
thermocouple control expansion
thermocouple signal
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 manufac-
turer 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 tem-
perature 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 num-
ber 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 21

Figure 6.2: Relevant characteristic of the power supply


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
10%
1

0
50%
1

0
90%
1

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 percent-
ages 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 loads 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]

Intersective method

1
source signals

1
PWM signal

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 25

7.2 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 power supply
V 4.8
4.8 VR
0
I 0
time
time

1.2K input voltage


pwm signal A

47 mF
Vin VC

Figure 7.3: RC circuit

Vin VC dVC
=C (7.1)
R dt

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 systems 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 ) ) (7.3)

t
VR (t) = V e( RC ) (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 Ohms 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]

Vin
I= (7.5)
R + 1/jC

Z t
1
VC = Vin dt (7.6)
RC 0

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 27

desired input
variable
for power supply Qbasic pwm pwm- voltage 2.421
file voltage

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 ac-
cording 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.
pwm pwm- voltage
FF
voltage

reference signal + pwm pwm- voltage +


+ temperature
C PS HE
- voltage

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 Control

8.1 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 con-
trol 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 tem-
perature 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
(8.1)
error YLB

Vdesired
duty-cycle = (YU B YLB ) + YLB (8.2)
Vmax
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 5 C/min Saw: 0 - 1, heating rate 15 C/min
temperature [ C]

temperature [ C]
o

time [s] time [s]

(a) heating rate: 5o C/min (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 prob-
lem, 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 heat-
ing rate is followed.
8.2 Experiments 33

Sawtooth: 0 - 4 Sawtooth: 0 - 8
sawtooth sawtooth
error signal error signal
error [ C]

error [ C]
o

o
time [s] time [s]
Output voltage Output voltage
pwm signal pwm signal
output voltage output voltage
pwm state

pwm state

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 m-
file. 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

Saw 0 - 3 Saw 0 - 5
temperature [ C]

temperature [ C]
o

o
time [s] time [s]

(a) Feedforward sawtooth: 0 3 (b) Feedforward sawtooth: 0 5


Saw 1 - 5 Saw 1 - 8
temperature [ C]

temperature [ C]
o

time [s] time [s]

(c) Feedforward sawtooth: 1 5 (d) Feedforward sawtooth: 1 8

Figure 8.4: Results of feedforward experiments with varying sawtooth

with FF, constant T with FF, heating without FF, heating


heating rate mean error [o C] [o C] mean error [o C] [o C] mean error [o C] [o C]
5o C/min 0.7736 0.9666 0.8743 1.1110 1.6620 1.7575
10o C/min 0.9716 1.2207 1.0663 1.3012 1.8022 1.3912
15o C/min 1.1073 1.3628 1.4824 2.0078 1.5549 0.9506
20o C/min 1.0965 1.2763 1.3042 1.6343 ... ...

Table 8.1: Mean error and standard deviation during control


8.2 Experiments 35

temperature [ C] Tracking behaviour Error

temperature [ C]
o

o
time [s] time [s]
o
(a) Heating rate 5 C/min (b) Error
Tracking behaviour Error
temperature [ C]

temperature [ C]
o

time [s] time [s]


o
(c) Heating rate 10 C/min (d) Error
Tracking behaviour Error
temperature [ C]

temperature [ C]
o

time [s] time [s]


o
(e) Heating rate 15 C/min (f) Error
Tracking behaviour Error
temperature [ C]

temperature [ C]
o

time [s] time [s]

(g) Heating rate 20o C/min (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 max-
imal 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 Tracking behaviour

temperature [ C]
temperature [ C]

o
o

time [s] time [s]

(a) Heating rate 50 o C/min (b) Heating rate 75 o C/min


Tracking behaviour
temperature [ C]
o

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.

Cooling curves
temperature [ C]
o

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 feed-
forward 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 pos-
sible 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 modu-
lation. 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 elim-
inate 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 specifica-
tions 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-Gertebau GmbH, 1966.

[7] Measurement unit for dilatometer type 402/3E. NETZSCH-Gertebau GmbH, 1966.

[8] Recording unit for dilatometer type 402/3E. NETZSCH-Gertebau 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 quartz platinum chronin sample holder


AL2 O3
l l l l Dh
T l0 l0 l0 l0 = l0

x104 x103 x103 x103


20 0 0 0 0
20 - 100 0.41 0.706 1.044 0.400
- 200 1.00 1.613 3.643 0.963
- 300 1.62 2.545 5.153 1.629
- 400 2.25 3.508 6.741 2.275
- 500 2.86 4.490 8.433 3.020
- 600 3.46 5.498 10.216 3.808
- 700 4.04 6.542 12.082 4.638
- 800 4.60 7.600 14.019 5.44
- 900 5.15 8.69 16.03 6.29
- 1000 5.69 9.81 18.12 7.16
- 1100 - 10.94 - 7.99
- 1200 - 12.08 - 8.83
- 1300 - 13.30 - 9.75
- 1400 - 14.53 - 10.68
20 - 1500 - 15.77 - 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: .... .... 3 m3 /h

Recommended "Speedivac" backing pump: 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 Specifications Vacuum pumps

B.2 Specifications rotation pump


Ultimate vacuum without gas ballast: .... .... > 5x103 torr (McLeod)

Ultimate vacuum with gas ballast: .... .... > 5x103 torr (McLeod)
(air is a suitable ballast for most applications)

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: .... .... "Speedivac" No.16 oil

Weight of pump only, with pulley: .... .... .... 27.2 kg

Weight of pump outfit, less motor: .... .... .... 34.8 kg

Weight of pump outfit, with standard motor: .... .... 46.4 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
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 <math.h>

#define NSTATES 0
#define NINPUTS 2
#define NOUTPUTS 1
#define NPARAMS 0

#define T1(element) (*uPtrs0[element]) /* Temperature sample */


#define T2(element) (*uPtrs1[element]) /* Temperature tube */

/* definition of constants */
#define A 5.67e-8 /* Stefan-Boltzmann constant */
#define B 0.8 /* emissivity coefficient of the tube */
#define C 0.0490 /* Area of the tube [m2]*/
#define mc1 1.9580 /* m*c of the sample */
#define mc2 101.2449 /* 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 /* Is this file being compiled as a MEX-file? */


#include "simulink.c" /* MEX-file interface mechanism */
#else
#include "cg_sfun.h" /* Code generation registration function */
#endif

C.2 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 <math.h>

#define NSTATES 0
#define NINPUTS 3
#define NOUTPUTS 1
#define NPARAMS 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 /* Stefan-Boltzmann constant */
#define B 0.8 /* emissivity coefficient of the tube */
#define C 0.0490 /* Area of the tube [m2] */
#define mc1 1.9580 /* m*c of the sample */
#define mc2 101.2449 /* 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 double pow(double T1(0), double 4)


// #define T2t4 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 /* Is this file being compiled as a MEX-file? */


#include "simulink.c" /* MEX-file interface mechanism */
#else
#include "cg_sfun.h" /* Code generation registration function */
#endif
Appendix D

Specifications Microaxials 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 = 200A, IIH = 20A
Outputs: VOL = 0.35V, VOH = 2.7V, IOL = 8A, IOH = 400A
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 Microaxials ADQ12-B

Pin Function Pin Function


1 C7+ 20 C6+
2 C5+ 21 C4+
3 C3+ 22 C2+
4 C1+ 23 C0+
5 C7 24 C6
6 C5 25 C4
7 C3 26 C2
8 C1 27 C0
9 AGND 28 12V
10 +12V 29 IN4
11 IN3 30 IN1
12 IN2 31 IN0
13 G2 32 OUT2
14 CLK2 33 OUTB7
15 OUTB6 34 OUTB4
16 OUTB5 35 OUTB3
17 OUTB2 36 OUTB1
18 +VREF 37 PDGND
19 +5V

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


Appendix E

Thermocouple amplifier

100K 220K 4.7K


+15 V

680K
10K
LM335
R1 R2
10K LM336-5
10K

68W 100K 5K

R7 R6
-15 V R3
5K

+15 V
7

2 OP17
- 6
3
R4
+ Vout
4

Vin = a*(Tm-Tr)
Vout / Vin = 780 -15 V
Vin R5
V2=(V1*R5) / (R4+R5) Tm
Tr V1 V2

Figure E.1: Electric circuit of the amplifiers


Appendix F

Thermocouple

F.1 Conversion table

T/o C U/mV T/o C U/mV


0 0.000 500 4.234
10 0.055 550 4.732
20 0.113 600 5.237
30 0.173 650 5.751
40 0.235 700 6.274
50 0.299 750 6.805
60 0.365 800 7.345
70 0.432 850 7.892
80 0.502 900 8.448
90 0.573 950 9.012
100 0.645 1000 9.585
110 0.719 1050 10.165
120 0.795 1100 10.754
130 0.872 1150 11.348
140 0.950 1200 11.947
160 1.109 1250 12.550
180 1.273 1300 13.155
200 1.440 1350 13.761
225 1.654 1400 14.368
250 1.873 1450 14.973
275 2.096 1500 15.576
300 2.323 1550 16.176
350 2.786 1600 16.771
400 3.260 1650 17.360
450 3.743 1700 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(AA)AB (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

1200
temperature [oC]

1000

800

600

400

200 data
10th order fit
0
0 2 4 6 8 10 12 14 16 18
voltage [mV]

Figure F.1: Relation voltage to temperature


Appendix G

PWM-to-voltage interface

+6 V

27K
+6 V

BC337

2.2KW 100nF
V1 LN4005
100nF
1W
7

2
- 6
2.2KW Vout
3
V2 +
4

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 = DirBas + 0 * I/O directions relative to DirBas


STINR = DirBas + 0
OUTBR = DirBas + 4
ADLOW = DirBas + 8
ADHIG = DirBas + 9
CONT0 = DirBas + &HC
CONT1 = DirBas + &HD
CONT2 = DirBas + &HE
COWOR = DirBas + &HF

******************************************************************
* Reference Signal *
******************************************************************
TIMER ON

INPUT "Heating rate: ", heatingrate! * define heating rate in degC/min


INPUT "Final temperature: ", Tfinal! * define desired final temperature
INPUT "Time constant temperature: ", tc! * define desired time to keep T constant
INPUT "Desired Vout: ", Vout! * define desired output voltage [V]

hrate! = heatingrate! / 60 * heating rate in degC/sec


Ti! = 20 * initial temperature
tf! = (Tfinal! - Ti!) / hrate! * final time ramp
tf2! = tf! + tc! * final time

OPEN "pwm.mat" FOR OUTPUT AS #1


OPEN "pwmsaw.mat" FOR OUTPUT AS #2
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 * Wait till end of conversion
LOOP WHILE e = 0

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

IF n! MOD x = 0 THEN
OUT OUTBR, &HA * set max voltage
y! = 1
ts! = TIMER - t0!
WRITE #2, ts!, y! * write sawtooth to pwmsaw.mat
ELSE
OUT OUTBR, &H2 * set voltage to 0
y! = 0
ts! = TIMER - t0!
WRITE #2, ts!, y! * write sawtooth to pwmsaw.mat
END IF

WRITE #1, tr!, y! * save time and y to pwm.mat

n! = n! + 1
t01! = TIMER

WEND

WEND

TIMER OFF

CLOSE #1
CLOSE #2
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 = DirBas + 0 * I/O directions relative to DirBas


STINR = DirBas + 0
OUTBR = DirBas + 4
ADLOW = DirBas + 8
ADHIG = DirBas + 9
CONT0 = DirBas + &HC
CONT1 = DirBas + &HD
CONT2 = DirBas + &HE
COWOR = DirBas + &HF

************************************************************************
* 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! = -.000010756958# * for implementation of the heatingrate


Yff2! = -.000476604093# * vs input voltage constants determined
Yff3! = .0523549357965# * through 4th order least squares fit, analysisVall.m
Yff4! = 1.7682174592426#

x = 100 * every x cycles the data is saved to compare with reference


voltmax! = .05 * maximum voltage possible for measuring expansion
Vmax! = 4.8 * maximum output voltage of the card

n! = 140 * for designing of sawtooth, start at 2 to make MOD work


p! = 0 * counter to average the initial temperature
i! = 1

************************************************************************
* Reference Signal *
************************************************************************
TIMER ON

OUT CTREG, 1 * select channel 1, FE: +5V


e = INP(ADLOW) * 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 * heating rate in degC/sec


tf! = (Tfinal! - Ti!) / heatingrate! * final time ramp
tf2! = tf! + tco! * 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 * used as starting time of the measurement


t01! = TIMER * used as current time during measurement
tr! = TIMER - t0! * used as time for analysis, starting at 0

Tref! = Ti! * set starting point of reference at initial temperature


Treal! = Ti! * set real temperature to initial temperature

DO
e = INP(STINR) AND &H20 * Wait for end of conversion (EOC)
LOOP WHILE e = 0

* 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 * Vout of amplifier


Treal! = v0! + va! / .005 * determine control temperature, offset:5 mV/degC

tr! = TIMER - t0! * real time from start of measurement


Tref! = heatingrate! * tr! + Ti! * 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 * if Treal > Tref, do nothing
OUT OUTBR, &H6 * send 0 V to outport 2 (0110): OUTB6 =pin15
WRITE #3, 0
ELSE
OUT OUTBR, &HE * send 5 V to outport 2 (1110): OUTB6 =pin15
WRITE #3, 1
END IF
ELSE
OUT OUTBR, &H6 * send 0 V to outport 2 (0110): OUTB6 =pin15
WRITE #3, 0
END IF

* 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 * send 0 V to outport 2 (0010): OUTB2 =pin17
WRITE #4, 0
END IF

i! = i! + 1
n! = n! + 1 * counter for designing sawtooth and averaging data
t01! = TIMER * reset current time

WEND

OUT OUTBR, &H6


*i! = 1 * reset i to 2 to make MOD work
*Tc! = 0
n! = 130

* 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! * real time from start of measurement


Tref! = Tfinal! * 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 the sawtooth


IF n! MOD 130 = 0 THEN
y! = 0
END IF
IF n! MOD 131 = 0 THEN
y! = .05
END IF
.
..
etc
..
.
IF n! MOD 149 = 0 THEN
y! = 1.45
END IF
IF n! MOD 140 = 0 THEN
y! = 1.5
n! = 129
END IF

* 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 * send 0 V to outport 2 (0010): OUTB2 =pin17


WRITE #4, 0
END IF

i! = i! + 1
n! = n! + 1 * counter for sawtooth and avg data
t01! = TIMER * reset current time

WEND

OUT OUTBR, &H6


OUT OUTBR, &H2

TIMER OFF

CLOSE #1
CLOSE #2
CLOSE #3
CLOSE #4
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

You might also like