Model Module¶
Authors: |
|
---|
Description¶
It should be imported in scripts that do the analysis. We model systems composed of resources and tasks. Tasks are activated by events, modeled as event models. The general System Model is described in Section 3.6.1 in [Jersak2005] or Section 3.1 in [Henia2005].
-
class
pycpa.model.
CTEventModel
(c, T, dmin=1, name='min', **kwargs)[source]¶ c events every T time event model.
-
set_c_in_T
(c, T, dmin=1)[source]¶ Sets the event-model to a periodic Task with period T and c activations per period. No minimum arrival rate is assumed (delta_plus = infinity)! Cf. Equation 1 in [Diemer2010].
-
-
class
pycpa.model.
ConstraintsManager
[source]¶ This class manages all system-wide constraints such as deadlines, buffersizes and more.
-
add_backlog_constraint
(task, size)[source]¶ adds a buffer size constraint backlog must be less or equal than size
-
add_load_constraint
(resource, load)[source]¶ adds a resource load constraint actual load on the specified resource must be less or equal than load
-
-
class
pycpa.model.
EffectChain
(name, tasks=None)[source]¶ An cause-effect chain describes a (functional) chain of independent tasks. All tasks within a chain are time-triggered and hence sample their input data independently.
-
task_sequence
(writers_only=False)[source]¶ Generates and returns the sequence of reader/writer tasks in the form of [reader_0, writer_0, reader_1, writer_1,…].
A task in this sequence therefore acts either as a reader or a writer. Tasks at odd positions in this sequence are readers while tasks at even positions are writers.
Parameters: writers_only (boolean) – if true, only include writer tasks in sequence (omit readers)
-
-
class
pycpa.model.
EventModel
(name='min', container={}, **kwargs)[source]¶ The event model describing the activation of tasks as described in [Jersak2005], [Richter2005], [Henia2005]. Internally, we use and , which represent the minimum/maximum time window containing n events. They can be transformed into and which represent the maximum/minimum number of events arriving within .
-
delta_min
(n)[source]¶ Delta-minus Function Return the minimum time interval between the first and the last event of any series of n events. This is actually a wrapper to allow caching of delta functions.
-
static
delta_min_from_eta_plus
(etaplus_func)[source]¶ Delta-minus Function Return the minimum time window containing n activations. The delta_minus-function is derived from the eta_plus-function. This function is rarely needed, as EventModels are represented by delta-functions internally. Equation 3.7 from [Schliecker2011].
-
delta_plus
(n)[source]¶ Delta-plus Function Return the maximum time interval between the first and the last event of any series of n events. This is actually a wrapper to allow caching of delta functions.
-
static
delta_plus_from_eta_min
(etamin_func)[source]¶ Delta-plus Function Return the maximum time window containing n activations. The delta_plus-function is derived from the eta_minus-function. This function is rarely needed, as EventModels are represented by delta-functions internally. Equation 3.8 from [Schliecker2011].
-
eta_min
(w)[source]¶ Eta-minus Function Return the minimum number of events in a time window w. Derived from Equation 3.6 from [Schliecker2011], but different, as Eq. 3.6 is wrong.
-
eta_min_closed
(w)[source]¶ Eta-minus Function Return the minimum number of events in a time window w. Using CLOSED intevals
-
eta_plus
(w)[source]¶ Eta-plus Function Return the maximum number of events in a time window w. Derived from Equation 3.5 from [Schliecker2011], but assuming half-open intervals for w as defined in [Richter2005].
-
eta_plus_closed
(w)[source]¶ Eta-plus Function Return the maximum number of events in a time window w. Derived from Equation 3.5 from [Schliecker2011], but assuming CLOSED intervals for w as defined in [Richter2005].
This is technically identical to eta_plus(w + EPSILON), but the use of epsilon has issues with float precision, as w+EPSILON == w for large w and small Epsilon (e.g. 40000000+1e-9)
-
-
class
pycpa.model.
Fork
(name, strategy=<pycpa.model.StandardForkStrategy object>, *args, **kwargs)[source]¶ A Fork allows the modification (determined by the assigned strategy) of output event models dependent on the destination task.
-
class
pycpa.model.
Junction
(name='unknown', strategy=None)[source]¶ A junction combines multiple event models into one output event model This is used to model multi-input tasks. Typical semantics are “and” and “or” strategies. See Chapter 4 in [Jersak2005] for definitions and details.
-
class
pycpa.model.
LimitedDeltaEventModel
(limited_delta_min_func=None, limited_delta_plus_func=None, limit_q_min=inf, limit_q_plus=inf, min_additive=<function recursive_min_additive>, max_additive=<function recursive_max_additive>, name='min', **kwargs)[source]¶ User supplied event model on a limited delta domain.
-
set_limited_delta
(limited_delta_min_func, limited_delta_plus_func, limit_q_min=inf, limit_q_plus=inf, min_additive=<function recursive_min_additive>, max_additive=<function recursive_max_additive>)[source]¶ Sets the event model to an arbitrary function specified by limited_delta_min_func and limited_delta_plus_func. Contrary to directly setting deltamin_func and deltaplus_func, the given functions are only valid in a limited domain [0, limit_q_min] and [0, limit_q_plus] respectively. For values of q beyond this range, a conservative extension (additive extension) is used. You can also supply a list() object to this function by using lambda x: limited_delta_min_list[x]
-
-
class
pycpa.model.
Mutex
(name=None)[source]¶ A mutually-exclusive shared Resource. Shared resources create timing interferences between tasks which may be executed on different resources (e.g. multi-core CPU) but require access to a common resource (e.g. shared main memory) to execute. See e.g. Chapter 5 in [Schliecker2011].
-
class
pycpa.model.
PJdEventModel
(P=0, J=0, dmin=0, phi=0, name='min', **kwargs)[source]¶ A periodic, jitter, min-distance event model.
-
set_PJd
(P, J=0, dmin=0, phi=0, early_arrival=False)[source]¶ Sets the event model to a periodic activation with jitter and minimum distance. Equations 1 and 2 from [Schliecker2008].
-
-
class
pycpa.model.
Path
(name, tasks=None)[source]¶ A Path describes a (event) chain of tasks. Required for path analysis (e.g. end-to-end latency). The information stored in Path classes could be derived from the task graph (see Task.next_tasks and Task.prev_task), but having redundancy here is more flexible (e.g. path analysis may only be interesting for some task chains).
-
class
pycpa.model.
Resource
(name=None, scheduler=None, **kwargs)[source]¶ A Resource provides service to tasks.
-
class
pycpa.model.
StandardForkStrategy
[source]¶ Standard fork strategy: propagates unmodified output event model to all tasks.
-
output_event_model
(fork, dst_task=None, task_results=None)[source]¶ This strategy does not distinguish between destination tasks.
Parameters: - fork (model.Task) – Fork from which to take the output event model.
- dst_task – destination task
-
-
class
pycpa.model.
System
(name='')[source]¶ The System is the top-level entity of the system model. It contains resources, junctions, tasks and paths.
-
class
pycpa.model.
Task
(name, *args, **kwargs)[source]¶ A Task is an entity which is mapped on a resource and consumes service. Tasks are activated by events, which are described by EventModel. Events are queued in FIFO order at the input of the task, see Section 3.6.1 in [Jersak2005] or Section 3.1 in [Henia2005].
-
get_mutex_interferers
()[source]¶ returns the set of tasks sharing the same Mutex as Task ti excluding ti itself
-
get_resource_interferers
()[source]¶ returns the set of tasks sharing the same Resource as Task ti excluding ti itself
-
-
class
pycpa.model.
TraceEventModel
(trace_points=[], min_sample_size=20, min_additive=<function recursive_min_additive>, max_additive=<function recursive_max_additive>, name='min', **kwargs)[source]¶ -
set_limited_trace
(trace_points, min_sample_size=20, min_additive=<function recursive_min_additive>, max_additive=<function recursive_max_additive>)[source]¶ Compute a pseudo-conservative event model from a given trace (e.g. from SymTA/S TraceAnalyzer or similar). trace_points must be a list of integers encoding the arrival time of an event. The algorithm will compute delta_min and delta_plus based on the trace by evaluating all candidates. min_sample_size is the minimum amount of candidates that must be available to derive a representative deltamin/deltaplus
-