blob: 7851b2508b6f8a9650f6147ba1ccfa1711b846c6 [file] [log] [blame]
h2. Stimuli Model
The Stimuli Model contains stimulus and clock objects.
!(scale)../pictures/model_stimuli.png!
h3. Stimuli
!(scale)../pictures/model_stimuli_stimuli.png!
A stimulus is responsible to activate processes. The following different types are available:
* *SingleStimulus*: Activates the process only once.
* *ArrivalCurveStimulus*: A list of time-borders in which a specified number of occurrences are expected.
* *PeriodicStimulus*: Periodic activations based on an offset, a recurrence and (optionally) a jitter.
* *PeriodicSyntheticStimulus*: Defines a periodically triggered stimuli depending on a defined list of occurrence times.
* *PeriodicBurstStimulus*: Defines a periodic burst pattern of the process.
* *RelativePeriodicStimulus*: Periodic activation based on offset and a recurrence.<br/>In contrast to PeriodicStimulus the recurrence is relative to the last occurrence and a deviation is mandatory.
* *VariableRateStimulus*: Periodic activations based on other events, like rotation speed.
* *InterProcessStimulus*: Activations based on an explicit inter-process activation.<br/>Contains a Counter element if activation is either shifted and / or happening every n<sup>th</sup> time.
* *EventStimulus*: Activation triggered by an event, defined in the event model.<br/>Contains a Counter element if activation is either shifted and / or happening every n<sup>th</sup> time.
* *CustomStimulus*: To describe own custom types of activations, including properties.
*(validation-rule) _PeriodicStimulus_: The _Time_ object in the role of _offset_ must not contain a negative value!
*(validation-rule) _PeriodicStimulus_: The _Time_ object in the role of _recurrence_ must not contain a negative value!
*(validation-rule) _PeriodicBurstStimulus_: The _Time_ object in the role of _offset_ must not contain a negative value!
*(validation-rule) _PeriodicBurstStimulus_: The _Time_ object in the role of _recurrence_ must not contain a negative value!
*(validation-rule) _PeriodicSyntheticStimulus_: The _Time_ object in the role of _offset_ must not contain a negative value!
*(validation-rule) _PeriodicSyntheticStimulus_: The _Time_ object in the role of _recurrence_ must not contain a negative value!
*(validation-rule) _TimestampList_: The _Time_ objects in the role of _timestamps_ must not contain a negative value!
*(validation-rule) _SingleStimulus_: The _Time_ object in the role of _occurrence_ must not contain a negative value!
*(validation-rule) _ArrivalCurveEntry_: The _Time_ object in the role of _lowerTimeBorder_ must not contain a negative value!
*(validation-rule) _ArrivalCurveEntry_: The _Time_ object in the role of _upperTimeBorder_ must not contain a negative value!
h4. Single
_Single_ allows to specify an activation at a single relative point in time. The single activation occurs after the time units specified by _occurrence_.
!{width:600px}../pictures/model_stimuli_single.png!
h4. Arrival Curves
An arrival curve is described as a list of time-borders in which a specified number of activations are expected. The picture below shows an example for this. In the first picture there is a number of occurrences on a timeline.
!{width:500px}../pictures/model_stimuli_arrival_curve_1.png!
In the picture below every distance between two activations is measured. The minimum and the maximum distance is added to the table as time-border for the occurrence of two activations. This means that after one activations there has to be at least a gap of one time-unit before the next activations can occur. It also means that there will be always a second activations within eight time units after the last activations. Basically this would be enough to describe an Arrival Curve Stimulus. But it is possible to create a more precise stimulus by describing additional time borders for greater number of occurrences. This is shown in the steps below.
!{width:400px}../pictures/model_stimuli_arrival_curve_2.png!
The same as for two activations in the picture above is done here for three activations. Like already mentioned above, this is an additional restriction for occurrence of an activations.
!{width:400px}../pictures/model_stimuli_arrival_curve_3.png!
And for four activations:
!{width:400px}../pictures/model_stimuli_arrival_curve_4.png!
The picture below shows the table as arrival curve graph. The red line is the upper-time-border that shows the latest time where the activations will occur. The green line shows the earliest possible time where the activations can occur.
!{width:600px}../pictures/model_stimuli_arrival_curve_5.png!
h4. Common properties of fixed periodic stimuli
The abstract class _FixedPeriodic_ defines the common attributes of _Periodic_, _PeriodicSynthetic_ and _PeriodicBurst_. In general all period based Stimuli specify periodic occurrences based on an offset and a recurrence. The first occurrence happens after the time units specified by _offset_, and then every following occurrence happens after the time units specified by _recurrence_. This means, in general, an occurrence of instance i is happening at time t = _offset_ + i * _recurrence_.
The following figure shows a _Periodic_ Stimulus example with only a fix offset and recurrence time.
!{width:650px}../pictures/model_stimuli_periodic.png!
h4. Periodic
In addition to the standard periodic behavior the _Periodic_ Stimulus can be extended by a _Jitter_ e.g. an Gaussian deviation. The activation time of each occurrence jitters according to the values of the distribution as depicted in the following figure. Depending on the _Jitter_ distribution the upper bound of the current and the lower bound of the next activation can be close to each other or even overlap. The _minDistance_ value allows the user to define the minimum distance between the current and the next activation.
!{width:650px}../pictures/model_stimuli_periodic_jitter.png!
The recurrence of a _Periodic_ Stimulus is absolute. This means that a recurrence of 10ms points exactly to the next activation every 10ms. The _Jitter_ describes the deviation of the occurrence around this absolute value.
h4. PeriodicSynthetic
_PeriodicSynthetic_ allows to specify a periodic activation of trigger patterns. It is defined by a list of List of _occurrenceTimes_, a period _recurrence_, and an _offset_. Each time value in _occurrenceTimes_ specifies a single activation at a relative point in time. The moment in time these time values are relative and is defined the following way: an activation of instance i is triggered at time t = _offset_ + floor(i / m) * _recurrence_ + _occurrenceTimes_[i modulo m].
The following figure shows a _Synthetic_ Stimulus example with two periodic activations after the time units T1 and T2.
!../pictures/model_stimuli_synthetic.png!
h4. PeriodicBurst
The _PeriodicBurst_ Stimulus specifies a set of burst activations that are periodically repeated. This means that multiple activations occur very close to each other and this recurs in a periodic matter. The burst pattern has a fixed recurrence period and every burst results in multiple activations.
!{width:700px}../pictures/model_stimuli_periodic_burst.png!
The number of occurrences per burst are specified via _occurrenceCount_. The _occurrenceMinDinstance_ defines the minimal distance between them. The _burstLength_ defines the maximum time the burst pattern can last. If the number of occurrences multiplied with the minimum distance between activations is bigger than the _burstLength_ only the number of activations that fit into the _burstLength_ are executed.
h4. RelativePeriodic
In contrast to the _Periodic_ Stimulus the _RelativePeriodic_ Stimulus allows to specify relative recurrences. The next activation depends on the current activation time and the added deviation for the next step. The _lower_ and _upperBound_ are specified in the _nextOccurrence_ deviation similar to the _Jitter_ specification in the _Periodic_ Stimulus.
!{width:700px}../pictures/model_stimuli_periodic_relative.png!
h4. VariableRateStimulus
With the _VariableRate_ Stimulus the description of task activation based on e.g. the crankshaft rotation speed or other adaptive variable rate activations.
The _step_ has to be defined as a base value for the following specifications.<br/>
In the deviation _occurrencesPerStep_ the lower and upper frequency of the variable rate are described. The distribution can be used to describe the standard frequency occurrences. The user can describe that the frequency is distributed e.g. uniformly over the complete frequency band or as another example the occurrences happens mostly at the _Boundaries_ of the frequency band that can be specified with the _CornerCase_ _samplingType_ in the distribution.<br/>
The user can set _maxDecrease_ and _maxIncrease_ values to describe the number of additional respectively reduced task activations that can occur within a predefined time _step_. With these values, the maximum acceleration and maximum deceleration of the stimuli can be calculated.
!{width:700px}../pictures/model_stimuli_variableRate.png!
An additional feature for the _variableRate_ Stimulus is the description of _simulationScenario_ that specifies the progression of the _variableRate_ over time.
In contrast to the generic specification via statistical values the scenario defines the computation via the _samplingOffset_ and _samplingRecurrence_ property that is modified by a factor based on a _clock_.
h3. Clocks
The _Clock_ is triggered based on logical clocks rather than the simulation time, thus providing a dynamic trigger pattern for a simulation. _Clock_ defines the (variable) rate at which a stimulus will be fired. This rate follows a certain pattern defined by the subclasses: _ClockFunction_ and _ClockStepList_.
!(scale)../pictures/model_stimuli_clocks.png!
h4. ClockFunction
A clock function defines the clock period change via a continuous function. There are two functions available: _Sine_ and _Triangle_. They can be chosen by setting the _curveType_ property.
In the sine clock function the clock period increases and decreases smoothly following a sine wave pattern. The figure below depicts the attributes used to define the sine wave. Note that the sine wave always lies above the x-axis. Adding a positive or negative _x-Offset_ will shift the wave horizontally. The clock fires a stimulus whenever the area under the sine curve is a multiple of one (an integral value). If used in a _Scenario_ this factor can be defined via the recurrence attribute. As can be seen, the size of the area can be influenced by the _yOffset_ and _peakToPeak_ attributes. In the example shown in the figure the first stimulus is fired at 1.3s, second at 2.06s and so on.
!{width:850px}../pictures/model_stimuli_clocks_sine.png!
The triangle clock function increases and decreases at a constant rate. The shape of this clock function is governed by the same attributes as the sine wave, only the underlying mathematical definition is different. In the example figure below, the first activation occurs at 0.828s, the second at 1.464s and so on.
!{width:650px}../pictures/model_stimuli_clocks_triangle.png!
h4. ClockStepList
The list of clock steps defines the clock period change via a step function. Each _ClockStep_ of that function is defined by a _frequency_ and a _time_ stamp. The optional period attribute of the clock step list can be used to repeat the pattern (exactly like the recurrence in the _PeriodicSynthetic_ stimulus). If the period is not set, the clock rate will remain the same after the last clock step change. Considering the clock steps: <1Hz, 1s>, <3Hz, 3s>, <2Hz, 5s>, <0Hz, 6s>, <2Hz, 7s>, a sampling recurrence of 2, and a period of 9s, the clock step function will result in the plot depicted in the following figure.
!{width:750px}../pictures/model_stimuli_clocks_steplist.png!
h4. Example
The engine crankshaft is a good example in which Clocks can be used to model the behavior. Let’s suppose a scenario in which a stimulus is triggered each time the rotating crankshaft reaches a specific angle.
In this example, the engine speed steeply increases from 3000rpm to 6000rpm in 5s, then the speed again decreases to 3000rpm in 5s. An stimulus shall be triggered when the engine crankshaft reaches 30 degrees. Triggering should repeat every two rotations.
Steeply increasing and decreasing pattern fits to the triangle clock function. The equations below show the calculations for the triangle clock function. _xOffset_ is added to make the triangle wave begin at the desired engine speed of 3000rpm:
* _yOffset_ = min.ticks = 3000rpm = 50rps = 50Hz
* _peakToPeak_ = max.ticks - min.ticks = 6000rpm - 3000rpm = 50Hz
* _period_ = 2 * risingSteepTime = 2 * 5s = 10s
* _xOffset_ = risingSteepTime / 2 = 2.5s
!{width:750px}../pictures/model_stimuli_clocks_triangle_example.png!
Task shall be triggered when the engine crankshaft reaches 30 degrees. Triggering should repeat for every two rotations. The scenario configuration for this example can then be derived as follows:
* _samplingOffset_ = firstTriggerAngle = 30 ^o^ / 360 ^o^ = 0.0833
* _samplingRecurrence_ = everySecondRotation = 2
!{width:750px}../pictures/model_stimuli_clocks_triangle_example_scenario.png!
The engine crankshaft reaches 30 degrees at 1.66ms. From then on, the crankshaft completes 2 rotations at 41.49ms and 4 rotations at 81ms.
h3. Mode Value List and Execution Condition
It is possible to change mode label values when a stimulus is executed. The mode labels and their new values are stored in the *set-mode-value-list*. Via an *execution-condition* modes also determine if a stimulus is executed.
!(scale)../pictures/model_stimuli_modevaluelist.png!
*(validation-rule) _ModeValue_: The _value_ string must be a valid element of the corresponding _Mode_!
The *set-mode-value-list* indicates: Each time the stimulus is executed all mode labels in this list are set to the corresponding value.
The *execution-condition* is used to determine if a stimulus is executed.