You are on page 1of 16

Execution Time Validation of the Mathematical

Models of a Electric Motor in


Soft Real Time Simulation
M.T.A. Jorge Salvador Valdez Martnez
Dr. Pedro Guevara Lpez
Dr. Juan Carlos Garca Infante
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 absolutely
imperative 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 Overload
Critical security requirements
Active redundancy
Reduced data volume.
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) to
appropriate 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 overloads
Non-critical security requirements
Fail recovery
Large volume of data
1.1 Real Time System
Classification (Time Constraints)
Correct
Answers
Temporal
Constraints
Real
Process
STR
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
1.2 Real Time Simulation
Minimal Characteristics
A 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).
1.3 Real Time Simulation
SIMULINK
In SIMULINK, the Synchronization services is possible with the asynchronous
interruptions 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 obtained
in 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.
.
2.1 Physical Models Simulation:
DC motor Fundamentals [Gue99]
| | | |
LJ
ea t ki
t
LJ
t i k Rb
t
LJ
RJ Lb
t
) (
) (
) (
) ( ) (
2 2
=
+
+ '
+
+ ' ' e e e

(1)
L
ea
t i
L
t k R
t i
a a
=
+
+ ' ) (
) (
) (
e

(2)

| |
RJ
ea t ki
t
RJ
t i k Rb
t
) (
) (
) (
) (
2 2
=
+
+ ' e e

(3)
) (
) (
t k R
ea
t i
a
e +
=

(4)

Second Order Model
First Order Model

Figure 1. Series wound DC Motor:
Electromechanical circuit

if
ia
Rf Lf
Ra La
Vinduced
ARMOR
ea
J
b
I(t)
e(t)
Varmor
CONSTANT INDUCED
FIELD
MOTOR
e(t)
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 by
considering the sampling criteria [Nyq28]..
Table 1. Code to obtain The execution time:
First Order Mathematical Model
for MC=1:experimentos
for 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
Time ( 2.81e-6 sec)

Table 2. Code to obtain The execution time:
Second Order Mathematical Model
for MC=1:1
for 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


Figure 5. . Second Order Finite Differences
Execution Time (3.87e-6 sec)

2.3 Simulation
Results
(Off line)

Figure 6. Block Diagram in SIMULINK:
First Order Mathematical Model

u(t)
w(t-xi)
i(t)
corri ente de Armadura
Pri mer Orden
-1
Z
Xi
u(t)
i(t)
w(t-x)
w(t)
Vel oci dad angul ar
Pri mer Orden
Vel oci dad
angul ar
Step
-K-
Gai n
Corri ente de
Armadura
Anal og
Output
Anal og Output1
National Instruments
PCI-1200 [auto]
Anal og
Output
Anal og Output
National Instruments
PCI-1200 [auto]
93
93

Figure 8. NI PCI 1200 Output:
First Order Mathematical model Execution time
sec 06 . 2


2.3 Simulation
Results
(Soft real time )

Figure 7. Block Diagram in SIMULINK:
Second Order Matematical model

u(t)
i(t)
w(t - xi)
w(t - 2xi)
w(t)
Vel oci dad Angul ar
Segundo Orden
Vel oci dad
Angul ar
Step
-1
Z
Integer Del ay2
-1
Z
Integer Del ay1
-1
Z
Integer Del ay
u(t)
i(t - xi)
w(t - xi)
i(t)
Corri ente de Armadura
Segundo orden
Corri ente de
armadura
Anal og
Output
Anal og Output1
National Instruments
PCI-1200 [auto]
Anal og
Output
Anal og Output
National Instruments
PCI-1200 [auto]
93
93
-K-
1/(2*pi )

Figure 9. NI PCI 1200 Output:
Second Order Mathematical model Execution time
sec 10 . 2


2.3 Simulation
Results
(Soft real time)
3.1 Execution time
Importance

Figure 10. Real Time Simulation Time Line
[Med07]

t Simulation time
T Real time
(tn, Tn)
T
a
s
k
(tn+1, Tn+1)
Communication time
Idle time
Execution time of a task
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]..
3.1 Conclusions
The current computer technology program can run codes with high computational
complexity, and thus using more complete mathematical models

The execution times obtained by the measurement techniques are reliable.

The execution times of the models in study, can affect the dynamics of the system if they
exceed the sampling period (Time Constraints).

Operating Systems Options






[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
Real IPN
[GVL09] Guevara Lpez P. Valdez Martnez J. S. y Lpez E. Un Prototipo Virtual para la Enseanza del
Funcionamiento del Motor de Corriente Continua Congreso Internacional de Innovacin Educativa,
Mxico
[Gue99] Guevara Lpez P. Control de 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 Doctorado Faculty of The University of Akron, EUA, 2007.

4 Bibliography

You might also like