Re: [Perl-workflow-devel] Using Workflow for managing home automation
Brought to you by:
jonasbn
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? > :) > |