Professional Documents
Culture Documents
The fuzzy control is made on a D.C. shunt motor, with speed sensor
attached. The output characteristics are similar with the c.c. motors. The order
current is quasi rectangular, trapezoidal excitation. DC shunt motor appeared
out of a need for electric drives which would work with variable speed in wide
range. DC shunt motors are classified according the control method used in:
The fuzzy logic is a class of artificial intelligence with a recent history and
application. In 1965, Lotfy Zadeh a computer scientist propounded the theory
of fuzzy logic. He argued that human thinking is often fuzzy, vague, or
imprecise in nature, and, therefore cannot be represented by yes (1) or no (0).
Although FL deals with imprecise “IF … THEN …” rules, the information is
processed in sound mathematical theory, which has progressed (seen advances)
in recent years. Each fuzzy set is defined by a linguistic variable (low, large)
which is again defined by a multi valued membership function (MF). An MF
varies between 0 and 1 and can have a range of shapes. The logical operations
on fuzzy sets and crisp sets are and (intersection), or (reunion), not, sum, prod.
The IF part of the rule is defined as antecedent and THEN part is defined as
consequence. The corresponding fuzzy set of each rule is defined by a
linguistic variable.
The basic steps in fuzzy inference systems (FIS) are:
• Fuzzification of input variables;
• Application of fuzzy operator in the IF part of the rule;
• Implication from the antecedent to the consequent part of the rule;
• Aggregation of the consequents across the rule;
• Defuzzification.
Fuzzification defines the correlation between a crisp value and one or more
linguistic values. The conversion of fuzzy outputs in a fuzzy system into crisp
output is defined as defuzzification. The fuzzy output in constructed by
superimposing the outputs of individual rule. The most usual method of
defuzzification is the center of area method (also called centroid) which
involves integration covering the outer envelope.
Fuzzy logic has two different meanings, in a narrow sense, fuzzy logic is a logical
system, which is an extension of multivolume’s logic, and however, in a wider
sense fuzzy logic is almost synonymous with the theory of fuzzy sets, a theory
which relates to classes of objects with un-sharp boundaries in which membership
is a matter of degree. In this perspective fuzzy logic in its more narrow definition,
fuzzy logic differs both in concept and substance from traditional multi-valued
logical system. Fuzzy logic is a convenient way to map input space to an output
space. Mapping input to output is the starting point for everything.
• To derive optimal power system operation rules at the macro level for better
performance and control of the power system.
• To develop a fuzzy logic tool for deriving optimal operational rules at the
macro level for better performance and control of power system.
4.1 WHY USE FUZZY LOGIC?
Fuzzy logic offers several unique features that make it a particularly good
choice for many control problems.
• Fuzzy logic is conceptually easy to understand. The mathematical concepts
behind fuzzy reasoning are very simple. Fuzzy logic is a more intuitive
approach without the for-reachicomplexity. Fuzzy logic is flexible. Fuzzy
logic is tolerant of imprecise data. Fuzzy logic can model non-linear
function of arbitrary complexity. Fuzzy logic is based on natural language.
• It is inherently robust since it does not require precise, noise-free inputs and
can be programmed to fail safely if a feedback sensor quits or is destroyed.
The output control is a smooth control function despite a wide range of input
variations.
• Since the Fuzzy logic controller processes user-defined rules governing the
target control system, it can be modified and tweaked easily to improve or
drastically alter system performance. New sensors can easily be incorporated
into the system simply by generating appropriate governing rules.
• Fuzzy logic is not limited to a few feedback inputs and one or two control
outputs, nor is it necessary to measure or compute rate-of-change parameters
in order for it to be implemented. Any sensor data that provides some
indication of a system's actions and reactions is sufficient. This allows the
sensors to be inexpensive and imprecise thus keeping the overall system cost
and complexity low.
• Because of the rule-based operation, any reasonable number of inputs can be
processed (1-8 or more) and numerous outputs (1-4 or more) generated,
although defining the rule base quickly becomes complex if too many inputs
and outputs are chosen for a single implementation since rules defining their
interrelations must also be defined.
• It would be better to break the control system into smaller chunks and use
several smaller Fuzzy logic controllers distributed on the system, each with
more limited responsibilities.
Fuzzy logic control is derived from fuzzy set theory. In fuzzy set theory, the
transition between membership and non-membership can be graded. Therefore,
boundaries of fuzzy sets can be vague and ambiguous, making it useful for
approximate systems. Fuzzy Logic Controller (FLC) is an attractive choice when
precise mathematical formulations are not possible. Other advantages are
• It can work with less precise inputs.
• It needs less data storage in the form of membership functions and rules than
conventional look up table for nonlinear controllers.
Theoretical background
2.1 Fundamentals of DC Motor
The commonly used configuration of the dc motors is shown below in figure . In a
separately excited motor, the armature and the field coil are connected to different
dc source. This gives the configuration total control over the armature and the field
voltage separately. In the shunt motor, both coils have a common source. In case of
the series motor, both the armature and the field current are the same. In the
cumulatively compound motor, the magneto-motive force of the series field is a
function of armature current and is in the same direction as mmf of the shunt field.
Pin diagram:
Features:
Description:
The atmega16 is a low-power cmos 8-bit microcontroller based on
the avr risc architecture. By executing powerful instructions in a single clock cycle,
the atmega16 achieves throughputs approaching 1 mips per mhz, allowing the
system designer to optimize power consumption versus processing speed. The avr
core combines a rich instruction set with 32 general-purpose working registers. All
the 32 registers are directly connected to the arithmetic logic unit (alu), allowing
two independent registers to be accessed in one single instruction executed in one
clock cycle. The resulting architecture is more code efficient while achieving
throughputs upto ten times faster than conventional cisc microcontrollers.
The device is manufactured using atmel’s high-density non-volatile
memory technology. The flash program memory can be reprogrammed in-system
through an spi serial interface, by a conventional non-volatile memory
programmer, or by an on-chip boot program running on the avr core. The boot
program can use any interface to download the application program in the
application flash memory. Software in the boot flash section will continue to run
while the application flash section is updated, providing true read-while-write
operation. By combining an 8-bit risc cpu with in-system self-programmable flash
on a monolithic chip, the atmel atmega16 is a powerful microcontroller that
provides a highly flexible and cost-effective solution to many embedded control
applications. The atmega16 avr is supported with a full suite of program and
system development tools, including c compilers, macro assemblers, program
debugger/simulators, in-circuit emulators, and evaluation kits.
Pin descriptions:
• Gnd - ground.
• Avcc:
Avcc is the supply voltage pin for the a/d converter, port c (3-
0) and adc (7-6). It should be externally connected to vcc, even if the adc
is not used. If the adc is used, it should be connected to vcc through a
low-pass filter. Note that port c (5-4) use digital supply voltage, vcc.
• Aref:
Aref is the analog reference pin for the a/d converter.
• PORT B: (PB7 – PB0)
Introduction:
This section discusses the avr core architecture in general. The main
function of the cpu core is to ensure correct program execution. The cpu must
therefore be able to access memories, perform calculations, control peripherals,
and handle interrupts.
Architectural overview:
In order to maximize performance and parallelism, the avr uses harvard
architecture with separate memories and buses for program and data. Instructions
in the program memory are executed with a single level pipelining. While one
instruction is being executed, the next instruction is pre-fetched from the program
memory. This concept enables instructions to be executed in every clock cycle.
The program memory is in system reprogrammable flash memory. The fast-access
register file contains 32 x 8-bit general purpose working registers with a single
clock cycle access time. This allows single-cycle arithmetic logic unit (alu)
operation. In a typical alu operation, two operands are output from the register file,
the operation is executed, and the result is stored back in the register file – in one
clock cycle.
1.1.1.1.1.1
The high-performance avr alu operates in direct connection with all the 32
general purpose-working registers. Within a single clock cycle, arithmetic
operations between general-purpose registers or between a register and an
immediate are executed. The alu operations are divided into three main categories
– arithmetic, logical, and bit-functions. Some implementations of the architecture
also provide a powerful multiplier supporting both signed/unsigned multiplication
and fractional format. See the “instruction set” section for a detailed description.
Status register:
The status register contains information about the result of the most recently
executed arithmetic instruction. This information can be used for altering program
flow in order to perform conditional operations. Note that the status register is
updated after all alu operations, as specified in the instruction set reference. This
will in many cases remove the need for using the dedicated compare instructions,
resulting in faster and more compact code.
The status register is not automatically stored when entering an interrupt
routine and restored when returning from an interrupt. This must be handled by
software.
The global interrupt enable bit must be set for the interrupts to be enabled.
The individual interrupt enable control is then performed in separate control
registers. If the global interrupt enable register is cleared, none of the interrupts are
enabled independent of the individual interrupt enable settings. The i-bit is cleared
by hardware after an interrupt has occurred, and is set by the reti instruction to
enable subsequent interrupts. The i-bit can also be set and cleared by the
application with the sei and cli instructions, as described in the instruction set
reference.
The stack pointer points to the data sram stack area where the
subroutine and interrupt stacks are located. This stack space in the data sram must
be defined by the program before any subroutine calls are executed or interrupts
are enabled. The stack pointer must be set to point above 0x60. The stack pointer is
decremented by one when data is pushed onto the stack with the push instruction,
and it is decremented by two when the return address is pushed onto the stack with
subroutine call or interrupt. The stack pointer is incremented by one when data is
popped from the stack with the pop instruction, and it is incremented by two when
address is popped from the stack with return from subroutine ret or return from
interrupt reti.
The avr stack pointer is implemented as two 8-bit registers in the i/o
space. The number of bits actually used is implementation dependent. Note that the
data space in some implementations of the avr architecture is so small that only spl
is needed. In this case, the sph register will not be present.
The interrupt execution response for all the enabled avr interrupts
is four-clock cycles minimum. After four clock cycles, the program vector
address for the actual interrupt handling routine is executed. During this 4-clock
cycle period, the program counter is pushed onto the stack. The vector is
normally a jump to the interrupt routine, and this jump takes three clock cycles.
If an interrupt occurs during execution of a multi-cycle instruction, this
instruction is completed before the interrupt is served. If an interrupt occurs
when the mcu is in sleep mode, the interrupt execution response time is
increased by four clock cycles. This increase comes in addition to the start-up
time from the selected sleep mode.
Avr atmega16 memories:
This section describes the different memories in the atmega16. The
avr architecture has two main memory spaces, the data memory and the program
memory space. In addition, the atmega16 features an eeprom memory for data
storage. All three memory spaces are linear and regular.
Types of memories:
• In-system reprogrammable flash program memory:
• Data memory:
.
The lower 1120 data memory locations address the register file, the i/o
memory, and the internal data sram. The first 96 locations address the register file
and i/o memory, and the next 1024 locations address the internal data sram. The
five different addressing modes for the data memory cover: direct, indirect with
displacement, indirect, indirect with pre-decrement, and indirect with post-
increment. In the register file, registers r26 to r31 feature the indirect addressing
pointer registers.
• EEprom data memory:
• I/o memory:
All atmega16 i/os and peripherals are placed in the i/o space. The i/o
locations are accessed by the in and out instructions, transferring data between the
32 general-purpose working registers and the i/o space. I/o registers within the
address range 0x00 - 0x1f are directly bit-accessible using the sbi and cbi
instructions. In these registers, the value of single bits can be checked by using the
sbis and sbic instructions. Refer to the instruction set section for more details.
When using the i/o specific commands in and out, the i/o addresses 0x00 - 0x3f
must be used. When addressing i/o registers
As data space using ld and st instructions, 0x20 must be added to these addresses.
For compatibility with future devices, reserved bits should be written to zero if
accessed.
Application section
The application section is the section of the flash that is used for
storing the application code.
The protection level for the application section can be selected by the
application boot lock bits. The application section can never store any boot loader
code since the spm instruction is disabled when executed from the application
section.
Bls – boot loader section
While the application section is used for storing the application code,
the the boot loader software must be located in the bls since the spm instruction
can initiate a programming when executing from the bls only. The spm instruction
can access the entire flash, including the bls itself. The protection level for the boot
loader section can be selected by the boot loader
Read-while-write and no read- while-write flash sections
Whether the cpu supports read-while-write or if the cpu is halted
during a boot loader software update is dependent on which address that is being
programmed. In addition to the two sections that are configurable by the bootsz
fuses as described above, the flash is also divided into two fixed sections, the read-
while-write (rww) section and the no read-while- write (nrww) section. The limit
between the rww- and nrww sections is given. The main difference between the
two sections is:
when erasing or writing a page located inside the rww section, the nrww section
can be read during the operation.
when erasing or writing a page located inside the nrww section, the cpu is halted
during the entire operation.
Note that the user software can never read any code that is located inside the rww
section during a boot loader software operation. The syntax “read-while-write
section” refers to which section that is being programmed (erased or written), not
which section that actually is being read during a boot loader software update.
Switching element
Switching element are the important part of any electric drive. Switching element
provides the power to the load. The switching element should have following
characteristics.
• Minimum conduction loss
• Minimum switching loss
There are various types of switching element, among them MOSFET (Metal oxide
semiconductor field effect transistor) and IGBT (insulated gate bipolar transistor)
are mostly used in the electric drive.
2.2.1 Metal oxide semiconductor field effect transistor (MOSFET)
Power MOSFETs are the voltage controlled device requiring small current to turn
ON. Switching speed of the Power MOSFET is very high (of the order of
nanosecond). They are mostly used in low and medium power and high frequency
application. Figure 2-10 shows the symbol and the internal structure of the power
MOSFET. The characteristics curve of the MOSFET is given in figure 2-11.
Figure 2-10 Power MOSFET (a) Symbol (b) Vertical cross section
Figure 2-12 IGBT (a)Symbol (b) Equivalent circuit model (c) Vertical cross
section
Figure 2-13 Characteristics curve of the IGBT
In the figure 2-9 C and D are known as Lower side transistor. There are various
gate drive circuits for the lower side transistor. Fig 2-15 and 2-16 shows the
gate drive circuit for the lower side transistors. The gate drive circuit implementing
totem pole is better than the gate drive circuit of figure 2-16 because the switching
time for the totem pole transistors is fast.
PWM implementation
The single mosfet is used to drive the motor operates with the Pulse Width
Modulated (PWM) control signal. This signal is applied to the gate of MOSFETs
building the bridge. The duty cycle of this PWM signal is controlled by the fuzzy
controller. The PWM generator was implemented into the microcontroller. The
PWM generator generates 9.765 KHz PWM signal. The block diagram of the
PWM generator is shown below.
Figure 3-13 PWM generator block
The PWM generator has three modules or segments within it, namely
dutycycle_register, clk_counter and count_comparator. When a new duty cycle is
sent to the dutycycle register from the Fuzzy controller and then setting the Reset
pin high, the current count in the clk_count is stopped and the counter resets to
zero count (getting ready for next count). Also the high on Reset pin latches the
input new duty cycle into the dutycycle_register. The count_comparator
continuously compares the count value to the register value and generates PWM
output low after the count reaches the register value. Before that the PWM output
is high.
Figure 3-14 PWM generation
3.6 Feedback mechanism
The velocity feed back in terms of the revolution per minute (RPM) was sensed
using an opto-interrupter (also known as beam breaker). Opto-interrupter consists
of a infrared emitting diode and photo transistor aligned such that the emitted beam
falls on photo sensitive base of the photo transistor. A slotted disk as shown in the
figure below breaks the beam at regular interval and hence generates train of
pulses. Then the no of system frequency (10 KHz) clock pulses that fall on these
pulses (high or low) is counted. This count gives the width of a slot in terms of no
of 10 KHz pulse ie, in terms of time. From the already known slots count (30 open
and 30 closed slots) time for one revolution is determined by multiplying the slot
width (in time) with slot count. Its reciprocal gives us the revolution per sec, from
where RPM can be determined by multiplication with
.
Figure 3-15 Opto – interrupter
The Electric Drive technology is an alternative to the current fuel crisis and
the increasing environmental issues. Hence, the project has mounted itself to the
fundamentals of the speed controller. It deals with the problem of high current
driver circuit and an efficient algorithmic based control (Fuzzy Logic) to track the
velocity. The necessary component for this design was easily available in the local
market. The design was based on the choice of the MOSFET that could handle the
required current. In order to drive the gate of the MOSFET, a method known as
Bootstrap was used.
The circuit was successfully implemented and tested. The traditional analog
control of the motor’s speed requires the knowledge of the accurate mathematical
model which is very difficult to determine and varies with each motor, even with
the same manufactures’ specification. This makes the design inflexible. But in
contrast, the discrete control system has the advantage of employing complex
mathematical algorithm that is efficient and accurate. Hence the choice of FPGA
makes the best solution for the objective of the project. In addition, the
implementation of Fuzzy Logic in microcontroller makes the system design easier.
Also, it increases the flexibility of the controller to the change in system’s
parameter.