Skip to content

This is a small demo to show how to insert meter readings for a smart reader. Note : in this example readings come in through a file with a no of readings per day (per customer).

Notifications You must be signed in to change notification settings

jatin7/dse_iot_smart_meter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dse_iot_smart_meter

This project generates & insert smart meter reading. Note : the readings come in through a file with a no of readings per day.

Schema Setup

Note : This will drop the keyspace "dse_iot_demo" and create a new one. All existing data will be lost.

To specify contact points use the contactPoints command line parameter e.g.

'-DcontactPoints=192.168.25.100,192.168.25.101'

The contact points can take mulitple points in the IP,IP,IP (no spaces).

To create the a single node cluster with replication factor of 1 for standard localhost setup, run the following

To create the schema, run the following

mvn clean compile exec:java -Dexec.mainClass="com.datastax.demo.SchemaSetup" -DcontactPoints=localhost

Insert Meter Reading

To insert some meter readings, run the following

mvn clean compile exec:java -Dexec.mainClass="com.datastax.smartmeter.Main" -DcontactPoints=localhost

You can use -DnoOfCustomers and -DnoOfDays to change the no of customer readings and the no of days (in the past) to be inserted. Defaults are 100 and 180 respectively.

Verify Meter Reading in DataStax using CQL

To view the data using cqlsh, run

select * from smart_meter_reading where meter_id = 1;

Run Billing Cycle for specific Time Period

To run a billingCycle, which accummulates usages for a specific time period, run

mvn clean compile exec:java -Dexec.mainClass="com.datastax.smartmeter.BillingCycleProcessor" -DcontactPoints=localhost

To specific billing cycle use -DbillingCycle (Default is 7).

Run Day Aggregation

To run an DAY aggregation, which sums the usage for a day, run

mvn clean compile exec:java -Dexec.mainClass="com.datastax.smartmeter.Aggregate" -DcontactPoints=localhost

You can use -DnoOfCustomers and -DnoOfDays to change the no of customer readings and the no of days (in the past) to be aggregated. Defaults are 100 and 180 respectively.

Verify Aggregation

To view the data using cqlsh, run

select * from smart_meter_reading_aggregates where meter_id = 1 and aggregatetype ='DAY';

Cleanup

To remove the tables and the schema, run the following.

mvn clean compile exec:java -Dexec.mainClass="com.datastax.demo.SchemaTeardown" -DcontactPoints=localhost

About

This is a small demo to show how to insert meter readings for a smart reader. Note : in this example readings come in through a file with a no of readings per day (per customer).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 88.5%
  • Shell 11.5%