locked
Robot = Whole House Automation ? RRS feed

  • Question

  • Hi, as a newbie I am wondering if MSRS will fit my needs... a whole house automation system (lighting, HVAC, telephony, security, Vista Media Center State Aggregation Service etc.). 

     

    I want to be able to host DSS nodes on multiple PCs throughout the house, and wrap services around each of the automation components (e.g., single light switch, Media Center PopUps to display text, etc.). 

     

    On at least one of the PCs and ideally several, I want to be able to use VPL to define automation scripts (e.g., if a DVD starts playing in media room, then dim the lights and close the shades).  It would need access to services across the network.

     

    It seems that MSRS is exactly what I need...  CCR seems critical as many events could be happening at any time, especially if each individual dimmer switch is its own service... DSSP seems a great lightweight protocol for interaction amongst services.  After all the house itself effectively becomes a huge robot.

     

    However, before I get stuck in, I wanted to (a) validate this thinking and (b) understand some of the constraints.

     

    Specifically I am concerns around the distributed nature... was DSS envisaged for these scenarios of multiple PCs, but with one or more intelligent "brains" that use VPL to control *all* services (not just those on the local node)?  If not, then it seems this is not as distributed as the name implies? 

     

    Secondly, I dont see much mention of discovery services.  I was thinking about using Web Services for Devices instead, which requires WS-DISCOVERY.  Does DSSP include anything equivalent, and in fact is there any interoperability between WSDP and DSSP?  There seem to be no .Net implementations of WSD and nothing like VPL which are two pre-requisites for my project.

     

    Thirdly, I will be using VS 2008 on Vista and Windows Server 2008 so have access to latest tools / languages but vastly prefer VB.NET to C#.  Am I right in understand that services themselves have to be coded in C#?

     

    Finally, a question on VPL.  Is this really a language for the CLR or is it in fact just a WPF application that generates C# code?  Reason is that I am keen to create a "scripting add-in" environment for my application and so would like to be able to use VPLembedded within my application  using CODEDOM and someway to call the IDE (like VBA).  If not, is there any source code available or way to embed it?

     

    Any thoughts or reactions to any of this welcome...

     

     

    Monday, September 3, 2007 12:49 PM

Answers

  • Hi gphb,

    You don't sound like a newbie! Smile Firstly, welcome to our community and sorry for the late response (people get scared when they see a lot of questions at once!)

    For your first question I should say DSS as the runtime engine is capable of running services on multiple nodes on different machines and depending on the design of your system you can spread the brain services, controller services and orchestration services across as many nodes as you want assuming that service are configured correctly to communicate with partner services on other nodes. However, at this time VPL can only run a diagram on a local node. Using VPL to connect services on multiple nodes is a required feature that we are considering for future.

    Second: The directory service is used for discovery of services running on a node and the contract directory service is used for discovery of services that are available on a node (not necessarily running services). A service that is partnered and is authorized to the node can tell the node to run a service remotely and start using it. I don’t think there is any runtime interoperability between WSDP and DSSP but it is possible to create DSS service wrappers for Web Services and use them in VPL.

    Third: Services can be written in any CLR language but there are some CCR tricks that C# can do better than any other language. One of them is the “Iterators” feature of C# 2.0 that allows simulating sequential programming while the procedures are run as concurrent blocks of code one after another. This is the “yield return” calls that you can see everywhere in the C# samples. Another feature that is extensively used in CCR coding is “Anonymous Methods” which makes handling CCR success/failure responses much easier than having to call explicit methods for each response. VB.NET does not support anonymous methods. Also languages that do not support generics cannot be used with MSRS for writing services.

    Lastly: VPL is a language for DSS services. It is not designed to be used for object oriented programming like initializing classes, calling methods etc. Instead it can work with services to invoke operations and orchestrate messages. Obviously any CLR class wrapped with a DSS service can be used in VPL (see for example samples\Misc\Utility\StringHelper that wraps System.String).

    In all, your scenario would be a very nice application of MSRS and feel free to ask your questions here.

     

    Thanks

    Thursday, September 13, 2007 2:27 AM

All replies

  • Hi gphb,

    You don't sound like a newbie! Smile Firstly, welcome to our community and sorry for the late response (people get scared when they see a lot of questions at once!)

    For your first question I should say DSS as the runtime engine is capable of running services on multiple nodes on different machines and depending on the design of your system you can spread the brain services, controller services and orchestration services across as many nodes as you want assuming that service are configured correctly to communicate with partner services on other nodes. However, at this time VPL can only run a diagram on a local node. Using VPL to connect services on multiple nodes is a required feature that we are considering for future.

    Second: The directory service is used for discovery of services running on a node and the contract directory service is used for discovery of services that are available on a node (not necessarily running services). A service that is partnered and is authorized to the node can tell the node to run a service remotely and start using it. I don’t think there is any runtime interoperability between WSDP and DSSP but it is possible to create DSS service wrappers for Web Services and use them in VPL.

    Third: Services can be written in any CLR language but there are some CCR tricks that C# can do better than any other language. One of them is the “Iterators” feature of C# 2.0 that allows simulating sequential programming while the procedures are run as concurrent blocks of code one after another. This is the “yield return” calls that you can see everywhere in the C# samples. Another feature that is extensively used in CCR coding is “Anonymous Methods” which makes handling CCR success/failure responses much easier than having to call explicit methods for each response. VB.NET does not support anonymous methods. Also languages that do not support generics cannot be used with MSRS for writing services.

    Lastly: VPL is a language for DSS services. It is not designed to be used for object oriented programming like initializing classes, calling methods etc. Instead it can work with services to invoke operations and orchestrate messages. Obviously any CLR class wrapped with a DSS service can be used in VPL (see for example samples\Misc\Utility\StringHelper that wraps System.String).

    In all, your scenario would be a very nice application of MSRS and feel free to ask your questions here.

     

    Thanks

    Thursday, September 13, 2007 2:27 AM
  •  

    Omid,

     

    Many thanks for the reply.  Yes I realized afterwards I should have restrained myself on the questions.

     

    All your points make sense... I have since downloaded the toolkit and got a couple of services running on one node.  Using some of the serial port examples I was able to wrap the call detail report on my telephone switchboard (a Talkswitch) so that I now have access to all ingoing and outgoing calls.  Using CCR seemed to make the async programming a bit easier (although my C# skills were a bit rusty). 

     

    Next I am going to hook up my home alarm system (a Honeywell Vista 20P) so that I get event notifications of door openings and closings.  That particular interface is actually http so what I like about DSS is that I can wrap these vastly different services up but when they appear in VPL I have no real idea what the underlying interface is.

     

    I started a thread on the DSS board about the distributed nature of DSS.   If you are accepting feature requests, while I like that VPL may eventually work on cross-node services I would also ask you to relook at the way discovery happens... the examples (tutorial 7 I think) show quite a bit of coding that is specific to a multi-node situation... I for one would prefer if all the multi-node (creating local forwarders as far as I can tell) logic was seemless and built into the runtime than in my application. 

     

    The area I am leaving until last is my Zwave interface.  While there is a nice .Net wrapper for this that I think I can encapsulate quite easily into a DSS interface, I am going to have to decide whether to make the interface a single service (with multiple operations) or actually spawn a service instance for each switch.  Since this will be on a dedicated (albeit low powered single CPU) server, are there any performance considerations either way?

     

    Thanks again for thoughtful reply.

     

    Guy

     

     

     

     

     

     

    Thursday, September 13, 2007 12:41 PM
  • There's no noticable performance cost if you spawn a service instance for each switch. What I suggest is to have a generic switch contract with operations like SetPower(on/off), SetDim(0%-100%), SetAutoAdjust(on/off), SetScene(Dinner/Watch TV/Evening/BedTime), SetTimer(TimeSpan) and create a Zwave service using the generic contract. The generic contract lets you extend this to other switch types with a similar interface later. Then run one instance for each switch service with it's own configurations.

     

    BTW, there is this community project in codeplex for MSRS services:

    http://www.codeplex.com/MRSS

     

    If you were interested you can share your services there for everyone to use.

     

    Thanks,

     

    Omid

     

    Thursday, September 13, 2007 3:21 PM