Professional Documents
Culture Documents
Lin2022 Article StudyOnHybridTestControlSystem
Lin2022 Article StudyOnHybridTestControlSystem
, 2022.
APPLICATION OF COMPUTER
IN EXPERIMENTS
*e-mail: gyingqing@126.com
Received October 29, 2021; revised November 25, 2021; accepted November 26, 2021
Abstract–Hybrid test is a new seismic test method combining numerical simulation with physical test. It is an
advanced test method to evaluate the performance of nonlinear structures and systems. This paper proposes
a novel hybrid test control system based on MATLAB-STM32. The system uses the STM32 microcontroller
as the main controller and electrodynamic vibrator as excitation source of system. Furthermore, a complete
set of hybrid test control system which includes physical hardware test and numerical software simulation is
established by using MATLAB-STM32 communication technology, PID control method, displacement sen-
sors, force sensors, etc. It provides a test platform for nonlinear test structures, components that are difficult
to model, or components that require performance testing. This system realizes the function of real-time two-
way communication between MATLAB and STM32 microcontroller. It uses the finite element software
OpenSees to establish the numerical substructure, which solves the problem of the collaborative work
between the numerical simulation test and the physical test of the experimental substructure, and can simu-
late the hybrid dynamic seismic test of the damping structure. To test the control performance of the designed
system, this paper selects the viscoelastic dampers as the test substructure, and the performance detection and
test analysis are completed for the hybrid test of single-layer frame structure with a viscoelastic damper.
The test results show that the data communication between the upper and lower computers is stable and the
whole control system performs well on both dynamic and static behaviors.
DOI: 10.1134/S0020441222020191
218
STUDY ON HYBRID TEST CONTROL SYSTEM BASED ON MATLAB-STM32 219
OpenSees
Force Displacement
Force feedback
MATLAB The sensor
Signal
The data collection
VIEW/dSpace to complete one-layer frame structure ity, which can effectively improve the prediction accu-
hybrid test, and the test results show that the two racy and calculation efficiency of recovery force.
hybrid test systems have good stability and precision
Finally, the test load control method is related to
[9]. Xu et al. set up a hybrid test system based on elec-
the realization of the hybrid experiment, and the qual-
tric fatigue machine, MATLAB and STM32, com-
ity of the control effect determines the success or fail-
pleted the numerical simulation and hybrid test of ure of the hybrid experiment to a great extent [18]. The
two-layer steel frame with additional spring support, common load control modes are displacement con-
and verified the feasibility of the test system [10]. trol, force control, and force-displacement switching
In addition, the control algorithm of the hybrid control [19]. Liu et al. [20] proposed a force displace-
experiment is the key to realizing the real-time hybrid ment hybrid control method that can be used for
experiment of the whole structure, Sangyam et al. put multi-axis actuator coupling of spatial multi-degree
forward a method based on fuzzy control theory and hybrid experiment. Jon et al. [21] studied the speed
PID control parameters, which can effectively deter- control method of PC-DSP hardware system, carried
mine the three parameters of KP, KI and KD, and real- out the hybrid test of three rubber isolation supports,
ize the intelligent control of PID controller parame- and analyzed the effect of the isolation and shock
ters [11]. In view of the defects of general PID control, absorption of bridge structure.
Tang et al. [12] proposed the corresponding improved In summary, the hybrid experimental methods
algorithm, composite PID algorithm, and fuzzy con- have developed rapidly in recent years, but most of
trol algorithm with dynamic compensation, and Kim these experimental methods are based on large-scale
and Choi [13] designed a fuzzy PID composite con- hydraulic servo system [22], the test loading equip-
troller based on the comparison between PID and ment is single, expensive, and covers a large area, the
fuzzy control algorithm, which combines the superior control system has been packaged, experiment per-
dynamic performance of fuzzy controller with the high sonnel is inconvenient to modify, and the secondary
steady-state accuracy of PID control. Xiong et al. [14] development is difficult. In response to these issues,
proposed adaptive neural network time-varying for- this paper proposes a hybrid test control system based
mation tracking control for multi-agent systems. Pan on MATLAB-STM32, mainly uses the electrody-
et al. [15] adopted the displacement-force switching namic vibrator as excitation source of system, uses
control method and completed the pseudo dynamic STM32 microcontroller as the main controller, uses
test of the isolation layer. Ince et al. [16] proposed the MATLAB-STM32 communication technology, PID
combination of outer loop displacement control and control method, displacement sensors, and force sen-
inner loop force control to improve the accuracy of the sors, etc., builds a complete set of hybrid test control
outer loop displacement control and achieve it in the system including hardware physical test and software
real-time signal processing board dSpace, Bartl et al. simulation, and provides a test platform for nonlinear
[17] proposed a hybrid test method based on the test structures, parts that are difficult to model or that
online neural network algorithm with better adaptabil- require performance testing. In order to test the con-
Sending Accept
terminal Displacement
serial port command
End Start
Digital/analogue
switching circuit
buck circuit
Y
N Send
i=n displacement Actuator
i=i+1 command run
Calculated
Accept deviation value
Send force
displacement e(k)
response
command
Accepting
Send force
terminal
responce
serial port
The lower computer
trol performance of the designed system, this has com- between the OpenSees module and the actuator sys-
pleted the performance detection and test analysis of tem. The lower computer mainly includes the control
the hybrid test of the single-layer frame structure with system and the physical substructure system. The con-
viscoelastic damper. The test results showed that the trol system is mainly controlled by the STM32 micro-
data communication between the upper and lower controller, the physical substructure system includes
computers was stable and the whole control system the electrodynamic vibrator system, the sensor system,
had good dynamic and steady performance. The the reaction frame structure, and the nonlinear test
hybrid test system built in this paper has high research substructure which is installed horizontally on the
significance and wide popularity in practical applica- reaction frame of the actuator system.
tion.
In each analysis step, the data is run according to
the following process: the lower computer sends force
2. INTRODUCTION data–MATLAB receives force data–MATLAB sends
OF THE HYBRID TEST SYSTEM force data–OpenSees receives force data–OpenSees
analyzes and calculates displacement data–OpenSees
The hybrid test control system based on MATLAB- sends displacement data–MATLAB receives displace-
STM32 proposed in this paper is divided into two ment data–MATLAB sends displacement data–the
parts: the upper computer and the lower computer. lower computer receives displacement data, so as to
The upper and lower computers can exchange real- ensure the correctness of the whole hybrid test pro-
time data and work together, as shown in Fig. 1. The cess.
upper computer mainly uses OpenSees software to
build a numerical structure, numerically simulates the According to the difference of software and func-
housing framework for building structures, and uti- tion, the software design of upper computer is divided
lizes MATLAB module to realize the communication into OpenSees module and MATLAB module. The
(a)
See partial
enlargement
Power amplifier
Electric
vibrator
Peripheral circuit
Computer
STM32 Stabilized dc
Microcomputer power supply
(b)
Actuating head of Viscoelastic
vibrator damper Reaction device
Fig. 3. Overall design of hybrid test control system: (a) overall design drawing, (b) partial enlargement.
operation process of the hybrid test system is shown in the test substructure to realize the displacement com-
Fig. 2. The specific process is as follows: mand, and the displacement and force sensors collect
First, the OpenSees module calculates the numer- the displacement signal and force signal, respectively.
ical substructure model, obtains the inter-layer dis- The deviation e(k) between displacement theory and
placement in the step i, and sends the displacement test is calculated; if the error range is acceptable, the
command signal to the MATLAB module; MATLAB force command will be converted into a numerical sig-
module receives the command and sends it to the nal through the processing of STM32 microcontroller.
lower computer through the serial port. The lower If the error range is not acceptable, the deviation value
computer converts the displacement command into a will be converted into voltage signal by the control
voltage signal after processing by STM32 microcom- algorithm of PID controller and conversion coeffi-
puter. The lower computer drives the actuator to load cient Cf and sent to the actuator system. The force
response signal collected by the sensor will be sent to and negative voltage, but the logical state of TTL out-
the MATLAB module through the serial port. MAT- put by STM32 microcontroller is represented by high
LAB receives the force command signal sent by the and low levels. Therefore, the level and logical rela-
lower computer, draws the response graph of the test tionship between the RS-232 interface and TTL must
substructure under the earthquake in real time, and be converted to ensure the normal communication
sends the force response signal to the OpenSees mod- between the upper and lower computers. This paper
ule, then step i+1 is calculated until the end of the test. chooses CH340G and MAX3232 level switching cir-
cuits to realize serial communication together with
USART.
3. DESIGN OF HYBRID TEST CONTROL
SYSTEM The control system designed in this paper requires
two serial ports to realize the data communication
3.1. Overall Design of the Control System between STM32 microcontroller and MATLAB. As
As shown in Fig. 3, the control system of hybrid test shown in Fig. 4, two serial circuits are designed. First,
is based on STM32 microcomputer as the main con- the traditional 9 pin interface is used to connect with
troller, embedded with PID control program, data the computer. In order to ensure the reliability of data
acquisition program, and communication program of transmission of serial port, the MAX3232 level switch-
serial port, and realizes the displacement control and ing chip is needed to convert the data signal of 0−3.3 V
the loading of vibration force of the system actuator output from the chip into the data signal of −9 … +12 V.
electric vibrator with the peripheral circuit. Second, for the reasonable distribution of on-board
resources and convenience of use, USB serial port cir-
Within each step, lower computer uses the dis- cuit is used to realize data transmission of serial port,
placement sensors and force sensors for acquiring dis- and CH340G is used for its level switching chip.
placement and force signals of nonlinear test substruc- Meanwhile, this USB interface and USB power supply
ture in real-time after executing command load interface are shared, which fully reflects the effective
respectively, cooperated with the internal digital-to- use of resources.
analogue conversion circuit of STM32 microcom-
puter, the voltage signal is converted to digital signal According to the hardware conditions of the PC
that MATLAB can receive and send to OpenSees after and the actual test needs of the communication pro-
data processing, OpenSees calculates the next dis- cess, the communication part of the upper computer is
placement command based on the collected recovery used for serial definition, serial mode setting, interrupt
force and the structural reaction of the numerical sub- setting, and callback function writing. These tasks are
structure. performed according to the data format requirements
of the lower computer, through the MATLAB pro-
Stabilized dc power supply is used to power the gramming language. The upper computer communi-
peripheral circuit and the sensor, and the power cation software part mainly includes the definition of
amplifier amplifies and transmits the drive signal to serial port and receipt function.
the electric vibrator. Using the USART interface of
STM32 microcomputer and the external interface of MATLAB’s setting of serials consists of the follow-
serial port communication of MATLAB software, the ing steps:
data communication between upper and lower com- (1) create a serial port and initialize the serial s =
puters is realized. serial ('COM10');
(2) open the serial port fopen(s);
3.2. The Data Communication Design (3) read the serial data A=fscanf();
of Upper and Lower Computers (4) close the serial port fclose(s);
In contrast to the parallel communication which MATLAB’s main program is as follows:
possesses the shortcomings including the signal inter- s = serial('COM10');
ference between multiple lines, transmission error, the s.baudrate=115200;
high costs of long-distance transportation etc., serial s.parity='none';
communication has the advantages of strong anti- s.stopbits=1;
interference ability, long-distance transmission, low
line cost and so on, and thereby it has been a very pop- s.InputBufferSize=4096;
ular computer peripherals interface. In this hybrid test s.OutputBufferSize=4096;
system, the communication between the MATLAB of s.BytesAvailableFcnMode = 'terminator';
the upper computer and the STM32 microcontroller s.BytesAvailableFcn = @zdinstrcallback;
of the lower computer is realized via the serial port.
g = serial('COM6');
The serial communication is based on the RS-232
interface standard, which is realized by USART and g.baudrate=115200;
MAX232 level switching circuit. The logical state of g.InputBufferSize=4096;
RS-232 interface standard is represented by positive g.OutputBufferSize=4096;
GND
GND
KP
+ Conversion
r(k) e(k) u(k) Actuator Experimental y(k)
KI Coefficient
System Substructure
− + Cf
KD
manners, respectively. The discretized expression of the compiled directly into the STM32 micro controller
control algorithm of the positional PID controller is through Keil uvison4 software, so as to realize the
function of the lower computer.
k
u(k ) = K P ek + K I e
i =0
i + K D (ek − ek −1) + u0, (6) The hybrid test system designed in this paper is a
kind of control system based on the feedback of dis-
placement, and in order to ensure the control effect,
where k represents the serial number of the sample, the positional PID control algorithm is used.
u(k) represents the kth output value of the control The partial control code of PID is as follows:
quantity, represents the deviation of the kth output
error of the controlled system, ek–1 represents the devi- float PID_realize(float move)
ation of the (k – 1)th output error, and u0 represents {
the initial value of the control output. double adcx;
In the hybrid test system developed in this paper, pid.setmove =move;
the force size of the electric actuator output is related
to voltage, when the deviation of displacement pid.err= pid.setmove-pid.actualmove;
appears, the micro controller drives the actuator sys- pid.integral +=pid.err;
tem to output force signal to eliminate the deviation,
pid.voltage=pid.kp*pid.err+pid.ki*pid.inte-
so it is necessary to introduce a conversion coefficient
gral+pid.kd*(pid.err-pid.errlast);
c to convert the control of displacement into a voltage
signal to control. The conversion coefficient c needs to pid.errlast =pid.err;
be adjusted before the test to achieve the best control pid.actualmove =pid.voltage*1.0;
effect. The PID control schematic in this hybrid test
system is shown in Fig. 5. DAC->DHR12R1=pid.voltage;
The above is the design of the PID controller for Adcx =Get_Adc_ Average1(ADC_Channel_1,10);
the characteristics of the electric actuator system. The pid.actualF = (float) (adcx*50.000/4096-23.010);
basic idea is to convert the displacement into a voltage pid.actualmove= (float)adcx*(3.3/4096)*14.2857;
signal by the conversion coefficient c and then control
the electric actuator system to output force and load }
on the experimental substructure. However, because As described above, the principle of PID control
the conversion coefficient cannot perfectly convert algorithm takes the error between expected value and
displacement and output, there will be some errors in actual output as the operation object to realize the
the actual trial process. Therefore, before the start of control of the system. In the PID implementation
the experiment, the three parameters KP, KI, KD of the function, a number of variables are defined, including
PID controller, as well as the sampling cycle T, need to pid.setmove(expected value), pid.actualmove(actual
be adjusted, the optimal control effect can only be output), pid.err(error), pid.integral, pid.voltage, etc.
achieved by adjusting to the appropriate value. The pid.setmove = move statement represents the dis-
placement number obtained by the upper and lower
The program of lower computer in this paper was computers during the communication process; pid.err
developed in Keil uvison4 software and is based on the = pid.setmove – pid.actualmove represents displace-
firmware library of the STM32 micro controller. The ment error; pid.voltage = pid.kp*pid.err + pid.ki *
program development of peripheral firmware library pid.integral + pid.kd * (pid.err – pid.errlast) rep-
file is the main part of the software design of the lower resents the calculation of PID output; voltage.actual-
computer. After the development of program of the move = pid.voltage * 1.0 represents the calculation of
lower computer is completed, the program can be output voltage.
Transferred data
Raw data
1.6 Post-transfer data
1.4
1.2
1.0
0.8
0.6
4. THE PERFORMANCE TEST and accurately achieve the target displacement com-
OF HYBRID TEST SYSTEM mand.
4.1. The Performance Test of Communication between The performance test of displacement control for
the Upper and Lower Computers PID controller is as follows: send a set displacement
signal to the electric actuator system through the con-
Serial communication is the only channel for troller, then, the PID controller receives the displace-
exchanging data between the upper and lower comput- ment signal and processes and drives the electric actu-
ers in this paper, and the real-time and reliability of ator system to load, and then the displacement data
serial communication is directly related to the effect of should be collected through the displacement sensor,
the whole experiment. This experiment is to send the and finally the collected displacement data and target
sine wave named 'elc' to the lower computer after being displacement data should be compared and analyzed,
disposed by the upper computer, then, lower computer so as to check the displacement control performance
returns the data as is to the upper machine and stores of the PID controller.
it in the self-defined array AA[ ]. Finally, the two 'elc'
sine waves before and after transmission are drawn The purpose of this paper is to study the response
through the plot() function in MATLAB, and then of viscoelastic damping structure under the influence
they are compared to verify the reliability of the serial of earthquakes. In the course of the actual hybrid test,
communication. the signal sent to the actuator system via the controller
From Fig. 6, it can be seen that data before and is a seismic wave signal which represents random dis-
after sine wave communication are consistent, which placements. Therefore, in the displacement control
proves the high reliability of the serial communication. performance test, a sine signal is set to simulate the
Besides, from the MATLAB command window, it is signal in the hybrid test. Finally, according to the char-
learned that the transmission time of 1502 data is acteristics of the numerical substructure of the hybrid
about 30 s, which meets the real-time requirements of test system in this paper, the sine signal with the ampli-
the experiment. tude value of ±1 mm and the frequency of 1000 × π/60
is used as the test signal.
4.2. The Performance Test of Displacement Control In the performance test, the signal is sent to the
for PID Controller electric actuator system through the PID controller for
loading and the displacement response is collected by
The methods and steps of PID control in the lower the displacement sensor to obtain the final actual
computer micro controller of the hybrid test system result of displacement response. The target displace-
are introduced in Subsection 3.3. Therefore, this sec- ment results are compared and analyzed in the same
tion tests the displacement control performance of the graph with the actual displacement results, as shown
PID controller to see if the PID controller can quickly in Fig. 7.
Displacement, mm
1.5 (a)
See the local enlarged view The target displacement
The actual displacement
1.0
0.5
−0.5
−1.0
−1.5
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
Time, s
Error, mm
0.008
(b)
0.006
0.004
0.002
−0.002
−0.004
−0.006
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
Time, s
Fig. 7. Comparison diagram (a) and error diagram (b) of displacement control performance test for PID controller.
From Fig. 7, one can intuitively see that the curves on MATLAB-STM32. A housing frame is taken from
of the target and the actual displacements almost the one-layer concrete frame structure for analysis,
coincide without large overshoot and the order of taking into account the parameters of the electric
magnitude of error at each moment is 10–3 mm, actuator system, the scale model of the frame is estab-
showing good tracking effect. The dynamic effect is lished for experiment.
also good as the output can track the input rapidly.
Besides, the small delay of the system and the minor The overall model of the experiment is a scale
error indicate a good control effect. This means that frame structure of one-layer one-span two-dimen-
the PID controller is well positioned to drive the elec- sional reinforced concrete structure with a viscoelastic
tric vibrator to complete the displacement command. damper, as shown in Fig. 8, taking the viscoelastic
damper in the structure model as the experimental
substructure, and the rest of the structural model as a
4.3. Hybrid Test of One-layer Two-dimensional numerical substructure.
Viscoelastic Damping Frame Structure The height of the floor is 600 mm, the span is
In this paper, a simpler model is selected to verify 800 mm, the span of the floor is 600 mm, the thick-
the correctness of the hybrid test control system based ness of the floor is 12 mm, and the density of concrete
Displacement, mm
0.8
(a) Finite element simulation
0.6
Hybrid test
0.4
0.2
−0.2
−0.4
−0.6
−0.8
0 5 10 15 20 25 30
Time, s
Speed, mm/s
10 (b) Finite element simulation
8 Hybrid test
6
4
2
0
−2
−4
−6
−8
−10
0 5 10 15 20 25 30
Time, s
Acceleration, mm/s2
150
(c) Finite element simulation
100 Hybrid test
50
−50
−100
−150
0 5 10 15 20 25 30
Time, s
Fig. 9. The contrast between the one-layer frame structure hybrid test with viscoelastic damper and the theoretical results.
16. Ince, M., Yigit, T., and Isik, A.H., Int. J. Inf. Technol. 19. Yuan, Y., Xiong, S., and Zhu, H., J. Southeast Univ.,
Decis. Making, 2020, vol. 19, no. 2, p. 629. Nat. Sci. Ed., 2008, vol. 38, no. 5, p. 784.
https://doi.org/10.1142/S0219622020500054 https://doi.org/10.3321/j.issn:1001-0505.2008.05.009
20. Liu, J., Qiao, B., Zhang, X., Yan, R., and Chen, X.,
17. Bartl, A., Mahdiabadi, M.K., Insam, C., Mayet, J., Mech. Syst. Signal Process., 2019, vol. 132, p. 122.
and Rixen, D.J., Mech. Syst. Signal Process., 2020, https://doi.org/10.1016/j.ymssp.2019.06.024
vol. 139, no. 15, p. 1215.
https://doi.org/10.1016/j.ymssp.2019.106586 21. Jon, U., Kim, J., and Lee, H., Int. J. Automot. Technol.,
2018, vol. 19, no. 6, p. 959.
18. Chen, Z., Salas-Avlia, J.R., Tao, Y., Yin, W., Zhao, Q., https://doi.org/10.1007/s12239-018-0093-1
and Zhang, Z., Rev. Sci. Instrum., 2020, vol. 91, no. 2, 22. Phan, H.T., Itagaki, S., and Sato, Y., J. Rob. Mecha-
p. 153. tron., 2020, vol. 32, no. 5, p. 984.
https://doi.org/10.1063/1.5130734 https://doi.org/10.20965/jrm.2020.p0984