AG VLSI Design and Architecture

SFB 501 - Project D1: Application System "Buildings"

PSiGene

Pattern Catalog

[PSiGene]

10.5 Pattern ContinuousComputation

Intent

This pattern takes care that a special method of an object is called continuously.

Also Known As

Kontinuierliche Simulation [Rie96] ( http://wwwagz.informatik.uni-kl.de/projects/SFB501/D1/PSiGene/publications.shtml#Rie96.0 ).

Motivation

Modelling a formula to compute a value is not enough to make the system alive. The computing object has to be told from time to time to update its value. For example the temperature of a room has to be updated in regular intervals as influencing parameters change by time.

Applicability

This pattern may be bound to any class having a value to be updated in intervals.

Structure

The target object will be bound to an ActiveObject. The target class does actually not need to know about this binding as communication will only happen from the ActiveObject to the target.

The ActiveObject periodically calls the targets method doing the computation. This call is realized due to a new thread of an ActiveObject being created by this pattern.

Participants

Objects:
Attributes
Relations
Methods
Expressions

Collaborations

The event will be send via a scheduler which takes care of timing the computations execution (see [Hei96] for details on scheduler).

Consequences

This pattern can be added to nearly every object in the model. Indeed, it should be used rarely as it creates some overhead for each active object.

Implementation

{establish}
    | aThread |
    self con_{activeObject}: ActiveObject new.
    (anEvent := SimEvent new)
        sender: self {activeObject} instance;
        receiver: self {activeObject} instance;
        timestamp:
            (Scheduler simSched simMillisecondClockValue
             + self interval);
        deadline: (anEvent timeStamp + 3000);
        eventType: #activate;
        eventData: ``.
    self con_{event}: anEvent.
    aThread := Thread
        createThread:
        [   :currentEvent |
            self {compute}.
            (self {event} instance)
                timestamp: currentEvent timestamp+self {interval};
                deadline: currentEvent deadline + self {interval};
                send.
        ]
        atPriority: {priority}.
    self {activeObject} instance
        addThread: anThread reactOn: #(#activate).
self {event} instance send.
{init}
    self {interval}: 30000.
    self {establish}

Related Patterns

 

PEdit description

Pattern ContinuousComputation Category active
    ObjectType use target
    SingleRelation use activeObject
    SingleRelation use event
    Attribute use preset interval
    SingleMethod implement preset establish
    SingleMethod use compute
    SigleMethod implement preset init
    Expression implement priority
End

previous page next page up   Table of Contents PSiGene