There's quite a lot of buzz around smart grid lately - many companies jumping on the green tech band wagon and investing resources in making all kinds of applications for smart grid - the next-generation energy infrastructure. Microsoft is no exception - it's developing Microsoft Hohm - a consumer-oriented service to help home residents to reduce their energy bills based on detailed usage report created from the data their utilities provide. My group is also helping our partner ISVs to develop smart-grid solutions based on Microsoft products and technologies. Most recently I helped Invensys to develop Smart Grid Pilot (SGP) application on top of Windows Azure, AppFabric (new name for .NET Services) and Silverlight. The idea behind Smart Grid Pilot is pretty simple - connect all smart grid participants (energy producers, utilities and consumers - businesses and homes) into one distributed network that can reach massive scale but would be easy to use.

Smart Grid Pilot Energy Controller Screen 

So, why Azure, AppFabric and Silverlight? The main obstacle on the path to adoption of smart grid is not the outdated power infrastructure (it's actively being modernized), laws (many countries adopted very favorable laws for smart grid businesses) or lack of willingness of consumers to adopt (it means more savings for them). It is the lack of software infrastructure. Simply put, there's no such smart grid software solution right now that could scale to millions of homes, businesses, and most importantly devices. It's not just about connectivity (Internet is everywhere where energy might be these days) but mostly about applications and resources they use to serve the myriad of users, components and data streams in real time, changing constantly in both volume and distribution patterns.

Here comes AppFabric Service Bus. By design, Service Bus is supposed to serve exactly this kind of applications - super-scalable, distributed and involving many otherwise unconnected and sometimes incompatible clients and services. For example, to distribute energy prices in real time, you can use Service Bus to distribute this pricing data to all subscribed users (and subscribed here merely means "having well-known URL for the endpoint") in multicast pattern. As a service publishing these prices you simply have to know the endpoint to publish them to and use appropriate binding (e.g. NetEventRelayBinding).  

Why Azure? Having messaging set up and configured for smart-grid services is not enough. You have to aggregate certain data streams and spit out only meaningful portions of information to connected clients. This aggregation requires some sort of scalable resource to serve as many clients as smart-grid solution will support (and that means millions potentially). Moreover, the load will probably not be well-balanced throughout time and geographies and hence the need for scale-up and scale-down capabilities of this resource with some geographical affinity. Windows Azure fits the bill perfectly.

Why Silverlight? Creating user-friendly applications that actually look like next-gen is a key for adoption of smart grid solutions on a wide scale. Dynamic nature of data streams being utilized also requires dynamic and rich execution environment. Last but not least multiple platforms have to be supported to extend the reach to as many consumers as possible. There are many functions that Smart Grid Pilot will finally support on the client side - it's not just reports and dynamic pricing charts - it's operations with electrical appliances that users will be able to perform remotely just by navigating to their account web page (hosted by utility in Windows Azure), billing and payment operations and customer support. Silverlight is probably best fit to satisfy these requirements at the moment.

Since many different roles with different responsibilities and permissions are supported (consumers getting the prices and publishing utilization information and issuing commands to their appliances through the service, energy producers publishing the wholesale prices, utility companies collecting all this data and producing retail price feeds, local authorities monitoring the utilization and generating all kinds of reports), a flexible security mechanism has to be adopted so entire system is secure yet easy to connect to by growing number of users.  AppFabric ACS (Access Control Service) serves as a security glue here to provide claims-based authentication and authorization functions for applications and services connecting to both Windows Azure and Service Bus from either Silverlight or other runtimes.

We recently presented this project at PDC2009 and published a case study that should help other companies in adopting Windows Azure and AppFabric for their smart-grid solutions.