Open access peer-reviewed chapter

Using NI-USB Data Acquisition Systems to Study the Switching Phenomena of Reactive Loads

Written By

Niculescu Titu, Marcu Marius, Niculescu Vlad and Popescu Florin Gabriel

Submitted: 18 December 2015 Reviewed: 02 February 2016 Published: 07 July 2016

DOI: 10.5772/62349

From the Edited Volume

Applications from Engineering with MATLAB Concepts

Edited by Jan Valdman

Chapter metrics overview

2,031 Chapter Downloads

View Full Metrics


The chapter presents a new and modern method to study the transient phenomena that occur when connecting the reactive charges to an AC power source using the MATLAB-Simulink software package. It is known that NI-USB data acquisition systems manufactured by National Instruments are not recognized by the Simulink software package in 64-bit systems. That is why a 32-bit system is obligatory. From this point of view, the article presents a method by which this disadvantage is eliminated, making the data acquisition process possible in the Simulink software package.


  • capacitive circuit
  • data acquisition
  • diagrams
  • electrical diagram
  • MATLAB-Simulink
  • NI-USB

1. Introduction

Data acquisition systems of the NI-USB type, manufactured by National Instruments, allow real-time evaluation of analog measurements in various practical situations. These quantities can be read by the MATLAB software but cannot be processed in Simulink because MathWorks Incorporated does not offer support for this software in 64-bit systems. The chapter presents a method that makes this possible and studies the case when an inductive-capacitive load is connected to a voltage power source, with a data acquisition system in Simulink on 64-bit systems. In this scope, we will consider an RLC series circuit with concentrated parameters, which are connected to an AC power source.

This scenario occurs in practice in case one wants to connect an electrical equipment that includes capacitors to an AC power source. In this case, over voltages or over currents can occur during transient regime, which can cause problems in systems sizing.


2. Theoretical considerations

The differential equation for transitory phenomena is presented below:


where R is the circuit resistance, L is the circuit inductance, C is the capacity of circuit, and Ψ is the initial phase of voltage when was connected the circuit. The current is denoted by i and the angular frequency by ω.

The most important and common regime is when the circuit resistance is very small, practically the resistance of the junction wires. This event is known in the scientific literature as an oscillating regime. If we consider the R resistance of circuit very small, the Laplace transform applied to this circuit conducts to the following solution [1], [7]:


where Equation (3) represents the voltage on the capacitor.


where Equation (4) represents the voltage on the coil, and δ is a dumping factor:


and ω0 is the resonance angular frequency of the circuit:


The following notations are also used:


Due to the low value of the conductors’ resistance, the regime is oscillating. Therefore, a high-frequency oscillation can be observed in the following charts, which overlaps the current and voltage curve at a 50 Hz frequency.


3. Interface circuits necessary for study of inductive loads

For the experimental evaluation of these parameters, a data acquisition system manufactured by National Instruments was used, namely, the NI USB-6003 type. The graphics and the electrical diagram presented in Figures 1 and 2 were created using the MATLAB 2014b software. The inductive circuit is connected to the AC voltage through a capacitor C, and the DAQ input voltage levels are obtained using resistive dividers. A differential measurement was chosen to perform calculations.

To eliminate the risk of connecting directly the AC phase voltage to the input of the data acquisition system, symmetrical voltage dividers were used and the analog inputs of the measuring system were connected in parallel with the median divider resistors Ri0 and Ri1. To protect the analog inputs of data acquisition system to any voltage surge, the DZ Zener diodes were used (Figure 3) [8].

The measuring mode is a differential one, because it allows accurate measurements for low-voltage amplitudes (below 1 V).

The used system for data acquisition has the following important parameters:

  • 8 analog inputs (16-bit resolution, 100 kS/s);

  • 2 analog outputs (16-bit, 5 kS/s/ch); 13 digital I/O lines; one 32-bit counter;

  • Lightweight and BUS powered for easy portability;

  • Easy to install sensors and signals with screw-terminal connectivity.

The system is compatible with MATLAB software but not with the Simulink package, because the Data Acquisition Toolbox package does not appear in its graphical interface on 64-bit operating systems.

Figure 1.

Connecting an inductive capacitive load.

To study switching transient inductive-capacitive loads, two situations were considered to be representative:

  • Connecting an inductive-capacitive load to an alternating power supply made with the following values of electrical parameters:

U=220 V; R=1.2 Ω; L=2 mH; C=100 μF.

In this case the diagram from Figure 1 is obtained.

  • Disconnecting an inductive capacitive load from an alternating power supply made with the following values of electrical parameters:

U=220 V; R=1.2 Ω; L=90 mH; C=100 μF.

In this case, the diagram from Figure 2 is obtained.


addAnalogInputChannel(s,’Dev1’, 0, ‘Voltage’);

addAnalogInputChannel(s,’Dev1’, 1, ‘Voltage’);








ylabel(ax(1),’Voltage[V]’); % label left y-axis

ylabel(ax(2),’Current[A]’); % label right y-axis

xlabel(‘Time[secs]’); % label x-axis


Data acquisition is made with the Ni-USB 6003 system, which has a sampling frequency of 100 ks/s. The sequence of MATLAB program that reads current and voltage inputs and make data acquisition is shown as follows:

where 163 and 27 are values dependent on resistor values of interface from Figure 3. These values are dependent on the input resistive divider values of the measurement system (163 is the value of 2R1/Ri1 and 27 represents the value of 2R0/Ri0).

To run this code, it needs a system NI USB-6000 series connected to the PC and installing the driver from the National Instruments website. The first part of this code represent data acquisition with a rate of the 45 kS/s, and the acquisition time is 1.5 s. The second part of the code represents the plotting mode of voltage and current [6].

Because the acquisition time is relatively high (1.5 s), after the completion of the acquisition process, one can decrease this time to 0.1 s by focusing on the event (click Edit figure>Axes properties…>xLimits).

The sampling frequency is divided by two because there are two inputs to read. Therefore, it was used a sampling rate of 45 kS/s for each channel.

Figure 2.

Disconnecting an inductive-capacitive load.

Connecting regime from Figure 1 primarily highlights an oscillating process for current and coil voltage. In the first moment of connection, an over current appears, with a peak of over 30 A. The overvoltage peak is almost 200 V in the first moment, after which these values are stabilized to the oscillating values.

The disconnecting regime from Figure 2 highlights a peak voltage that can be almost 1000 V. This value can be dangerous for consumers, connected to the alternating supply voltage. These overvoltages can cause the semiconductor destruction or insulation electric penetrations.

Figure 3.

Electrical diagram of the measurement system for inductive loads.


4. Measurement processing in Simulink software package

Experimental measurements were made with a data acquisition system type NI USB-6003 with a rate of 100 kS/s, and the measurements were processed by the 2014b MATLAB version, which recognizes only data acquisition system in MATLAB, not in Simulink. Data processing in Simulink involves the following steps:

  • It makes the appropriate data acquisition in MATLAB (using specific program lines for data acquisition system type);

  • It saves the Workspace generated by the measurement (for further processing);

  • The Data file from the Workspace opens;

  • The Time file from the Workspace opens;

  • Undock command is given to these files (Figure 4);

  • The Time column is copied in the Data file and is placed at the beginning of the columns (Figure 5).

  • It executes the Dock Variables command and saves the new Workspace.

At this moment, the Data folder from the Workspace can be read from a Simulink simulation model (Figure 6).

Figure 4.

Original content of the Data folder from the Workspace.

Figure 5.

Modified content of the Data folder from the Workspace.

Figure 6.

Simulink model for reactive load connecting.


5. Study of inductive loads

The first representative case for connecting the inductive-capacitive load leads to the following charts for the inductor voltage, circuit current, and the powers dissipated in the coil.

As one can observe, the coil voltage and current diagrams (Figures 7 and 8) show the identical dependences with Figure 1 where the forms were obtained by data acquisition directly in MATLAB, by programming. The MATLAB program is presented in paragraph 3.

Figure 7.

Voltage variation on coil when connection is initiated.

Figure 8.

Current variation on coil at connecting.

Figure 9.

Active power variation on intern coil resistance at connecting.

Figure 10.

Reactive power variation on coil at connecting.

Figures 9 and 10 represent the diagrams of the active and reactive power variation during the commutation process. An inductive load of 2 mH was connected to an alternating power source.

Because of the capacitor, the oscillating process occurs in both the current curve and the coil voltage. The value of capacitance that made the connection process was of 100 μF. The voltage oscillations and current circuit right after the connection was initiated are accompanied by the oscillations of active and reactive power. The measurement was done in the time interval of 1.1 to 1.2 s.

Figure 11.

Voltage variation on coil upon disconnection.

If one considers the second case, the disconnection of inductive-capacitive load, Simulink model from Figure 6 leads to the following diagrams for electrical quantities considered: the voltage variation on the coil at circuit disconnecting (Figure 11), the current variation in circuit at disconnecting (Figure 12), and active and reactive powers in this regime (Figures 13 and 14). As can be seen, coil voltage and current diagrams (Figures 11 and 12) show the identical dependences with Figure 2 where the forms were obtained by data acquisition directly in MATLAB, by programming.

Figure 12.

Current variation on coil upon disconnection.

The high-frequency oscillations of the voltage and current curves generate oscillations also in the two powers variation curves. The active and reactive powers dissipated on the coil upon disconnection are shown in Figures 13 and 14.

Figure 13.

Active power variation on internal resistance of coil upon disconnection.

Figure 14.

Reactive power variation on coil upon disconnection.

If we take into consideration the two regimes, connecting and disconnecting, from the first measurements, one can notice a reactive and active power peak in the powers chart. Then, these stabilize at oscillating constant values.


6. Interface circuits necessary for study of capacitive loads

For the study of transitory phenomena regarding capacitive loads, the interface circuits from Figure 15 were used.

Figure 15.

Electrical diagram of measurement system for capacitive loads.

The study of capacitive loads considered the case of connecting a capacitive load to an AC voltage power source through an inductivity.

The measuring circuit is similar to the one in Figure 3, differing by the fact that, on the input of acquisition system (−a1, +a1), the voltage on the C capacitor terminals is measured.


7. Study of capacitive loads

For the study of capacitive loads, take into consideration the case of connecting a capacitor to an AC voltage power source through an inductivity of 2 mH. The electrical parameters have the values:

  • U=220 V;

  • R=2 Ω;

  • L=2 mH;

  • C=100 μF;

The MATLAB code for the data acquisition is the same with the one used in paragraph 3, and as a result of its run, it was obtained from the diagram in Figure 16. This displays the current and voltage variation on capacitor in the same axis system.

Figure 16.

Variation of electrical parameters.

After Workspace processing, as described in paragraph 4, the Simulink model from Figure 6 was used for the reading of this data, and the following charts were obtained. The capacitor voltage variation and current variation in the circuit are plotted in Figures 17 and 18.

Figure 17.

Capacitor voltage variation.

As seen in the voltage and current variation charts, a current peak appears in circuit, immediately after connection is initiated, and it can become dangerous for the other electrical equipment. This is accompanied by a small voltage peak, which disappears quite fast. In the current curve, a high-frequency oscillation can be noticed, which overlaps the current curve and disappears after a time.

Figure 18.

Capacitor current variation.

It must be noticed that these variation forms are dependent on the connecting moment, so they are dependent on the ψ angle from Equations (2) and (3).

Diagrams from Figures 19 and 20 show the variation of the two dissipated powers. In Figure 19, the active power variation on the circuit resistance is plotted, and in Figure 20, the one of the reactive power dissipated on the capacitor.

Figure 19.

Active power variation.

Figure 20.

Reactive power variation.

Figure 19 highlights the active power oscillations, owing to current oscillations in the circuit. Figure 20 highlights the fact that the reactive capacitor power is negative and its value can be read using the diagram. It is almost constant, with low oscillations around this value.


8. Conclusions

This analysis method allows the study of transient electrical phenomena on 64-bit operating systems. In this case, the Data Acquisition Toolbox package, which is specific to the 32-bit operating systems, does not appear in Simulink.

We have to mention that the transient regime for connecting the reactive loads to an AC power source depends on the moment of connecting, given by the Ψ angle from relations (2)–(4). In this paper, we considered a representative case of several measurements that emphasize the higher values of voltage and current occurring immediately after connecting.

The most dangerous regime is the oscillating regime and this is the most common regime that can be met in practice. In practice, this could be seen in the alternative power supply for electric motors, which includes the starting capacitor. In this case, oscillating overvoltage may occur and they need to be taken into account when sizing the systems. The value of these voltages depends on the connecting moment, which is the initial phase of the AC voltage. For the circuits designing and sizing phase, the overvoltage peaks occurring immediately after connection must be taken into account, which can endanger the internal isolation of the equipment. Overcurrent peaks in oscillatory regime can lead to the possible switching of protective relays.

It is important that the electric charge on the connected capacitor to be initially zero, otherwise a high value of over current may occur after the connecting moment.

In conclusion, it must be stressed that the proposed method can be applied to other Simulink models of greater complexity.


  1. 1. Ghe H. Electrical Devices. Ed.D.P. Bucharest, 1980.
  2. 2. Ghinea M, Firteanu V. MATLAB, Numerical Calculus-Graphics-Applications. Ed. Teora, Bucharest 2000 2000.
  3. 3. Nicolae Golovanov s.a. Electrical Energy Consumers. Materials, Measurements, Devices, Installations. Ed. AGIR, Bucharest, 2009.
  4. 4. Titu N. Analysis of Electrical Circuits by Simulating in MATLAB Space. Ed. TehnoArt, Petrosani 2006.
  5. 5. Titu N. Study of Inductive-Capacitive Series Circuits Using the Simulink Software Package. Publisher InTech, Technology and Engineering Applications of Simulink, Ed. InTech 2012, Chapter 2.
  6. 6. Titu N. Study of Transient Phenomena Using NI-USB Data Acquisition Systems in MATLAB-Simulink Medium on 64bit Operating Systems. Journal of Advanced Computer Science & Technology. 2015, vol.4, pp.212-219, ID:4518.
  7. 7. Titu N. Transitory phenomena in capacitive circuits connected to an AC source. In: Proceedings of the 4th International Conference on Circuits, Systems, Control, Signals—CSCS’13; Valencia, Spain; 2013. p. 162–166.
  8. 8. Titu N, Marius M, Gabriel PF. Study of transitory phenomena at connecting the capacitive loads to an AC power source. Journal of Advanced Computer Science & Technology. 2015, vol.4, pp.198-203, ID:4518.
  9. 9. Halunga-Fratu S, Fratu O. Simulation of Analog and Digital System Transmissions, Using MATLAB/SIMULINK Medium. Ed. MatrixRom, Bucharest 2004.
  10. 10. Marinov A, Valchev V. Improved methodology for power loss measurements in power electronic switches using digital oscilloscope and MATLAB. 14th International Power Electronics and Motion Control Conference (EPE/PEMC), 6–8 September, Ohrid 2010.
  11. 11. Czarnecki LS, Swietlicki T. Powers in nonsinusoidal networks: their interpretation, analysis, and measurement. IEEE Transactions on instrumentation and measurement, 39, 2, 1990.
  12. 12. Willems JL. Mathematical foundations of the instantaneous power concepts: a geometrical approach. ETEP European Transactions on Electrical Power, 6, 5, 1996.

Written By

Niculescu Titu, Marcu Marius, Niculescu Vlad and Popescu Florin Gabriel

Submitted: 18 December 2015 Reviewed: 02 February 2016 Published: 07 July 2016