General discussion

Locked

How can I generate the Water Consumption bill in c sharp?

By Chirag_Bhatt ·
hi all.. I am working on Automatic Meter Reading system. Using GSM modem to send and receive SMS. I am getting the SMS string as
>>AA5500101#0000440585#000000000.820#0000000.000#0.3.689#TE=Y,RF=N#0000440585#0000000000#0000000000#000#000#212#55AA
Now I am breaking it as
Flowmeter Id :- 001
GSM/GPRS :- 01 (02 for GPRS)
Current Meter Reading :- 820
Battery Voltage :-3.689
TE=Y, RF=N

the pseudo code,,

Get the Message string
Detect Flowmeter_ID
Find Previous Meter reading(PMR) for the same( If it is for the first time then PMR=0 else the Meter reading taken last time
Subtract PMR from Current Meter reading to get Consumed Water
Now Store Current meter reading as Previous Meter reading for the next Time
Similarly if I am getting the Message string as following

AA5500201#0000440585#000000000.620#0000000.000#0.3.689#TE=Y,RF=N#0000440585#0000000000#0000000000#000#000#212#55AA

Flowmeter Id :- 002
GSM/GPRS :- 01 (02 for GPRS)
Current Meter Reading :- 620
Battery Voltage :-3.689
TE=Y, RF=N

In this case device id is different so it will search the PMR for device id 002 and subtract it from the Current meter reading of the same device.


there will be a database column

Device Number
Date Time
Flowmeter_ID(PKey)
GSM/GPRS
Current Meter Reading
Battery voltage
TE, RF
Consumed Water
Charge/Ltr
Amount

then in the reporting I will be create a view in which I will combine customer table with Device table

and finally I will have following in the report

Customer ID
Customer Name
Address
Device Number
Date Time
Flowmeter_ID(PKey)
GSM/GPRS
Current Meter Reading
Battery voltage
TE, RF
Consumed Water
Charge/Ltr
Amount

I am cant able to write the code for shifting PMR and CMR.........
please help me out.

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

This wouldn't be

by AnsuGisalas In reply to How can I generate the Wa ...

homework, by any chance?
You won't learn if you don't do it the hard way, you know.

Collapse -

You may want to consider another career

by NickNielsen In reply to How can I generate the Wa ...

if you can't write the code to save a data variable to a field in a database table.

Collapse -

Google is your friend

by Tigger_Two In reply to How can I generate the Wa ...

Google for similar code in the language you are writing in.

Your post was well written and included a lot of good information but you've missed on telling us what you have tried to do and what about it didn't work.

Collapse -

Well if you are using a database

by Tony Hopkinson In reply to How can I generate the Wa ...

all you should be doing is calling a stored procedure and passing it the content of teh SMS message, raw or otherwise.
Then you can simplify your life and openn up all sorts of enhancements simply by recording the reading.

That way consumed water can be calculated on next meter reading, or for the report.
You've fallen into a classic trap here

All you need is meter reading and datemeteread.
The previous is the one before it order of ascending date.
No calculations, no finding, one insert statement.
Current is the last one, job done.
and you've got them all...
in one place....
and no messing about trying to figure out why the previous meter reading doesn't make sense.

Time to apply the KISS principle, trust me you don't want to go with this previous and next crap, it's a tin of worms.

Back to Windows Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums