Vous êtes sur la page 1sur 59

THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

CHAPTER I
GENERAL INTRODUCTION
I.1: Introduction
Our project work is carried out on the topic Power Transmission/Distribution Automation:
Case of Eneo Cameroon. Its aim at formulating and promoting a vision for the development of
Cameroons electricity networks looking towards 2035 and beyond. Efficient transmission and
distribution of electricity is a fundamental requirement for providing citizens and economies with
essential energy. In 2014 after KRIBI Thermal plant was made operational, Cameroonians were told
to forget about power interruption implying that there was enough power to meet up with the
increasing load demand. Few hours later, part of the population experienced light seizure. We thus
question: what explains power outages despite sufficient power in the Grid? This question yielded
us to this study with one main target: upgrading the transmission and distribution system to a self-
monitoring one in order to take to the minimum level the frequency of power outages. In other to
achieve this, our work is divided into three main steps: firstly that of understanding how the network
is organized; secondly apprehending the load sharing process and lastly, figuring out how the existing
network could be upgraded to an automatic one.

Starting with the literature review (Chapter II) which is devoted to the structure of the network,
we look forward to describing the Grid as a whole and to breaking it down into three layers
(interconnected, sharing-out and distribution substations) and two sub-networks (HTB and
HTA). The configuration of each post/substation along with its position and role within the Grid as
well as the function of its equipment are provided here. The following part (Chapter III) points out
some sets of technologies which could help in automating Transmission and Distribution. Subsequent
is the Methodology (Chapter IV) adopted to address the problem outlined. On the same impetus, this
chapter provides clear and concise explanation of the material and method used. The next chapter, in
addition to the outcomes from the gathered data under methodology as well as a small scale simulation
of a prototype, indicates how these recommendations could profit to Eneo first and to the
Cameroonian society as a whole. These are outlined under Results and Discussions which stands for
Chapter V. lastly, our research studies logically closes on a conclusion and a future scope of study
(Chapter VI).

1 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

I.2: Presentation of the company


AES-SONEL is a government owned company in charge of producing, transporting and
distributing electrical energy in Cameroon. It resulted from the privatization of SONEL on July 18th
2001. This privatization was worth 23 billion CFA. The company now has 3924 employees, with a
social capital worth 43 903 690 000 CFA. On September 12th, 2014, AES-SONEL became ENEO
CAMEROON S.A.

This internship was carried out within the DRTL (Division Rgionale Transport Littoral) and
the Grid Dispatch Departments. The DRTL is in charge of exploiting the Network that is, monitoring
and maintaining substations and line voltages. The Grid dispatch controls generating stations and
very high voltage power transmission so as to implement load sharing. The following is Eneos
organizational chart.

Fig1.1 : Organizational chart

2 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

CHAPTER II
LITERATURE REVIEW
This chapter will be constituted of four main sub-headlines. It opens on the General
description of Eneo Grid (I.1), continues with the HTB POST of LOGBABA (II.2) then, closes with
HTB-HTA and HTA Substations. Various control boards and electric circuit and other figures
presented under this chapter are drawn with AUTOCAD 2013.

II.1. General description of Eneo Grid

For electricity to reach the consumer, it must be produced, transported and distributed. The
electric network (the Grid) consists of thousands of kilometers of lines disposed in the form of a
spider web. Almost every substation is supplied by more than one line and, the flow of current on
those lines is frequently controlled. A modern electric power system consists of six components:

1) The power station;


2) A set of transformers to step up the generated power to very high voltages for transmission;
3) The transmission lines;
4) The substations at which the power is stepped down to the voltage on the distribution lines;
5) The distribution lines;
6) The transformers that lower the distribution voltage to the consumer's equipment level.

Eneo uses overhead and underground cabling systems for Transmission and Distribution.
Underground cables do support voltage levels up to 64KV. Now, Eneo using 90KV and 225KV on
transmission lines, is bound to opt for overhead cabling system for power Transmission. The
Distribution is conducted through overhead and underground cables for 15KV lines on the one hand
and on the other, via overhead cables for 230/380V voltage levels.
The RIS (Southern Interconnected Network) is divided into two sub-networks (figure 2.1)
namely: HTB (consisting of two regions which are the very high voltage, 225KV and the high voltage,
90KV) and HTA (divided constituted of the Medium Voltage, 15/30 KV and the Low Voltage, 380
V). The boundaries of the sub-networks are the input/output of transformers. The section ranging
from the output of transformers at Songloulou to the input of transformers at the sharing-out post
constitutes the HTB network. The very high voltage part travels from Songloulou to the input of
transformers at interconnected posts. Now, the high voltage side goes from the output of the
transformers at the interconnected substations to the input of those at the sharing-out substation.
Likewise, the output of 90KV/15KV or 90KV/30KV transformers gives way to the HTA network

3 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

which consists of medium and low voltages. The medium voltage region extends from the output of
these transformers to the input of 15KV/380V or 30KV/380V transformers on polls/H59 (distribution
cabins) whereas the 380V side represents the low voltage. Thus, based on the voltage level at the
input and output of transformers at substations, they can be referred to as HTB-HTB post (or simply
HTB post: interconnected substations), HTB-HTA (sharing-out substations) post and HTA post
(distribution substations or distribution cabins). Fig2.1 illustrates an electric power system:

Fig 2.1: Electric power system configuration

Based on the row material, The Grid comprises of three different types of power sources:
Hydroelectric, light/heavy fuel thermal plants (LFO and HFO) and Gas thermal plant (Kribi). Two
hydroelectric plants, Songloulou with a capacity of 384 MW and Edea with a capacity of 263 MW
meanwhile the Kribi Gas thermal plant injects 246MW. The Light Fuel Hermal Plants (LFO) are
Bamenda (20 MW), Bafoussam (12 MW), Bassa (3.5 MW), Mbalmayo (10 MW00), Ebolowa (10
MW), Ahala (60 MW) and Oyo 2(9.6 MW). Oyo 1, Dibamba, Logbaba and Limbe are the HFO
respectively producing 18 MW, 86 MW, 12 MW and 67/84 MW. In order to reduce losses (caused
by current) on Very high voltage and long lines, the reactive power is rather produced locally at
substations. The whole network is monitored by the GRID DISPATCH and its Conducting Center
(CCR). The Grid Dispatch permanently regulates the instantaneous and predictable consumption with
either the available production or the one it will call upon. In the accomplishment of its duty, it works
hand in hand with the CCRs in charge of monitoring the HTA network. Figure 2.2 below illustrates
the above mentioned.
4 |Written and presented by KEMTA Arthur
THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

Fig 2.2: Southern Interconnected Network

5 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

II.2. HTB post: Logbaba

As we earlier indicated, HTB refers to Very High and High Voltage levels and, that of
Logbaba will be apprehended here. We hereby look forward to portraying the Structure of the
substation and describing its control board illustrated in Fig 2.3.

2.2.1. Structure of the substation


The exploitation of the post is carried out via a synoptic board from the control room. This
board consists of symbols joined and disposed in a form of diagrams. The post consists of four (4)
bus bars (two for the 225 KV side and others for the 90KV side); two 225/90/15 KV transformers
(each being a set of 3 mono-phase transformers); a set of voltage transformers, line isolators, earth
isolators, current transformers, circuit breakers, Auxiliary Service Transformers (TSA), a Relay
Room (BR) and coupling isolators.
Divided into two, the 225KV side connects to SONGLOULOU, MANGOMBE and
BEKOKO meanwhile the 90 KV side supplies BASSA, KOUMASSI, NGODI-BAKOKO, and
MANGOMBE. A bus bar here is a set of three (3) bars with each phase landing on one. A line coming
from Songloulou for instance (225 KV) successively passes through the following equipment:
- A voltage transformer (instrument transformer) which provides information about the
incoming voltage even when isolated from the post.
- Line isolator that create a visual cut from the incoming line
- Current transformer (instrument transformer) providing information about the current (phase
and line currents magnitude)
- 225 KV Circuit breaker
- Bus bar (225 KV bus )
- Transformers circuit breaker
- Transformers (power transformer)
Likewise, transformer outputs subsequently go through the following:
- 90 KV Circuit breaker
- Bus bars
- Voltage transformers connected to bus bars
- Current transformers
NB: Different names are assigned to the isolator depending on its position and purpose
Earth isolator: the one close to ground symbol
Line isolator : the one located just after the circuit breaker
Coupling isolator : placed beside the bus bars
6 |Written and presented by KEMTA Arthur
THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

Fig 2.3: Control Board, Logbaba substation

7 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

The interface between the control board/Grid and the equipment is the BR (Btiment de
relayage). This consists of a set of relays and contactors taking instructions from the control
room/Grid and forwarding them to the intended receiver (equipment). They do not execute any action,
they route the information only.

2.2.2. Description of the control board

This description entails picturing the 225 KV, the 90 KV, the couplage bar, the capacitor
bank and lastly, the power transformers.

2.2.2.1. 225 KV line

It is protected by the Micom technology which watches over 80 or 120% of its length. A
protective set consists of distance protection (primary) controlling the line impedance and a
secondary protecting against surge currents. The following are the components of a 225 KV line.

225 KV circuit breaker (FA1 type)


Designed to protect the line against short term
surge currents and long term overvoltage, it consists of
a command box and three poles (Pho 2.1). A particular
gas, SF6 (Sulphur Hexafluoride) is used to adjust the gas
pressure in the poles (3) of the circuit breaker on a
regular basis. This is an insulator that suppresses the
electric arc on its opening.

Before closing the circuit breaker, the line Pho 2.1: 225KV Three phase Circuit
Breaker
voltage and frequency must be synchronized with that of the system.

A synchronization column is provided for this purpose. This column is activated (or turned on) first
with a key then, the same is inserted beside the circuit breaker and turned for synchronization.

A switch local-distance (in the circuit breakers box) prohibits the circuit breaker from being
commanded locally when positioned on distance (that is from the control room). Again, it cannot
be closed via TPL (Tourner, Pousser Luminer) if one of the following conditions is not put in place:

Synchronization key is unlocked


Insufficient hydraulic/gas pressure on any or all its phases
Line isolator is opened
There is a fault with bus bar selector/isolator

8 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

Closing procedure of a circuit breaker via TPL

Turn the CB (circuit breaker) 90 degrees to the right (discordance lamp on)
Press the CB, lamp goes off when the operation is successful
Opening procedure of a circuit breaker

Turn it to the left (lamp on)


Press it, lamp off if CB opened successfully
Putting the line into detention

Open the CB
Isolate the line from the bus bars
Open the line isolator
Close the earth isolator
Releasing the line

Close line isolator ( earth isolator opened)


Select appropriate bus bar using bus bar selector/isolator
Position the synchronization key (red bulb on)
Control on the synchronization system, the line and bus voltages
Close CB
Automatic opening of the circuit breaker

The main causes of such automatic openings are:

- Line fault that is, a short circuit has occurred


somewhere along the line. It could be Neutral Phase
(NP) if a phase cuts and touches the ground; Phase-
Phase being the contact between two phases or
Phase-Phase-Phase (PPP) amongst the three phases
caused by the rupture of the bridge (Pho 2.2) or by Pho 2.2: a bridge
something else.
- Poles discordance: that is to say poles did not close at the same time

In these two previous cases, the Circuit Breaker (CB) usually attempts to close back
automatically but if it does and still sees the fault, it will open back and block itself. Until
the problem is solved then it can be closed again.

9 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

- CB to isolate: when the gas pressure inside the poles drop to a certain level (1st stage), it
indicates in the control room via a printer and if nothing is done to remedy the situation, it
will continue dropping until it reaches the 2nd stage; point at which it just trips.

Coupling isolator

It can be driven either manually or electrically (from


the control room) and is used to either select the bar from
which the voltage is being taped or to completely isolate the
lines from the bars. The system is secured in such a way
that it cannot be electrically closed if:

The CB is closed
Its motor is not supplied
Pho 2.3: coupling isolator
The other bus bar selector/isolator is not opened
well positioned
From the control room, it is closed by firstly turning its TPL to the right (90 degrees) lamp on
and secondly, pressing. The lamp goes off indicating successful operation.

Pho 2.4: coupling isolator closed


Line and Earth isolators
A mechanical safety system prevents any wrong action at this level:

The Earth Isolator cannot be closed when that of the line is closed at the same time and vice versa.
This is because one might attempt to ground the line when it is live that is, line isolator closed. This
would ground the bus bar to which the line is connected damaging part of the installation. It is
opened/closed by first arming its corresponding Tourner Luminer (TL) in the control room and
then manually driving it outside.

Pho 2.5: Ground opened, lying horizontally

10 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

Pho 2.6: Line isolator, closed Pho 2.7: Line isolator, Fig. 2.8 : Ground closed
Opened
Button: local-telecommande
This is used to control the line with all its equipment either
locally (site) or from distance (Grid). The distance control is
achieved via a particular communication tool: a resonant circuit (Pho
2.9). Stations and substations are connected to one another and to the
grid in the Eneo network through it. It also serves as tele-signaling
(informs the grid of any fault or maneuver at substations), tele-
measure (the Grid sees charges on transformers and departures live)
and telephony. Pho 2.9: a resonant circuit

Fault clearing
Whenever a fault occurs somewhere along the line, the micom (protective tool) orders the
appropriate CB to trip and if dangerous, this cannot be closed back until the fault is cleared, and read
later run in order to reset micoms user interface.

Essai lampe
This is to test whether the lightening of the signaling screens are still up and running.

2.2.2.2. 90 KV LINE
The description of its components is analogous to that of a 225KV line; refer to section

A 90 KV line voltage tapped from the appropriate bus bar (using coupling isolators) passes
through its circuit breaker, combined measuring tool (including both current and voltage
transformers) line and earth isolator before travelling to its destination. Current and voltage
transformers of the 225KV side are separated from each other.

11 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

Fig 2.4: 90 KV line departure

2.2.2.3. COUPLAGE
It is a mechanism used to either operate the transformers individually or in parallel by
connecting their respective bus bars. Parallel Coupling is achieved under certain conditions regarding
both transformers which must be identical that is:

- Same phase sequence


- Same voltage magnitude. This is achieved by manually blocking their respective tap changers
to identical positions
- Same phase shift between corresponding current and voltage

12 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

2.2.2.4. CAPACITOR BANK


Reactive power production at the level of
generating stations is negligible as compared to
active power. In order to compensate this,
condensers are mounted at various substations
(Pho.2.10). This configuration presents some key
advantages: it reduces the heat on long lines and
increases their lifetime. The HTB reactive
compensation of LOGBABA Pho 2.10: a bank of capacitors (a group)

comprises of a hundred and forty four (144) batteries divided into two groups of 72 elements; each
group providing a 25 MVAR to a bus bar and mounted in a star configuration. A set of 24 elements
(a layer) of a group takes care of one phase and a common neutral point suppresses any fault from
either a group or a single element.

The vital components of Capacitor Banks are the following: Coupling isolator, Circuit Breaker,
Line and Earth isolators, Essai lampe.
Circuit Breaker
A switch local-distance prohibits the circuit breaker from being commanded locally when
positioned on distance (that is from the control room). It cannot be closed via TPL if one of the
following situations exists:

Insufficient GAS pressure on any or all its phases


Opened line isolator
Faulty bus bar selector/isolator
Less than 10 Min between open/close commands (discharge time)
For the Closing and opening procedure, of its circuit breaker refer to Section 2.2.2.1 (under
225KV circuit breaker). Likewise, refer to the same section as far as a clear understanding of the
Coupling isolator, the Circuit Breaker, the Line and Earth isolators and the Essai lampe is
concerned.

2.2.2.5. POWER TRANSFORMERS


This part of the work will be sub-divided into two points: a brief description of power
transformers and a view of transformers protection.

2.2.2.5.1. Brief description of power transformers


The post can provide 210 MVA via two 225/90/15 KV power transformers, each being a
coupling of three (3) single phase transformers of 35 MVA .Manufacturers do not provide standalone
13 |Written and presented by KEMTA Arthur
THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

three phase transformers with input voltage above 90KV. Every single phase power transformer
consist of two faces, 225KV side and the 90/15 KV side. The cooling systems used are ODAF
(Directed Oil, Forced Air) and ONAN (Oil Natural, Air Natural) for 225/90 KV and 15/380(120) KV
transformers respectively.

The 15 KV output of 3 monophase transformers (1 power transformer of 105MVA) are delta


connected and tied to the biberon/TSA. These are then used to supply both the cooling system of
the transformers and
the whole station
itself. There are thus
two TSA but only one
is functioning at any
given time; this
mechanism (A) is
ensured by a
commutator which
toggles between both, Fig 2.5: One power transformer configuration;
either after a given
period or when the other stops functioning. A second mechanism (B) drives (A) and a GES (Groupe
Electrogne de Secours), if both TSAs stop providing energy for any reason, the GES takes over and
lastly, if the whole post breaks down, a feeder (C) from Bassa (15KV underground cable) will be
called upon to restore the post as illustrated bellow. Bassa would then draw its load from Bekoko
through the Deido and Bonaberi posts.

Fig 2.6: Logbaba supply system

14 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

2.2.2.5.2. Transformers protection


Protective tools watch the internal temperature of a transformer (Thermostat); protect them
from surge currents usually due to thunderbolt (Surge arrestor); signal the presence of unwanted gas
(or air) in the oil into which windings are (Buchholz); prevent the cage from conducting due to a
leakage, induction or thunderbolt by grounding (Mascuve) in other words, mascuve protection
triggers an alarm when the transformer is attacked and opens the CB of the transformer.
The Thermostat and Buchholz signal an alarm at a stage and if nothing is done to reduce the
transformers temperature or free the unwanted gas, they will go crescendo and once they reach the
second stage, they order the CB to trip.

II.3. HTB-HTA and HTA substations


In addition to the Bassa and Makepe substation, H61 and H59 distribution cabins will be studied in
this section of our research study.
2.3.1. HTB-HTA: BASSA SUBSTATION
2.3.1.1. Description
The BASSA post has the same functioning principle as that of the HTB but distinguishes itself
with the voltage level it deals with (HTB or high voltage 90KV and HTA or medium voltage 15KV)
and through the type of transformer being used that is, each being a 3 phase standalone.
The chief of the post opens and closes departures accordingly during load sharing,
maintenance work and interventions under the supervision of the CCR (Network Conducting Centre)
.They take records of each departures load every 2H in order to anticipate and prevent a cellule from
being destroyed by overloaded ( 8MW being the limit).
At BASSA, two 90KV line voltages coming from LOGBABA land on a unique bus bar and
are stepped down via three (3) three phase 90KV / 15KV power transformers and made available to
distribution cabins through cellules connected to the three (3) 15KV bus bars (each supplied by one
transformer) . The control room consists of three (3) rams with each consisting of a number of cellules
connected to one bus bar (two tubes); see Fig 2.7.

The following picture shows the 15KV underground cables taped from the transformers
output and travelling to 15KV bus bars. The horiz ontal metallic tubes are the phases.

15 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

Pho 2.11: 15KV side of a


2.3.1.2. 15KV bar configuration
One bus bar is used to form a ram (Pho 2.14) which consists of five (5) different types of cellules:
- TSA, TV, DEPARTURE, TRANSFORMERS ARRIVAL and THERMAL PLANT.

The TSA/BPN are 15KV / 380V transformers supplying the whole post; the transformers cooling
system (auxiliary service transformer) and, provide an artificial ground to secure the 15KV bus bars
(Delta connected) from faulty
currents occurring on
undergound cables (Bobine
de point neuter) by opening
its CB and, the Arrive
Transfo (AT), being
programmed to trip whenever
its TSA/BPN is out, will
follow; thus saving the whole
RAM from danger. They are
three of them and the load is Pho 2.12: a Ram
drawn from only one at any
given time. TSA1 and TSA2 are automatically driven by a commutator; TSA2 manually. In case of
a total blackout, a GES (Groupe lectrogne de Secours) is present.
The Voltage Transformer (TV) collects information about the voltage from the bus bar and
sends to the sepams of departures and TSA which then provides all necessary measurement via their
respective sepams after, collecting adequate information on the current from the bar through their
Current Transformer (TC)
The DEPARTURES supply various H61 and companies via underground cables. The maximum
authorized load from a departure is 8MW although they can provide more (12MW in makepe); this
is to protect the cables from burning due to overheat.
The ARRIVEE TRANSFO is the bridge between the transformers output and various
cellules. It supplies the bus bar.

16 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

The THERMAL PLANT is an alternative energy source injecting power on bus bars, thereby
reducing the transformers load. Usually off, they come into play only upon a request from the GRID
Dispatch.

A sepam incorporated in cellules does also play a protective role. Upon the gravity of the fault
occurred on a cable from a cellule, it will either trip the cellules CB or that of the AT of the RAM.

NB: As interconnected and sharing-out posts are connected by 225KV and 90KV lines respectively,
so is the 15 KV network (medium voltage) from substations to H61 (distribution cabins). It is for
instance the case of two cellules BK1 (Bassa-Koumassi 1) and BK2. They can draw their load either
from BASSA or KOUMASSI substations so, in H61, a 15KV arrival out of service (departure from
posts) can be replaced by another one from the same or different post. 15KV lines from cellules often
travel to the most distant H61/H59.

2.3.2. HTB-HTA: MAKEPE SUBSTATION


It consists of a more recent technology as compared to that of BASSA: the departures CBs
can be controlled from the control panel, the whole post can be monitored through a computer via an
interface called Centre de Conduite Numris (CCN). In addition, the voltage transformer and the
transformers arrival are combined into one cellule. The configuration is on Fig 2.8.

2.3.3. HTA: H61/H59 distribution substations


As stated under section 2.3.1.2, 15KV lines from cellules often travel to the most distant
H61/H59. Both do play the same role which is, stepping the 15KV voltage further down for customer
use. H59 are lodged in small cabins whereas H61 are hanged on polls. On the left corner of Pho 2.15:
H59 15KV cables entering the cabin. Pho2.16 shows the tapping from the 15KV line to the
transformer for distribution purpose.

Pho 2.13: H59 Pho 2.14: H61

17 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

Fig 2.7: Bassa substation; control board

18 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

Fig 2.8: Makepe substation; site configuration


19 |Written and presented by KEMTA Arthur
THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

CHAPTER III
IMPROVEMENT TO THE EXISTING SYSTEM

Substations are standalone, they do not communicate with each other. This places the Man as
the Bridge between them. What if substation are given sufficient intelligence so as to change the
status of workers from masters to supervisors? By automating transmission and distribution that is,
load sharing. In order to achieve this, every station and substation to be able to communicate with
and listen to others and to the control center on the one hand, and on the other; capable of taking
decisions.
ABB Technology, (ABB, 2014) provides dedicated Intelligent Electronic Devices for the
protection, control, measurement and supervision of all power equipment or actuators such as
reclosers, breakers (no, switchgear, capacitor banks and tap-changing transformers required in
implementing the suggestion.

Technology transforming transmission-distribution


Technologies of an Automatic Grid include: Programmable logic controllers, sensing and
measurement technologies, advanced components, advanced control methods, improved interfaces
and decision support, (Texas Tech University, 2012).

 Programmable Logic Controllers (PLCs) enable electronic components to get information and
control every part in real time on the one hand and, on the other, make every part of the
network both listen and talk (two way communication).
 Sensing and measurement technologies would help to provide faster and more accurate
response information of each important part of the Grid, such as remote monitoring, real time
thermal rating, electromagnetic signature analysis and real-time pricing. Advanced
components would be useful in applying the latest research in superconductivity, storage,
power electronics and diagnostics. They include: first and second generation superconducting
wire, high temperature superconducting cable, distributed energy generation and storage
devices and lastly, composite conductors.
 Advanced control methods, if used, would very much assist in monitoring essential
components, enabling therefore rapid diagnosis and precise solutions appropriate to any event.
 With Improved Interfaces and decision support, information systems would reduce the
complexity of automated network to make both the operator and the manager use it more
efficiently so as to amplify human decision-making.

20 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

CHAPTER IV
METHODOLOGY
Methodology as far as this work is concerned refers to the various steps taken towards
constructing and simulating a prototype of an automated Network (Load Sharing). The chapter thus
comprises three major axes: data gathering (IV.1), Program Writing (IV.2) and simulation (IV.3).

IV.1. Data gathering


In order to illustrate our recommendation (upgrading to a self-monitoring Grid), the following
data table providing the forecast and consumed power of a normal day was collected, plotted with
Matlab (v R2011a) and exploited.
Table 4.1: Forecast and real power consumption

Time(H) 1 2 3 4 5 6 7 8 9 10 11
Prevision 95 93 94 100 114.5 125 146 175 190 205 161
(estimation)
Demand 93.5 92 94.5 96.7 119 130 154.3 186.2 215 208.6 158.7
(real power)

12 13 14 15 16 17 18 19 20 21 22 23 24

180 211.5 220 242 280 267.5 325 256 265 204.5 190 152.3 130

175 215 226.5 248.7 278 272 326 250 250 195 200 148 128

The decision of which generator to turn on at a given moment is made based on economical bases
because that which causes less expenses (row material) is prioritized. From such angle, priority
follows the sequence: Hydroelectric plants-Gas TP-HFO TP-LFO TP. Let the table below be that of
the power sources in a 343 MW Network
Table 4.2: Grids generators capacity

Label A B C D E F G H I J K L M N O P
Capacity 50 60 45 40 25 30 20 15 12 10 8 14 15 10 3 5
(MW)
Hydroelectric (1) Gas TP (2) HFO TP (3) LFO TP (4)

The main component of our simulation is the load generator. Loads are assigned LEDs; each
LED refers to a town/quarter/company/university. The Following table provides the various loads
21 |Written and presented by KEMTA Arthur
THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

with associated LED labels:


Table 4.3: set of loads
.
Label A1 A2 A3 B1 B2 B3 C1 C2 C3 D1 D2 D3 E1 E2 E3
Load 46 47 1 2 23 11 24 32 29 17 40 11 22 30 54
(MW)

IV.2. Program Writing


The software used in writing the program is MPLAB IDE, in assembly language. It is a
software program that runs on a personal computer to develop applications for Microchip
microcontrollers. It is called an Integrated Development Environment or IDE, because it provides a
single integrated environment to develop code for embedded microcontrollers. It also includes a
compiler that converts source code to machine instructions with the extension .HEX which is then
loaded in the microcontrollers from proteus for simulation purpose. The source code is available in
appendices.

IV.3. Simulation
In order to illustrate our ameliorative perspectives, we used a set of electronic components:
numbered microcontrollers (PIC 16F877 and PIC 16F84A families. MCs), 7seg display, LEDs,
relays, NPN transistors, resistors, switches, diodes and motors the build up a circuit using Proteus
8.0.

 Roles of the various components of the circuit (Fig: 5.4)


Briefly, MCs are programmable ICs that are meant for executing dedicated tasks within an
application upon request of a microprocessor. Usually referred to as small computer, MCs in
addition to input/output pins have both ROM and RAM memory. Their processing speed is of that
assigned to them. So a MC provided with a 4MHZ will run at 1MHZ.

Fig 4.1: architecture of a MC

22 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

- IC1: Being in a virtual world, the load needs to be created/generated; it is the duty of this
MC.
- IC3: In charge of printing out via a set of 3 7seg displays, the instantaneous load demand.
- IC11: Illustrates energy supply by lighting up the LED or set of LED corresponding to the
demand.
- IC2: Compares the demand and generated power at every instant t and decide on whether
to momentarily cut off part of the load, isolate/turn on a generator.
- IC4: Drives all the motors through their respective MCs.
- IC5: Monitors the hydroelectric plant.
- IC6: Controls the Gas thermal plant.
- IC7: Commands the HFO thermal plant.
- IC8: Takes care of the LFO thermal plants.
- IC9: Measures the instantaneous generated power, drives IC 10 to output the corresponding
value which it also make available to the comparator.
- IC10: Outputs the instantaneous generated power.
- IC12: Provides the time with load variation.

The motors operating at 12Vcannot be turned on directly with the output of an IC. These
currents are too low to trigger them. Now, transistors which need such a low base current to drive
sufficient one to close a relay is thus welcome for such a situation so; to every motor is assigned a
transistor (receiving the signal dedicated to that motor) and a relay. The relay closes contact to 15V
when the coil is magnetized that is, on the passage of the collector current. The diodes placed across
the relay are usually termed as freewheeling diode. They protect the transistors from destruction
once the base current is no longer, the coil stores energy on passage of collector current and once
Ic=0, it discharges through the diodes, not the transistor.

23 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

CHAPTER V
RESULTS AND DISCUSSION
This chapter is divided in two major parts. The first (V.1) provides description of the work
announced in the previous chapter to realize the simulation. The second (V.2) identifies some losses
that could be attenuated or in the best of cases, avoided and points out the results that would be
obtained if the recommendation of automating transmission and distribution is implemented.

V.1. Results

- Data organization
At any given time t, the couple of generators being on are with respect to power demand. The
following table provides the combination of tables 4.1, 4.2 and 4.3. Red zones indicate power outage
(difference > 5MW).
Table 5.1: combination of load and generation

Generation Demand
Time(H) Power Combination Load Combination
(MW) (MW)
1 95 AC 94 A1A2A3
2 92 BGI 93 A1A2
3 95 AC 94 A1A2A3
4 100 BD 96 A1A2A3B1
5 115 BDH 119 A1A2A3B1B2
6 125 ACF 130 A1A2A3B1B2B3
7 145 BCD 154 A1A2A3B1B2B3C1
8 175 BCDF 186 A1A2A3B1B2B3C1C2
9 190 ABDEH 215 A1A2A3B1B2B3C1C2C3
10 205 ABDFHJ 208 A1A2A3B1B2B3C1C2C3
11 162 ABDI 158 A1B2B3C1C2C3
12 180 ABCE 175 A1B2B3C1C2C3D1
13 212 ABCEFI 215 A1B2B3C1C2C3D1D2
14 220 ABCDE 226 A1B2B3C1C2C3D1D2D3
15 242 ABCDGHI 248 A1B2B3C1C2C3D1D2D3E1
16 283 12K 278 A1B2B3C1C2C3D1D2D3E1E2
17 268 1EFG 272 A1B2B3C1C2C3D1D2D3E1E2
18 324 123M 326 A1B2B3C1C2C3D1D2D3E1E2E3
19 256 1FGH 250 B2B3C1C2C3D1D2D3E1E3
20 265 1FGHP 250 B2B3C1C2C3D1D2D3E1E3
21 205 ABDFHJ 195 B3C1C3D1D2D3E1E3
22 190 ABDEH 200 B3C1C3D1D2D3E1E3
23 152 ABFI 147 B3D1D2D3E1E3
24 130 BDF 125 B3D1D2D3E3

24 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

Based on this combination and table 4.1, we used Matlab (v R2011a) to plot the forecast and
real power consumption in order to build a prototype from its analysis.

Fig 5.1: Estimated and real power (consumption) curves

A difference of about 5/6 MW between load demand and generated power is negligible and
does not represent a major threat to the grid. However, a slight increase is first of all observed and if
continuity is detected (which would result in a considerable change of the frequency), power outage
would be carried out to maintain the integrity of the network and avoid possible black-outs.
Maintaining the stability between demand and generated power is the key to healthy and money
producing Grid.
From Fig 5.1, it is observed that:
D>G : the power demand being greater than the production within this interval, some of the
load will be dropped to preserve the Grid and later on based on the gap, appropriate generators will
be called upon while gradually retaking the left-over loads.
D=G: depending on the peak point (magnitude) usually, power outage is performed because
being particularly stressed within that time interval, an imbalance can be fatal. In other words, this
could rapidly cause a black-out.
D<G: in respect to the gap, appropriate generators would be switched off but this might result
in the isolation of some of the loads. If the gap is 15 MW for instance and the analysis suggests to

25 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

cancel out a 20 MW generator instead, 5 MW will be the isolated load.

- Program writing and simulation

The source code is made available under appendix C. The following flowchart (Fig 4.2)
globally provides an explanation to the program (D=load demand; G=generated power):

Fig 5.2: flowchart of the program

26 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

The following GRAPHCET gives the various steps of the program. The time t is in hour (so
t<=6 is actually t<=6am that is, from 1am to 6am. t<=19 refers to t<=7pm).
Legend: Outputs
- M: couple of motors being on within the interval set by the loop
- t: time display
- LD: load display within the appropriate loop
- DG: display generated power
- LG: load generator within the corresponding loop
- LI: load illustrator within the corresponding loop
- LD, LG, DG and M do have the same function but indicate reduction of load from 7 to
9am
- Likewise, LD, LG, DG and M stand for reduction of generation followed by the load
from 8 pm to 10pm.

Legend: Inputs (transitions)


- Start
- C: signal from the comparator requesting either isolation of some loads or additional
generators
- g, gand g: signals requesting the value of the actual generation to be printed out
- a, b and d: set of signals driving the actuators

27 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

Fig 5.3: Graphcet of the program


28 |Written and presented by KEMTA Arthur
THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

Fig 5.4: Simulation

29 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

V.2. Further Discussions

4.2.1 Estimations of the losses


For confidential reasons, the Grid Dispatch did not disclose records of power outages within
a week (be it past of forecast). Yet, we were told a total of 200MW was cut off during 2h the day
before.
Taxes put aside, 1KWH costs 74 CFA. On that Tuesday, Eneo lost 29.600.000 CFA. Now,
assuming they do perform this operation once/week, we shall have as losses:
- 118.400.000 CFA/Month and,
- 1.420.800.000 CFA/Year.
In 10 years for example, the losses added up (about 14.208.000.000 FCFA) can be enough to
carry out the greater part of the innovations and make more money; the investment is worth it. For
instance, the PIC16F84 costs 2500 CFA. The losses within a year can afford 568320 of PIC16F84.
Due to communication problems that might occur, Bamenda Puissance Thermique
dUrgence (PTU) is often requested to be ready to inject full power in the Grid 30Min earlier. HFOs
have the particularity that they start with light fuel (Gasoil) and once they start generating full power
(usually after 15Min), the heavy fuel is injected. Towards the end of the process, light fuel is re-
injected to clean up the pipes. This means that they would turn ON their plant 45Min earlier instead.
During the first 15Min, light fuel will be used and during the next 30Min, it will instead be the heavy
fuel.
Given that this station consumes about 1200 liters of gasoil in 1h, 15Min will correspond to
300 liters that is, 180.000 CFA as 1 liter of gasoil costs 600 CFA.
Approximately between 800 to 1000 Kg of heavy fuel are required every 1h. With 900 Kg as
average consumption, 450 Kg is thus cut off within 30Min. A Kg is worth 300 CFA meaning that
135.000 CFA are spent within those 30Min.
The total losses make up 315.000 CFA each time Bamenda is called upon. If needed twice a
week, 630.000 CFA will be lost and,
- 2.520.000 CFA/Month,
- 30.240.000 CFA a year.
With an automated Power Transmission/Distribution system assuming these power outages
cannot be avoided (though difficult) a considerable amount of money would be saved whenever it
is to be turned on; the same with Bafoussam. Furthermore, a significant amount of money spent in
communicating throughout a day within various departments in charge of monitoring the Grid would
be saved as well.
30 |Written and presented by KEMTA Arthur
THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

4.2.2 Advantages of automatic Grids


As we know, the total load connected within the power Grid can change remarkably which
means the overall load is not a stable, slow varying, average power consumption. Usually, the
response time of a rapid increase in power consumption should be longer than the start-up time of a
large generator (7, 8, 9 am and 10pm of our simulation) and some spare generators are put on a
dissipative standby mode (open loaded). An automated Grid may restrict all individual devices or
another larger customer (be it ALUCAM, DANGOTE, CDC, COMETAL etc) in order to reduce
the load temporarily (to allow time to start up a larger generator) or continuously (in the case of
limited resources). With mathematical predictive algorithms help, it is possible to figure out how
many standby generators need to be used to reach a certain failure rate.

Further advantages

Improved resilience to disruption and self-healing capability from power disturbance events
will be advantageous in a number of ways, (DOE, 2010):

 Operators or managers could use the real-time information which comes from embedded
sensors and automated controls to anticipate, detect, and respond to system problems to
automatically avoid or mitigate power outages, black-outs and power quality problems.

Black-outs often are the result of a series of events. If for instance the 90KV line Bekoko -
Nkongsamba suddenly breaks down, a significant instability could cause a Black-out within the Grid
because Limbe and Dibamba HFO isolate themselves from the Grid just 2 or 3s after such imbalance
(due to drop in frequency); followed by other generating stations. Decision speeds increasingly would
become too fast for humans to manage so as to stop the cascading failures yet, sentinels (or PLCs)
monitoring the system would quickly identify the problems and, based on pre-written algorithms,
would have performed millions of calculus within short time interval so the fault could be contained.
In order to improve on its response, the network could be divided into small islands.

 Isolation - If failures were to occur, the whole network would break into isolated islands,
each of which must fend for itself. Each island would reorganize its power plants and
transmission flows the best it could. Although this might cause voltage fluctuations or even
small outages, it would prevent the cascades that cause major blackouts. As line crews repair
the failures, human controllers would prepare each island to smoothly rejoin the larger grid.
The controllers and their computers would function as a distributed network, communicating
via microwaves, optical fibers or the power lines themselves. As soon as power flows are
restored, the system would again start to self-optimize.
31 |Written and presented by KEMTA Arthur
THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

 Smart Grid would likely have a control system that could analyze its performance using
distributed, autonomous reinforcement learning controllers that have learned successful
strategies to govern the behavior of the grid in the face of an ever changing environment such
as equipment failures. Such a system might be used to control electronic switches that are tied
to multiple substations.

Social benefits

By far, the biggest winner will be society as a whole. The smart grid will be expected to
provide benefits to the society in the following ways, (DOE, 2010):
1. Reliability by reducing the cost of interruptions and power quality disturbances and
reducing the probability and consequences of widespread blackouts.
2. Efficiency by reducing the cost to produce, deliver, and consume electricity
3. Economics by keeping downward price on electricity, creating new jobs within Eneo and
via new investments thus, stimulating the Cameroon growth domestic product (GDP).

32 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

CHAPTER VI
CONCLUSION AND FUTURE SCOPE OF STUDY

While current network presently fulfil its function, it will not be sufficient to meet future
challenges unless strategies for making this vision reality are adopted. There are two reasons to
automate Transmission and Distribution of electricity. First, todays Grid needs to be upgraded
because it is aging, inadequate and outdated in many aspects: investment is needed to improve on its
material condition, ensure an adequate capacity and, make it fit to the contemporary challenges of
power supply. Status quo is not an option. Secondly, the benefits of the smart Grid are substantial as
both the company and the society do benefit. A sophisticated, intelligent and more reliable network
supplying a constant, stable and good power quality to consumers when they desire or need it is
essential to our country in its journey toward an emerging and mostly industrialized state by 2035.
The causes of power outage and blackout with respect to the generating stations if addressed with this
approach, would incontestably lead to a more robust power system thus; opens the door to our future
scope of study.

33 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

REFERENCES

1- Texas Tech University, 2012, Introduction to smart grid: Department of Electrical & Computer
Engineering.
2- ABB, 2014 Distribution Grid automation, raising the bar in Grid efficiency and reliability, (p.8).
3- Electric Grid control: algorithms and open problems. UNM school of Engineering

4- http://fr.wikipedia.org/wiki/Smart_grid
5- http://en.wikipedia.org/wiki/Electric_power_transmission
6- AcientificAmerican.com
7- www.energybizmag.com

34 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

APPENDICES
Appendix A:
A: Makepe control board and ICs Pin assignment

Fig A1: Makepe control board

 Pin assignment of microcontrollers

35 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

Table A-1: IC 1, 3, 9 and 10 pin configuration


GENERATION DEMAND
Time(H) Power IC 9 IC 10 Load IC 1 IC 3
(MW) 9-10 OUT 9-10 IN (MW) 1-3 OUT 1-3 IN

1 95 B0,B1 A0,A1 94 B0,B1 A0,A1


2 92 B1 A1 93 B1 A1
3 95 B2 A2 94 B2 A2
4 100 B3 A3 96 B3 A3
5 115 B4 A4 119 B4 A4
6 125 B5 A5 130 B5 A5
7 145 B0,B1 A0,A1 154 B0,B1 A0,A1
8 175 B0,B2 A0,A2 186 B0,B2 A0,A2
9 190 B0,B3 A0,A3 215 B0,B3 A0,A3
10 205 B0,B4 A0,A4 208 B0,B4 A0,A4
11 162 B0,B5 A0,A5 158 B0,B5 A0,A5
12 180 B1,B2 A1,A2 175 B1,B2 A1,A2
13 212 B1,B3 A1,A3 215 B1,B3 A1,A3
14 220 B1,B4 A1,A4 226 B1,B4 A1,A4
15 242 B1,B5 A1,A5 248 B1,B5 A1,A5
16 283 B2,B3 A2,A3 278 B2,B3 A2,A3
17 268 B2,B4 A2,A4 272 B2,B4 A2,A4
18 324 B2,B5 A2,A5 326 B2,B5 A2,A5
19 256 B3,B4 A3,A4 250 B3,B4 A3,A4
20 265 B3,B5 A3,A5 250 B3,B5 A3,A5
21 205 B4,B5 A4,A5 195 B4,B5 A4,A5
22 190 B0,B1,B2 A0,A1,A2 200 B0,B1,B2 A0,A1,A2
23 152 B1,B2,B3 A1,A2,A3 147 B1,B2,B3 A1,A2,A3
24 130 B2,B3,B4 A2,A3,A4 125 B2,B3,B4 A2,A3,A4

Binary
Dec Code g f e d c b a
0 abcdef 0 0 1 1 1 1 1 1
1 bc 0 0 0 0 0 1 1 0
2 abdeg 0 1 0 1 1 0 1 1
3 abcdg 0 1 0 0 1 1 1 1
4 bcfg 0 1 1 0 0 1 1 0
5 acdfg 0 1 1 0 1 1 0 1
6 acdefg 0 1 1 1 1 1 0 1
7 Abc 0 0 0 0 0 1 1 1
8 abcdefg 0 1 1 1 1 1 1 1
Fig A-2: 7segment display configuration 9 abcdfg 0 1 1 0 1 1 1 1

36 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

Table A-2: IC 1, 2 and 9 pin configuration

Time(H) Power IC 9 IC 2 Load IC 1 IC 2 IC 2 IC 1 IC 2


G 9-2 OUT 9-2 IN D 1-2 OUT 1-2 IN 2-1 OUT 2-1 IN 2-4 OUT
(MW) (MW)
1 95 A0,A1 94 D0,D1 A0,A1 C0,C1 B0,B1
2 92 A1 D0,D1 93 D1 A1 C2 A0,A1 B1
3 95 A2 D1 94 D2 A2 C3 A2 B2
4 100 A3 D2 96 D3 A3 C4 A3 B3
5 115 A4 D3 119 D4 A4 C5 A4 B4
6 125 A5 D4 130 D5 A5 C0,C2 A5 B5
7 145 A1,A0 D5 154 D1,D0 A1,A0 C3 A0,A2 B0,B1
8 175 A2 D1,D0 186 D2 A2 C4 A3 B0,B2
9 190 A3 D2 215 D3 A3 C5 A4 B0,B3
10 205 A4 D3 208 D4 A4 C0,C3 A5 B0,B4
11 162 A5 D4 158 D5 A5 C4 A0,A3 B0,B5
12 180 A1,A2 D5 175 D1,D2 A1,A2 C5 A4 B1,B2
13 212 A3 D1,D2 215 D3 A3 C1,C2 A5 B1,B3
14 220 A4 D3 226 D4 A4 C0 A1,A2 B1,B4
15 242 A5 D4 248 D5 A5 C1 A0 B1,B5
16 283 A1,A3 D5 278 D1,D3 A1,A3 C2 A1 B2,B3
17 268 A4 D1,D3 272 D4 A4 C3 A2 B2,B4
18 324 A5 D4 326 D5 A5 C4 A3 B2,B5
19 256 A1,A4 D5 250 D1,D4 A1,A4 C5 A4 B3,B4
20 265 A5 D1,D4 250 D5 A5 C1,C3 A5 B3,B5
21 205 A2,A3 D5 195 D2,D3 A2,A3 C2 A1,A3 B4,B5
22 190 A4 D2,D3 200 D4 A4 C3 A2 B0,B1,B2
23 152 A5 D4 147 D5 A5 C4 A3 B1,B2,B3
24 130 A1 D5 125 D1 A1 C5 A4 B2,B3,B4

37 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

Table A-3: IC 4,5,6,7 and 8 pin configuration


Time( Pow IC 4 IC 5 IC 6 IC 7 IC 8
H) er 4-5 4-6 4-7 4-8
G IN OUT IN OUT IN OU IN OU I O
(M T T N U
W) T
1 95 A0,A1 B0,B2 A0,A2 B0,B2
2 92 A1 B1,B6,C0 A1 B1 A2 B2 A B0
0
3 95 A2 B0,B2 A0,A2 B0,B2
4 100 A3 B1,B2 A1,A3 B1,B3
5 115 A4 B1,B3,B7 A1,A3 B1,B3 A3 B3
6 125 A5 B0,B2,B5 A0,A2 B0,B2 A1 B1
7 145 A0,A1 B1-B3 A1-A3 B1-B3
8 175 A0,A2 B1-B3,B5 A1-A3 B1-B3 A1 B1
9 190 A0,A3 B0,B1,B3,B4,B A0,A1, B0,B1, A0,A3 B0,
7 A3 B3 B3
10 205 A0,A4 B0,B1,B3,B5,B A0,A1, B0,B1, A1,A3 B1, A B1
7,C1 A3 B3 B3 1
11 162 A0,A5 B0,B1,B3,C0 A0,A1, B0,B1, A B0
A3 B3 0
12 180 A1,A2 B0-B2,B4 A0-A2 B0-B2 A0 B0
13 212 A1,A3 B0- A0-A2 B0-B2 A0,A1 B0, A B0
B2,B4,B5C0 B1 0
14 220 A1,A4 B0-B4 A0-A3 B0-B3 A0 B0
15 242 A1,A5 B0- A0-A3 B0-B3 A2,A3 B2, A B0
B3,B6,B7,C0 B3 0
16 283 A2,A3 B0-B7,C2 A0-A3 B0-B3 A0- A3 B0- A B2
B3 2
17 268 A2,A4 B0-B6 A0-A3 B0-B3 A0-A2 B0-
B2
18 324 A2,A5 B0-B7,C0-C4 A0-A3 B0-B3 A0-A3 B0- A B0- A B
B3 0- B3 0 0
A
3
19 256 A3,A4 B0-B3,B5-B7 A0-A3 B0-B3 A1,A2, B1-
A3 B3
20 265 A3,A5 B0-B3,B5- A0-A3 B0-B3 A0-A3 B0- A B
B7,C7 B3 3 3
21 205 A4,A5 B0,B1,B3,B5,B A0,A1, B0,B1, A1,A3 B1, A B1
7,C2 A3 B3 B3 1
22 190 A0,A1, B0,B1,B3,B4,B A0,A1, B0,B1, A0,A3 B0,
A2 7 A3 B3 B3
23 152 A1,A2, B0,B1,B5,C0 A0,A1 B0,B1 A1 B1 A B0
A3 0
24 130 A2,A3, B0,B1,B5 A1,A3 B1,B3 A1 B1
A4

38 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

Table A-4: IC 1 and 11 pin configuration


Time(H) Load IC 1 IC 11
D 1-11 OUT 1-11
(MW) IN OUT: LOAD
1 94 C0,C1 B0,B1 C0-C2
2 93 C0,C2 B0,B2 C0,C1
3 94 C0,C3 B0,B3 C0-C2
4 96 C0,C4 B0,B4 C0-C3
5 119 C0,C5 B0,B5 C0-C4
6 130 C0,C6 B0,B6 C0-C5
7 154 C0,C7 B0,B7 C0-C6
8 186 C1,C2 B1,B2 C0-C7
9 215 C1,C3 B1,B3 C0-C7,D0
10 208 C1,C4 B1,B4 C0-C7,D0
11 158 C1,C5 B1,B5 C0,C4-C7,D0
12 175 C1,C6 B1,B6 C0,C4-C7,D0,D1
13 215 C1,C7 B1,B7 C0,C4-C7,D0-D2
14 226 C2,C3 B2,B3 C0,C4-C7,D0-D3
15 248 C2,C4 B2,B4 C0,C4-C7,D0-D4
16 278 C2,C5 B2,B5 C0,C4-C7,D0-D5
17 272 C2,C6 B2,B6 C0,C4-C7,D0-D5
18 326 C2,C7 B2,B7 C0,C4-C7,D0-D6
19 250 C3,C4 B3,B4 C4-C7,D0-D4,D6
20 250 C3,C5 B3,B5 C4-C7,D0-D4,D6
21 195 C3,C6 B3,B6 C5,C6,D0-D4,D6
22 200 C3,C7 B3,B7 C5,C6,D0-D4,D6
23 147 C4,C5 B4,B5 C5,D1-D3,D4,D6
24 125 C4,C6 B4,B6 C5,D1-D3,D6

AppendixB: MATLAB code


Matlab code:

SC-A
% --------------------------------------------------------------------
% Combination of the Forecasted and real power curves
% ----------------------------------------------------
% let t = time in hours
% let e the estimated power
% let r the real power demand
% -------------------------
t=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24] ;
e=[95 93 94 100 114.5 125 146 175 190 205 170 180 211.5 220 242 280
267.5 325 256 265 204.5 190 152.3 130] ;
r=[93.5 92 94.5 96.7 119 130 154.3 186.2 215 208.6 158.7 175 215 225.5
248.7 278 272 326 250 250 195 200 148 128] ;
plot(t, e, t, r, v),grid, xlabel(Time (H)),
ylabel(Power (MW)), axis ([0, 25, 0, 400]);
% --------------------------------------------------------------------

39 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

Appendix C:
C: MPLAB Programs
Programs MOVLW B'11111111' MOVWF PORTB GOTO am8b
MOVWF TRISA CALL tempo MOVLW B'00000100'
Source code
BANKSEL PORT ;bank 0 am5a BTFSC A3 MOVWF PORTD
B-1: Load Generator ;------------------------------------ GOTO am5a MOVLW B'00000110'
;initiliaze and wait am5b BTFSS A4 MOVWF PORTC
; IC N1 : Load
CLRF PORTB GOTO am5b MOVLW B'00000101'
provider/Generator
CLRF PORTC MOVLW B'00010000' MOVWF PORTB
Provides values to IC N4
CLRF PORTD MOVWF PORTD CALL tempo
through assigned pins, poll ICN3
wait BTFSS start MOVLW B'00100001' rep2 BTFSS PORTB,7
to display the corresponding value
am2a BTFSS A0 MOVWF PORTC GOTO rep2
while listening to IC N2 to know
GOTO am2a MOVLW B'00010000' am9a BTFSC A3
whether load should be ;reduced
am2b BTFSS A1 MOVWF PORTB GOTO am9a
;________________________
GOTO am2b CALL tempo am9b BTFSS A4
___
MOVLW B'00000010' am6a BTFSC A4 GOTO am9b
LIST P=16F877, F=INHX8M,
MOVWF PORTD GOTO am6a MOVLW B'00001000'
r=dec MOVLW B'00000101' am6b BTFSS A5 MOVWF PORTD
include "P16F877.inc" MOVWF PORTC GOTO am6b MOVLW B'00001010'
__CONFIG _PWRTE_ON & MOVLW B'00000010' MOVLW B'00100000' MOVWF PORTC
_WDT_OFF & _XT_OSC MOVWF PORTB MOVWF PORTD MOVLW B'00001001'
;__________________ CALL tempo MOVLW B'01000001' MOVWF PORTB
; Input pin assigment
am3a BTFSC A0 MOVWF PORTC CALL tempo
#DEFINE A0 PORTA,0 ;
GOTO am3a MOVLW B'00100000' rep3 BTFSS PORTB,7
#DEFINE A1 PORTA,1
am3b BTFSS A2 MOVWF PORTB GOTO rep3
#DEFINE A2 PORTA,2
GOTO am3b CALL tempo am10a BTFSC A4
#DEFINE A3 PORTA,3
MOVLW B'00000100' am7a BTFSS GOTO am10a
#DEFINE A4 PORTA,4
MOVWF PORTD A0 am10b BTFSS A5
#DEFINE A5 PORTA,5
MOVLW B'00001001' GOTO am7a GOTO am10b
#DEFINE start PORTD,7
MOVWF PORTC am7b BTFSS A2 MOVLW B'00010000'
N1 equ 0x0F
MOVLW B'00000100' GOTO am7b MOVWF PORTD
N2 equ 0x0E MOVWF PORTB MOVLW B'00000011' MOVLW B'00010010'
N3 equ 0x0C CALL tempo MOVWF PORTD
;------------------------------- am4a BTFSC A2 MOVLW B'10000001' MOVWF PORTC
; setting the ports GOTO am4a MOVWF PORTC MOVLW B'00010001'
;------------------------------ am4b BTFSS A3 MOVLW B'00000011' MOVWF PORTB
BANKSEL TRISB ;bank 1
GOTO am4b MOVWF PORTB CALL tempo
MOVLW B'00000110'
MOVLW B'00001000' CALL tempo am11a BTFSS A0
MOVWF ADCON1
MOVWF PORTD rep1 BTFSS PORTB,7 GOTO am11a
CLRF TRISC
MOVLW B'00010001' GOTO rep1 am11b BTFSS A3
MOVLW B'11000000'
am8a BTFSC A2 GOTO am11b
MOVWF TRISD
MOVWF PORTC GOTO am8a MOVLW B'00100000'
MOVWF TRISB
MOVLW B'00001000' am8b BTFSS A3 MOVWF PORTD

40 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

MOVLW B'00100010' GOTO pm15b CALL tempo GOTO pm22b


MOVWF PORTC MOVLW B'00100000' pm19a BTFSC A3 MOVLW B'00010000'
MOVLW B'00100001' MOVWF PORTD GOTO pm19a MOVWF PORTD
MOVWF PORTB MOVLW B'00010100' pm19b BTFSS A4 MOVLW B'10001000'
CALL tempo MOVWF PORTC GOTO pm19b MOVWF PORTC
am12a BTFSC A3 MOVLW B'00100010' MOVLW B'00010010' MOVLW B'00000111'
GOTO am12a MOVWF PORTB MOVWF PORTD MOVWF PORTB
am12b BTFSS A4 CALL tempo MOVLW B'00011000' CALL tempo
GOTO am12b pm16a BTFSC A0 MOVWF PORTC rep4 BTFSS PORTB,7
MOVLW B'00000110' GOTO pm16a MOVLW B'00011000' GOTO rep4
MOVWF PORTD pm16b BTFSS A1 MOVWF PORTB pm23a BTFSC A2
MOVLW B'01000010' GOTO pm16b CALL tempo GOTO pm23a
MOVWF PORTC MOVLW B'00001010' pm20a BTFSC A4 pm23b BTFSS A3
MOVLW B'00000110' MOVWF PORTD GOTO pm20a GOTO pm23b
MOVWF PORTB MOVLW B'00100100' pm20b BTFSS A5 MOVLW B'00100000'
CALL tempo MOVWF PORTC GOTO pm20b MOVWF PORTD
pm13a BTFSC A4 MOVLW B'00001100' MOVLW B'00100000' MOVLW B'00110000'
GOTO pm13a MOVWF PORTB MOVWF PORTD MOVWF PORTC
pm13b BTFSS A5 CALL tempo MOVLW B'00101000' MOVLW B'00001110'
GOTO pm13b pm17a BTFSC A1 MOVWF PORTC MOVWF PORTB
MOVLW B'00001000' GOTO pm17a MOVLW B'00101000' CALL tempo
MOVWF PORTD pm17b BTFSS A2 MOVWF PORTB pm24a BTFSC A3
MOVLW B'10000010' GOTO pm17b CALL tempo GOTO pm24a
MOVWF PORTC MOVLW B'00010000' rep5 BTFSS PORTB,6 pm24b BTFSS A4
MOVLW B'00001010' MOVWF PORTD GOTO rep5 GOTO pm24b
MOVWF PORTB MOVLW B'01000100' pm21a BTFSS A1 MOVLW B'00000010'
CALL tempo ; IC11 GOTO pm21a MOVWF PORTD
pm14a BTFSS A1 MOVWF PORTC pm21b BTFSS A3 MOVLW B'01010000'
GOTO pm14a MOVLW B'00010100' GOTO pm21b MOVWF PORTC
pm14b BTFSS A2 MOVWF PORTB MOVLW B'00001100' MOVLW B'00011100'
GOTO pm14b CALL tempo MOVWF PORTD MOVWF PORTB
MOVLW B'00010000' pm18a BTFSC A2 MOVLW B'01001000' ;------- ----MAIN ENDS---
MOVWF PORTD GOTO pm18a MOVWF PORTC GOTO wait
MOVLW B'00001100' pm18b BTFSS A3 MOVLW B'00110000' tempo MOVLW D'255'
MOVWF PORTC GOTO pm18b MOVWF PORTB MOVWF N1
MOVLW B'00010010' MOVLW B'00100000' CALL tempo MOVLW D'131'
MOVWF PORTB MOVWF PORTD rep6 BTFSS PORTD,6 MOVWF N2
CALL tempo MOVLW B'10000100' GOTO rep6 MOVLW D'30'
pm15a BTFSC A2 MOVWF PORTC pm22a BTFSC A3 MOVWF N3
GOTO pm15a MOVLW B'00100100' GOTO pm22a loop1 DECFSZ N1
pm15b BTFSS A0 MOVWF PORTB pm22b BTFSS A2 GOTO loop1

41 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

MOVLW D'255' MOVWF TRISA CALL T6 pm15a BTFSC A4


MOVWF N1 BANKSEL PORTB ;bank 0 am7a BTFSS A0 GOTO pm15a
DECFSZ N2 CLRF PORTC GOTO am7a pm15b BTFSS A5
GOTO loop1 CLRF PORTD am7b BTFSS A1 GOTO pm15b
MOVLW D'131' wait BTFSS start GOTO am7b CALL T15
MOVWF N2 GOTO wait CALL T7 pm16a BTFSS A2
DECFSZ N3 CLRF PORTC am8a BTFSC A1 GOTO pm16a
GOTO CLRF PORTD GOTO am8a pm16b BTFSS A3
loop1 ;------------------------------------ am8b BTFSS A2 GOTO pm16b
RETURN ; MAIN GOTO am8b CALL T16
END ;-------------------------- --------- CALL T8 pm17a BTFSC A3
B-2: Time display main am9a BTFSC A2 GOTO pm17a
; IC N12: Displays Time am1 BTFSS A0 GOTO am9a pm17b BTFSS A4
; every hour is assigned a set of GOTO am1 am9b BTFSS A3 GOTO pm17b
input am1b BTFSS A1 GOTO am9b CALL T17
bits for indication purpose GOTO am1b CALL T9 pm18a BTFSC A4
;________________________ CALL T1 am10a BTFSC A3 GOTO pm18a
LIST P=16F877, F=INHX8M, am2 BTFSC A0 GOTO am10a pm18b BTFSS A5
r=dec GOTO am2 am10b BTFSS A4 GOTO pm18b
include "P16F877.inc" am2b BTFSS A1 GOTO am10b CALL T18
__CONFIG _PWRTE_ON & GOTO am2b CALL T10 pm19a BTFSS A3
_WDT_OFF & _XT_OSC CALL T2 am11a BTFSC A4 GOTO pm19a
;________________________ am3 BTFSC A1 GOTO am11a pm19b BTFSS A4
; Input pin configuration GOTO am3 am11b BTFSS A5 GOTO pm19b
#DEFINE A0 PORTA,0 ; am3b BTFSS A2 GOTO am11b CALL T19
#DEFINE A1 PORTA,1 GOTO am3b CALL T11 pm20a BTFSC A4
#DEFINE A2 PORTA,2 CALL T3 am12a BTFSS A1 GOTO pm20a
#DEFINE A3 PORTA,3 am4 BTFSC A2 GOTO am12a pm20b BTFSS A5
#DEFINE A4 PORTA,4 GOTO am4 am12b BTFSS A2 GOTO pm20b
#DEFINE A5 PORTA,5 am4b BTFSS A3 GOTO am12b CALL T20
#DEFINE start PORTD,7 GOTO am4b CALL T12 pm21a BTFSS A4
;------------------------------------ CALL T4 pm13a BTFSC A2 GOTO pm21a
; setting the ports am5 BTFSC A3 GOTO pm13a pm21b BTFSS A5
;-------------------------- --------- GOTO am5 pm13b BTFSS A3 GOTO pm21b
BANKSEL TRISB ;bank 1 am5b BTFSS A4 GOTO pm13b CALL T21
MOVLW B'00000110' GOTO am5b CALL T13 pm22a BTFSS A0
MOVWF ADCON1 CALL T5 pm14a BTFSC A3 GOTO pm22a
CLRF TRISC am6 BTFSC A4 GOTO pm14a pm22b BTFSS A1
MOVLW B'10000000' GOTO am6 pm14b BTFSS A4 GOTO pm22b
MOVWF TRISD am6b BTFSS A5 GOTO pm14b pm22c BTFSS A2
MOVLW B'11111111' GOTO am6b CALL T14 GOTO pm22c

42 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

CALL T22 T5 MOVLW B'00111111' MOVWF PORTC MOVLW B'00000110'


pm23a BTFSC A0 MOVWF PORTC MOVLW B'01001111' MOVWF PORTD
GOTO pm23a MOVLW B'01101101' MOVWF PORTD RETURN
pm23b BTFSS A2 MOVWF PORTD RETURN T22 MOVLW B'01101101'
GOTO pm23b RETURN T14 MOVLW B'00110000' MOVWF PORTC
pm23c BTFSS A3 T6 MOVLW B'00111111' MOVWF PORTC MOVLW B'01011011'
GOTO pm23c MOVWF PORTC MOVLW B'01100110' MOVWF PORTD
CALL T23 MOVLW B'01111101' MOVWF PORTD RETURN
BCF PORTE,1 MOVWF PORTD RETURN T23 MOVLW B'01101101'
am24a BTFSC A1 RETURN T15 MOVLW B'00110000' MOVWF PORTC
GOTO am24a T7 MOVLW B'00111111' MOVWF PORTC MOVLW B'01001111'
am24b BTFSS A3 MOVWF PORTC MOVLW B'01101101' MOVWF PORTD
GOTO am24b MOVLW B'00000111' MOVWF PORTD RETURN
am24c BTFSS A4 MOVWF PORTD RETURN T24 MOVLW B'01101101'
GOTO am24c RETURN T16 MOVLW B'00110000' MOVWF PORTC
CALL T24 T8 MOVLW B'00111111' MOVWF PORTC MOVLW B'01100110'
;-------------END OF MAIN----- MOVWF PORTC MOVLW B'01111101' MOVWF PORTD
GOTO wait MOVLW B'011111111' MOVWF PORTD RETURN
;------------------------------------ MOVWF PORTD RETURN END
; TIME RETURN T17 MOVLW B'00110000' B-3: Comparator
;------------------------------------ T9 MOVLW B'00111111' MOVWF PORTC IC N2: Comparator
T1 MOVLW B'00111111' MOVWF PORTC MOVLW B'00000111' ;Receies values from IC9
MOVWF PORTC MOVLW B'01101111' MOVWF PORTD (generation) and :IC1(load),
MOVLW B'00000110' MOVWF PORTD RETURN compares them anddrives :either
MOVWF PORTD RETURN T18 MOVLW B'00110000' IC1(reduce load) or
RETURN T10 MOVLW B'00110000' MOVWF PORTC :IC4(reduce/increase generation)
T2 MOVLW B'00111111' MOVWF PORTC MOVLW B'011111111' ;___________________________
MOVWF PORTC MOVLW B'00111111' MOVWF PORTD LIST P=16F877, F=INHX8M,
MOVLW B'01011011' MOVWF PORTD RETURN r=dec
MOVWF PORTD RETURN T19 MOVLW B'00110000' include "P16F877.inc"
RETURN T11 MOVLW B'00110000' MOVWF PORTC ;
T3 MOVLW B'00111111' MOVWF PORTC MOVLW B'01101111' __CONFIG _PWRTE_ON &
MOVWF PORTC MOVLW B'00000110' MOVWF PORTD _WDT_OFF & _XT_OSC
MOVLW B'01001111' MOVWF PORTD RETURN ;___________________________
MOVWF PORTD RETURN T20 MOVLW B'01101101' ; Input pin configuration
RETURN T12 MOVLW B'00110000' MOVWF PORTC #DEFINE A0 PORTA,0
T4 MOVLW B'00111111' MOVWF PORTC MOVLW B'00111111' #DEFINE A1 PORTA,1
MOVWF PORTC MOVLW B'01011011' MOVWF PORTD #DEFINE A2 PORTA,2
MOVLW B'01100110' MOVWF PORTD RETURN #DEFINE A3 PORTA,3
MOVWF PORTD RETURN T21 MOVLW B'01101101' #DEFINE A4 PORTA,4
RETURN T13 MOVLW B'00110000' MOVWF PORTC #DEFINE A5 PORTA,5

43 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

#DEFINE D0 PORTD,0 ; MOVLW B'00000011' MOVWF PORTC GOTO okc


#DEFINE D1 PORTD,1 MOVWF PORTC am7a BTFSS A1 BCF PORTD,6
#DEFINE D2 PORTD,2 am2a BTFSC A0 GOTO am7a am10a BTFSC A3
#DEFINE D3 PORTD,3 GOTO am2a am7b BTFSC D4 GOTO am10a
#DEFINE D4 PORTD,4 am2b BTFSS D0 GOTO am7b am10b BTFSC D2
#DEFINE D5 PORTD,5 GOTO am2b MOVLW B'00000011' GOTO am10b
#DEFINE start PORTD,7 MOVLW B'00000010' MOVWF PORTB MOVLW B'00010001'
;--------------------------------- ------ MOVWF PORTB MOVLW B'00001000' MOVWF PORTB
; setting the ports MOVLW B'00000100' MOVWF PORTC MOVLW B'00001001'
;------------------------------ ------- MOVWF PORTC inc10 BTFSS PORTE,0 MOVWF PORTC
BANKSEL TRISB ;bank 1 am3a BTFSC A1 GOTO inc10 am11a BTFSC A4
MOVLW B'00000110' GOTO am3a BSF PORTD,6 GOTO am11a
MOVWF ADCON1 am3b BTFSC D0 ok BTFSC PORTE,0 am11b BTFSC D3
CLRF TRISC GOTO am3b GOTO ok GOTO am11b
CLRF TRISB MOVLW B'00000100' BCF PORTD,6 MOVLW B'00100001'
MOVLW B'11111111' MOVWF PORTB am8a BTFSC A1 MOVWF PORTB
MOVWF TRISA MOVLW B'00001000' GOTO am8a MOVLW B'00010000'
MOVLW B'10111111' MOVWF PORTC am8b BTFSS D1 MOVWF PORTC
MOVWF TRISD am4a BTFSC A2 GOTO am8b am12a BTFSS A1
MOVLW B'00000111' GOTO am4a MOVLW B'00000101' GOTO am12a
MOVWF TRISE am4b BTFSC D1 MOVWF PORTB am12b BTFSC D4
BANKSEL PORTB ;bank 0 GOTO am4b MOVLW B'00010000' GOTO am12b
;------------------------------ ------ MOVLW B'00001000' MOVWF PORTC MOVLW B'00000110'
; Initialize and wait MOVWF PORTB incb10 BTFSS PORTE,0 MOVWF PORTB
CLRF PORTB MOVLW B'00010000' GOTO incb10 MOVLW B'00100000'
CLRF PORTC MOVWF PORTC BSF PORTD,6 MOVWF PORTC
wait BTFSS start am5a BTFSC A3 okb BTFSC PORTE,0 pm13a BTFSC A2
GOTO wait GOTO am5a GOTO okb GOTO pm13a
CLRF PORTB am5b BTFSC D2 BCF PORTD,6 pm13b BTFSS D2
CLRF PORTC GOTO am5b am9a BTFSC A2 GOTO pm13b
BCF PORTD,6 MOVLW B'00010000' GOTO am9a MOVLW B'00001010'
;---------------------------------------- MOVWF PORTB am9b BTFSC D1 MOVWF PORTB
; MAIN MOVLW B'00100000' GOTO am9b MOVLW B'00000110'
;---------------------------------------- MOVWF PORTC MOVLW B'00001001' MOVWF PORTC
main am6a BTFSC A4 MOVWF PORTB pm14a BTFSC A3
am1a BTFSS A0 GOTO am6a MOVLW B'00100000' GOTO pm14a
GOTO am1a am6b BTFSC D3 MOVWF PORTC pm14b BTFSC D2
am1b BTFSS A1 GOTO am6b incc10 BTFSS PORTE,0 GOTO pm14b
GOTO am1b MOVLW B'00100000' GOTO incc10 MOVLW B'00010010'
MOVLW B'00000011' MOVWF PORTB BSF PORTD,6 MOVWF PORTB
MOVWF PORTB MOVLW B'00000101' okc BTFSC PORTE,0 MOVLW B'00000001'

44 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

MOVWF PORTC pm20a BTFSC A4 pm24b BTFSC D4 MOVWF ADCON1


pm15a BTFSC A4 GOTO pm20a GOTO pm24b MOVLW B'10000000'
GOTO pm15a pm20b BTFSS D1 MOVLW B'00011100' MOVWF TRISD
pm15b BTFSC D3 GOTO pm20b MOVWF PORTB MOVWF TRISB
GOTO pm15b MOVLW B'00101000' MOVLW B'00100000' MOVWF TRISC
MOVLW B'00100010' MOVWF PORTB ; IC1 MOVLW B'11111111'
MOVWF PORTB MOVLW B'00001010' MOVWF PORTC MOVWF TRISA
MOVLW B'00000010' MOVWF PORTC ;-----MAIN ENDS------- MOVLW B'00000110'
MOVWF PORTC pm21a BTFSS A3 GOTO wait MOVWF TRISE
; pm16a BTFSS A3 GOTO pm21a END BANKSEL PORTB ;bank 0
GOTO pm16a pm21b BTFSC D4 B-4: Display generated power ;-------------- -------------------------
pm16b BTFSC D4 GOTO pm21b ;IC N10: Displays generated ; initialize and wait
GOTO pm16b MOVLW B'00110000' power (MW) CLRF PORTB
MOVLW B'00001100' MOVWF PORTB ; Each hour is assigned a set of CLRF PORTC
MOVWF PORTB MOVLW B'00000100' input bits for indication purpose CLRF PORTD
MOVLW B'00000100' MOVWF PORTC ;initially, the program polls input wait BTFSS start
MOVWF PORTC pm22a BTFSC A3 pin 0 to output the load at 1am GOTO wait
pm17a BTFSC A3 GOTO pm22a then waits for 2am- CLRF PORTB
GOTO pm17a pm22b BTFSS D3 ;-to print out its load. It does this CLRF PORTC
pm17b BTFSS D3 GOTO pm22b chronologically. D1=load demand CLRF PORTD
GOTO pm17b MOVLW B'00000111' at 1am (or am1). ;----------------------- - ---------------
MOVLW B'00010100' MOVWF PORTB ;___________________________ ; MAIN
MOVWF PORTB MOVLW B'00001000' LIST P=16F877, F=INHX8M, ;-------------------- -------------------
MOVLW B'00001000' MOVWF PORTC r=dec main
MOVWF PORTC incd10 BTFSS PORTE,0 include "P16F877.inc" am1 BTFSS A0
pm18a BTFSC A4 GOTO incd10 __CONFIG _PWRTE_ON & GOTO am1
GOTO pm18a BSF PORTD,6 _WDT_OFF & _XT_OSC am1b BTFSS A1
pm18b BTFSC D3 okd BTFSC PORTE,0 ;___________________________ GOTO am1b
GOTO pm18b GOTO okd ; Input pin configuration CALL G1
MOVLW B'00100100' BCF PORTD,6 #DEFINE A0 PORTA,0 ; am2 BTFSC A0
MOVWF PORTB pm23a BTFSC A4 #DEFINE A1 PORTA,1 GOTO am2
MOVLW B'00010000' GOTO pm23a #DEFINE A2 PORTA,2 am2b BTFSS A1
MOVWF PORTC pm23b BTFSC D3 #DEFINE A3 PORTA,3 GOTO am2b
pm19a BTFSS A4 GOTO pm23b #DEFINE A4 PORTA,4 CALL G2
GOTO pm19a MOVLW B'00001110' #DEFINE A5 PORTA,5 am3 BTFSC A1
pm19b BTFSC D4 ; IC4 #DEFINE start PORTD,7 GOTO am3
GOTO pm19b MOVWF PORTB ;--------------------------------------- am3b BTFSS A2
MOVLW B'00011000' MOVLW B'00010000' ; setting the ports GOTO am3b
MOVWF PORTB MOVWF PORTC ;--------------------- ------------- CALL G3
MOVLW B'00100000' pm24a BTFSS A1 BANKSEL TRISB ;bank 1 am4 BTFSC A2
MOVWF PORTC GOTO pm24a MOVLW B'00000110' GOTO am4

45 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

am4b BTFSS A3 patb BTFSC PORTE,1 CALL G17 GOTO pm23a


GOTO am4b GOTO patb pm18a BTFSC A4 pm23b BTFSS A2
CALL G4 am10a BTFSC A3 GOTO pm18a GOTO pm23b
am5 BTFSC A3 GOTO am10a pm18b BTFSS A5 pm23c BTFSS A3
GOTO am5 am10b BTFSS A4 GOTO pm18b GOTO pm23c
am5b BTFSS A4 GOTO am10b CALL G18 CALL G23
GOTO am5b CALL G10 pm19a BTFSS A3 am24a BTFSC A1
CALL G5 am11a BTFSC A4 GOTO pm19a GOTO am24a
am6 BTFSC A4 GOTO am11a pm19b BTFSS A4 am24b BTFSS A3
GOTO am6 am11b BTFSS A5 GOTO pm19b GOTO am24b
am6b BTFSS A5 GOTO am11b CALL G19 am24c BTFSS A4
GOTO am6b CALL G11 pm20a BTFSC A4 GOTO am24c
CALL G6 am12a BTFSS A1 GOTO pm20a CALL G24
am7a BTFSS A0 GOTO am12a pm20b BTFSS A5 ;---------MAIN ENDS-----------
GOTO am7a am12b BTFSS A2 GOTO pm20b GOTO wait
am7b BTFSS A1 GOTO am12b CALL G20 ;----------------------------------------
GOTO am7b CALL G12 red1 BTFSS PORTB,7 ; POWER: VALUES
CALL G7 pm13a BTFSC A2 GOTO red1 ;----------------------------------------
pat BTFSS PORTE,1 GOTO pm13a CALL G200 G1 MOVLW B'00111111'
GOTO pat pm13b BTFSS A3 pm21a BTFSS A4
CALL G77 GOTO pm13b GOTO pm21a MOVWF PORTB
pat2 BTFSC PORTE,1 CALL G13 pm21b BTFSS A5 MOVLW B'01111011'
GOTO pat2 pm14a BTFSC A3 GOTO pm21b MOVWF PORTC
am8a BTFSC A1 GOTO pm14a CALL G21 MOVLW B'01011011'
GOTO am8a pm14b BTFSS A4 red2 BTFSS PORTC,7 MOVWF PORTD
am8b BTFSS A2 GOTO pm14b GOTO red2 RETURN
GOTO am8b CALL G14 CALL G211 G2 MOVLW B'00111111'
CALL G8 pm15a BTFSC A4 pm22a BTFSS A0 MOVWF PORTB
pat3 BTFSS PORTE,1 GOTO pm15a GOTO pm22a MOVLW B'01111011'
GOTO pat3 pm15b BTFSS A5 pm22b BTFSS A1 MOVWF PORTC
CALL G88 GOTO pm15b GOTO pm22b MOVLW B'01101101'
pat4 BTFSC PORTE,1 CALL G15 pm22c BTFSS A2 MOVWF PORTD
GOTO pat4 pm16a BTFSS A2 GOTO pm22c RETURN
am9a BTFSC A2 GOTO pm16a CALL G22 G3 MOVLW B'00111111'
GOTO am9a pm16b BTFSS A3 ;--------------------------------- -- MOVWF PORTB
am9b BTFSS A3 GOTO pm16b patc BTFSS PORTE,1 MOVLW B'01111011'
GOTO am9b CALL G16 GOTO patc MOVWF PORTC
CALL G9 pm17a BTFSC A3 CALL G222 MOVLW B'01011011'
pata BTFSS PORTE,1 GOTO pm17a patd BTFSC PORTE,1 MOVWF PORTD
GOTO pata pm17b BTFSS A4 GOTO patd RETURN
CALL G99 GOTO pm17b pm23a BTFSC A0 G4 MOVLW B'00110000'

46 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

MOVWF PORTB MOVWF PORTB G13 MOVLW B'01101101' MOVLW B'01011011'


MOVLW B'00111111' MOVLW B'011111111' MOVWF PORTB MOVWF PORTC
MOVWF PORTC MOVWF PORTC MOVWF PORTD MOVLW B'01011111'
MOVWF PORTD MOVLW B'01011111' MOVLW B'00110000' MOVWF PORTD
RETURN MOVWF PORTD MOVWF PORTC RETURN
G5 MOVLW B'00110000' RETURN RETURN G20 MOVLW B'01101101'
MOVWF PORTB G9 MOVLW B'00110000' G14 MOVLW B'01101101' MOVWF PORTB
MOVWF PORTC MOVWF PORTB MOVWF PORTB MOVLW B'01011111'
MOVLW B'01011011' MOVLW B'01111011' MOVWF PORTC MOVWF PORTC
MOVWF PORTD MOVWF PORTC MOVLW B'00111111' MOVLW B'01011011'
RETURN MOVLW B'00111111' MOVWF PORTD MOVWF PORTD
G6 MOVLW B'00110000' MOVWF PORTD RETURN RETURN
MOVWF PORTB RETURN G15 MOVLW B'01101101' G200 MOVLW B'01101101'
MOVLW B'01101101' G99 MOVLW B'01101101' MOVWF PORTB MOVWF PORTB
MOVWF PORTC MOVWF PORTB MOVWF PORTD MOVLW B'01011011'
MOVLW B'01011011' MOVLW B'00110000' MOVLW B'01110010' MOVWF PORTC
MOVWF PORTD MOVWF PORTC MOVWF PORTC MOVLW B'00111111'
RETURN MOVLW B'01011011' RETURN MOVWF PORTD
G7 MOVLW B'00110000' MOVWF PORTD G16 MOVLW B'01101101' RETURN
MOVWF PORTB RETURN MOVWF PORTB G21 MOVLW B'01101101'
MOVLW B'01110010' G10 MOVLW B'01101101' MOVLW B'011111111' MOVWF PORTB
MOVWF PORTC MOVWF PORTB MOVWF PORTC MOVLW B'00111111'
MOVLW B'01011011' MOVLW B'00111111' MOVLW B'01111001' MOVWF PORTC
MOVWF PORTD MOVWF PORTC MOVWF PORTD MOVLW B'01011011'
RETURN MOVLW B'01011011' RETURN MOVWF PORTD
G77 MOVLW B'00110000' MOVWF PORTD G17 MOVLW B'01101101' RETURN
MOVWF PORTB RETURN MOVWF PORTB G211 MOVLW B'00110000'
MOVLW B'01011011' G11 MOVLW B'00110000' MOVLW B'01011111' MOVWF PORTB
MOVWF PORTC MOVWF PORTB MOVWF PORTC MOVLW B'01111011'
MOVLW B'01110010' MOVLW B'01011111' MOVLW B'011111111' MOVWF PORTC
MOVWF PORTD MOVWF PORTC MOVWF PORTD MOVLW B'01011011'
RETURN MOVLW B'01101101' RETURN MOVWF PORTD
G8 MOVLW B'00110000' MOVWF PORTD G18 MOVLW B'01111001' RETURN
;1 RETURN MOVWF PORTB G22 MOVLW B'00110000'
MOVWF PORTB G12 MOVLW B'00110000' MOVLW B'01101101' MOVWF PORTB
MOVLW B'00110001' MOVWF PORTB MOVWF PORTC MOVLW B'01111011'
MOVWF PORTC MOVLW B'011111111' MOVLW B'01110010' MOVWF PORTC
MOVLW B'01011011' MOVWF PORTC MOVWF PORTD MOVLW B'00111111'
MOVWF PORTD MOVLW B'00111111' RETURN MOVWF PORTD
RETURN MOVWF PORTD G19 MOVLW B'01101101' RETURN
G88 MOVLW B'00110000' RETURN MOVWF PORTB G222 MOVLW B'01101101'

47 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

MOVWF PORTB #DEFINE B4 PORTB,4 am3 BTFSC B2 MOVWF PORTC


MOVLW B'00111111' #DEFINE B5 PORTB,5 GOTO am3 BSF PORTD,7
MOVWF PORTC #DEFINE B6 PORTB,6 am3b BTFSS B3 Red2 BTFSS PORTA,1
MOVLW B'00111111' #DEFINE B7 PORTB,7 GOTO am3b GOTO Red2
MOVWF PORTD ;---------------------------------- --- MOVLW B'00000111' BCF PORTD,7
RETURN ; setting the ports MOVWF PORTC Redb BTFSC PORTA,1
G23 MOVLW B'00110000' ;------------------------------- ------ am4 BTFSC B3 GOTO Redb ;on
MOVWF PORTB BANKSEL TRISB ; bank 1 GOTO am4 BSF PORTD,7
MOVLW B'01011011' MOVLW B'00000110' am4b BTFSS B4 am9 BTFSC B2
MOVWF PORTC MOVWF ADCON1 GOTO am4b GOTO am9
MOVLW B'01101101' CLRF TRISC MOVLW B'00001111' am9b BTFSS B3
MOVWF PORTD CLRF TRISD MOVWF PORTC GOTO am9b
RETURN MOVLW B'11111111' am5 BTFSC B4 MOVLW B'11111111'
G24 MOVLW B'00110000' MOVWF TRISA GOTO am5 MOVWF PORTC
MOVWF PORTB MOVWF TRISB am5b BTFSS B5 MOVLW B'10000001'
MOVLW B'01111001' BANKSEL PORTB ; bank 0 GOTO am5b MOVWF PORTD
MOVWF PORTC ;------------------------------------ --- MOVLW B'00011111' Red3 BTFSS PORTA,1
MOVLW B'00111111' ; Initialize and wait MOVWF PORTC GOTO Red3
MOVWF PORTD CLRF PORTC am6 BTFSC B5 BCF PORTD,7
RETURN CLRF PORTD GOTO am6 Redc BTFSC PORTA,1
END wait BTFSS start am6b BTFSS B6 GOTO Redc ;on
5: Illustrate load supply GOTO wait GOTO am6b BSF PORTD,7
;IC N11: Load supply illustrator CLRF PORTC MOVLW B'00111111' am10 BTFSC B2
;Illustrate load supply by turning CLRF PORTD MOVWF PORTC GOTO am10
set off LEDs corresponding to the ;---------------------------------- --- am7 BTFSC B6 am10b BTFSS B3
actual ; MAIN GOTO am7 GOTO am10b
; Displayed load value as each ;------------------------------------ am7b BTFSS B7 MOVLW B'11111111'
LED correspond to a given load. main GOTO am7b MOVWF PORTC
;___________________________ am1 BTFSS B0 MOVLW B'01111111' MOVLW B'10000001'
LIST P=16F877, F=INHX8M, GOTO am1 MOVWF PORTC MOVWF PORTD
r=dec am1b BTFSS B1 Reda BTFSS PORTA,1 am11 BTFSS B4
include "P16F877.inc" GOTO am1b GOTO Reda GOTO am11
__CONFIG _PWRTE_ON & MOVLW B'00000111' BCF PORTD,7 ;off am11c BTFSC B4
_WDT_OFF & _XT_OSC MOVWF PORTC Red BTFSC PORTA,1 GOTO am11c
;__________________________ BSF PORTD,7 GOTO Red ;on am11b BTFSS B5
; Input pin configuration am2 BTFSC B1 BSF PORTD,7 GOTO am11b
#DEFINE start PORTA,0 ; GOTO am2 am8 BTFSS B2 MOVLW B'11110001'
#DEFINE B0 PORTB,0 am2b BTFSS B2 GOTO am8 MOVWF PORTC
#DEFINE B1 PORTB,1 GOTO am2b am8b BTFSS B1 MOVLW B'10000001'
#DEFINE B2 PORTB,2 MOVLW B'00000011' GOTO am8b MOVWF PORTD
#DEFINE B3 PORTB,3 MOVWF PORTC MOVLW B'11111111' am12 BTFSC B5

48 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

GOTO am12 pm18c BTFSC B6 GOTO pm24 BANKSEL TRISB ; bank 1


am12b BTFSS B6 GOTO pm18c pm24b BTFSS B6 MOVLW B'00000110'
GOTO am12b pm18b BTFSS B7 GOTO pm24b MOVWF ADCON1
MOVLW B'11110001' GOTO pm18b MOVLW B'00100000' CLRF TRISC
MOVWF PORTC MOVLW B'11110001' MOVWF PORTC CLRF TRISB
MOVLW B'10000011' MOVWF PORTC MOVLW B'11001110' CLRF PORTE
MOVWF PORTD MOVLW B'11111111' MOVWF PORTD MOVLW B'10000000'
pm13 BTFSC B6 MOVWF PORTD ;-------------MAIN ENDS-------- MOVWF TRISD
GOTO pm13 pm19 BTFSS B3 GOTO wait MOVLW B'11111111'
pm13b BTFSS B7 GOTO pm19 END MOVWF TRISA
GOTO pm13b pm19b BTFSS B4 B-6: Display Load value BANKSEL PORTB ; bank 0
MOVLW B'11110001' GOTO pm19b ; IC N3 : Displays the load value ;--------------------------- --------
MOVWF PORTC MOVLW B'11110000' ;initially, the program polls input ; initialize and wait
MOVLW B'10000111' MOVWF PORTC pin 0 to output the load at 1am CLRF PORTB
MOVWF PORTD MOVLW B'11011111' then waits for 2am- CLRF PORTC
pm14 BTFSS B2 MOVWF PORTD ;-to print out its load. It does this CLRF PORTD
GOTO pm14 pm21 BTFSS B5 chronologically. D1=load demand CLRF PORTE
pm14b BTFSS B3 GOTO pm21 at 1 am(or am1). wait BTFSS start
GOTO pm14b pm21c BTFSC B5 ;every hour is assigned a set of GOTO wait
MOVLW B'11110001' GOTO pm21c input bits for indication purpose CLRF PORTB
MOVWF PORTC pm21b BTFSS B6 ;___________________________ CLRF PORTC
MOVLW B'10001111' GOTO pm21b LIST P=16F877, F=INHX8M, CLRF PORTD
MOVWF PORTD MOVLW B'01100000' r=dec CLRF PORTE
pm15 BTFSC B3 MOVWF PORTC include "P16F877.inc" ;----------------------------------------
GOTO pm15 MOVLW B'11011111' __CONFIG ; MAIN
pm15b BTFSS B4 MOVWF PORTD _PWRTE_ON & _WDT_OFF & ;----------------------------------------
GOTO pm15b Red4 BTFSS PORTA,1 _XT_OSC main
MOVLW B'11110001' GOTO Red4 ___________________________ am1 BTFSS A0
MOVWF PORTC BCF PORTD,7 ; Input pin configuration GOTO am1
MOVLW B'10011111' Redd BTFSC PORTA,1 #DEFINE A0 PORTA,0 ; am1b BTFSS A1
MOVWF PORTD GOTO Redd ;on #DEFINE A1 PORTA,1 GOTO am1b
pm16 BTFSC B4 BSF PORTD,7 #DEFINE A2 PORTA,2 CALL D1
GOTO pm16 pm23 BTFSS B4 #DEFINE A3 PORTA,3 am2 BTFSC A0
pm16b BTFSS B5 GOTO pm23 #DEFINE A4 PORTA,4 GOTO am2
GOTO pm16b pm23b BTFSS B5 #DEFINE A5 PORTA,5 am2b BTFSS A1
MOVLW B'11110001' GOTO pm23b #DEFINE start PORTD,7 GOTO am2b
MOVWF PORTC MOVLW B'00100000' N1 equ 0x0F CALL D2
MOVLW B'10111111' MOVWF PORTC N2 equ 0x0E am3 BTFSC A1
MOVWF PORTD MOVLW B'11011110' N3 equ 0x0C GOTO am3
pm18 BTFSS B6 MOVWF PORTD ; setting the ports am3b BTFSS A2
GOTO pm18 pm24 BTFSC B5 ;----------------------------- --------- GOTO am3b

49 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

CALL D3 MOVLW D'20' ;2s am11a BTFSC A4 GOTO pm19a


am4 BTFSC A2 CALL tempo GOTO am11a pm19b BTFSS A4
GOTO am4 BSF PORTE,2;PO am11b BTFSS A5 GOTO pm19b
am4b BTFSS A3 CALL D88 GOTO am11b CALL D19
GOTO am4b MOVLW D'20' CALL D11 pm20a BTFSC A4
CALL D4 CALL tempo ;2s am12a BTFSS A1 GOTO pm20a
am5 BTFSC A3 BCF PORTE,2 ;PO GOTO am12a pm20b BTFSS A5
GOTO am5 CALL D8 am12b BTFSS A2 GOTO pm20b
am5b BTFSS A4 BSF PORTE,0 GOTO am12b CALL D20
GOTO am5b MOVLW D'30' CALL D12 pm21a BTFSS A4
CALL D5 CALL tempo ;3s pm13a BTFSC A2 GOTO pm21a
am6 BTFSC A4 BCF PORTE,0 GOTO pm13a pm21b BTFSS A5
GOTO am6 BSF PORTE,1 pm13b BTFSS A3 GOTO pm21b
am6b BTFSS A5 BCF PORTE,2 GOTO pm13b CALL D21
GOTO am6b am9a BTFSC A2 CALL D13 pm22a BTFSS A0
CALL D6 GOTO am9a pm14a BTFSC A3 GOTO pm22a
am7a BTFSS A0 am9b BTFSS A3 GOTO pm14a pm22b BTFSS A1
GOTO am7a GOTO am9b pm14b BTFSS A4 GOTO pm22b
am7b BTFSS A1 CALL D9 GOTO pm14b pm22c BTFSS A2
GOTO am7b BCF PORTE,1 CALL D14 GOTO pm22c
CALL D7 MOVLW D'20' ;2s pm15a BTFSC A4 CALL D22
MOVLW D'20' ;2s CALL tempo GOTO pm15a MOVLW D'20' ;2s
CALL tempo BSF PORTE,2;PO pm15b BTFSS A5 CALL tempo
BSF PORTE,2 CALL D99 GOTO pm15b BSF PORTE,2
CALL D77 ;-10 ;-22 CALL D15 CALL D222 ;-10
MOVLW D'20' MOVLW D'20' pm16a BTFSS A2 MOVLW D'30'
CALL tempo ;2s CALL tempo ;2s GOTO pm16a CALL tempo ;3s
BCF PORTE,2 BCF PORTE,2;PO pm16b BTFSS A3 BCF PORTE,2
CALL D7 CALL D9 GOTO pm16b CALL D22
BSF PORTE,0 BSF PORTE,0 CALL D16 BSF PORTE,0
MOVLW D'30' MOVLW D'30' pm17a BTFSC A3 MOVLW D'20'
CALL tempo ;3s CALL tempo ;3s GOTO pm17a CALL tempo ;2s
BCF PORTE,0 BCF PORTE,0 pm17b BTFSS A4 BCF PORTE,0
BSF PORTE,1 BSF PORTE,1 GOTO pm17b BSF PORTE,1
BCF PORTE,2 BCF PORTE,2 CALL D17 BCF PORTE,2
am8a BTFSC A1 am10a BTFSC A3 pm18a BTFSC A4 pm23a BTFSC A0
GOTO am8a GOTO am10a GOTO pm18a GOTO pm23a
am8b BTFSS A2 am10b BTFSS A4 pm18b BTFSS A5 pm23b BTFSS A2
GOTO am8b GOTO am10b GOTO pm18b GOTO pm23b
CALL D8 CALL D10 CALL D18 pm23c BTFSS A3
BCF PORTE,1 BCF PORTE,2 pm19a BTFSS A3 GOTO pm23c

50 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

CALL D23 MOVLW B'01111101' MOVLW B'01111101' MOVWF


BCF PORTE,1 MOVWF PORTD MOVWF PORTD PORTD
am24a BTFSC A1 RETURN RETURN RETURN
GOTO am24a D5 MOVLW B'00000110' D9 MOVLW B'01011011' D13 MOVLW B'01011011'
am24b BTFSS A3 MOVWF PORTB MOVWF PORTB MOVWF PORTB
GOTO am24b MOVWF PORTC MOVLW B'00000110' MOVLW B'00000110'
am24c BTFSS A4 MOVLW B'01101111' MOVWF PORTC MOVWF PORTC
GOTO am24c MOVWF PORTD MOVLW B'01101101' MOVLW B'01101101'
CALL D24 RETURN MOVWF PORTD MOVWF PORTD
;-------------END OF MAIN-------- D6 MOVLW B'00000110' RETURN RETURN
GOTO wait MOVWF PORTB D99 MOVLW B'00000110' D14 MOVLW B'01011011'
;------------------ --------------------- MOVLW B'01001111' MOVWF PORTB MOVWF PORTB
; LOAD VALUES MOVWF PORTC MOVLW B'01101111' MOVWF PORTC
;---------------------------- ----------- MOVLW B'00111111' MOVWF PORTC MOVLW B'01111101'
- MOVWF PORTD MOVLW B'01001111' MOVWF PORTD
D1 MOVLW B'00111111' RETURN MOVWF PORTD RETURN
MOVWF PORTB D7 MOVLW B'00000110' RETURN D15 MOVLW B'01011011'
MOVLW B'01101111' MOVWF PORTB D10 MOVLW B'01011011' MOVWF PORTB
MOVWF PORTC MOVLW B'01101101' MOVWF PORTB MOVLW B'01100110'
MOVLW B'01100110' MOVWF PORTC MOVLW B'00111111' MOVWF PORTC
MOVWF PORTD MOVLW B'01100110' ;0 MOVLW B'011111111'
RETURN MOVWF PORTD MOVWF PORTC MOVWF PORTD
D2 MOVLW B'00111111' RETURN MOVLW RETURN
MOVWF PORTB D77 MOVLW B'00000110' B'011111111';8 D16 MOVLW B'01011011'
MOVLW B'01101111' MOVWF PORTB MOVWF PORTD MOVWF PORTB
MOVWF PORTC MOVLW B'01100110' RETURN MOVLW B'00000111'
MOVLW B'01001111' MOVWF PORTC D11 MOVLW B'00000110' MOVWF PORTC
MOVWF PORTD MOVLW B'01100110' ;1 MOVLW B'011111111'
RETURN MOVWF PORTD MOVWF PORTB MOVWF PORTD
; RETURN MOVLW B'01101101' RETURN
D3 MOVLW B'00111111' D8 MOVLW B'00000110' ;5 D17 MOVLW B'01011011'
MOVWF PORTB MOVWF PORTB MOVWF PORTC MOVWF PORTB
MOVLW B'01101111' MOVLW B'011111111' MOVLW B'011111111' MOVLW B'00000111'
MOVWF PORTC MOVWF PORTC MOVWF PORTD MOVWF PORTC
MOVLW B'01100110' MOVLW B'01111101' RETURN MOVLW B'01011011'
MOVWF PORTD MOVWF PORTD D12 MOVLW B'00000110' MOVWF PORTD
RETURN RETURN MOVWF PORTB RETURN
D4 MOVLW B'00111111' D88 MOVLW B'00000110' MOVLW B'00000111' D18 MOVLW B'01001111'
MOVWF PORTB MOVWF PORTB MOVWF PORTC MOVWF PORTB
MOVLW B'01101111' MOVLW B'00000111' MOVLW B'01101101' MOVLW B'01011011'
MOVWF PORTC MOVWF PORTC MOVWF PORTC

51 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

MOVLW B'01111101' MOVLW B'00000111' __CONFIG _PWRTE_ON & am1b BTFSS A1


MOVWF PORTD MOVWF PORTD _WDT_OFF & _XT_OSC GOTO am1b
RETURN RETURN ;___________________________ MOVLW B'00000101'
D19 MOVLW B'01011011' D24 MOVLW B'00000110' ; Input pin configuration MOVWF PORTB
MOVWF PORTB MOVWF PORTB #DEFINE A0 PORTA,0 ; am2 BTFSC A0
MOVLW B'01101101' MOVLW B'01011011' #DEFINE A1 PORTA,1 GOTO am2
MOVWF PORTC MOVWF PORTC #DEFINE A2 PORTA,2 am2b BTFSS A1
MOVLW B'00111111' MOVLW B'01101101' #DEFINE A3 PORTA,3 GOTO am2b
MOVWF PORTD MOVWF PORTD #DEFINE A4 PORTA,4 MOVLW B'01010010'
RETURN RETURN #DEFINE A5 PORTA,5 MOVWF PORTB
D20 MOVLW B'01011011' tempo MOVWF N3 #DEFINE start PORTD,0 MOVLW B'00000011'
MOVWF PORTB MOVLW D'255' ;3s ;-------------------------- --------- MOVWF PORTC
MOVLW B'01101101' MOVWF N1 ; setting the ports am3 BTFSC A1
MOVWF PORTC MOVLW D'131' ;----------------------------- ---- GOTO am3
MOVLW B'00111111' MOVWF N2 BANKSEL TRISB ; bank 1 am3b BTFSS A2
MOVWF PORTD loop1 DECFSZ N1 MOVLW B'00000110' GOTO am3b
RETURN GOTO loop1 MOVWF ADCON1 MOVLW B'00000101'
D21 MOVLW B'00000110' MOVLW D'255' CLRF TRISC MOVWF PORTB
MOVWF PORTB MOVWF N1 CLRF TRISB CLRF PORTC
MOVLW B'01101111' DECFSZ N2 MOVLW B'00000001' am4 BTFSC A2
MOVWF PORTC GOTO loop1 MOVWF TRISD GOTO am4
MOVLW B'01101101' MOVLW D'131' MOVLW B'11111111' am4b BTFSS A3
MOVWF PORTD MOVWF N2 MOVWF TRISA GOTO am4b
RETURN DECFSZ N3 MOVLW B'00000111' MOVLW B'00001010'
D22 MOVLW B'01011011' GOTO loop1 MOVWF TRISE MOVWF PORTB
MOVWF PORTB RETURN BANKSEL PORTB ; bank 0 am5 BTFSC A3
MOVLW B'00111111' END ;--------------------------------- GOTO am5
MOVWF PORTC B-7: Plants Driver ; initialize and wait am5b BTFSS A4
MOVWF PORTD ; IC N4 : Generator selector CLRF PORTB GOTO am5b
RETURN ; Each hour is assigned a set of CLRF PORTC MOVLW B'10001010'
D222 MOVLW B'00000110' input bits for indication purpose wait BTFSS start MOVWF PORTB
MOVWF PORTB ;this IC based on the input from GOTO wait am6 BTFSC A4
MOVLW B'01101111' the comparator, select desired CLRF PORTB GOTO am6
MOVWF PORTC generators: these are not selected CLRF PORTC am6b BTFSS A5
MOVLW B'01100110' randomly as the economic criteria CLRF PORTD GOTO am6b
MOVWF PORTD is the foundation ;----------------------------- -------- MOVLW B'00100101'
RETURN ___________________________ ; MAIN MOVWF PORTB
D23 MOVLW B'00000110' LIST P=16F877, F=INHX8M, ;------------------ ------------------ am7a BTFSS A0
MOVWF PORTB r=dec main GOTO am7a
MOVLW B'01100110' include "P16F877.inc" am1 BTFSS A0 am7b BTFSS A1
MOVWF PORTC GOTO am1 GOTO am7b

52 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

MOVLW B'00001110' am11b BTFSS A5 MOVWF PORTB pm22b BTFSS A1


MOVWF PORTB GOTO am11b MOVLW B'00000100' GOTO pm22b
inc10 BTFSS PORTE,0 MOVLW B'00001011' MOVWF PORTC pm22c BTFSS A2
GOTO Inc10 MOVWF PORTB pm17a BTFSC A3 GOTO pm22c
BSF PORTD,1 MOVLW B'00000001' GOTO pm17a MOVLW B'10011011'
ok BTFSC PORTE,0 MOVWF PORTC pm17b BTFSS A4 MOVWF PORTB
GOTO ok am12a BTFSS A1 GOTO pm17b BCF PORTC,1
BCF PORTD,1 GOTO am12a MOVLW B'01111111' incd BTFSS PORTE,0
am8a BTFSC A1 am12b BTFSS A2 MOVWF PORTB GOTO incd
GOTO am8a GOTO am12b CLRF PORTC BSF PORTD,1
am8b BTFSS A2 MOVLW B'00010111' pm18a BTFSC A4 okd BTFSC PORTE,0
GOTO am8b MOVWF PORTB GOTO pm18a GOTO okd
MOVLW B'00101110' CLRF PORTC pm18b BTFSS A5 BCF PORTD,1
MOVWF PORTB pm13a BTFSC A2 GOTO pm18b pm23a BTFSC A0
incb10 BTFSS PORTE,0 GOTO pm13a MOVLW B'11111111' GOTO pm23a
GOTO incb10 pm13b BTFSS A3 MOVWF PORTB pm23b BTFSS A2
BSF PORTD,2 GOTO pm13b MOVLW B'00111111' GOTO pm23b
okb BTFSC PORTE,0 MOVLW B'00110111' MOVWF PORTC pm23c BTFSS A3
GOTO okb MOVWF PORTB pm19a BTFSS A3 GOTO pm23c
BCF PORTD,2 MOVLW B'00000001' GOTO pm19a MOVLW B'00100011'
am9a BTFSC A2 MOVWF PORTC pm19b BTFSS A4 MOVWF PORTB
GOTO am9a pm14a BTFSC A3 GOTO pm19b BSF PORTC,0
am9b BTFSS A3 GOTO pm14a MOVLW B'11101111' am24a BTFSC A1
GOTO am9b pm14b BTFSS A4 MOVWF PORTB GOTO am24a
MOVLW B'10011011' GOTO pm14b CLRF PORTC am24b BTFSS A3
MOVWF PORTB MOVLW B'00011111' pm20a BTFSC A4 GOTO am24b
incc10 BTFSS PORTE,0 MOVWF PORTB GOTO pm20a am24c BTFSS A4
GOTO incc10 CLRF PORTC pm20b BTFSS A5 GOTO am24c
BSF PORTD,3 pm15a BTFSC A4 GOTO pm20b MOVLW B'00101010'
okc BTFSC PORTE,0 GOTO pm15a MOVLW B'11101111' MOVWF PORTB
GOTO okc pm15b BTFSS A5 BSF PORTC,7 BCF PORTC,0
BCF PORTD,3 GOTO pm15b pm21a BTFSS A4 ;-------------MAIN ENDS--------
am10a BTFSC A3 MOVLW B'11001111' GOTO pm21a GOTO wait
GOTO am10a MOVWF PORTB pm21b BTFSS A5 END
am10b BTFSS A4 MOVLW B'00000001' GOTO pm21b B-8: Hydroelectric plant
GOTO am10b MOVWF PORTC MOVLW B'10101011' controller
MOVLW B'10101011' pm16a BTFSS A2 MOVWF PORTB ;IC N5 : Monitors hydroelectric
MOVWF PORTB GOTO pm16a MOVLW B'00000010' plant
BSF PORTC,1 pm16b BTFSS A3 MOVWF PORTC ; Each hour is assigned a set of
am11a BTFSC A4 GOTO pm16b pm22a BTFSS A0 input bits for indication purpose
GOTO am11a MOVLW B'11111111' GOTO pm22a

53 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

;Turns on appropriate generator GOTO am2a MOVLW B'00000111' #DEFINE start PORTA,4
upon the request of IC 4 am2 BTFSS A1 MOVWF PORTB N1 equ 0x0F
;___________________________ GOTO am2 pm14 BTFSS A3 N2 equ 0x0E
LIST P=16F84, F=INHX8M, MOVLW B'00000010' GOTO pm14 N3 equ 0x0C
r=dec MOVWF PORTB MOVLW B'00001111' ; setting the ports
include "P16F84.inc" am3a BTFSC A1 MOVWF PORTB ;------------------------------------
__CONFIG _PWRTE_ON & GOTO am3a pm21 BTFSC A2 BSF STATUS,5 ;bank 1
_WDT_OFF & _XT_OSC am3b BTFSS A2 GOTO pm21 MOVLW B'11111111'
;___________________________ GOTO am3b MOVLW B'00001011' MOVWF TRISA
; Input pin configuration MOVLW B'00000101' MOVWF PORTB MOVLW B'00100000'
#DEFINE A0 PORTA,0 ; MOVWF PORTB pm23 BTFSC A3 MOVWF TRISB
#DEFINE A1 PORTA,1 am4a BTFSC A2 GOTO pm23 BCF STATUS,5 ;bank 0
#DEFINE A2 PORTA,2 GOTO am4a MOVLW B'00000011' ;------------------------------------
#DEFINE A3 PORTA,3 am4b BTFSS A3 MOVWF PORTB ; initialize and wait
#DEFINE start PORTA,4 GOTO am4b pm24 BTFSC A0 CLRF PORTB
;----------------------------- --------- MOVLW B'00001010' GOTO pm24 wait BTFSS start
; setting the ports MOVWF PORTB pm24b BTFSS A1 GOTO wait
;--------------------------------------- am6a BTFSS A0 GOTO pm24b CLRF PORTB
BSF STATUS,5 ;bank 1 GOTO am6a MOVLW B'00001010' ;-------------------------------------
CLRF TRISB am6b BTFSS A2 MOVWF PORTB ; MAIN
MOVLW B'11111111' GOTO am6b ;--- -------MAIN ENDS------ ;------------------------------------
MOVWF TRISA MOVLW B'00000101' GOTO wait main
MOVWF PORTB END am2 BTFSS A2
BCF STATUS,5 ;bank 0 am7 BTFSC A0 B-9: Gas Thermal Plant driver GOTO am2
;---------------------------------- GOTO am7 ; IC N6 : Monitors Gas thermal am2b BTFSS A0
; initialize and wait am7b BTFSS A1 ;plant Each hour is assigned a set GOTO am2b
CLRF PORTB GOTO am7b ;of input pins for indication MOVLW B'00000100'
wait BTFSS start MOVLW B'00001110' ;purpose Turns on appropriate MOVWF PORTB
GOTO wait MOVWF PORTB ;generator ;upon IC 4 request am3 BTFSC A2
CLRF PORTB am9a BTFSC A2 ;___________________________ GOTO am3
;------------------------------------ GOTO am9a LIST P=16F84, F=INHX8M, CLRF PORTB
; MAIN am9b BTFSS A1 r=dec am5 BTFSS A3
;------------------------------------- GOTO am9b include "P16F84.inc" GOTO am5
main am9c BTFSS A3 __CONFIG _PWRTE_ON & MOVLW B'00001000'
am1a BTFSS A0 GOTO am9c _WDT_OFF & _XT_OSC MOVWF PORTB
GOTO am1a MOVLW B'00001011' ;___________________________ am6 BTFSC A3
am1b BTFSS A2 MOVWF PORTB ; Input pin configuration GOTO am6
GOTO am1b am12 BTFSC A3 #DEFINE A0 PORTA,0 ; am6b BTFSS A1
MOVLW B'00000101' GOTO am12 #DEFINE A1 PORTA,1 GOTO am6b
MOVWF PORTB am12b BTFSS A2 #DEFINE A2 PORTA,2 MOVLW B'00000010'
am2a BTFSC A0 GOTO am12b #DEFINE A3 PORTA,3 MOVWF PORTB

54 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

am7 BTFSC A1 pm15b BTFSS A3 GOTO pm22a request of ;IC 4


GOTO am7 GOTO pm15b pm22b BTFSS A3 ;___________________________
CLRF PORTB MOVLW B'00001100' GOTO pm22b LIST P=16F84, F=INHX8M,
am8 BTFSS A1 MOVWF PORTB MOVLW B'00001001' r=dec
GOTO am8 pm16a BTFSS A1 MOVWF PORTB include "P16F84.inc"
MOVWF PORTB GOTO pm16a pm23a BTFSC A3 __CONFIG _PWRTE_ON &
am9a BTFSS A0 pm16b BTFSS A0 GOTO pm23a _WDT_OFF & _XT_OSC
GOTO am9a GOTO pm16b pm23 BTFSS A1 ; __________________________
am9b BTFSS A3 MOVLW B'00001111' GOTO pm23 ; Input pin configuration
GOTO am9b MOVWF PORTB MOVLW B'00000010' #DEFINE A0 PORTA,0 ;
MOVLW B'00001001' pm17a BTFSC A3 MOVWF PORTB #DEFINE A1 PORTA,1
MOVWF PORTB GOTO pm17a pm24 BTFSS A0 #DEFINE A2 PORTA,2
inc BTFSS PORTB,5 pm17b BTFSS A0 GOTO pm24 #DEFINE A3 PORTA,3
GOTO inc GOTO pm17b MOVLW B'00000010' #DEFINE start PORTA,4
MOVLW B'00001101' MOVLW B'00000111' MOVWF PORTB N1 equ 0x0F
MOVWF PORTB MOVWF PORTB ;------------MAIN ENDS-------- N2 equ 0x0E
;BTFSC PORTB,5 pm18a BTFSS A3 GOTO wait N3 equ 0x0C
GOTO ok GOTO pm18a pause MOVWF N3 ; setting the ports
am10a BTFSC A0 pm18b BTFSS A2 MOVLW D'255' ; 3s ;----------------------------------
GOTO am10a GOTO pm18b MOVWF N1 BSF STATUS,5 ;bank 1
am10b BTFSS A3 MOVLW B'00001111' MOVLW D'131' MOVLW B'11111111'
GOTO am10b MOVWF PORTB MOVWF N2 MOVWF TRISA
MOVLW B'00001010' pm19 BTFSC A0 loop DECFSZ N1 MOVLW B'00100000'
MOVWF PORTB GOTO pm19 GOTO loop MOVWF TRISB
am11 BTFSC A1 pm19b BTFSS A1 MOVLW D'255' BCF STATUS,5 ;bank
GOTO am11 GOTO pm19b MOVWF N1 ;---------------------------------
CLRF PORTB MOVLW B'00001110' DECFSZ N2 ; initialize and wait
am12 BTFSS A0 MOVWF PORTB GOTO loop CLRF PORTB
GOTO am12 MOVLW D'20' MOVLW D'131' wait BTFSS start
MOVLW B'00000001' CALL pause MOVWF N2 GOTO wait
MOVWF PORTB MOVLW B'00000110' DECFSZ N3 CLRF PORTB
pm13 BTFSS A1 MOVWF PORTB GOTO loop ;---------------------------------
GOTO pm13 MOVLW D'10' RETURN ; MAIN
MOVLW B'00000011' CALL pause END ;---------------------------------
MOVWF PORTB MOVLW B'01000110' B-10: Heavy Fuel Thermal main
pm14 BTFSC A1 MOVWF PORTB Plant driver am2a BTFSS A0
GOTO pm14 pm21 BTFSC A2 ;IC N7: Drives the Heavy Fuel GOTO am2a
MOVLW B'00000001' GOTO pm21 thermal ;plant (HFO)Each hour is am2b BTFSS A1
MOVWF PORTB MOVLW B'00001010' assigned a set of ;input bits for GOTO am2b
pm15a BTFSC A0 MOVWF PORTB indication purpose Turns on MOVLW B'0000001'
GOTO pm15a pm22a BTFSC A1 ;appropriate generator upon the MOVWF PORTB

55 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

; am3 BTFSC A0 CLRF PORTB ;----------MAIN ENDS-------- N2 equ 0x0E


GOTO am3 pm18a BTFSS A0 ;IJKL GOTO wait N3 equ 0x0C
CLRF PORTB GOTO pm18a pause MOVWF N3 BSF STATUS,5 ;bank 1
inc BTFSS PORTB,5 pm18b BTFSS A1 MOVLW D'255' ;3s MOVLW B'11111111'
GOTO inc GOTO pm18b MOVWF N1 MOVWF TRISA
BSF PORTB,1 pm18c BTFSS A2 MOVLW D'131' MOVLW B'00100000'
ok BTFSC PORTB,5 GOTO pm18c MOVWF N2 MOVWF TRISB
GOTO ok pm18d BTFSS A3 loop DECFSZ N1 BCF STATUS,5 ;bank 0
CLRF PORTB GOTO pm18d GOTO loop ;---------------------------------- -
am10 BTFSS A1 MOVLW B'00001111' MOVLW D'255' ; initialise and wait
GOTO am10 MOVWF PORTB MOVWF N1 CLRF PORTB
MOVLW B'00000010' pm19 BTFSC A2 DECFSZ N2 wait BTFSS start
MOVWF PORTB GOTO pm19 GOTO loop GOTO wait
am11a BTFSC A1 CLRF PORTB MOVLW D'131' CLRF PORTB
GOTO am11a pm21 BTFSS A1 ;J MOVWF N2 ;--------------------------------
am11 BTFSS A0 GOTO pm21 DECFSZ N3 ; MAIN
GOTO am11 BSF PORTB,1 GOTO loop ;-------------------------------
MOVLW B'00000001' MOVLW D'10' RETURN main
MOVWF PORTB CALL pause ;1s END inc BTFSS PORTB,5
am12 BTFSC A0 CLRF PORTB B-11: Light Fuel Thermal Plant GOTO inc
GOTO am12 MOVLW D'10' driver BSF PORTB,1;
CLRF PORTB CALL pause ; IC N8: Drives the light Fuel ok BTFSC PORTB,5;
pm13 BTFSS A0 MOVLW B'01000000' thermal plant (LFO) ;Each hour is GOTO ok
GOTO pm13 MOVWF PORTB assigned a set of input bits for CLRF PORTB
MOVLW B'00000001' pm22 BTFSC A1 indication purpose pm18a BTFSS A0
MOVWF PORTB GOTO pm22 ;Turns on appropriate generator GOTO pm18a
pm14 BTFSC A0 CLRF PORTB upon the request of IC 4 pm18b BTFSS A1
GOTO pm14 incc BTFSS PORTB,5 ___________________________ GOTO pm18b
CLRF PORTB GOTO incc LIST P=16F84, F=INHX8M, MOVLW B'00000001'
pm15 BTFSS A0 BSF PORTB,1;+10 r=dec MOVWF PORTB
GOTO pm15 okc BTFSC PORTB,5 include "P16F84.inc" pm19 BTFSC A0
MOVLW B'00000001' GOTO okc __CONFIG _PWRTE_ON & GOTO pm19
MOVWF PORTB CLRF PORTB _WDT_OFF & _XT_OSC CLRF PORTB
pm16a BTFSC A0 pm23 BTFSS A0 ;__________________________ pm21 BTFSS A3
GOTO pm16a GOTO pm23 ; Input pin configuration GOTO pm21
pm16 BTFSS A2 BSF PORTB,0 #DEFINE A0 PORTA,0 ; MOVLW B'00001000'
GOTO pm16 pm24 BTFSC A0 #DEFINE A1 PORTA,1 MOVWF PORTB
MOVLW B'00000100' GOTO pm24 #DEFINE A2 PORTA,2 CALL delay
MOVWF PORTB MOVLW D'2' #DEFINE A3 PORTA,3 CLRF PORTB
pm17 BTFSC A2 CALL pause #DEFINE start PORTA,4 ;----------MAIN ENDS--------
GOTO pm17 CLRF PORTB N1 equ 0x0F GOTO wait

56 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

delay MOVLW D'255' #DEFINE A PORTC,0 ; ;----------------------------------- MOVWF PORTB


MOVWF N1 #DEFINE Bb PORTC, ; MAIN MOVLW B'00010000'
MOVLW D'131' #DEFINE Cc PORTC, ;---------------------------------- MOVWF PORTA
MOVWF N2 #DEFINE Dd PORTC, main am6a BTFSC H
MOVLW D'10' ;1S #DEFINE E PORTC,4 am1a BTFSS A GOTO am6a
MOVWF N3 #DEFINE F PORTC,5 GOTO am1a am6b BTFSS Cc
loop DECFSZ N1 #DEFINE Gg PORTC,6 am1b BTFSS Cc GOTO am6b
GOTO loop #DEFINE H PORTC,7 GOTO am1b am6c BTFSS F
MOVLW D'255' #DEFINE I PORTD,0 ; MOVLW B'00000011' GOTO am6c
MOVWF N1 #DEFINE J PORTD,1 MOVWF PORTB MOVLW B'00100000'
DECFSZ N2 #DEFINE K PORTD,2 MOVLW B'00000011' MOVWF PORTB
GOTO loop #DEFINE L PORTD,3 MOVWF PORTA MOVLW B'00100000'
MOVLW D'131' #DEFINE M PORTD,4 am2a BTFSC A MOVWF PORTA
MOVWF N2 #DEFINE N PORTD,5 GOTO am2a am7a BTFSC A
DECFSZ N3 #DEFINE O PORTD,6 am2b BTFSS Gg GOTO am7a
GOTO loop #DEFINE Pp PORTD,7 GOTO am2b am7b BTFSS Dd
RETURN #DEFINE start PORTB,7 am2c BTFSS I GOTO am7b
END ;--------------------------------- GOTO am2c MOVLW B'00000011'
B-12: Production ; setting the ports MOVLW B'00000010' MOVWF PORTB
;IC N9: Provides measure of the ;---------------------------------- MOVWF PORTB MOVLW B'00000011'
;generated power Assume two BANKSEL TRISB ;bank 1 MOVLW B'00000010' MOVWF PORTA
consecutive ;hours have ABCHG MOVLW B'00000110' MOVWF PORTA pat BTFSS J
and ABCDF. the first ;shall have MOVWF ADCON1 am3a BTFSC I GOTO pat
the combination ABCHG and ;the CLRF TRISA GOTO am3a BSF PORTE,2
second, just DF because ABC are CLRF TRISE am3b BTFSS Cc pat2 BTFSC J
;already/still(HG off) ON see 4 MOVLW B'11000000' GOTO am3b GOTO pat2
;and ;5am(we just add). pm17 MOVWF TRISB MOVLW B'00000100' BCF PORTE,2
BTFSC H=being MOVLW B'11111111' MOVWF PORTB am8 BTFSS F
;previously on ;and the MOVWF TRISC MOVLW B'00000100' GOTO am8
combination at ;pm17 having MOVWF TRISD MOVWF PORTA MOVLW B'00000101'
;nothing not figuring in the BANKSEL PORTB ;bank 0 am4a BTFSC A MOVWF PORTB
;pm16 combination, let's then use ;---------------------------------- GOTO am4a MOVLW B'00000100'
the one ;that when off ; initialize and wait am4b BTFSS Dd MOVWF PORTA
;___________________________ CLRF PORTB GOTO am4b pata BTFSS N
LIST P=16F877, F=INHX8M, CLRF PORTA MOVLW B'00001000' GOTO pata
r=dec CLRF PORTE MOVWF PORTB BSF PORTE,2
include "P16F877.inc" wait BTFSS start MOVLW B'00001000' patb BTFSC N
__CONFIG _PWRTE_ON & GOTO wait MOVWF PORTA GOTO patb
_WDT_OFF & _XT_OSC CLRF PORTB am5 BTFSS H BCF PORTE,2
;___________________________ CLRF PORTA GOTO am5 am9a BTFSC F
; Input pin configuration CLRF PORTE MOVLW B'00010000' GOTO am9a

57 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

am9b BTFSS E GOTO pm13b pm18a BTFSS H MOVLW B'00001100'


GOTO am9b MOVLW B'00001010' GOTO pm18a MOVWF PORTA
am9c BTFSS H MOVWF PORTB pm18b BTFSS I remb BTFSC J;-10MMW
GOTO am9c MOVLW B'00001000' GOTO pm18b GOTO remb
MOVLW B'00001001' MOVWF PORTA pm18c BTFSS J BSF PORTE,0
MOVWF PORTB pm14 BTFSC F GOTO pm18c pm22a BTFSC F
MOVLW B'00001000' GOTO pm14 pm18d BTFSS K GOTO pm22a
MOVWF PORTA pm14b BTFSS Dd GOTO pm18d pm22 BTFSS E
pat1 BTFSS Gg GOTO pm14b pm18e BTFSS L GOTO pm22
GOTO pat1 MOVLW B'00010010' GOTO pm18e MOVLW B'00000111'
BSF PORTE,2 MOVWF PORTB pm18f BTFSS M MOVWF PORTB
pat1a BTFSC Gg MOVLW B'00010000' GOTO pm18f MOVLW B'00010000'
GOTO pat1a MOVWF PORTA MOVLW B'00100100' MOVWF PORTA
BCF PORTE,2 pm15a BTFSC E MOVWF PORTB CLRF PORTE
am10a BTFSC E GOTO pm15a MOVLW B'00100000' patd BTFSS J
GOTO am10a pm15b BTFSS H MOVWF PORTA GOTO patd
am10b BTFSS J GOTO pm15b pm19a BTFSC E BSF PORTE,2
GOTO am10b pm15c BTFSS I GOTO pm19a pate BTFSC J
MOVLW B'00010001' GOTO pm15c pm19b BTFSC I GOTO pate
MOVWF PORTB MOVLW B'00100010' GOTO pm19b BCF PORTE,2
MOVLW B'00010000' MOVWF PORTB pm19c BTFSC M pm23 BTFSC Dd
MOVWF PORTA MOVLW B'00100000' GOTO pm19c GOTO pm23
am11 BTFSC F MOVWF PORTA MOVLW B'00011000' pm23a BTFSS F
GOTO am11 pm16a BTFSS E MOVWF PORTB GOTO pm23a
am11b BTFSS I GOTO pm16a MOVLW B'00010010' pm23b BTFSS I
GOTO am11b pm16b BTFSS F MOVWF PORTA GOTO pm23b
MOVLW B'00100001' GOTO pm16b pm20 BTFSS Pp MOVLW B'00001110'
MOVWF PORTB pm16c BTFSS K GOTO pm20 MOVWF PORTB
MOVLW B'00100000' GOTO pm16c MOVLW B'00101000' MOVLWB'00100000' ;
MOVWF PORTA MOVLW B'00001100' MOVWF PORTB MOVWF PORTA
am12a BTFSC Dd MOVWF PORTB MOVLW B'00100000' pm24a BTFSC A
GOTO am12a MOVLW B'00001010' MOVWF PORTA GOTO pm24a
am12b BTFSS E MOVWF PORTA rem BTFSC H ;-15MW pm24 BTFSS Dd
GOTO am12b pm17 BTFSC H GOTO rem GOTO pm24
MOVLW B'00000110' GOTO pm17 BSF PORTE,1 MOVLW B'00011100'
MOVWF PORTB pm17b BTFSS E pm21 BTFSC Pp MOVWF PORTB
MOVLW B'00000110' GOTO pm17b GOTO pm21 MOVLW B'00000010'
MOVWF PORTA MOVLW B'00010100' pm21b BTFSS J MOVWF PORTA
pm13a BTFSS F MOVWF PORTB GOTO pm21b ;------MAIN ENDS-------
GOTO pm13a MOVLW B'00010000' MOVLW B'00110000' GOTO wait
pm13b BTFSS I MOVWF PORTA MOVWF PORTB END

58 |Written and presented by KEMTA Arthur


THEME : POWER TRANSMISSION/DISTRIBUTION AUTOMATION

59 |Written and presented by KEMTA Arthur

Vous aimerez peut-être aussi