7/27/2019 Execution Time
1/16
Execution Time Validation of the Mathematical
Models of a Electric Motor inSoft Real Time Simulation
M.T.A. Jorge Salvador Valdez Martnez
Dr. Pedro Guevara Lpez
Dr. Juan Carlos Garca Infante
7/27/2019 Execution Time
2/16
Correct
Answers
Temporal
Constraints
Real
Process
STR
1.1 Real Time System
Classification (Time Constraints)
Hard Real Time System
In Real-time systems, the response times are always in synchrony with the dynamics of
the environment in all ranges of evolution, and the data set is always stable and
converges at every point to appropriate values [GMC07]. In these systems, it is absolutelyimperative that responses occur strictly within the time periods specified, otherwise there
is risk of causing a disaster or system instability. And they have the following
characteristics [GM03]:
Strict response deadline
Temporal behavior determined by the environment
Predictable behavior OverloadCritical security requirements
Active redundancy
Reduced data volume.
7/27/2019 Execution Time
3/16
Soft Real Time Systems
Response times are in synchrony with the dynamic environment in intervals of evolution in
any sense of probability. The output is an interval bounded by minimum and maximum
range and the data set can be marginally stable and converges (probabilistically) toappropriate values. They work correctly if a restriction is lost, the performance is degraded
but not destroyed the system because of failure in the delivery time information [GMC07].
These systems have the following characteristics [GM03]:
Flexible response deadline
Temporal behavior determined by computer
Degraded performance against overloadsNon-critical security requirements
Fail recovery
Large volume of data
1.1 Real Time System
Classification (Time Constraints)
Correct
Answers
Temporal
Constraints
Real
Process
STR
7/27/2019 Execution Time
4/16
Firm Real Time Systems
Systems where high response times are not acceptable in any sense of probability in the
intervals of evolution, although the data set is always stable and have convergence at all
points to appropriate values when the environment gets steady [GMC07].If do not respect the time constraint does not help the service it provides, and therefore
the real-time system is not functional.
1.1 Real Time System
Classification (Time Constraints)
Correct
Answers
Temporal
Constraints
Real
Process
STR
7/27/2019 Execution Time
5/16
1.2 Real Time Simulation
Minimal CharacteristicsA simulator can be considered to work in real-time, if it has the following characteristics
[BK08]:
Deterministic response to disruptions
Communication between processes
High-precision timers
Interrupt Handling
A real-time system provides to the user:
Synchronization services (The external real time with the Operative system time)
Capture and interruption treatment (it is a mechanism that is responsible for capturing
interrupts when occur, and advise models or tasks that interest them such disruption is
already present)File management(It is required because of depending on the systems behavior,
sometimes is needed to get data or view data)
Measurement of real time: Because in the Mathematical models, should know the actual
time to do certain actions (Task).
7/27/2019 Execution Time
6/16
1.3 Real Time Simulation
SIMULINKIn SIMULINK, the Synchronization services is possible with the asynchronousinterruptions services (Warnings) to the Operating System with Async IRQ Source block.
To the deterministic response to disruptions, in SIMULINK there are blocks that help
to get information from external data (as well as interruptions), and there are blocks that
help to give certain response to the outside, using data acquisition cards.
To manage files, SIMULINK has a number of blocks that allows observe the systems
behavior (with a Digital Oscilloscope) and is possible to save digital information obtainedin Digital SINKS.
With Measurement of real time, is possible to obtain it (using MATLAB command line).
For the physical system modeled and simulated must have minimal time constraints, for
its simulation:
1) Ability to express recursively using models obtained from discretization methods (eg
finite differences, Z transform)
2) The value of convergence is bounded within a finite interval on which it is oscillating
3) The mathematical model simulated permits the extraction and release of information
observable and synchronized with the time evolution of the process by considering the
sampling criteria [Nyq28]. And it needs to give the correct answers and bounded in time
according to the time constraints of the dynamic system..
7/27/2019 Execution Time
7/16
2.1 Physical Models Simulation:
DC motor Fundamentals [Gue99]
LJ
eatkit
LJ
tikRbt
LJ
RJLbt
)()(
)()()(
22
(1)
L
eati
L
tkRti
aa
)(
)()(
(2)
RJ
eatkit
RJ
tikRbt
)()(
)()(
22
(3)
)(
)(tkR
eati
a
(4)
Second Order Model First Order Model
Figure 1. Series wound DC Motor:Electromechanical circuit
if
ia
Rf Lf
Ra La
ARMOR
ea
J
b
t
t
Varmor
CONSTANT INDUCED
FIELD
MOTOR
t
7/27/2019 Execution Time
8/16
2.2 Physical Models Simulation:
Simulation graphics (Angular Speed and Electric Current)
Figure 2. Angular Speed Figure 3. Armor Electric Current
1) Ability to express recursively
2) The value of convergence is bounded
3) The mathematical model simulated permits the extraction and release of
information observable and synchronized with the time evolution of the process byconsidering the sampling criteria [Nyq28]..
7/27/2019 Execution Time
9/16
Table 1. Code to obtain The execution time:First Order Mathematical Model
for MC=1:experimentosfor ejec=1:ejecuciones
omega(MC,1)=0;
tic;
for n=1:1000
F(MC,n)=(k*omega(MC,n))/R;
ia(MC,n)=gamma/(1+F(MC,n));
C(MC,n)=(R*b+k*k*ia(MC,n)*ia(MC,n))/(R*J);
beta(MC,n)=(k*ia(MC,n)*eao)/(R*J);
omega(MC,n+1)=(xi*beta(MC,n)+omega(MC,n))/(1+xi*C(MC,n));
end
tiempodeejecucion(MC,ejec)=toc;
end
end
for tt=1:ejecuciones
ejecucionMontecarlo(tt)=sum(tiempodeejecucion
(:,tt))/numel(tiempodeejecucion(:,tt));
end
2.3 Simulation
Results
(Off line)
Figure 4. First Order Finite Differences Execution
7/27/2019 Execution Time
10/16
Table 2. Code to obtain The execution time:Second Order Mathematical Model
for MC=1:1for ejec=1:1
omega(MC,1)=0;
ia(MC,1)=eao/R;
ia(MC,2)=eao/R;
omega(MC,2)=0;
tic;
for n=3:1000
D(MC,n)=(R+k*omega(MC,n-xi))/L;
ia(MC,n)=(xi*delta+ia(MC,n-
xi))/(1+xi*D(MC,n));
B(MC,n)=(R*b+k*k*ia(MC,n)*ia(MC,n))/(L*J);alfa(MC,n)=(k*ia(MC,n)*eao)/(L*J);
omega(MC,n)=(xi*alfa(MC,n)+(2+A*xi)*omega(MC,
n-xi)-omega(MC,n-
2*xi))/(1+xi*A+xi*xi*B(MC,n));
end
tiempodeejecucion(MC,ejec)=toc;
end
end
for tt=1:ejecuciones
ejecucionMontecarlo(tt)=sum(tiempodeejecucion(:,tt))/numel(tiempodeejecucion(:,tt));
end
Fi ure 5. . Second Order Finite Differences
2.3 Simulation
Results
(Off line)
7/27/2019 Execution Time
11/16
Figure 6. Block Diagram in SIMULINK:First Order Mathematical Model
u(t)
w(t-xi)i(t)
corriente d e Armadura
Primer Orden
-1
Z
Xi
u(t)
i(t)
w(t-x)
w(t)
Velocidad angular
Primer Orden
Velocidad
angular
Step-K-
Gain
Corriente de
Armadura
Analog
Output
Analog Output1
National Instruments
PCI-1200 [auto]
Analog
Output
Analog OutputNational Instruments
PCI-1200 [auto]
93
93
Figure 8. NI PCI 1200 Output:First Order Mathematical model Execution timesec06.2
2.3 Simulation
Results
(Soft real time )
7/27/2019 Execution Time
12/16
Figure 7. Block Diagram in SIMULINK:
Second Order Matematical model
u(t)
i(t)
w(t - xi)
w(t - 2xi)
w(t)
Velocidad Angular
Segundo Orden
Velocidad
Angular
Step
-1Z
Integer Delay2
-1Z
Integer Delay1
-1
Z
Integer Delay
u(t)
i(t - xi)
w(t - xi)
i(t)
Corriente de Armadura
Segundo orden
Corriente de
armadura
Analog
Output
Analog Output1
National Instruments
PCI-1200 [auto]
Analog
Output
Analog Output
National Instruments
PCI-1200 [auto]
93
93
-K-
1/(2*pi)
Figure 9. NI PCI 1200 Output:Second Order Mathematical model Execution timesec10.2
2.3 Simulation
Results
(Soft real time)
7/27/2019 Execution Time
13/16
3.1 Execution time
Importance
Figure 10. Real Time Simulation Time Line
[Med07]
t Simulation time
T Real time(tn, Tn)
Task
(tn+1, Tn+1)
Communication time
Idle time
Execution time of a task
7/27/2019 Execution Time
14/16
The mathematical model simulated permits the extraction and release of information
observable and synchronized with the time evolution of the process by considering thesampling criteria [Nyq28]..
7/27/2019 Execution Time
15/16
7/27/2019 Execution Time
16/16
[Val09]. Valdez Martnez J. S. Modelado discreto, Simulacin, y Control de un Motor de Corriente
Continua Tipo Serie Considerando: Prdidas Mecnicas, Elctricas y Magnticas. Tesis de Maestra,
CICATA Legaria, Mxico.
[MG03] Medel Jurez J. J. y Guevara Lpez P. Introduccin a los sistemas en tiempo real IPN
[MGC07] Medel Jurez J. J. Guevara Lpez P. y Cruz Lpez D. Temas Selectos de Sistemas en tiempo
RealIPN
[GVL09] Guevara Lpez P. Valdez Martnez J. S. y Lpez E. Un Prototipo Virtual para la Enseanza delFuncionamiento del Motor de Corriente Continua Congreso Internacional de Innovacin Educativa,
Mxico
[Gue99] Guevara Lpez P. Controlde motores de corriente continua con capacidad de telecontrol y tele
monitoreo. Tesis de Maestra, CIC IPN Mxico
[Var82] Vargas Prudente P. Problemas Resueltos de mquinas Sincronas: Conversin de Energa II
IPN, 1982
[BK08] Bergero F. y Kofman E. Desarrollo de un simulador de sistemas hbridos en tiempo real.XXI Congreso Argentino de Control Automtico, Argentina
[Gue04] Guevara Lpez P. Filtrado Digital en Tiempo Real: Anlisis Computacional para Estimacin de
Parmetros en Sistemas Estocsticos Lineales Estacionarios. Tesis de Doctorado, CIC IPN Mxico
[Nyq28] Nyquist H. Certain Topics in Telegraph Transmission Theory. AIEE Transactions, EUA.
[Med07] Praveen Medisetti Real Time Simulation and Hardware-in-loop Testing of a hybrid Electric
Vehicle Control System Tesis de DoctoradoFaculty of The University of Akron, EUA, 2007.
4 Bibliography