[Embedlets-dev] Re: Device polling and embedlet dependencies/initialization
Status: Alpha
Brought to you by:
tkosan
|
From: Andrzej J. T. <an...@ch...> - 2003-02-18 16:16:47
|
Chris postulates a polling scenario: > 1. An output (embedlet) controls a raw material supply function and must > be off on startup. 2. The output is controlled by a threshold Embedlet > monitoring the raw material supply level. 3. The threshold embedlet is > event driven and fires when the level exceeds an upper value or drops > below a lower threshold. 4. When the level is low the output should come > on to start the raw material feed. When the upper level is exceeded the > output should turn off to stop the supply. > > The problem occurs when the supply is initially low and not changing > because the output is off. The threshold embedlet sees no change so the > event is not fired and the output remains off... the manufacturing process > cannot start. The way I envision you would handle this scenario is as follows: 1) The Threshold embedlet would be listed as "dependent" on the Output embedlet in the application config/wiring file (this might be derived from who consumes and who produces events of a particular type). Using this dependency info, the lifecycle service will ensure that the Output embedlet is started and listening for events first. We might need to find a better word than "dependent" here....since the usage is a bit backwards. From an event/messaging paradigm, consumers should be started prior to producers, for obvious reasons. 2) The Threshold embedlet will thus be assured that when it's start() lifecycle method is called, that the Output embedlet is started and running (listening for the threshold events). 3) The Threshold embedlet would be responsible (in the start() method) for initializing itself. That is, it should check the raw material supply level (likely using a JAPL API call to the sensor that measures this), and if the level is low, it should post a "tart material feed" threshold event. 4) The Output embedlet would then receive this event at startup, and all would be well. The solution is based on the LifeCycle service controlling the sequence in which related/dependent Embedlets are started up, based on the config information. Andrzej Jan Taramina Chaeron Corporation: Enterprise System Solutions http://www.chaeron.com |