Fpga Control Motor Asincron
Fpga Control Motor Asincron
Fpga Control Motor Asincron
1. INTRODUCTION
251
_____________________________________________________________________________________
CONFERINA NAIONAL DE ACIONRI ELECTRICE, ediia XVI, SUCEAVA - 2012
processor concept, seen as a black box, which will get
an input argument in order to receive an output desired
function. The CORDIC processsors are placed in two
categories: iterative and non interative.
For the simulation and implementation the iterative
CORDIC algorithm was described in Verilog language,
in order to calculate the sin and cos functions. The
algorithm ensures for each iteration an auxiliary
increase of precision of one bit. The implementation of
trigonometric functions is based on vector rotation,
while other functions, such as the square root, is
implemented based on incremental expression of the
desired function.
The trigonometric functions sin, cos, etc. are not
found only in the mathematic modellation of the stator
rotating magnetic field, but also in numerous problems
that appear in technical fields such as: robotics
(movement prediction, calculation on the environment
geometry), Linear systems (control), Signal processors
(transformations, filters, final applications: Radar). The
calculation techniques of the trigonometric functions
can be based on the development in Taylor series,
polynomial
approximations,
associative
tables,
CORDIC algorithms, etc.
Compared to other methods, CORDIC presents a
series of advantages such as: the presence of only the
addition and shift operations, the absence of the
multiplication operation, the easy implementation in a
reconfigurable hardware (FPGA), the complexity
comparable with that of the multiplication and square
root extraction operations.
2. F.P.G.A. PROGRAMMING
2.1. A brief presentation of the F.P.G.A.
architecture
The FPGA architecture contains a vector of
configurable logical blocks, extensions I/O and routing
channel. Generally, all routing channels have the same
width (number of wires). The multiple I/O extensions
can be mounted in the height of a line or on the width of
a column in the array. FPGAs are matrix designed.
A circuit must be mapped on a FPGA circuit using
appropriate resources. While the number of necessary
logical blocks and I/O are easy to be determined from
the project, the number of necessary routing roads can
vary considerably even among projects that use the
same logic. Since the unused routes increase the cost
and decrease the performance of a component without
providing any other benefit, the FPGA manufacturers
try to offer necessary routes so that most schematic
projects can be routed depending on the LUT and the
I/O ports. A classic logical block FPGA contains a look
up table with 4 inputs and a flip-flop. It presents only an
_____________________________________________________________________________________
252
Buletinul AGIR nr. 4/2012 octombrie-decembrie
2
_____________________________________________________________________________________
Buletinul AGIR nr. 4/2012 octombrie-decembrie
253
3
_____________________________________________________________________________________
CONFERINA NAIONAL DE ACIONRI ELECTRICE, ediia XVI, SUCEAVA - 2012
2.3. the rotative algorithm
F.P.G.A. programming
(
y =K
+ x (d
K = cos(arctg (2 )) =
i +1
Where
2 i
1
)] ,
)] ,
(4),
,
and
1 + 2 2i
y1 = x0 sin + y 0 cos
[
[y
xi +1 = K i xi y i d i 2 i
(1),
y1 = cos( ) [ y 0 + x0 tg ( )]
(2).
tg = (+ / )2 i
(3),
then the multiplication with the term tg is reduced to a
movement operation. Thus, the rotation with an
arbitrary angle is reduced to a series of elementary
rotations, with angles i, whose direction must be set at
each iteartion i.
Cos being an even function, from the relations (2) and
Figure 4. The main CORDIC block
(3)
results:
_____________________________________________________________________________________
254
module cordic_control(CosX,SinX,theta,sign,clock,reset);
output [16:0] CosX,SinX;
input [15:0] theta;
input sign,clock,reset;
reg [16:0] CosX,SinX;
wire [16:0] cos,sin;
reg [4:0] cnt;
reg rst;
cordic mycordic(cos,sin,theta,Sign,clock,rst);
always@(posedge clock)
if (reset) begin
cnt <= 0;
CosX <= 0;
SinX <= 0;
rst <= 1;
end else if (cnt<=16)
begin
cnt <= cnt + 1;
CosX <= cos;
SinX <= sin;
rst <= 0;
end else rst <= 1;
endmodule
`define REG_SIZE 15
//Dimensiunea real a registrului este: REG_SIZE+1.
module cordic(CosX,SinX,theta,sign,clock,reset);
output [`REG_SIZE+1:0] CosX,SinX;
input [`REG_SIZE:0] theta;
input sign,clock,reset;
reg AngleCin,Xsign,Ysign;
reg [`REG_SIZE:0] X,Y,Angle;
reg [3:0] iteration;
wire [`REG_SIZE:0] tanangle;
wire [`REG_SIZE:0] BS1,BS2;
wire [`REG_SIZE:0] SumX,SumY,SumAngle;
wire CarryX,CarryY,AngleCout;
shifter SH1(BS1,Y,iteration);
Adder AddX(SumX,CarryX,Xsign,X,BS1,~AngleCin);
shifter SH2(BS2,X,iteration);
Adder AddY(SumY,CarryY,Ysign,Y,BS2,AngleCin);
Adder
Add0(SumAngle,AngleCout,AngleCin,Angle,tanangle,~Angl
eCin);
assign CosX={CarryX,SumX};
assign SinX={CarryY,SumY};
_____________________________________________________________________________________
Buletinul AGIR nr. 4/2012 octombrie-decembrie
255
5
_____________________________________________________________________________________
CONFERINA NAIONAL DE ACIONRI ELECTRICE, ediia XVI, SUCEAVA - 2012
series have a clock frequency of 50 MHz. Thus, even if
the number of iterations is high, the time period in
which the calculation is performed is very short, i.e.
nanoseconds, a few microseconds at the most.
There is also the possibility of the direct calculation
of the Sin and Cos functions using the Xilinx soft as
block instructions (similar to an assembly language),
but these are less precise and rarely used.
These functions are stored in a ROM memory. They
are defined through one functional block. The setting of
the parameters and the introduction of the sin and cos
function values is performed through a window as
follows:
d
= cos ,
q
= sin , (5). Thus, we can easily see the angle
d
, (6).
dt
BIBLIOGRAPHY:
1.
_____________________________________________________________________________________
256
Buletinul AGIR nr. 4/2012 octombrie-decembrie
6
_____________________________________________________________________________________
Buletinul AGIR nr. 4/2012 octombrie-decembrie
257
7