E Datenerfassung PC (1)

download E Datenerfassung PC (1)

of 15

Transcript of E Datenerfassung PC (1)

  • 7/25/2019 E Datenerfassung PC (1)

    1/15

    140

    Carl von Ossietzky University Oldenburg Faculty V - Institute of PhysicsModule Introductory laboratory course physics Part I

    Data Acquisition and Processing with the PC

    Keywords:Continuous and discrete signals, sampling, sampling rate, sampling frequency,resolution, ana-log/digital conversion, weighing method, multiplexing, dual numbers, bit, digit.

    Measuring program:Writing of a MATLAB-script for data acquisition with an A/D board, determination of the resolution ofan A/D board, measurement of alternating voltages, calibration of a pressure sensor, measurement oftemporal pressure changes.

    References:

    /1/ Kose, V. [Hrsg.]; Wagner, S. [Hrsg.]: Kohlrausch - Praktische Physik Bd. 3, Teubner, Stuttgart,1996

    1 Introduction

    In many physical experiments, the change of a value of a physical quantity Gis to be acquired as a func-tion of time t. Such quantities may be e.g.: Pressure p, temperature T, intensity of radiation I, force F,acceleration a, among others. For recording G(t), sensors are used which convert the value of G(t) e.g.into a voltage signal U(t) (compare experiment Sensors...).

    Previously, so-called XT recorderswere used to record the temporal course of U(t) on paper. Nowadays,

    PCs with data acquisition boards1

    (hereafter DAB) are used instead, which register the course of U(t)digitally.

    In this experiment, the most important properties of such data acquisition boards and a software required

    for their control (exemplarily Mat l abwith the Dat a Acqui si t i on Tool box) are illustrated.

    2 Basics of Data Acquisition

    2.1 Continuous and Discrete Signals

    With a data acquisition board an analog voltage signal U(t) is transformed into a time series of numericalvalues N(i), i , that can be further processed with the PC. In general, the signal U(t) is neither

    restricted to certain voltage values nor to certain time values according toFig. 1 (top). Therefore, it iscalled a time- and value-continuoussignal.

    Even with very fast (and hence expensive) electronic components of a data acquisition board, voltagevalues U(t) can be recorded (sampled) only at discrete points in time tiat the interval

    (1) { }1 \ 0i it t t i =

    The quantity tis called sampling interval, thereciprocal value of this quantity,

    1 A data acquisition board is a card to be installed into a PC containing all electronic components necessary for its

    function that can communicate with the rest of the hardware in the PC via the system bus(the entirety of data,address and control wires).

  • 7/25/2019 E Datenerfassung PC (1)

    2/15

    141

    (2) [ ] 11

    sR Rt

    = =

    is called sampling rateor sampling frequencyand is given in samples/s or only in 1/s. The greater R, the

    better is the temporal resolutionof the signal recording.

    In practice, a restricted sampling rate is often used in order to reduce the amount of data to be stored. Thequestion of how large Rhas to be chosen to enable the signal course to be recorded correctly will beinvestigated in detail later on in the experiment Fourier analysis.

    Due toRbeing restricted to t> 0, and henceR< , a time-discretesignal U(ti) is generated by samplingU(t) as shown inFig. 1 (middle). For better visibility, vertical lines are drawn in the diagram instead ofdata points whose lengths correspond to the individual voltages U(ti).

    Fig. 1: Conversion of a value- and time-continuous voltage signalU

    (t) (top) into a time-discrete signalU(ti) (middle) and a value- and time-discrete numerical sequenceN(i) (bottom).

    t

    U(t)

    t

    U(t )

    i

    i

    N(i)U

    t

    ti

  • 7/25/2019 E Datenerfassung PC (1)

    3/15

    142

    The conversion of an analog voltage value U(ti) into a numerical value N(i) by means of an analog todigital converter(A/D converter, cf. Chap.2.2)of a data acquisition board is not feasible at an arbitraryprecision, but is restricted by the resolutionAof the A/D converter.Ais given in bit:

    (3) Bit,A m m=

    For every data acquisition board, the measurable input voltage is restricted to an interval of the width

    (4)max mine

    U U U=

    For A/D conversion, mbit and thus 2mnumerical values in the range between N = 0 and N = 2m 1 are

    available for this voltage interval. Hence, the difference between two voltage values, the assigned numeri-cal values of which differ by just 1 (1 digit), is

    (5)2

    e

    m

    UU =

    This quantity is also called the resolutionof the A/D conversion. With U> 0, the time-discrete signal in

    Fig. 1 (middle) becomes a time- and value-discrete signal by A/D conversion as shown inFig. 1 (bottom).

    Within a maximum voltage range (e.g. 10 V), Uemay often be restricted to a smaller interval by soft-ware (cf.Table 1). This can be used to increase the resolution of the A/D conversion, if the input signal isknown lie within this interval.

    An example for this: If the voltage interval is set to 10 V, then Ue= 20 V and, according to Eq. (5)

    (rounded to 4 significant digits): U= 0.07813 V for m= 8 and U= 0.0003052 V for m= 16. If the

    voltage interval is constrained to 0.5 V, then Ue= 1 V and higher resolution is achieved for an equal

    number of bits: U= 0.003906 V for m= 8 and U= 0.00001526 V for m= 16.

    2.2 Principle of A/D Conversion

    Analog to digital converters (ADC) work on different principles. A conversion method frequently appliedin data acquisition is the so-called weighing methodworking on the principle of successive approxima-tion. This method is schematically represented inFig. 2.

    First, all mbits of the converter are set to 0. After that, the most significant bit (MSB) with the numbermand the significance 2m

    -1is set to 1 on a trial basis. A voltage source contained in the A/D converter

    subsequently generates a voltage UDwith the value

    (6) [ ]12mDU k k V = =

    kbeing a proportional factor dependent on Ue. A comparatoris used thereafter to verify

    (7) ( ) ?i DU t U

    If so:

    bit no. mcontinues to be set to 1,

    bit no. m-1 is set to 1, too,

    the internal voltage source generates a new voltage UDwith the value

    (8) ( )1 22 2m mDU k = +

  • 7/25/2019 E Datenerfassung PC (1)

    4/15

    143

    If not:

    bit no. mis set back to 0,

    bit no. m-1 is set to 1,

    the internal voltage source generates a new voltage UDwith the value

    (9)2

    2

    m

    DU k

    =

    Fig. 2: Principle of A/D conversion according to the weighing method for an A/D converter with m= 8

    bits. For the voltages UDgenerated by the A/D converter (red) that exceed the input voltageU(ti) (blue), the corresponding bits are set to 0. In the example, these are the bits having values27, 23and 22. The other bits are set to 1, since UD< U(ti) is fulfilled for the voltages UD.

    Thereafter, the validity of Eq. (7) is verified anew with the voltage UDfrom Eqs. (8) and (9), respectively,

    and depending on the result, bit no. m-1 is treated like bit no. mwas treated before.

    Analogous steps are performed until the least significant bit (LSB) with the number 1 and the significance2

    0has been obtained. In this way, the values 0 or 1 of the individual bits can be determined by means of

    successive approximation between U(ti) and UD.

    In the example fromFig. 2,the voltage level U(ti) (blue) is associated with the binary number 011 100 11,

    which isN= 115 in decimal representation. If we assume that Ue= 10 V, the binary number 111 111 11(corresponding toN= 255) must be associated with the voltage level 10 V. This means, that for this valueof Ue, we must have:

    10V

    255k=

    Hence, under this prerequisite the binary number 011 100 11 fromFig. 2 corresponds to a voltage value

    U= k N= k115 4,51 V.

    Each conversion process takes a certain time period tw, which increases linearly with the number m of

    bits. Therefore, ttwmust hold for the sampling interval tfrom Eq. (1). Thus twdetermines the mini-mal temporal distance between two successive samplings and hence the maximum sampling rate Rmax:

    (10)max

    1

    w

    Rt

    =

    D

    U(t )i

    U

    0 0 01 1 1 1 1

    LSBMSB

    Bits auf0, daU >U(t)D i

    27 26 25 24 23 22 21 20

    ZustandWertigkeit

    115

    N

    8 4 37 6 5 2 1 Bit-Nr.

  • 7/25/2019 E Datenerfassung PC (1)

    5/15

    144

    The described weighting process only works, if U(ti) does not change appreciably over the time tw. Hence,it is necessary to guarantee that U(t) remains nearly constant over temporal intervals of width of twbeforea signal U(t) is recorded by a data acquisition card.

    2.3

    Multiplexing

    Normally, data acquisition boards have several signal inputs(channels) of which Mare used depending

    on the application. In most cases, however, only one A/D converteris available on the boards. Samplingof theMinput signals must then be done in the so-called multiplexing mode. At first, the signal at channel1 is sampled, then with a temporal delay of tweach the signal at channel 2, the signal at channel 3 and so

    on, until channelMhas been reached. After the time t has passed, the process starts anew with the signalat channel 1. This has the consequence that the maximum sampling rate Rmax is reduced to Rmax/M perchannel in that case.

    twbeing the minimal time difference between two samples, an actually simultaneous sampling of two ormore signals is not feasible in the multiplexing mode. In practice, however, the time difference twis often

    small compared to the time in which the input signals vary appreciably, so that it can be neglected.

    An example will illustrate this fact (Fig. 3). Two signals U1(t) and U2(t) are to be recorded simultaneouslyat a sampling rate of R= 1 kHz. The temporal distance between successive sample values of U1and U2

    shall thus be t= 1 ms. The A/D converter of the data acquisition board is assumed to allow a maximumsampling rate of Rmax= 250.000 s

    -1, the minimal temporal distance between two samplings thus being

    tw= 4 s. The first value of the signal U1(t) is assumed to be recorded at time t= 0, the first value of sig-

    nal U2(t) is then recorded at time t= tw. Sampling of the second value of U1(t) is done at time t = t, the

    second value of U2(t) at time t= t+ twand so on. As tw

  • 7/25/2019 E Datenerfassung PC (1)

    6/15

    145

    If the input voltages Ujdo not have a common reference potential3, as e.g. the partial voltages Ujon the

    resistances of a voltage divider according toFig. 5 (right), the differential operation mode (DI mode, orfloating-sourcemode: FS) has to be used (Fig. 4 right). In this mode, the potential differences betweentwo separate supply contacts each are recorded for each channel. The advantages of this mode are:

    1. Identical potential fluctuations at both supply terminals of a channel4do not affect the measuredsignal, because only the potential difference Ubetween the supply terminals is measured.

    2. The input voltages Uj can have different reference potentials; there is no common referencepotential.

    However, the DI mode also produces one disadvantage. Since each DI input requires two separate con-tacts on the data acquisition board, the number of DI inputs is only half the number of SE inputs.

    Fig. 4: Left: SE signal connection with the case ground () of the data acquisition board as referencepotential (grounded source, GS).Right: DI signal connection without reference to a potential of the data acquisition board (float-ing source, FS).

    Fig. 5: Voltage source Uwith connected resistancesRjand loads Lj.Left: Partial voltages Ujwith common reference potential (ground).Right: Partial voltages without common reference potential.

    Voltmeters for measuring the partial voltages are shown in red.

    3 Characteristics of Data Acquisition Boards

    Data acquisition boards supplied by NATIONAL INSTRUMENTS(NI) are used in the introductory laboratory

    course. The most important characteristics of these cards are listed inTable 1. Fig. 6 shows as an examplea photo of the board NI PCI 6221.

    3 Such signals are also calledfloating source(FS) signals. The name comes from the fact that there is no common

    fixed reference potential. On the contrary, the potentials of both contacts can float at constant potential differ-

    ence (voltage). Example: A potential difference of (5 V - 0 V) = 5 V yields the same measurement result as thedifference (100 V 95 V) or (1.000 V 995 V).

    4 Potential fluctuations can e.g. be caused by feed throughs into the connecting cables which connect a sensor to

    the data acquisition board.

    U U

    SE / GS DI / FS

    Gehuse

    U

    U U1 2

    R1 R2 R1 R2 R3 R4

    U1 U2 U3 U4

    U

    L1 L2 L0

  • 7/25/2019 E Datenerfassung PC (1)

    7/15

    146

    Besides A/D conversion, the data acquisition boards can also be used for D/A conversion. Hence, it ispossible to convert computer-generated signals into analog voltage signals which are available at an ana-log output of the board. This option, however, is of no importance for the present and is therefore notdescribed in further detail.

    Parameter NI PCI 6014 NI PCI 6221

    A/D converter type successive approximation successive approximation

    Number of inputs 16 SE / 8 DI 16 SE / 8 DI

    Maximum sampling rateRmax/ s-1

    200.000 250.000

    ResolutionA/ Bit 16 16

    Input coupling DC DC

    Input resistance / G 100 10

    Input capacity / pF 100 100

    Range of input voltage / V(adjustable by software)

    0.05, 0.5, 5, 10 0.2, 1, 2, 10

    Table 1: Characteristics of data acquisition boards used in the introductory laboratory course.

    Fig. 6: Photo of the data acquisition board NI PCI 6221 (ref.: NI).

    4 MATLAB-Software for Controlling Data Acquisition Boards

    In the Introductory laboratory course, the software Mat l abwith the Dat a Acqui si t i on Tool boxis used to control the NI data acquisition boards specified in Chapter3.The interface between the opera-

    tion system of the PC (Wi ndows XP) and the Mat l ab software is the driver NI - DAQmx.

    The following list states the Mat l ab commands to be used to read a voltage signal into the PC, to pro-cess it and to store it via a NI-DAB. All Mat l ab commands (starting with >> ) and the related state-ments in the Command window are set in the typeface Cour i er , while the respective comments appearin the typeface of the body text (Times Roman).

  • 7/25/2019 E Datenerfassung PC (1)

    8/15

    147

    >> cl ear Clear Matlab workspace

    >> cl ose( ' al l ' , ' hi dden' ) Close all figures

    >> HW=daqhwi nf o; daqhwinfo stands for data acquisition hardwareinformation: Get information about the dataacquisition hardware installed in the PC andstore it into the structure5HW. HW containsseveralfields.

    >> HW. I nst al l edAdaptors Read content of field InstalledAdaptors of thestructure HW. This field contains the Matlabnames of the data acquisition componentsinstalled in the PC

    ans =' ni daq'' par al l el '

    ' wi nsound'

    NI-DABParallel interface of the PC

    Soundcard of the PC

    >> NI =daqhwi nf o( ' ni daq' ) ; Read information about the NI-DAB and store itinto the structure NI

    >> NI . BoardNames

    ans =' PCI - 6221'

    Query the content of the field BoardNames ofthe structure NI. This field contains the typename of the NI-DAB, here PCI 6221

    >> NI . I nst al l edBoar dI ds

    ans =' Dev1'

    Read content of field InstalledBoardIds. Thisfield contains the Matlab identification (ID) of

    the NI-DAB, here Dev1 (Device1)

    >> AI =anal ogi nput ( ' ni daq' , ' Dev1' ) ; Generate analog input object AI. After gener-ation AI establishes the connection betweenMatlab and the DAB.

    >> addchannel ( AI , 0) ; Connect input channel 0 of the DAB with theanalog input object AI. The input voltage range

    is preset to 10 V.

    >> R=1000; Choose sampling rateR, here e.g. 1000 / s

    >> set ( AI , ' Sampl eRat e' , R) ; Set (SampleRate) R on the data acquisitionboard

    >> N=1000; Choose number Nof voltage values to be read,here e.g.N= 1000

    >> set ( AI , ' Sampl esPer Tr i gger ' , N) ; SetN(SamplesPerTrigger) on the data acquisi-tion board

    >> st ar t ( AI ) Start measurement

    5 For details on structures, please refer to the appendix (Chap.6).

  • 7/25/2019 E Datenerfassung PC (1)

    9/15

    148

    >> [ U, t ] =get dat a( AI ) ; Read voltage and corresponding time valuesfrom PC-memory

    6and store data into the varia-

    bles Uand t. Uand tare column vectors.

    >> U_Mean = mean( U)

    U_Mean = . . .

    Calculate the mean Umean of the elements of Uand write it into the command window.

    >> si gma_U = st d( U)

    si gma_U = . . .

    >>si gma_U_Mean = st d(U) / sqr t ( N)

    si gma_U_Mean = . . .

    Calculate the standard deviation U of U andwrite it into the command window.

    Calculate the standard deviationU

    of the mean

    of Uand output it in the command window.

    >> Daten( : , 1) =t ;>> Dat en( : , 2)=U;

    For data storage copy the column vectors Uand t

    into the (N,2)-matrix Daten. Column 1: t,column 2: U.

    >> save( ' MD. dat ' , ' Dat en' , ' - asci i ' ) ; Store matrix Daten into ASCII file MD.dat.This file can be imported to Origin in order togenerate a diagram of U(t).

    >> pl ot ( t , U) ; Plot Uover tin order to receive a first summaryof the measured data.

    >> del et e( AI ) ; Delete input object.>> cl ear AI ; Clear AI from workspace.

    Instead of typing the mentioned commands into the command window of Mat l abline per line, it is morepractical to enter the commands into a Mat l abscript file (m-file), to save the file and then to start it. Fordetails, please refer to the Chapter Usage of computers of this script.

    In case it is known that a NI-DAB termed nidaq in Mat l abis installed in the PC and that the Mat l abidentification of the DAB is Dev1, some of the above-listed commands may be skipped. In that case, itis sufficient to enter the following lines into the m-file:

    cl earcl ose( ' al l ' , ' hi dden' )AI =anal ogi nput ( ' ni daq' , ' Dev1' ) ;addchannel ( AI , 0) ;

    R=1000;set ( AI , ' Sampl eRat e' , R) ;N=1000;set ( AI , ' Sampl esPer Tr i gger ' , N) ;star t (AI )[ U, t ] =get dat a( AI ) ;U_Mean = mean( U)si gma_U = st d(U)si gma_U_Mean = st d( U) / sqr t ( N)Dat en( : , 1) =t ;Dat en( : , 2) =U;

    6 At first, the fed data are stored into a FIFO- (First-In-First-Out)- memory on the DAB (size of the FIFO-memoryfor the DAB type NI PCI 6014: 512 measured values, type NI PCI 6221: 4096 measured values). From the

    FIFO-memory the data is transferred into the memory of the PC. This transfer is often realized by a direct con-nection between the DAB and the PC memory without using the CPU viaDirect Memory Access, DMA.

  • 7/25/2019 E Datenerfassung PC (1)

    10/15

    149

    save( ' MD. dat ' , ' Dat en' , ' - asci i ' ) ;pl ot ( t , U) ;del et e( AI ) ;cl ear AI ;

    When the m- file is to be executed several times with different values ofRandNin order to record differ-ent voltage courses (as in the experiment described below), it is useful not to alter the variables RandN

    as well as the file name, in which the data is to be saved, in the m- file each time, but to retrieve thesevariables via the command window after starting the script. For this purpose, the i nput command isused. The lines

    R=1000;N=1000;. . .save( ' MD. dat ' , ' Dat en' , ' - asci i ' ) ;

    in the m-File must then be replaced by the following lines:

    R=i nput ( ' Sampl i ng r at e R i n Hz: ' ) ;N=i nput ( ' Number N of sampl i ng poi nt s: ' ) ;. . .Name=i nput ( ' Fi l e name wi t h ext ensi on. dat : ' , ' s' ) 7;save( Name, ' Dat en' , ' - asci i ' ) ;

    Every i nput -command generates an output of the text in parenthesis in the command window and thesystem waits for an input via the keyboard. Every input is completed with the return key ().

    5 Experimental Procedure

    Equipment:Digital oscilloscope TEKTRONIX TDS 1012 / 1012B / 2012C / TBS 1102B, digital multimeter(AGILENT U1251B/U1272A), function generator (AGILENT33120A / 33220A), PC with data acqui-sition board (NATIONAL INSTRUMENTSPCI 6014 PCI or PCI 6221) and accompanying BNC adapter

    (NATIONAL INSTRUMENTSBNC-2120), 9 V battery with connector, power supply (PHYWE0 - 15 /0 - 30) V, pressure sensor (SENSORTECHNICSHCLA12X5DB) on base plate with valves on mount,ERLENMEYER flask with smoothed plug on table, U-tube manometer with holder and reading scale(filled with water), beaker glass on support jack, flexible tubes and couplings, air balloon, kitchenpaper roll.

    5.1

    Operating the PC and the Data Acquisition Board

    Before turning onthe PC make sure that the BNC adapter of type NI BNC-2120 (cf.Fig. 7)is hooked upto the data acquisition board of the PC (when the PC is running, this connecting cable must not be

    plugged in nor unplugged!). After turning on the PC, log in to the domain gprwith the known usernameandpassword.

    The BNC adapter makes it easy to connect the signals to be measured to the DAB by using coaxialcables. The adapter has 8 differential DI-inputs (labels dependent on the card typeACH 0,,ACH 7,orAI 0,,AI 7 respectively). In this experiment, signal sources (battery, power supply, pressure sensor)are, in general, only to be connected to the BNC inputACH 0, orAI 0resp.

    7 By using the s the fed characters are transferred as a text-variable (type char act er ).

  • 7/25/2019 E Datenerfassung PC (1)

    11/15

    150

    The (slider) switch above the BNC input connector of ACH 0, orAI 0 must be in the position labeledBNC. The input-selector switch for the BNC input is set to FS (floating source, cf. Chap.2.4).

    The maximum input voltage range that the data acquisition board can withstand is 10 V; this rangeshould not be exceeded. As a control, all of the input signals of the data acquisition board are thereforesimultaneously displayed on the oscilloscope.

    Fig. 7: Left: Photo of the BNC-adapter of type NI BNC-2120. Right: Sketch of the mounting jacks of

    the same adapter (Ref.: NI).

    5.2 Starting MATLAB

    Mat l ab is started by double click on the respective icon. In the Mat l ab menu line Current Direc-tory, the path O: \ Per sonal _Di r ect or y is set.

    With the commands described in Chapter 4, the designation (I nst al l edAdapt or s), the type(Boar dNames ) and the Mat l abidentification (I nst al l edBoar dI Ds) of the data acquisition boardare obtained.

    Subsequently, a m-file is written, by means of which voltage signals can be read in, processed and saved.The m file is saved in the personal directory.

  • 7/25/2019 E Datenerfassung PC (1)

    12/15

    151

    5.3 Measurement of a DC Voltage and Determination of the Resolution

    A 9 V battery is connected to the input channel of the DAB and in parallel with a multimeter. The voltageis read into the PC (R= 100 s

    -1andN= 100 are good orientation values) and the mean and the standard

    deviation of the single measurement are determined from the N measured values Ui. The determinedvalues are compared to the value measured with the multimeter and its maximum error.

    The Uiare plotted over iusing Ori gi n. It can be seen from the plot, that the Uidiffer only by integer

    multiples of a voltage value U. U is determined and compared to the expected resolution of the DABaccording to Eq. (5). Here sufficiently number of digits must be specified.

    5.4 Measurement of AC Voltages

    A sinusoidal alternating voltage without direct current offset (frequency 50 Hz, amplitude 2 V) is gener-ated using a function generator (FG). The output of the FG is connected to the input channel of the DABand in parallel with the digital oscilloscope and the multimeter. The voltage is read into the PC(R= 1,000 s

    -1andN= 1,000 are good orientation values) and its peak-peak value Ussas well as its effec-

    tive value Ueffare determined. For both quantities error informations are not required.

    Ussis, in good approximation, determined by the difference between the maximum and the minimum of

    the acquiredNvoltage values Ui. The corresponding formula in Mat l ab-notation reads:

    U_ss = max(U) - mi n(U)

    Ueff is given by:

    (11) 2eff

    1

    1 N

    i

    i

    U UN =

    =

    or, in Mat l ab- notation:

    U_ef f = sqrt ( sum( U. 2) / N)

    (cf. Chapter About the set-up of electric circuits.. of this script). This value is called the rms-value(root-mean-square value).

    The value of Ussis compared to the value measured with the oscilloscope and the effective value Ueffiscompared to the value indicated by the multimeter and to the theoretical expectation. Both devices must

    be configured so (V/DIV on the oscilloscope, measuring range on the multimeter) that Uss ,and respec-tively Ueffcan be measured with the highest possible resolution.

    The measurements described above are repeated with a square-voltage signal of the same frequency andamplitude.

    5.5 Measurement of Pressure Differences

    A pressure sensor of the type HCLA12X5DB, which has already been used in the experiment Sen-sors..., is available for measuring pressure changes in gasses. Details about its operational principle andits usage are to be taken from the accompanying script.

  • 7/25/2019 E Datenerfassung PC (1)

    13/15

    152

    5.5.1 Calibrating the Pressure Sensor

    The pressure sensor is calibrated by adjusting defined pressure differences pbetween the two connect-

    ing sleeves and by measuring the respective output voltage U for each value of p. Defined pressure dif-ferences can be adjusted using a set-up according toFig. 8,which was already described in the script for

    the experiment Sensors...

    (valve H1open, valve H2closed).

    Fig. 8: Setup for adjusting pressure differences p > 0 as compared to the ambient air pressure pL.Refer to the text and the script for the experiment Sensors for details.

    The pressure difference

    (12) Lp p p =

    at a level difference hmin the manometer is given by:

    (13) m mp h g =

    mbeing the density of the fluid in the manometer (here water) and gbeing the acceleration of gravity.For g, the value for Oldenburg is used: g = 9.8133 m/s

    2, which is assumed to be exact (error free)

    8. For

    the density mof water within the temperature range of (20 2) C a value of 998 kg/m3can be used that

    is also assumed to be accurate.

    The output voltage of the pressure sensor D is measured with the PC for at least ten different levels hm(tobe measured) (R= 100 s-1andN= 100 are good orientation values). The mean and standard deviation of

    the mean are calculated from the data measured for each individual height. It is most expedient to directly

    put these data into an Or i gi n worksheet.

    Finally, Uaccording to Eq. (13) is plotted over pand the parameters of the regression line are deter-mined. With the aid of the parameters of this calibration curve, the output voltages of the pressure sensorcan subsequently be converted into pressure differences.

    8 Value taken fromhttp://www.ptb.de/cartoweb3/SISproject.php;the error of 210

    -5m/s

    2is neglected.

    Wasser

    M

    Luft,Druckp

    EV

    S

    hm

    Wasser

    D

    - +

    pLH

    H1

    2

    B

    http://www.ptb.de/cartoweb3/SISproject.phphttp://www.ptb.de/cartoweb3/SISproject.phphttp://www.ptb.de/cartoweb3/SISproject.phphttp://www.ptb.de/cartoweb3/SISproject.php
  • 7/25/2019 E Datenerfassung PC (1)

    14/15

    153

    5.5.2 Measurement of Temporal Pressure Changes

    For measuring temporal pressure changes with a set-up according toFig. 8, the valve H2 is opened inaddition to valve H1to establish a connection between the balloon B and the air volume in E. An over-pressure in B is produced by raising the beaker glass V. Subsequently, the balloon is speedily squeezedtogether once and then released. While squeezing the balloon care must be taken that the maximum pres-

    sure difference of the sensor (p= + 1.25 103Pa) is not exceeded and that the pressure at the +-con-nection of the pressure sensor remains always above the pressure of the ambient air. The latter conditionis ensured as long as the water level in the right leg of the U-tube shown inFig. 8 is higher than the water

    level in the left leg.

    The temporal course of the pressure difference while and after squeezing the balloon is to be recordeduntil the water level in the manometer is again stable at its initial level. This measurement is carried outtwice.

    The recorded values of the output voltage of the pressure sensor are converted to pressure differences

    using the calibration data from Chap.5.5.1.The results are plotted in diagrams p(t) and analysed.

    6 Appendix: Definition of a Structurein Matlab

    A structureis a named section of memory divided intofields. The individual fields of a structure can havedifferent sizes. A field can hold just one element (e.g. a numerical value), or several elements in the formof a vector or a matrix

    9. The data contained in the elements of the structures fields can have different

    data types (also called classes in Mat l ab). Individual data types may be characters (data type char ac-t er ), integral numbers (data type i nt eger ), real numbers (data types si ngl e or doubl e) etc. Eachfield and each element has its own label.

    An example to clarify the above: We will create a structure named student, which is to contain the fields

    name, surname, matriculation_number, subjects, and semester. Furthermore, the field subjects shouldcontain an array of elements, while the other fields are to hold only one element each. The following

    Mat l ab- commands are used to save data to the individual elements (the period is the separator betweenstructure and field, or field and element respectively):

    >> st udent . name = ' Muel l er ' ; >> st udent . surname = ' Hans' ; >> st udent . mat r i cul at i on_number = 123456; >> st udent . subj ect s. a = ' Physi k' ; >> st udent . subj ect s. b = ' Mathemat i k' ; >> st udent . subj ect s. c = ' Chemi e' ; >>. st udent . semest er = 8;

    Since the data types for name, surname and subjects are character strings (data type char act er ),theassigned values need to be placed within single quotes.

    After the data has been entered, one can issue the command

    >> st udent

    to display how Mat l ab saved the structure:

    9A field may also be a structure containing structures, fields, or elements and so forth.

  • 7/25/2019 E Datenerfassung PC (1)

    15/15

    154

    st udent =

    name: ' Muel l er 'surname: ' Hans'

    mat r i cul at i on_number: 123456subj ects: [ 1x1 st r uct]

    semest er : 8

    Since the field subjects contains more than one element, only the data type of the field (struct ) isshown. To view the individual entries in subjects,the command

    >> st udent . subj ect s

    needs to be issued. The Mat l ab output will be:

    ans =

    a: ' Physi k'b: ' Mat hemat i k'c: ' Chemi e'

    Fig. 9 shows a schematic representation of the structure student. For further details, refer to the Mat l abdocumentation.

    Fig. 9: Schematic representation of a structure in Mat l ab.

    Mueller

    Hans

    123456789

    Physik

    Mathematik

    Chemie

    8

    nachname

    vorname

    matri kel nr

    semester

    faecher

    student

    a

    b

    c