Thread: [Perl-workflow-devel] Using Workflow for managing home automation
Brought to you by:
jonasbn
From: Sebastian S. <seb...@go...> - 2012-04-15 09:56:07
|
Hello folks, I hope it is ok to post to this list. If not, please tell me. I am trying to utilize the workflow framework that you guys have created and I am fascinated about the possibilities and the way it is so generic and configurable. However, there is one thing I am not sure if it is achievable. I have defined a workflow with a bunch of states and I use this to control a computer. This may sound weird. This "computer" can have several states: On, Off, Booting, Halting, Unknown. Now, a user requests this computer to be just on. The user does not care about the current state. The damn thing shall be on as quickly as possible. But if the computer is currently in the off state, it cannot be on directly from there. It has to move through the booting-state and only if the booting succeeds it will be on. I have actions defined how to move from off to booting ( i just have a radio controlled socket to switch it on, but it could also be wake on lan, etc.) and I have an action to move from booting to on (some tests have to perform ok). I am looking for a way of "path-finding" from the actual state to a desired state like I can do this for example with the Graph CPAN module which can find the shortest path between two nodes. Is there any way to achieve this or do you think my whole idea is crap? :) Thanks for your thoughts! Regards Sebastian |
From: Alejandro I. <ai...@p2...> - 2012-04-15 15:09:55
|
On Sun, Apr 15, 2012 at 5:55 AM, Sebastian Stuecker <seb...@go...> wrote: > Hello folks, > > I hope it is ok to post to this list. If not, please tell me. > > I am trying to utilize the workflow framework that you guys have created and > I am fascinated about the possibilities and the way it is so generic and > configurable. > > However, there is one thing I am not sure if it is achievable. I have > defined a workflow with a bunch of states and I use this to control a > computer. This may sound weird. This "computer" can have several states: On, > Off, Booting, Halting, Unknown. > > Now, a user requests this computer to be just on. The user does not care > about the current state. The damn thing shall be on as quickly as possible. > > But if the computer is currently in the off state, it cannot be on directly > from there. It has to move through the booting-state and only if the booting > succeeds it will be on. I have actions defined how to move from off to > booting ( i just have a radio controlled socket to switch it on, but it > could also be wake on lan, etc.) and I have an action to move from booting > to on (some tests have to perform ok). > > I am looking for a way of "path-finding" from the actual state to a desired > state like I can do this for example with the Graph CPAN module which can > find the shortest path between two nodes. > Coming from the automation world I find your post quite interesting and in that sense the state-action-state paradigm is similar somewhat to ladder logic on a PLC. What I don't understand is this last bit... why do you need this path-finding stuff? As I see it, you should simply stick to the event-based (e.g. EDA, SEDA, EPC, etc.) model just like you would if you were automating using ladder language. Going on a limb, but IMHO I think you are confusing EPC-style workflows with Petri-net style WF engines. -- Alejandro Imass > Is there any way to achieve this or do you think my whole idea is crap? :) |
From: Sebastian S. <seb...@go...> - 2012-04-15 17:38:41
|
I am maybe not so good at theoratical IT therefore it might be that I am confused and try to use this for an application where it does not fit. Why do I think I need path-finding-stuff? Lets say i have states a,b,c and d and actions AtoB, BtoC, CtoD and DtoA. The "system" is in state a. Now the user decides, it shall be in state d. >From a there is only b reachable through action AtoB. I want that the system goes automatically to state d through more than one action without further user input. Application example: The user decides he wants to liste to radio music in the living room. (User input "set LR music radio") (just a stupid example) Now several things have to happen, assuming everything is switched off. The PC in the living room (yes!) has to be switched on, it has to boot, the sucessful boot needs to be detected after a certain amount of time (if nothing goes wrong) then the "radio listening application" has to be startet, etc. In reallity in my home it is even more complex, becuase I need to start up the "play music stream" application on my music server, which also might be switched off completely, etc. So many tasks need to be completed automatically. Which ones, depends on the state of all systems before the user input. I am not so good in petri nets but I will look into this and maybe this is a better model for what I want to happen in my house. Thank you for this hint! |
From: Sebastian S. <seb...@go...> - 2012-04-16 20:21:57
|
Hello, let me shortly follow up on my approaches until today. After looking at the philosophy of petri-net approaches I decided for myself that I currently am not convinced that this relates to my reality I want to model. I sticked to the workflow approach. I did nit see hot the producer/consumer approach of petri-nets can relate to my situation, where I think i have only systems that have exactly one state at all times, if they are correctly designd. I inherited the workflow class and built around some functions I wanted to have (just for the sake of experimentation, very dirty) - path-finding capability (Dijkstra) used from the CPAN Graph module (I iterate through all states/actions and create in parallel a graph object) - in the context I foresee a field called "desired state" in which the user can set the desired state of the system. - I have states in the system which cannot be enforced by an action but can only be reached through a null action in case a condition fails (in my example: my PC is not ping-able any more). I skipped those transitions in the graph so that they are not used for path finding (the system would be stuck otherwise) I use a little while loop to do the following: - is the desired state equal to the current state? if yes - > i am happy. if no: - check if there is a path through the graph from the current state to the desired state. if no? damn! (should not happen by design of system). if yes? - check if the next node on the found path is part of the currently available actions. if yes? - do this action until I am happy... A test implementation with 8 different states now works...maybe I will find out that I am on the wrong approach later when I design complexer systems but for now...I am happy :) Regards Sebastian 2012/4/15 Alejandro Imass <ai...@p2...> > On Sun, Apr 15, 2012 at 5:55 AM, Sebastian Stuecker > <seb...@go...> wrote: > > Hello folks, > > > > I hope it is ok to post to this list. If not, please tell me. > > > > I am trying to utilize the workflow framework that you guys have created > and > > I am fascinated about the possibilities and the way it is so generic and > > configurable. > > > > However, there is one thing I am not sure if it is achievable. I have > > defined a workflow with a bunch of states and I use this to control a > > computer. This may sound weird. This "computer" can have several states: > On, > > Off, Booting, Halting, Unknown. > > > > Now, a user requests this computer to be just on. The user does not care > > about the current state. The damn thing shall be on as quickly as > possible. > > > > But if the computer is currently in the off state, it cannot be on > directly > > from there. It has to move through the booting-state and only if the > booting > > succeeds it will be on. I have actions defined how to move from off to > > booting ( i just have a radio controlled socket to switch it on, but it > > could also be wake on lan, etc.) and I have an action to move from > booting > > to on (some tests have to perform ok). > > > > I am looking for a way of "path-finding" from the actual state to a > desired > > state like I can do this for example with the Graph CPAN module which can > > find the shortest path between two nodes. > > > > Coming from the automation world I find your post quite interesting > and in that sense the state-action-state paradigm is similar somewhat > to ladder logic on a PLC. What I don't understand is this last bit... > why do you need this path-finding stuff? As I see it, you should > simply stick to the event-based (e.g. EDA, SEDA, EPC, etc.) model just > like you would if you were automating using ladder language. Going on > a limb, but IMHO I think you are confusing EPC-style workflows with > Petri-net style WF engines. > > -- > Alejandro Imass > > > > Is there any way to achieve this or do you think my whole idea is crap? > :) > |
From: Alejandro I. <ai...@p2...> - 2012-04-16 21:33:58
|
On Mon, Apr 16, 2012 at 4:21 PM, Sebastian Stuecker <seb...@go...> wrote: > Hello, > > let me shortly follow up on my approaches until today. > [...] > > until I am happy... > > A test implementation with 8 different states now works...maybe I will find > out that I am on the wrong approach later when I design complexer systems > but for now...I am happy :) > Glad to hear because I having a hard time understanding your examples. My mention of Petri vs. EPC was because __this__ Workflow is mostly of type EPC, or if I'm wrong please someone correct me! This means that this particular WF is not designed to guarantee a perfect cycle or optimized routes, etc. You may very well define dead ends, etc. because that is the nature of this EPC design. As the doc says it's just a bunch of states! but it's a pretty awesome WF engine IMHO. What I love about this WF is the easiness of integration to other code. I've configured some pretty complex stuff using this module and still haven't found any major limitations. Anyway, happy to hear you are using it for Automation like stuff because I've had a similar idea for a while in my head and maybe I'll use it for brewing some homemade beer ;-) Cheers, -- Alejandro Imass > Regards > Sebastian > > > 2012/4/15 Alejandro Imass <ai...@p2...> >> >> On Sun, Apr 15, 2012 at 5:55 AM, Sebastian Stuecker >> <seb...@go...> wrote: >> > Hello folks, >> > >> > I hope it is ok to post to this list. If not, please tell me. >> > >> > I am trying to utilize the workflow framework that you guys have created >> > and >> > I am fascinated about the possibilities and the way it is so generic and >> > configurable. >> > >> > However, there is one thing I am not sure if it is achievable. I have >> > defined a workflow with a bunch of states and I use this to control a >> > computer. This may sound weird. This "computer" can have several states: >> > On, >> > Off, Booting, Halting, Unknown. >> > >> > Now, a user requests this computer to be just on. The user does not care >> > about the current state. The damn thing shall be on as quickly as >> > possible. >> > >> > But if the computer is currently in the off state, it cannot be on >> > directly >> > from there. It has to move through the booting-state and only if the >> > booting >> > succeeds it will be on. I have actions defined how to move from off to >> > booting ( i just have a radio controlled socket to switch it on, but it >> > could also be wake on lan, etc.) and I have an action to move from >> > booting >> > to on (some tests have to perform ok). >> > >> > I am looking for a way of "path-finding" from the actual state to a >> > desired >> > state like I can do this for example with the Graph CPAN module which >> > can >> > find the shortest path between two nodes. >> > >> >> Coming from the automation world I find your post quite interesting >> and in that sense the state-action-state paradigm is similar somewhat >> to ladder logic on a PLC. What I don't understand is this last bit... >> why do you need this path-finding stuff? As I see it, you should >> simply stick to the event-based (e.g. EDA, SEDA, EPC, etc.) model just >> like you would if you were automating using ladder language. Going on >> a limb, but IMHO I think you are confusing EPC-style workflows with >> Petri-net style WF engines. >> >> -- >> Alejandro Imass >> >> >> > Is there any way to achieve this or do you think my whole idea is crap? >> > :) > > |