You are on page 1of 13

ELECTRI

CITYBI
LL

I
ntr
oduct
ion:
Elect
rici
tygener at
ionist heprocessofgener atingelectri
cpowerfrom
sourcesofpr i
maryener gy.Forelectr
icutil
it
iesi ntheelect r
icpower
i
ndust ry
,itisthefi
rststagei nthedeliveryofel ectr
icit
yt oendusers,
the
otherstagesbei ngtransmi ssi
on,dist
ributi
on, energyst orageand
recovery,usingpumped- st
oragemet hods.

Achar acteri
sti
cofelectri
cityi
sthati
tisnotapr imaryenergyf r
eel
y
presentinnaturei
nr emar kabl
eamount sanditmustbepr oduced.
Productioniscarr
iedouti npowerplants.El
ectri
cit
yismostof t
en
generatedatapowerst ati
onbyelectr
omechani calgenerators,
pri
mari
ly
dri
venbyheatengi nesf ueledbycombust i
onornucl earf
issionbutal
so
byothermeanssuchast hekineti
cenergyofflowingwat erandwind.
Otherener gysour
cesi ncl
udesolarphotovolt
aicsandgeot hermalpower.

El
ect
ri
cit
yBi
l
l:
AschemeofEl ectri
ci
tybill
i
ngsy st em call
ed“ PREPAI DENERGYMETER
WITHTARIFFI NDICATOR”canf aci l
i
tateinimpr ovedcashflow
managementinener gyutil
it
iesandcanr educespr obl
em associated
wit
hbil
li
ngconsumerl iv
ingi nisolatedareaandr educesdeploymentof
manpowerfort aki
ngmet erreadings.Ev eryconsumercanbuyamemor y
car
d(isnot
hingbutanEEPROM I C)wi thapasswor dstor
edi nsideit
usi
ngaMCpr ogram.Thememor ycar disav ail
ableatvar
iousr anges(i
e.
Rs50,Rs100, Rs200etc…) .

Inourpr ojectwehav egi vent henamef ormemor ycar dassmar tcar d.


Whent heconsumeri nsertasmar tcar dintot hecar dr eaderwhi chi s
connect edi n“prepaidener gymet erwi thtarif
findicat or”kit
.Thent he
car dreaderwi llr
eadt hest oredinf ormat i
onanddel et ethei nf
ormat i
on
from t heEEPROM I C( smar tcard)usi ngt heMCpr ogr am.Sot hatthe
smar tcar dcannotber eusedbyot hers.Supposei faconsumerbuy sa
car dforRs. 50/-he/shecani nsertt hisamountt hrought hecardr eader
sot hatpr epaidenergymet erwi tht ari
ffindicatorkitwi llbeactivat
ed.
Accor dingt othepowerconsumpt iont heamountwi llber educed.When
theamounti sover,ther elaywi ll
saut omat i
callyshut downt hewhol e
sy stem.I nourprojectweal sohav eapr ov i
siontogi veanal arm soundt o

Semest
erI
II
,Depar
tmentOfI
nfor
mat
ionTechnol
ogy
Page1
ELECTRI
CITYBI
LL

consumerbef
oret
hewhol
eamounti
sreduced.

Woki
ngPr
inci
ple:
VARI
ABLE:Avar
iabl
eisnot
hingbutanamegi
vent
oast
oragear
ea
thatourprogramscanmanipul
ate.Eachv ar
iabl
ei nChasaspeci f
ictype,
whichdeterminesthesi
zeandlayoutofthev ar
iable'
smemor y
;therange
ofvaluesthatcanbestor
edwit
hint hatmemor y;andthesetof
operati
onsthatcanbeappli
edtothev ar
iabl
e.

i
ntpr
evi
ous,
present
,di
ff
erence;

charmont
h,f
ir
st_
name,
l
ast
_name;

f
loatnet
_amount
;

doubl
eno;

Theline ntp
i rev
ious,present,dif
fer
ence;
 decl
aresanddefinesthevar
iables
previous,presentand di ffer
ence whi
ch inst
ructthe compil
erto create
var
iablesnamedprevi
ous,presentanddif
ferenceoftypei
nt.

St
ri
ng:
Ast r
ingisdefi
nedasacont iguoussequenceof 
codeunits t
erminat
ed
bythef i
rstzer
ocodeuni t(oftencall
edt NUL 
he  codeunit)
.Thismeansa
str
ingcannotcont ai
nt hezer ocodeunit,ast
hefirstoneseenmar ksthe
endoft hestri
ng.The l
engt h ofastri
ngisthenumberofcodeuni ts
[
1]
beforethezerocodeuni t.  Thememor yoccupiedbyast ri
ngisalways
onemor ecodeunitthant hel engt
h,asspaceisneededtostorethezero
ter
mi nator
.
Generallyifyouseethet erm stri
ng i
tmeansast r
ingwher ethecodeuni
t
i
soft ype char,whi
chi sexactly8bi t
sonal l
modern
machines.  
C90 def
ines widest r
ings whichuseacodeuni tof
ty
pe wchar _t,whi
chis16or32bi tsonmoder nmachines.Thiswas
i
ntendedf or Uni
code butitisincreasinglycommont ouse UTF-8 
in
normal str
ingsforUnicodei nstead.
St
ri
ngsarepassedtofuncti
onsbypassingapointert
ot hefi
rstcodeunit
.
Si
nce 
char*
 and 
w_char*
 ar
ediffer
entt
ypes,thefunct
ionsthatprocess
wi
destri
ngsaredif
fer
entthantheonesprocessi
ngnor malstri
ngsand
Semest
erI
II
,Depar
tmentOfI
nfor
mat
ionTechnol
ogy
Page2
ELECTRI
CITYBI
LL

hav
edi
ff
erentnames.

Themor
ecommonl
y-
usedst
ri
ngf
unct
ions[
edi
t]
Theni
nemostcommonl
yusedf
unct
ionsi
nthest
ri
ngl
i
brar
yar
e:

 st
rcat
 -concat
enat
etwost
ri
ngs

 st
rchr
 -st
ri
ngscanni
ngoper
ati
on

 st
rcmp 
-compar
etwost
ri
ngs

 st
rcpy
 -copyast
ri
ng

 st
rl
en 
-getst
ri
ngl
engt
h

 st
rncat
 -concat
enat
eonest
ri
ngwi
thpar
tofanot
her

 st
rncmp 
-compar
epar
tsoft
wost
ri
ngs

 st
rncpy
 -copypar
tofast
ri
ng

 st
rrchr
 -st
ri
ngscanni
ngoper
ati
on

L
ink
edL
ist
:
Ali
nkedli
stisasequenceofdat
ast
ruct
ures,whi
char
econnect
ed
t
oget
herv
iali
nks.
Li
nkedLi sti
sasequenceofl i
nkswhi chcontai
nsit
ems.Eachli
nk
contai
nsaconnectiontoanotherli
nk.Linkedl
isti
sthesecondmost-
useddatastruct
ureafterar
ray.Foll
owingaretheimport
antter
msto
underst
andtheconceptofLi
nkedList.
 Li
nk 
−Eachl
i
nkofal
i
nkedl
i
stcanst
oreadat
acal
l
edanel
ement
.
 Next 
−Eachli
nkofal
i
nkedl
i
stcont
ainsal
i
nkt
othenextl
i
nk
cal
ledNext
.
 Li
nkedLi
st 
−ALi nkedLi
stcont
ainst
heconnect
ionl
i
nkt
othef
ir
st
li
nkcall
edFir
st.

Semest
erI
II
,Depar
tmentOfI
nfor
mat
ionTechnol
ogy
Page3
ELECTRI
CITYBI
LL

L
ink
edL
istRe
pre
sent
ati
on
Li
nkedli
stcanbev isual
i
zedasachai
nofnodes,wher
eev
erynode
poi
ntst
othenextnode.

Ty
pesofL
ink
edL
ist
Fol
l
owi
ngar
ethev
ari
oust
ypesofl
i
nkedl
i
st.
 Si
mpl
eLi
nkedLi
st 
−It
em nav
igat
ioni
sfor
war
donl
y.
 Doubl
y Linked Li
st 
−It
ems can be nav
igat
ed f
orwar
d and
backwar
d.
 Ci
rcul
arLinkedLi
st 
−Lasti
tem cont
ainsli
nkoft
hef i
rstel
ement
asnextandt hefi
rstel
ementhasal inkt
othelastelementas
pr
ev i
ous.

Al
gor
it
hm:
St
ep1:
star
t

St
ep2:
Acceptanyoneoft
heopt
ion

1.Gener
ati
ngEl
ect
ri
cit
ybi
l
lfornewmachi
ne

2.Di
spl
ayi
ngofEl
ect
ri
cit
ybi
l
l

3.Changi
ngDet
ail
s

St
ep3:
Ent
erdet
ail
sforanyoft
heopt
ionment
ionabov
e.

St
ep4:
Displ
ayt
hegener
atedBi
l
l.

St
ep5:
Iff
eltnecessar
ytomodi
fyt
hedet
ail
s.

St
ep6.
Displ
aymodi
fi
edbi
l
l.

St
ep7.
stop
Semest
erI
II
,Depar
tmentOfI
nfor
mat
ionTechnol
ogy
Page4
ELECTRI
CITYBI
LL

Fl
owchar
t

Semest
erI
II
,Depar
tmentOfI
nfor
mat
ionTechnol
ogy
Page5
ELECTRI
CITYBI
LL

}
*st
art
=NULL,
*p,
*q,
*r
;

f
loatgener
atebi
l
l(i
nta,
i
ntb)

i
ntpr
e=a;

i
ntpuni
t=b;

i
ntdi
ff
;

f
loatr
tn=0;

di
ff
=pr
e-puni
t;

i
f(
dif
f<20)

Sour
ceCode:
r
tn=di
ff
*4.
75;
#i
ncl
ude<coni
o.h>
r
etur
nrt
n;
#i
ncl
ude<st
dio.
h>
}
#i
ncl
ude<st
dli
b.h>
el
se
#i
ncl
ude<st
ri
ng.
h>
{
st
ructnode
r
tn=20*
4.75+(
dif
f-
20)
*7.
75;
{

i
nty
ear
,di
ff
;
r
etur
nrt
n;
charf
name[
20]
;
}
charl
name[
20]
,
mont
h[10]
;
}
i
ntp_
uni
t,
pre_
uni
t;
v
oidmai
n()
l
ongnumber
;
{
charcont
act
[20]
;
int
st
ructnode*
next
;
ch,
i
,dat
e,z,
prev
ious,
present
,di
ff
,f
lag=0,
f
loatt
otal
; c;

Semest
erI
II
,Depar
tmentOfI
nfor
mat
ionTechnol
ogy
Page6
ELECTRI
CITYBI
LL

f
loatnet
_amt
=0.
0; pri
ntf
("\
n\tEnt
ert
henamef
ir
st
name:
")
;
l
ongno,
dpl
,
det
ail
s;
scanf
("%s"
,f
ir
st)
;
charcont
act
[20]
;
pr
int
f("
\n"
);
char
month[10]
,f
ir
st[
20]
,
fname[
20]
,
last
[20]
,
l pr
int
f("
\tEnt
ert
heLastname:
")
;
name[20];
scanf
("%s"
,l
ast
);
do
pr
int
f("
\n"
);
{
pri
ntf
("\
n\tEnt
ert
heCont
act
cl
rscr
(); number
:")
;

pri
ntf
("\
t--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
- scanf
("%s"
,&cont
act
);
-
--
--
--
--
--
--
--
--
---
")
;
pr
int
f("
\n\
tEnt
ert
heMont
h:"
);
pri
ntf
("\
n\t\t
\tBI
LLOFELECTRI
CITY
SUPPLY"); scanf
("%s"
,mont
h);

pri
ntf
("\
n\t-
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
- pr
int
f("
\n\
tEnt
ert
hey
ear
:"
);
-
--
--
--
--
--
--
--
--
--
--
--
"); /
/pr
int
f("
\n"
);
pr
int
f("
\n\
tMAI
NMENU"
); scanf
("%d"
,&dat
e);
pri
ntf
("\
n\n\
t1.
Gener
ati
ngEl
ect
ri
cit
y /
/pr
int
f("
\n"
);
bi
l
lfornewmachine"
);
pri
ntf
("\
n\tEnt
ert
hemet
er
pri
ntf
("\
n\n\
t2.
Displ
ayi
ngofEl
ect
ri
cit
y Number:
")
;
bi
l
l");
/
/pr
int
f("
\n"
);
pr
int
f("
\n\
n\t
3.Changi
ngDet
ail
s")
;
scanf
("%l
d",
&no)
;
scanf
("%d"
,&ch)
;
pr
int
f("
\n"
);
swi
tch(
ch)
pri
ntf(
"\n\
tEntert
hepr
evi
ous
{ uni
tsandpresentuni
ts:
")
;
case1:
clr
scr
(); /
/ pr
int
f("
\n"
);
pri
ntf
("\
t--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
-
--
--
--
--
--
---
--
--
--
--
--
---
--
--
")
; scanf
("%d%d"
,&pr
evi
ous,
&pr
esent
);
pri
ntf
("\n\
tEntert
hedet
ail
sfor pr
int
f("
\n"
);
gener
atingElectr
ici
tyBi
ll
")
;

pri
ntf
("\
n\t-
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
-- net
_amt
=gener
atebi
l
l(pr
esent
,pr
evi
ous)
-
--
--
--
--
--
---
--
--
--
--
--
---
--
--
--
-"
); ;

Semest
erI
II
,Depar
tmentOfI
nfor
mat
ionTechnol
ogy
Page7
ELECTRI
CITYBI
LL

di
ff
=pr
esent
-pr
evi
ous; p-
>next
=NULL;

p=mal
l
oc(
sizeof
(st
ructnode)
); st
rcpy
(q-
>fname,
fi
rst
);

i
f(
star
t==NULL) st
rcpy
(q-
>lname,
l
ast
);

{ p-
>pr
e_uni
t=pr
esent
;

st
art
=p; p-
>p_
uni
t=pr
evi
ous;

p-
>next
=NULL; p-
>number
=no;

st
rcpy
(p-
>cont
act
,cont
act
);

st
rcpy
(p-
>fname,
fi
rst
); /
/p-
>cont
act
=cont
act
;

st
rcpy
(p-
>lname,
l
ast
); st
rcpy
(p-
>mont
h,mont
h);

p-
>pr
e_uni
t=pr
esent
; p-
>tot
al=net
_amt
;

p-
>p_
uni
t=pr
evi
ous; p-
>year
=dat
e;

p-
>number
=no; p-
>di
ff
=di
ff
;

st
rcpy
(p-
>cont
act
,cont
act
);

/
/p-
>cont
act
=cont
act
; }

st
rcpy
(p-
>mont
h,mont
h); br
eak;

p-
>tot
al=net
_amt
; case2:

p-
>year
=dat
e;

p-
>di
ff
=di
ff
; pri
ntf
("\
n\t-
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
-
-
--
--
--
--
--
--
--
--
--
--
--
--
---
--
--
--
-"
);
}
pr
int
f("
\n\
t\t
\tEnt
erthemet
er
el
se numberyouwanttodispl
ay"
);
{ pri
ntf
("\
n\t-
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
-
q=st
art
; -
--
--
--
--
--
--
--
--
--
--
--
--
---
--
--
--
-"
);

whi
l
e(q-
>next
!=NULL) scanf
("%l
d",
&dpl
);

{ q=st
art
;

q=q-
>next
; whi
l
e(q-
>next
==NULL)

} {

q-
>next
=p; i
f(
dpl
==q-
>number
)

Semest
erI
II
,Depar
tmentOfI
nfor
mat
ionTechnol
ogy
Page8
ELECTRI
CITYBI
LL

{ pr
int
f("
\n\
t\t
\t\
tYOURPOWER
BI
LL"
);
f
lag=1;
pri
ntf
("\
n\t-
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
-
br
eak; -
--
--
--
--
--
--
--
--
--
--
--
--
---
--
--
--
-"
);
} pri
ntf
("\
n\t-
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
-
q=q-
>next
; -
--
--
--
--
--
--
--
--
--
--
--
--
---
--
--
--
-"
);

} pri
ntf
("\
n\t
|CurrentBil
l
Amount
: |%f",
p->t
otal)
;
i
f(
fl
ag==1)
pri
ntf
("\
n\t
|Netot
her
schar
ges:
{ |00.
00"
);

pri
ntf
("\
n\t-
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
- pri
ntf
("\
n\t
|Passdues:
-
--
--
--
--
--
--
--
--
--
--
--
--
---
--
--
--
-"
); |00.
00"
);

pri
ntf
("\
n\ t
\t\
tDI
SPLAYI
NG pr
int
f("
\n\
t|TotalAmount
ELECTRICI
TYBI LL")
; Pay
abl
e |%f",
p->t
otal)
;

pri
ntf
("\
n\t-
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
- pr
int
f("
\n\t
| Bil
lAmountAf
ter
-
--
--
--
--
--
--
--
--
--
--
--
--
---
--
--
--
-"
); duedat
es:|%f ",
p->tot
al+560)
;

pr
intf
("\
n\n\
t|NAME: pri
ntf
("\
n\t-
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
-
| %s",q-
>fname); -
--
--
--
--
--
--
--
--
--
--
--
--
---
--
--
--
-"
);

pr
int
f("
\n\
t|Lastname: }
| %s",
q->l
name);
br
eak;
pri
ntf
("\n\
t|Cont
actnumber
:
| %s"
,q-
>contact)
; case3:

pri
ntf
("\
n\t|
METERNO: pr
int
f("
\n\
tEnt
ertheMet
er
| %ld"
,q-
>number)
; numbert
ochangedet
ail
s")
;

pr
int
f("
\n\t|
BILLMONTH: scanf
("%l
d",
&det
ail
s);
| %s",
q->month)
; q=st
art
;
pr
int
f("\
n\t|Measur
esUni
ts: whi
l
e(q-
>next
==NULL)
| %d",
q->di
ff)
;
{
pr
int
f("\
n\t|
Prev
iusUni
ts:
| %d",
q->p_uni
t)
; i
f(
q->number
==det
ail
s)

pr
int
f("\
n\t|Uni
tsBi
l
led: | {
%d",
q->di
ff)
;
pr
int
f("
\n\t
***
whi
chdet
ail
syou
pri
ntf
("\
n\t-
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
- wantt
ochange")
;
-
--
--
--
--
--
--
--
--
--
--
--
--
---
--
--
--
-"
);

Semest
erI
II
,Depar
tmentOfI
nfor
mat
ionTechnol
ogy
Page9
ELECTRI
CITYBI
LL

pr
int
f("
\n\
t1.
fi
rstname"
); br
eak;

pr
int
f("
\n\
t2.
lastname"
); case3:

pr
int
f("
\n\
t3.
cont
act
"); pr
int
f("
\n\
tEnt
ernew
cont
actname")
;
scanf
("%d"
,&c)
;
scanf
("%s"
,cont
act
);
swi
tch(
c)
strcpy(q
{ -
>cont
act
,contact);
case1: br
eak;
pr
int
f("
\n\
tEnt
ernew def
aul
t:
f
ir
stname"
);
pr
int
f("
\n\
tEr
ror
");
scanf
("%s"
,f
name)
;
br
eak;
st
rcpy
(q-
>fname,
fname)
;
}
br
eak;
}
case2:
el
se
pr
int
f("
\n\
tEnt
ernewl
ast
name"
); {

scanf
("%s"
,l
name)
; pr
int
f("
Wrongi
nput
");

st
rcpy
(q-
>lname,
l
name)
; }

br
eak; scanf
("%d"
,&z)
;

} }
whi
l
e(z==1)
;

pr
int
f("
\n\
tDoy
ouwantt
o get
ch(
);
cont
inue"
);
}
pr
int
f("
\n\
tTocont
inueEnt
er1"
);

Semest
erI
II
,Depar
tmentOfI
nfor
mat
ionTechnol
ogy
Page10
ELECTRI
CITYBI
LL

Pr
ogr
am out
put
:

Semest
erI
II
,Depar
tmentOfI
nfor
mat
ionTechnol
ogy
Page11
ELECTRI
CITYBI
LL

Semest
erI
II
,Depar
tmentOfI
nfor
mat
ionTechnol
ogy
Page12
ELECTRI
CITYBI
LL

Fut
uredev
elopment
s(Opt
ional
):
Concl
usi
on:
Ref
erences:
(Atl
east5)
Anyot
heri
nfor
mat
ion(
Opt
ional
):

Semest
erI
II
,Depar
tmentOfI
nfor
mat
ionTechnol
ogy
Page13

You might also like