|
Kontinuierliche Simulation [Rie96] ( http://wwwagz.informatik.uni-kl.de/projects/SFB501/D1/PSiGene/publications.shtml#Rie96.0 ).
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.
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.

The events priority. This should be a value between 1 and 10 where 1 ist the highest priority. Usually "self priority" is used.
An optianal parameter to the compute method may be given.
The event will be send via a scheduler which takes care of timing the computations execution (see [Hei96] for details on scheduler).
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.
| 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.
self {interval}: 30000. self {establish}
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