Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

ISSN 0020-4412, Instruments and Experimental Techniques, 2022, Vol. 65, No. 2, pp. 218–231. © Pleiades Publishing, Ltd.

, 2022.

APPLICATION OF COMPUTER
IN EXPERIMENTS

Study on Hybrid Test Control System


Based on MATLAB-STM32
Yuan-Ling Lina, Tian-Tian Yanga, Ying-Qing Guoa,b,*, Shi Chenc, and Jin-Bao Lid
a College of Mechanical and Electronic Engineering, Nanjing Forestry University, Nanjing, 210037 China
b Nanjing Dongrui Damping Control Technology Co., Ltd, Nanjing, 210033 China
c
College of Civil Engineering, Southeast University, Nanjing, 211189 China
d Jiangsu Southeast Special Engineering & Technology Co., Ltd, Nanjing, 210008 China

*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

1. INTRODUCTION pseudo static loading process proposed by Li et al. [3],


Earthquake has always been one of the most dan- and many new test methods such as the sub-structure
gerous natural disasters for human life and property pseudo dynamic test method [4], real-time substruc-
security. To improve resistance of houses and avoid ture test method [5], and remote collaborative test
serious structural damage and collapse of earthquake method [6] are proposed on the basis of the pseudo
disasters, the effective structural seismic design dynamic test. The common feature of those three
approaches have been the practical and feasible solu- methods is to divide the analyzed structure into a
tion nowadays. Reasonable structural seismic design numerical calculation part that is simulated by a
methods require the support of corresponding seismic numerical model and a real test part. The technology
theory and the verification of seismic test, and obtain- is a combination method of the numerical simulation
ing the response of new anti-seismic specimen in the and the real test, and can be referred to as hybrid test.
earthquake at the lower test cost has become an urgent In recent years, Takanashi et al. have added a type
problem of seismic test technology. According to the of test unit in the source code when developing the
above requirements, Nakashima et al. [1] proposed a finite element software OpenSees, enabling the soft-
real-time hybrid test method on the basis of the ware to support hybrid test system [7]. UI-SimCor, a
pseudo dynamic test method. hybrid test system developed by the University of Illi-
For the hybrid test research, Dologlou et al. pro- nois at Champaign, decomposed complex structural
posed the pseudo dynamic test method based on the systems into multiple substructures and used the finite
numerical calculation process of the structural element software OpenSees to perform numerical
dynamic equation [2], whose greatest advantage is that analysis of numerical substructures [8]. Xu et al. used
the elastic-bounce-collapse of the structure under the finite element software OpenSees, interface program
seismic load can be reproduced by the multi-step OpenFresco, and test control software Lab-

218
STUDY ON HYBRID TEST CONTROL SYSTEM BASED ON MATLAB-STM32 219

The upper computer The lower computer Experimental substructure

OpenSees
Force Displacement

Force feedback
MATLAB The sensor
Signal
The data collection

Test loading device

Serial Port STM32 Displacement loading


Communication microcontroller Signal

Fig. 1. The overall structure diagram of the hybrid test system.

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-

INSTRUMENTS AND EXPERIMENTAL TECHNIQUES Vol. 65 No. 2 2022


220 LIN et al.

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

Accept force Sensors collect Cf conversion


response signal coefficient
Opensees

Calculated
Accept deviation value
Send force
displacement e(k)
response
command

e(k) Y The PID


Real-time
allows? controller
drawing
MATLAB N
Analogue/digital
conversion circuit
adding circuit

Accepting
Send force
terminal
responce
serial port
The lower computer

Fig. 2. The operation flow of the hybrid test system.

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

INSTRUMENTS AND EXPERIMENTAL TECHNIQUES Vol. 65 No. 2 2022


STUDY ON HYBRID TEST CONTROL SYSTEM BASED ON MATLAB-STM32 221

(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

Force sensor Displacement sensor

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

INSTRUMENTS AND EXPERIMENTAL TECHNIQUES Vol. 65 No. 2 2022


222 LIN et al.

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;

INSTRUMENTS AND EXPERIMENTAL TECHNIQUES Vol. 65 No. 2 2022


STUDY ON HYBRID TEST CONTROL SYSTEM BASED ON MATLAB-STM32 223

C21 VCC3.3 COM


U2
104 1 16 C25 1
C1+ VCC GND
C22 2 15 104 6
V+ GND
104 3 14 2
C1- DOUT1
C23 4 13 7
GND C2+ RIN1
104 5 12 USART2_RX 3
C2- ROUT1
C24 6 11 USART2_TX 8
V- DIN1
104 7 10 4
DOUT2 DIN2
8 9 9
RIN2 ROUT2
5
SP3232
VCC5 C29 USART
GND
U3 C30
1 16 104
GND GND VCC GND
USART1 RX 2 15
TND R232
USART1_TX
C26 3 14 10uF VUSB
RXD RTS#
4 13
GND V3 DTR#
CH340 D+ 5 12 VCC5
D+ DCD#
104 CH340_D- 6 11 USB_232
D- RI#
7 10 1
XI DSR# VCC
1 2 8 9 C31 CH340 D+ 2
XO CTS# D-
Y3 10uF CH340_D- 3
12 MHz CH340G D+
4
NC
5
GND
C27 C28 GND
22 22 USB

GND

GND

Fig. 4. Serial communication circuit diagram.

g.parity='none'; USART2_IRQHandler(void), where in void


g.stopbits=1; uart2_init(u32 bound) mainly setting of the serial port
is completed, the key settings are baud rate, data bit,
fopen(g); stop bit, parity bit, etc., those must be the same as the
fopen(s). serial port settings in the upper computer to success-
The above program mainly completes the specific fully communicate; void USART2_IRQHan-
configuration of the serial port in the PC, that is dler(void) function is the service program function of
MATLAB, the main task is to define two serial serial port interrupt, through which the target dis-
objects, set the serial port bit rate and the specific for- placement and force data are read in this paper, and
mat of data transmission such as data bits, check bits, also through the execution of this function, it can suc-
and so on. To implement data communication that cessfully jump to the main function to execute the sys-
meets the requirements of the experiment, it is neces- tem control program. Interrupt group setting and pri-
sary to set up a receipt function, because the main pro- ority management of interrupt are implemented
cessing of the data of the upper computer is done in through library functions in this paper, which makes
the receipt function. The definition of receipt function the configuration process of interrupts more intuitive
is completed by the following functions: s.Bytes Avail- and convenient for users.
ableFcnMode = 'terminator'; and s.BytesAvailableFcn Program of the lower computer STM32 is as fol-
=@zdinstrcallback; both functions are encapsulated lows:
in the MATLAB toolbox, s.Bytes AvailableFcnMode void USART IRQHandler(void)
= 'terminator'; completes the type definition of the
{
receipt function, which represents that the receipt
function is automatically called when the upper if (USART_GetState (USART, RXNE)! = RESET)
machine reads serial data with a “carriage return” {
character; s.BytesAvailableFcn = @zdinstrcallback datarec[buf_c]=USART_ReceiveData(USART2);
completes the name definition of the receipt function, val[buf_c] =datarec[buf_c]-0x30;
this allows the system to call the specified receipt func- }
tion.
buf_c++;
The lower computer uses the USART serial port to
complete the communication with the upper com- if (buf_c==5)
puter. The serial port setting mainly includes the fol- {
lowing functions: void uart2_init(u32 bound) and void flagflag=1;

INSTRUMENTS AND EXPERIMENTAL TECHNIQUES Vol. 65 No. 2 2022


224 LIN et al.

buf_c=0; crete motion equation of the structure and the equilib-


X=val[0]+val[1]/10+val[2]/100+val[3]/1000; rium equation of equivalent force is obtained:
D=val [4];
Kai +1 + K PD ai +1 + RiE+1 = FEQ,i +1, (4)
if (flagflag==1)
{ where K PD is the quasi-stiffness matrix of the struc-
start =1; ture; FEQ,i +1 is the equivalent external force vector,
flagflag =0; which is obtained by the joint action of the external
} load vector at time step i +1 and the restoring force of
the whole structure at time step i.
}
Equation (4) can be regarded as the equal-force
} equilibrium equation of the whole damping structure
In the program, datarec[buf_c] =USART_Re- under seismic excitation. On the left side of the equa-
ceiveData(USART2) function reads the data received tion, it is composed of the numerical substructure
in the serial port and val[buf_c] =datarec[buf_c]- restoring force Kai +1 , quasi-dynamic reaction force
0×30 converts the received ASCII code into decimal
number and then recombines it to get the voltage X. K PD ai +1 , and experimental substructure reaction force
Finally, the value of flagflag determines whether to RiE+1 . On the right side of the equation, it is the equiva-
jump to the main function for executing the system lent external force FEQ,i +1 applied on the whole damp-
control program. ing structure.

3.3. Design of Integral Algorithm 3.4. Design of PID Control Algorithm


for Numerical Substructure
The principle of hybrid test is derived from the The experimental principle of the hybrid test sys-
quasi-dynamic test method which has been developed tem developed in this paper is obtaining the force
for more than 30 years. The basic idea is to model the response of the test substructure by controlling the
numerical substructures and write specific numerical displacement of the test substructure through the
calculation programs. The discrete motion equation actuator system, and then applying the force on the
for solving the global damping structure is as follows: numerical model to obtain the next displacement
command. Therefore, based on the displacement sen-
Mai +1 + Cai +1 + Kai +1 + RiE+1(ai +1, ai +1, ai +1) = Fi +1, (1) sor and PID controller, this paper establishes the dis-
placement control method of this electrodynamic
where the subscript i represents the time step of step i; actuator system.
M is the mass matrix of the numerical substructure, C
is the damping matrix of the numerical substructure, The PID controller consists of a linear combina-
tion of a proportion unit, an integral unit and a differ-
and ai +1, ai +1, ai +1 are acceleration vector, velocity vec- ential unit. The expression of the control algorithm is
tor and displacement vector, respectively; K represents as follows:
the numerical substructure stiffness matrix, Kai +1 rep-
resents the numerical substructure restoring force vec-  t
de(t )

u(t ) = K P e(t ) + 1 e(t )dt + TD
tor; RiE+1 represents the reaction vector of the experi- 
mental substructure. The reaction vector of the exper-  TI 0 dt 
(5)
t
imental substructure RiE+1 is related to displacement, de(t )
velocity, and acceleration and can be measured in the 
= K P e(t ) + K I e(t )dt + K D
0
dt
,
test. Fi+1 represents the external load vector which is
the simulated earthquake excitation in this paper. where KP represents the proportional gain coefficient,
KI represents the integral gain coefficient, and KD rep-
We assume that the damping force of the numerical resents the differential gain coefficient; TI represents
substructure is linear, then, displacement and velocity the integral time constant, TD represents the differen-
expressions of the discrete time system with the aver- tial time constant.
age acceleration method are (respectively)
The control of electric actuator system is realized
Δt
2
ai +1 = ai + Δtai + , (2) through the lower computer STM32 microcontroller.
4(ai + ai +1) To realize PID control in the microcontroller, Eq. (5)
need to be discretized, the sampling time t should be
Δt 2
ai +1 = ai + . (3) discretized, leading to the fact that TI and TD are dis-
2(ai + ai +1) crete sampling periods, while KP, KI, and KD are dis-
The assumption of average acceleration method is crete sampling sequences. Moreover, the integrals and
substituted into the hybrid test Eq. (1) to solve the dis- differentials should be replaced by sum and difference

INSTRUMENTS AND EXPERIMENTAL TECHNIQUES Vol. 65 No. 2 2022


STUDY ON HYBRID TEST CONTROL SYSTEM BASED ON MATLAB-STM32 225

KP
+ Conversion
r(k) e(k) u(k) Actuator Experimental y(k)
KI Coefficient
System Substructure
− + Cf

KD

Fig. 5. PID control schematic for hybrid test system.

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.

INSTRUMENTS AND EXPERIMENTAL TECHNIQUES Vol. 65 No. 2 2022


226 LIN et al.

Transferred data
Raw data
1.6 Post-transfer data

1.4

1.2

1.0

0.8

0.6

0 500 1000 1500


Data points

Fig. 6. Test diagram of serial communication.

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.

INSTRUMENTS AND EXPERIMENTAL TECHNIQUES Vol. 65 No. 2 2022


STUDY ON HYBRID TEST CONTROL SYSTEM BASED ON MATLAB-STM32 227

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

INSTRUMENTS AND EXPERIMENTAL TECHNIQUES Vol. 65 No. 2 2022


228 LIN et al.

is 2500 kg/m3. It is assumed that the structural foun-


dation is connected to the foundation rigidly and the
viscoelastic damper is articulated with the main frame
structure. The length and width of cross section of the
column are both 40 mm, the thickness of the concrete
protective layer is 2 mm, and four no. 6 steel bars are
arranged in the column. The height and width of cross
section of the beam are 40 and 20 mm, respectively.
The seismic wave inputted is EI-Centro wave, the time
step is 0.02 s, the number of steps is calculated to take
1500, the duration of seismic wave is 30 s, and the peak
acceleration is 0.5 m/s2. Fig. 8. Schematic diagram of scale frame structure of one-
layer one-span two-dimensional reinforced concrete
Among them, in the horizontal seismic analysis, structure.
the column is the main stressed component, so in the
numerical model of the OpenSees module, the beam
cross section is defined as the elastic cross section, is adopted for the stiffness of the experimental sub-
which is realized by the section Elastic command. The structure and the force distribution coefficient is cal-
analysis of elastic cross section is simple, only the elas- culated at 0.0324. The contrast between the one-layer
tic modulus, cross section area, and moment of inertia frame structure hybrid test with viscoelastic damper
of the cross section need to be defined. Define the col- with the theoretical results is as shown in Fig. 9, the
umn cross section as a fiber section, which is achieved simulation results of the viscoelastic damper are simu-
by the section Fiber command. The nonlinearBeam- lated by the method of equivalent stiffness and equiv-
Column unit in the OpenSees module is based on the alent damping.
fiber model, which is based on the fiber model, the As can be seen from the results in Fig. 9, under the
fiber section is assigned to the component unit when influence of the earthquake, the one-layer frame
the model is built. In the calculation, the softness structure with viscoelastic damper has a maximal dis-
matrix of the component uses the Gaussian numerical placement of 0.716 mm and a minimal displacement
integration method. At the location of each point of of −0.678 mm, while the maximal displacement of the
integration, the section is simulated by fiber section, finite element simulation results is 0.684 mm, and the
so that the sectional softness at the point of integration minimal displacement is −0.706 mm. The maximal
is very close to the actual sectional softness and the absolute error of the two displacements is 0.109, and
response of the structure under the effect of the earth- the standard deviation of the displacement is 0.08888.
quake can be simulated more realistically. The structure has a maximal speed of 10.013 mm/s
The hybrid test is carried out on a one-layer frame and a minimal speed of –7.984 mm/s in the hybrid
structure with viscoelastic damper, the stiffness matrix test, while the maximal speed is 9.638 mm/s and the
and damping matrix of the numerical substructure are minimal speed is −6.651 mm/s in the finite element
K and C, the stiffness and damping of the experimental simulation. The maximal absolute error of the two
substructure are KE and CE, respectively. In this paper, speeds is 1.766, and the standard deviation of the
the amplitude of loading force is 100 N, the loading speed error is 0.2544. The maximal acceleration of the
frequency is 5 Hz, and the mass matrix of the one- hybrid test is 116.549 mm/s2, the minimal acceleration
layer frame structure is M, regardless of the effect of is −135.961 mm/s2, the maximal acceleration of the
the quality of the experimental substructure on the finite element simulation results is 124.31 mm/s2, the
hybrid test. The specific parameter values are as fol- minimal acceleration is −131.019 mm/s2, the absolute
lows: M = 500 kg, K = 492980 N/m, C =1570 N s/m, error of the acceleration is 15.797, and the standard
damping ratio e = 0.05, KE = 200 809 N/m, CE = deviation of acceleration error is 3.0912.
2865 N s/m, the whole structure’s self-vibration cycle
T = 0.2 s. From the above analysis, it can be seen that the
one-layer frame structure with viscoelastic damper
The seismic wave entered in this experiment is EI- differs greatly from the hybrid test value and the finite
Centro wave, peak acceleration is 0.3 m/s2, the time of element simulation value at peak under seismic action,
seismic action is 20 s, and the time step is 0.02 s. and it can be seen from Fig. 9 that the hybrid test value
The parameters of the adjusted positional PID con- is less than the finite element simulation value.
troller are as follows: proportional coefficient is 0.3, Because the viscoelastic damper is a speed-dependent
integral coefficient is 0.1, and differential coefficient is damper, its equivalent stiffness decreases with the
0. In the calculation of force distribution coefficient, decrease of loading frequency, the equivalent damping
the equivalent stiffness calculated when the force increases with the decrease of loading frequency, the
amplitude is 100 N and the loading frequency is 5 Hz hybrid test cannot be completed in real time, resulting

INSTRUMENTS AND EXPERIMENTAL TECHNIQUES Vol. 65 No. 2 2022


STUDY ON HYBRID TEST CONTROL SYSTEM BASED ON MATLAB-STM32 229

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.

INSTRUMENTS AND EXPERIMENTAL TECHNIQUES Vol. 65 No. 2 2022


230 LIN et al.

in the facts that equivalent stiffness of the viscoelastic ACKNOWLEDGMENTS


damper in the course of the experiment is small, the The authors gratefully acknowledge supports from the
equivalent damping is large, so the test results are National Key R&D Programs of China (2019YFE0121900),
slightly less than the theoretical results. and the National Natural Science Foundation of China
From Fig. 9, one can see that the hybrid test and (nos. 52130807, 51878355).
the theoretical results are basically consistent, and the
standard deviation of the error is small, which shows CONFLICT OF INTEREST
that the overall deviation between the hybrid test solu-
tion and the theoretical solution is small, and the fea- The authors declare that they have no conflicts of interest.
sibility of the hybrid test control system designed in
this paper is verified.
REFERENCES
1. Nakashima, M., Philos. Trans. R. Soc., A, 2001, vol. 359,
5. CONCLUSIONS no. 1786, p. 1851.
https://doi.org/10.1098/rsta.2001.0876
In this paper, using MATLAB software as the inter- 2. Dologlou, E., Int. J. Remote Sens., 2014, vol. 35, no. 24,
mediary between the upper and lower computers with p. 8208.
STM32 as the main controller, a control system of https://doi.org/10.1080/01431161.2014.980921
hybrid test based on MATLAB-STM32 is developed, 3. Li, Y., Wu, B., Wang, Q., and Ou, J., China Civ. Eng. J.,
and a hybrid test study of viscoelastic damping frame 2006, vol. 39, no. 7, p. 9.
structure is carried out. This paper uses MATLAB- https://doi.org/10.3321/j.issn:1000-131X.2006.07.002
STM32 communication technology, PID control 4. Chen, Z., Xu, G., Wu, B., Sun, Y., Wang, H., and
method, displacement sensors, and force sensors, etc., Wang, F., Earthquake Eng. Struct. Dyn., 2014, vol. 43,
builds a complete set of hybrid test control system no. 7, p. 969.
https://doi.org/10.1002/eqe.2382
including hardware physical test and software simula-
tion, and provides a test platform for nonlinear test 5. Nakashima, M., Kato, H., and Takaoka, E., Earth-
structures, parts that are difficult to model or that quake Eng. Struct. Dyn., 1992, vol. 21, no. 1, p. 79.
https://doi.org/10.1002/eqe.4290210106
require performance testing. The conclusions of this
paper are as follows: 6. Pearlman, L., IEEE Trans. Ind. Appl., 2004, vol. 51,
no. 4, p. 14.
(1) In order to solve the problem of the force load- https://doi.org/10.1109/HPDC.2004.1323474
ing characteristics of the electric actuator system used, 7. Takahashi, Y. and Fenve, G.L., Earthquake Eng. Struct.
the displacement control program based on the dis- Dyn., 2006, vol. 35, no. 3, p. 267.
placement sensor and PID controller is developed. https://doi.org/10.1002/eqe.518
The displacement signal command can be realized by 8. Kwon, O.S. and Nakata, N., J. Earthquake Eng., 2005,
testing the performance of sine displacement signal, vol. 9, no. 5, p. 741.
which can be used to meet the requirements of dis- https://doi.org/10.1142/S1363246905002158
placement control of hybrid test. 9. Xu, G., Hao, W., Chen, Y., Wu, B., and Ou, J., Eng.
Mech., 2013, vol. 30, no. 3, p. 417.
(2) This paper has developed a hybrid test control https://doi.org/10.6052/j.issn.1000-4750.2011.10.0658
system based on MATLAB-STM32, which details the 10. Xu, Z.D., Wang, K.Y., and Guo, Y.Q., Nondestr. Test.
whole hardware and software of the system, the com- Eval., 2016, vol. 32, no. 1, p. 1.
munication of the upper and lower computer and the https://doi.org/10.1080/10589759.2016.1149581
PID controller, and carries out some performance 11. Sangyam, T., Laohapiengsak, P., Chongcharoen, W.,
tests and data analysis pertinently, and verifies that the and Nilkhamhang, I., IEEE Trans. Autom. Control,
modules have good stability and high precision 2010, vol. 40, no. 3, p. 1265.
through the performance test to meet the require- 12. Tang, K.S., Kim, F.M, Chen, G., and Kwong, S., IEEE
ments of the hybrid test. Trans. Ind. Electron., 2001, vol. 48, no. 4, p. 757.
https://doi.org/10.1109/41.937407
(3) In this paper, the hybrid test of viscoelastic 13. Kim, W. and Choi, S.Y., Comput. Struct., 2018, vol. 196,
shock-absorbing concrete frame structure is carried p. 341.
out by using the control system developed of hybrid https://doi.org/10.1016/j.compstruc.2017.10.002
test based on MATLAB-STM32, and the feasibility 14. Xiong, T., Pu, Z., Yi, J., and Tao, X., IET Control The-
and accuracy of the control system for hybrid test are ory Appl., 2020, vol. 14, no. 9, p. 1147.
verified by the one-layer two-dimensional frame https://doi.org/10.1049/iet-cta.2019.0309
hybrid test. In addition, the results of the experiment 15. Pan, P., Nakashima, M., and Tomofuji, H., Earthquake
proved that the viscoelastic damper has a good damp- Eng. Struct. Dyn., 2005, vol. 34, no. 8, p. 869.
ing effect on the structure under the seismic action. https://doi.org/10.1002/eqe.457

INSTRUMENTS AND EXPERIMENTAL TECHNIQUES Vol. 65 No. 2 2022


STUDY ON HYBRID TEST CONTROL SYSTEM BASED ON MATLAB-STM32 231

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

INSTRUMENTS AND EXPERIMENTAL TECHNIQUES Vol. 65 No. 2 2022

You might also like