Professional Documents
Culture Documents
Fuzzy Based Energy Regulator
Fuzzy Based Energy Regulator
for sale
ABSTRACT
A set of fuzzy rules decides the enabling /disabling of a set of devices. Devices are
categorized in 5 priority levels, and the activation of these sets are controlled by the fuzzy
logic rules.
The project uses a PIC microcontroller (16F873/16F73) for the implementation of the
logic. . Energy metering chip type AD7755/7751 is used for converting the energy
consumed to pulses recognizable by the microcontroller.
The energy IC takes the input from the energy meter , process it and provides a
pulsated output .The frequency of the pulsated output is propotional to the energy
consumed by the user. More the energy consumed more will be the frequency of the
output.By counting these pulses the energy consumed can be determined .
The fuzzy rules designed by the user are implemented using programmers .The
programmer can be connected to the IC and can be programmed either in assembly
language or in mikro c.
1
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
INTRODUCTION
Regulation of energy has been of great concern
today.In the world of automation and artificial intelligence ,usage of energy can be easily
regulated .Regulating the usage automatically is always an appreciated task.The project
emphasizes on developing an energy regulator based on artificial intelligence technique
known as Fuzzy logic.Here we regulate the energy usage by priority switching of
devices.We have divided the main power line to four using four switches consisting of
relays and transistors.The four lines are then switched according to the fuzzy rules which
can be decided by the user.The rules can be altered or modified according to the
preferences of the user.Once it has been programmed the user does not have to intervene
with the device.
2
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
BLOCK DIAGRAM
Controller
Display
AD 7755/51
(Switching)
Current Voltage
Transform Transform
er er
Power line
Poepower Line
3
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
The only analog circuitry used in the ADE7755 is in the ADCs and reference circuit. All
other signal processing (for example, multiplication and filtering) is carried out in the
digital domain. This approach provides superior stability and accuracy over extremes in
environmental conditions and over time.
The ADE7755 supplies average active power information on the low frequency outputs,
F1 and F2. These logic outputs can be used to directly drive an electromechanical counter
or interface to an MCU. The CF logic output gives instantaneous active power
information. This output is intended to be used for calibration purposes or for interfacing
to an MCU.
4
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
The ADE7755 includes a power supply monitoring circuit on the AVDD supply pin. The
ADE7755 remains in a reset condition until the supply voltage on AVDD reaches 4 V. If
the supply falls below 4 V, the ADE7755 resets and no pulse is issued on F1, F2, and CF.
Internal phase matching circuitry ensures that the voltage and current channels are phase
matched whether the HPF in Channel 1 is on or off. An internal no load threshold ensures
that the ADE7755 does not exhibit any creep when there is no load.
The energy metering IC ADE 7755 , provides a pulsated output of the power. This IC has
two inputs both of which are voltage inputs , hence to have the power output the input
current has to be converted to equivalent voltage by using the current transformer.The
both input voltages are then converted into digital signals by the ADC’s .Next a phase
correction circuit corrects the phase difference between current and voltage which is
further passed through a high pass filter to remove any ripples or noise.Now by using a
multiplier both input voltages are multiplied and power output is produced.This power
output is then converted into frequency by using a Digital to frequency Converter, and this
frequency provides the measurement of the power consumed.
5
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
FEATURES:
6
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
PIC MICROCONTROLLER
PICs are popular with developers and hobbyists alike due to their low cost, wide
availability, large user base, extensive collection of application notes, availability of low
cost or free development tools, and serial programming (and re-programming with flash
memory) capability.
PIC 16F73
It is a low cost 16 bit microcontroller available for general purpose uses. It has an inbuilt
ADC within it , but not used in the project.Features are listed below.
7
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
Microcontroller Features:
• All single cycle instructions except for program branches which are two-cycle.
• Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation.
8
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
Peripheral Features:
• Timer1: 16-bit timer/counter with prescaler, can be incremented during SLEEP via
external crystal/clock.
• Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler.
• Synchronous Serial Port (SSP) with SPI (Master mode) and I2C(Slave).
• Parallel Slave Port (PSP), 8-bits wide with external RD, WR and CS controls (40/44-pin
only).
9
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
PIN DIAGRAM
PIN DESCRIPTION
Ø MCLR-(pin 1)
PIC16F7X devices have a noise filter in the MCLR Reset path. The filter will detect and
ignore small pulses. It should be noted that a WDT Reset does not drive MCLR pin low.
The behavior of the ESD protection on the MCLR pin has been altered from previous
devices of this family. Voltages applied to the pin that exceed its specification can result
in both MCLR Resets and excessive current beyond the device specification during the
ESD event. For this reason, Microchip recommends that the MCLR pin no longer be tied
directly to VDD.
Ø RESET
10
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
PORTA is a 6-bit wide, bi-directional port. The corresponding data direction register is
TRISA. Setting a TRISA bit (= ‘1’) will make the corresponding PORTA pin an input
(i.e., put the corresponding output driver in a Hi-Impedance mode). Clearing a TRISA bit
(= ‘0’) will make the corresponding PORTA pin an output (i.e., put the contents of the
output latch on the selected pin).
Reading the PORTA register reads the status of the pins, whereas writing to it will write
to the port latch. All write operations are read-modify-write operations. Therefore, a write
to a port implies that the port pins are read, the value is modified and then written to the
port data latch.
11
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
Ø GND –(pin 8)
Ø OSC1/CLKIN-(pin 9)
Ø OSC2/CLKOUT-(pin 10)
which has 1/4 the frequency of OSC1, and denotes the instruction
cycle rate.
OSCILLATOR TYPES:
12
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
PORTC is an 8-bit wide, bi-directional port. The corresponding data direction register is
TRISC. Setting a TRISC bit (= ‘1’) will make the corresponding PORTC pin an input
(i.e., put the corresponding output driver in a Hi-Impedance mode). Clearing a TRISC bit
(= ‘0’) will
make the corresponding PORTC pin an output (i.e., put the contents of the output latch on
the selected pin).
PORTC is multiplexed with several peripheral functions PORTC pins have Schmitt
Trigger input buffers. When enabling peripheral functions, care should be taken in
defining TRIS bits for each PORTC pin.
Ø Vss(pin 19)
Ground reference for logic and I/O pins
Ø Vdd(pin 20)
Positive supply for logic and I/O pins
Ø PORTB and the TRISB Register(pin 21 to 28)
PORTB is an 8-bit wide, bi-directional port. The corresponding data direction register is
TRISB. Setting a TRISB bit (= ‘1’) will make the corresponding PORTB pin an input
(i.e., put the corresponding output driver in a Hi-Impedance mode). Clearing a TRISB bit
(= ‘0’) will make the corresponding PORTB pin an output (i.e., put the contents of the
output latch on the selected pin).
Each of the PORTB pins has a weak internal pull-up. A single control bit can turn on all
the pull-ups. The weak pull-up is automatically turned off when the port pin is configured
as an output. The pull-ups are disabled on a Power-on Reset.
13
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
CORE ARCHITECTURE
14
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
• A fairly small amount of addressable data space (typically 256 bytes), extended
through banking.
• All RAM locations function as registers as both source and/or destination of math
and other functions.
• A hardware stack for storing return addresses
• The program counter is also mapped into the data space and writable (this is used
to implement indirect jumps).
Unlike most other CPUs, there is no distinction between memory space and register space
because the RAM serves the job of both memory and registers, and the RAM is usually
just referred to as the register file or simply as the registers
15
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
VOLTAGE TRANSFORMER
Transformers (sometimes called "voltage transformers") are
devices used in electrical circuits to change the voltage of electricity flowing in the circuit.
Transformers can be used either to increase the voltage (called "stepping up") or decrease
the voltage ("step down").
16
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
Both wires in a transformer are actually wrapped in a coil around an iron core. The iron
core is immersed in an insulating oil bath which does not conduct electricity well. The
coils of wire are not physically connected. One wire has more turns in its coil than the
other wire. The different numbers of coils in the two wires causes the voltage and current
in each wire to be different from the other wire. By designing the transformer with just the
right number of coils in each wire, electrical engineers can control exactly how much the
transformer changes the voltage from the incoming to the outgoing wire.
Transformers only work with AC (alternating current) circuits. Since the AC current on the
"incoming" wire is constantly changing, the magnetic field it creates changes too. The
changing magnetic field is what forces current to flow in the "outgoing" wire.
Transformers are passive devices - they don't add power. A high voltage and low current
exits the transformer carrying almost the same amount of power along the transmission
lines that the incoming low voltage and high current did. Transformers are very efficient.
Under normal conditions they transmit about 99% of the power that enters them (about
1% of the power is lost as heat).
17
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
CURRENT TRANSFORMER
A current transformer raises or lowers the
current of an AC circuit in a predictable manner dependent on the ratio between the
windings. For example, a 100:1 ratio current transformer, 100 amps flowing throw the
primary transformer winding will result in a current of 1 amp through the secondary
winding. According to Ohm's Law, power is conserved; therefore, the effect of a current
transformer on voltage is inverse to its effect on current.
A current transformer consists of primary and secondary coils of wire wrapped around a
core, usually made of steel or a nickel alloy. Transformer windings are electrically
insulated from each other and from the core. The winding connected to the power supply is
called the primary winding. The transformer winding in which current is induced is called
the secondary winding.
As current passes through the primary winding, an electromagnetic field is produced which
induces a current in the electrically isolated secondary winding.The number of coils in a
winding determine the amount of current and voltage in the circuit. By altering the coil
ratio between the primary and secondary winding, a current transformer can alter the
current, either stepping it up or down, while conserving power.
18
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
The most common design of CT consists of a length of wire wrapped many times around a
silicon steel ring passed over the circuit being measured. The CT's primary circuit therefore
consists of a single 'turn' of conductor, with a secondary of many hundreds of turns. The
primary winding may be a permanent part of the current transformer, with a heavy copper
bar to carry current through the magnetic core. Window-type current transformers are also
common, which can have circuit cables run through the middle of an opening in the core to
provide a single-turn primary winding. When conductors passing through a CT are not
centered in the circular (or oval) opening, slight inaccuracies may occur.
Shapes and sizes can vary depending on the end user or switchgear manufacturer.
Typical examples of low voltage single ratio metering current transformers are either ring
19
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
type or plastic moulded case. High-voltage current transformers are mounted on porcelain
bushings to insulate them from ground. Some CT configurations slip around the bushing of
a high-voltage transformer or circuit breaker, which automatically centers the conductor
inside the CT window.
The primary circuit is largely unaffected by the insertion of the CT. The rated
secondary current is commonly standardized at 1 or 5 amperes. For example, a 4000:5 CT
would provide an output current of 5 amperes when the primary was passing 4000
amperes. The secondary winding can be single ratio or multi ratio, with five taps being
common for multi ratio CTs. The load, or burden, of the CT should be of low resistance. If
the voltage time integral area is higher than the core's design rating, the core goes into
saturation towards the end of each cycle, distorting the waveform and affecting accuracy
20
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
ENERGY METER
An electric meter or energy meter is a device that measures the amount of electrical
energy consumed by a residence, business, or an electrically-powered device.
Electric meters are typically calibrated in billing units, the most common one being the
kilowatt hour. Periodic readings of electric meters establishes billing cycles and energy
used during a cycle.
In settings when energy savings during certain periods are desired, meters may measure
demand, the maximum use of power in some interval. In some areas, the electric rates are
higher during certain times of day, to encourage reduction in use. Also, in some areas
meters have relays to turn off nonessential equipment.
The most common unit of measurement on the electricity meter is the kilowatt hour,
which is equal to the amount of energy used by a load of one kilowatt over a period of one
hour, or 3,600,000 joules. Some electricity companies use the SI megajoule instead.
Demand is normally measured in watts, but averaged over a period, most often a quarter
or half hour.
Distortion of the electric current by loads is measured in several ways. Power factor is the
ratio of resistive (or real power) to volt-amperes. A capacitive load has a leading power
21
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
factor, and an inductive load has a lagging power factor. A purely resistive load (such as a
filament lamp, heater or kettle) exhibits a power factor of 1. Current harmonics are a
measure of distortion of the wave form. For example, electronic loads such as computer
power supplies draw their current at the voltage peak to fill their internal storage elements.
Electricity meters operate by continuously measuring the instantaneous voltage (volts) and
current (amperes) and finding the product of these to give instantaneous electrical power
(watts) which is then integrated against time to give energy used (joules, kilowatt-hours
etc.). Meters for smaller services ( such as small residential customers) can be connected
directly in-line between source and customer. For larger loads, more than about 200 amps
of load, current transformers are used, so that the meter can be located other than in line
with the service conductors
22
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
As in the block diagram, the meter has a power supply, a metering engine, A processing
and communication engine (i.e. a microcontroller), and other add-on modules such as
RTC, LCD display, communication ports/modules and so on.
The metering engine is given the voltage and current inputs and has a voltage reference,
samplers and quantisers followed by an ADC section to yield the digitised equivalents of
all the inputs. These inputs are then processed using a Digital Signal Processor to
calculate the various metering parameters such as powers, energies etc.
23
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
The largest source of long-term errors in the meter is drift in the preamp, followed by the
precision of the voltage reference. Both of these vary with temperature as well, and vary
wildly because most meters are outdoors. Characterizing and compensating for these is a
major part of meter design.
The processing and communication section has the responsibility of calculating the
various derived quantities from the digital values generated by the metering engine. This
also has the responsibility of communication using various protocols and interface with
other addon modules connected as slaves to it.
RTC and other add-on modules are attached as slaves to the processing and
communication section for various input/output functions. On a modern meter most if not
all of this will be implemented inside the microprocessor, such as the Real Time Clock
(RTC), LCD controller, temperature sensor, memory and analog to digital converters.
24
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
RTC is used by the microcontroller to make out the season and time of the day for
switching purposes. Although keeping time can be done without an RTC,using one has
benefits:
A GPS receiver can shorten its startup time by comparing the current time, according to
its RTC, with the time at which it last had a valid signal.If it has been less than a few
hours then the previous ephemeris is still usable.
An RTC Module
25
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
FUZZY LOGIC
WHAT IS FUZZY?
Fuzzy logic is a problem solving control system methodology that was invented
by Lofti Zadeh a professor at the University of California at Berkley. It has proven to be
an excellent choice for many control system applications since it mimics human control
logic. It can be built into anything from small hand-held products to large computerized
process control systems. It is imprecise but very descriptive language to deal with input
data more like human operator.
Fuzzy logic (FL) offers several unique features that make it a particularly good
choice for many control problems. These include:
It is inherently robust since it does not require precise, noise free input, and can be
programmed to fail safely if a feedback sensor quits or destroyed. The output control is a
smooth control function despite a wide range of input variations .FL controller processes
user-defined rules governing the target control system, therefore it can be modified and
tweaked easily to improve or drastically alter system performance for the better.
FL has no limited inputs feedback and control outputs. It is also not 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 action and reaction is sufficient.
This allows the sensor to be inexpensive and imprecise thus keeping the overall cost and
complexity low. FL control nonlinear systems that would be difficult or impossible to
model mathematically. This opens doors for control systems that could normally be
deemed unfeasible for automation
26
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
FUZZY SETS
FL deals with problems that have fuzziness or vagueness , unlike other methods
like classical theory which is based on Boolean logic where a particular object or variable
is either a member of a given set (logic 1) or not (logic 0). Fuzzy logic problem is an
input/output, static, nonlinear mapping problem through a main box as shown in figure 1
The input information is defined in the input space, it is processed in the main box
and the solution appears at the output space. The main box is a fuzzy system or any
other method e.g. expert system, neural network or a general mathematical system that
can give a desired output.
27
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
The input variables in a fuzzy control system are in general mapped in to by sets of
membership functions. This set is known as fuzzy sets. The process of converting crisp
input values to a fuzzy value is called “fuzzification”.
MF can have different shapes like triangular, trapezoidal, two sided Gaussian,
generalised bell, sigmoid-right, sigmoid-left, difference sigmoid, product sigmoid,
polynomial-Z, polynomial-Pi and polynomial-S. Triangular and trapezoidal types are the
28
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
FUZZY RULES
Usually these rules are of the form : If time of the day is ‘noon’ AND the
season is ‘summer’ AND usage is ‘normal’, THEN switch on the devices in ‘group 1’.
All the rules that apply are invoked, using the membership functions and truth values
obtained from the inputs to determine the result of the rule. This result in turn will be
mapped into membership functions and truth value containing the in the output
29
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
variable. The results are combined to give a specific answer (crisp). This procedure is
known as “defuzzyfication”.
5. FUZZY SYSTEMS
The following example shows how the above five steps can be implemented in a non
technical environment for a restaurant tipping where food and service are the inputs fuzzy
variable (0 -10 range) and tip is the output variable (0-25% range). The input variable
service is represented by three fuzzy sets poor, good, and excellent which corresponds to
curved MFs. While variable food is represented by two fuzzy sets bad and delicious this
corresponds to straight-line MFs. The output variable tip is represented by three sets
30
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
cheap, average, and generous which correspond to triangular MFs. Three rules are
developed as shown in figure 4.
Consider a simple feedback controller. A fuzzy set is defined for the input error variable
‘e’.
LP: large positive
SP: small positive
ZE: zero
SN: small negative
LN: large negative
If the error ranges from -1 to +1, with the analog- to- digital converter, the input variable’s
fuzzy set can be described very simply.
31
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
Based on this set and set of rules we can precisely control the system.
6. FEATURES
In fuzzy there is no need for a mathematical model unlike in classical sets. So it can
control nonlinear systems that difficult or impossible to model mathematically. Fuzzy
logic has the advantage that the solution to the problem can be cast in terms that human
operators can understand, so that their experience can be used in the design of the
controller. This makes it easier to mechanize tasks that are already successfully
performed by humans.
32
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
FUZZY RULES
Usually these rules are of the form :
If time of the day is ‘noon’ AND the season is ‘summer’ AND usage is
‘normal’, THEN switch on the devices in ‘group 1’.
1) SEASONS
Summer (SU)
Winter (WI)
Autumn (AU)
Spring (SP)
2) TIMINGS
Morning (MOR)
After Noon (AF)
Evening (EVE)
3) USAGE
Nil (NIL)
Normal (NOR)
High (HIG)
Extreme (EX)
4) DEVICES
Lights (D1)
Fans (D2)
Tv (D3)
Other (D4)
33
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
NIL DC DC DC 1 1 1 1
NOR DC DC DC 1 1 1 1
HIG AF SUM A 0 1 1 1
HIG AF WIN A 0 0 1 1
HIG AF AU/SP A 0 1 1 1
EX MOR SUM A 0 1 0 0
EX MOR WIN A 0 0 0 0
EX MOR AU/SP A 0 0 0 0
EX AF SUM A 0 1 0 0
EX AF WIN A 0 0 0 0
EX AF AU/SP A 0 0 0 0
EX EVE SUM A 1 1 0 0
EX EVE WIN A 1 0 1 0
EX EVE AU/SP A 1 0 1 0
EX NIG SUM A 1 1 0 0
EX NIG WIN A 1 0 0 0
EX NIG AU/SP A 1 0 0 0
34
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
CIRCUIT DIAGRAM
35
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
ENERGY REGULATION
The energy regulation is carried out with the help of Relays.Here we use 12 volt solid
state relay.The whole housing circuit is divided into four lines. Here in this project we
have divided the resources into four categories
• Lights
• Fan
• Tv
• Others
For the regulation of energy the PIC IC needs to read the energy from the main
power line.This is done with the help of energy metering IC ADE 7755.The ADE
IC takes the input from the current transformer and from the voltage
transformer.One input is thus current and other the voltage .These signals are then
processed and multiplied by a multiplier giving the power output.The power output
is in the form of pulses.The frequency of these pulses are propotional to the energy
consumed and are thus read by the microcontroller.The PIC IC measures the season
and time using a real time clock.
36
FUZZY ENERGY REGULATOR PROJECT REPORT 2010
CONCLUSION
The fuzzy logic Energy regulator controls the energy
consumption of house/factory by switching between various devices.The number of
factors on which the switching can be done is designed according to the need of the
user.Hence the device being flexible can satisfy the needs of the consumer effectively and
efficiently.This automated control thus reduces the strain of turning of each and every
light/fan for energy consumption.
37