  %% rtsched.sty
  %% Copyright 2005 Giuseppe Lipari
  %% Copyright 2015 Antoine Bertout <bertout.antoine@gmail.com> Transition from PSTricks to TikZ/PGF.
  % This work may be distributed and/or modified under the
  % conditions of the LaTeX Project Public License, either version 1.3
  % of this license or (at your option) any later version.
  % The latest version of this license is in
  %   http://www.latex-project.org/lppl.txt
  % and version 1.3 or later is part of all distributions of LaTeX
  % version 2005/12/01 or later.
  %
  % This work has the LPPL maintenance status `maintained'.
  % 
  % The Current Maintainer of this work is Giuseppe Lipari
  %
  % This work consists of the file rtsched.sty.
  
  
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{rtsched}[2015/05/01]
\typeout{'rtsched' style for Latex and TikZ/PGF}
\typeout{Easily draw real-time schedules in TeX/Latex.}
\typeout{(c) 2005, Giuseppe Lipari, Pisa, Italy (g.lipari@sssup.it)}
\typeout{(c) 2015, Antoine Bertout (bertout.antoine@gmail.com)}
\typeout{Version 2.0}

\RequirePackage{tikz}
\usetikzlibrary{shadows, patterns}
\RequirePackage{keyval}
\newcommand\rtfont{\usefont{T1}{phv}{m}{n}}
\@ifpackagelater{pgf}{2008/01/15}
{
 %pgf package date is 2008/01/15 or later
}
{
 %pgf package date is older than 2008/01/15
\PackageError{rtsched}{%
rtsched requires version 2.10 of pgf or greater\MessageBreak

}{%
Please update pgf to version 2.10 minimum!\MessageBreak
\space \space Try typing \space \protect\pgfversion
\space to print your current version of pgf.
}
}

%%
%% These can be changed at any time
%% 
\def\RTWindowLength{10cm}    % window length
\def\RTWindowHeight{0}     % window height
\def\RTNullWindowHeight{0} % nullwindow height
\def\RTTaskLabelSize{\normalsize}   % font size the task label
\def\RTNumberLabelSize{\normalsize} % font size of the number labels
\def\RTDefTaskSymbol{\tau} 
\def\RTDefNumberOffset{0}
\def\RTDefTaskFill{solid}
\def\RTDefTaskColor{gray}
\def\RTDefLineColor{black}
\def\RTDefXScale{1}
\def\RTDefWriteSymbols{0}
\def\RTDefGridInvisible{0}
\def\RTDefNumbersInvisible{0}
\def\RTDefRowLabelOffset{0pt}
\def\RTDefAxisInvisible{0}
\def\RTDefLineWidth{1pt}
\def\RTDefLineStyle{solid}
\def\RTDefExecHeight{1}
\def\RTArrowStyle{stealth} %arrow style for deadlines, arrivals and horizontal axes
% -{Triangle 45}[length=x] with length is a more modern arrow style but requires arrows.meta tikz library (available on latest texlive but rarely up to date on linux distribution)
%-stealth is a predefined more classical arrow style

\def\RTExecLabel{\ }
\def\RTTaskSymbol{\RTDefTaskSymbol}
\def\RTTaskFill{\RTDefTaskFill}
\def\RTTaskColor{\RTDefTaskColor}
\def\RTLineColor{\RTDefLineColor}
\def\RTXScale{\RTDefXScale}
\def\RTWriteSymbols{\RTDefWriteSymbols}
\def\RTNumberOffset{\RTDefNumberOffset}
\def\RTGridInvisible{\RTDefGridInvisible}
\def\RTNumbersInvisible{\RTDefNumbersInvisible}
\def\RTAxisInvisible{\RTDefAxisInvisible}
\def\RTRowLabelOffset{\RTDefRowLabelOffset}
\def\RTLineWidth{\RTDefLineWidth}
\def\RTLineStyle{\RTDefLineStyle}
\def\RTExecHeight{\RTDefExecHeight}




\define@key{RT}{height}[\RTNullWindowHeight]{\def\RTWindowHeight{#1}}
\define@key{RT}{width}[10]{\def\RTWindowLength{#1}}
\define@key{RT}{labelsize}[\normalsize]{\def\RTTaskLabelSize{#1}}
\define@key{RT}{numbersize}[\normalsize]{\def\RTNumberLabelSize{#1}}
\define@key{RT}{color}[\RTDefTaskColor]{\def\RTTaskColor{#1}}
\define@key{RT}{linecolor}[\RTDefLineColor]{\def\RTLineColor{#1}}
\define@key{RT}{execlabel}[\ ]{\def\RTExecLabel{#1}}
\define@key{RT}{fillstyle}[\RTDefTaskFill]{\def\RTTaskFill{#1}}
\define@key{RT}{nocommand}{}
\define@key{RT}{xscale}[\RTDefXScale]{\def\RTXScale{#1}}
\define@key{RT}{symbol}[{\tau}]{\def\RTTaskSymbol{#1}}
\define@key{RT}{nosymbols}[\RTDefWriteSymbols]{\def\RTWriteSymbols{#1}}
\define@key{RT}{numoffset}[\RTDefNumberOffset]{\def\RTNumberOffset{#1}}
\define@key{RT}{nogrid}[\RTDefGridInvisible]{\def\RTGridInvisible{#1}}
\define@key{RT}{nonumbers}[\RTDefNumbersInvisible]{\def\RTNumbersInvisible{#1}}
\define@key{RT}{labeloffset}[\RTDefRowLabelOffset]{\def\RTRowLabelOffset{#1}}
\define@key{RT}{axis}[\RTDefAxisInvisible]{\def\RTAxisInvisible{#1}}
\define@key{RT}{lw}[\RTDefLineWidth]{\def\RTLineWidth{#1}}
\define@key{RT}{style}[\RTDefLineStyle]{\def\RTLineStyle{#1}}
\define@key{RT}{exeheight}[\RTDefExecHeight]{\def\RTExecHeight{#1}}


%%
%% temporaries

\newdimen\sx % slot length
\newdimen\sy % slot height
\newdimen\hy % frame height
\newdimen\xx % x position
\newdimen\yy % y position
\newdimen\xxx % x position
\newdimen\yyy % y position
\newcount\nsx % number of horizontal slots
\newcount\nsy % number of vertical slots
\newcount\nhl % number of horizontal lines
\newcount\nvl % number of vertical lines
\newcount\ntasks % number of tasks
\newcount\tmp % temp


\newcounter{myLabel}

\def\RTGrid{\@ifnextchar[\@mygrid@begin{\@mygrid@begin[]}}

\def\RTGridBegin{\@ifnextchar[\@mygrid@begin{\@mygrid@begin[]}}
\def\@mygrid@begin[#1]#2#3{\setkeys{RT}{#1}%
  %% get the number of tasks
  \ntasks = #2
  %% number of horizontal steps in the grid
  \nsx = #3 \advance \nsx by 2 %
  %% real length of the window (approx)
  \nvl = \nsx \advance \nvl by 1 %
  %% compute length of a step
  \sx = \RTWindowLength \divide \sx by \nsx %
  %% number of vertical steps in the grid
  \nsy = #2 \multiply \nsy by 3 \advance \nsy by 1 %
  %% compute length of a vertical step (if height is null, \sy is the
  %% same as \sx)
  \ifx\RTWindowHeight\RTNullWindowHeight%
    \sy = \sx%
    \hy = \sy \multiply \hy by \nsy %\advance \hy by \sy%
  \else 
    \sy = \RTWindowHeight \divide \sy by \nsy %
    \hy = \RTWindowHeight %\advance \hy by \sy %
  \fi
  %% compute real height
  \nhl = \nsy \advance \nhl by 1 %
  \advance \nsy by -1 \advance \nsx by -1
  %% the picture
  \pgfdeclarelayer{foreground} 
  \pgfsetlayers{main,foreground}

  \begin{tikzpicture}
    %% draw grid (if not invisible)
    \if\RTGridInvisible\RTDefGridInvisible
      \draw[lightgray, semithick] (0,0) grid[xstep = \sx,ystep=\sy ] (\RTWindowLength,\hy);
    %% draw border grid
      \draw [black, thick] (0,0) rectangle (\RTWindowLength,\hy);
    \else\relax
    \fi

    %% draw numbers (if not invisible)
    \if\RTNumbersInvisible\RTDefNumbersInvisible
       \foreach \i [evaluate = \i as \j using \i*\sx] in {0,...,#3}{
       \ifodd \i
       \else
       \pgfmathsetmacro\nbwithoffset{\i + \RTNumberOffset};
       \node[below, font=\RTNumberLabelSize \rtfont] at (\j +\sx , 0) {\pgfmathprintnumber[int trunc,/pgf/number format/assume math mode=true]{\nbwithoffset }};
       \fi
       }
    \else
    \relax
    \fi

    %% Task Names
    \if\RTWriteSymbols\RTDefWriteSymbols
     \foreach \i  [evaluate = \i as \j using (\hy -3*\i*\sy)] in {0,...,\numexpr \ntasks - 1}{
      \pgfmathsetmacro\task{\i + 1};
      \node[below, font=\rtfont] at (-\sx , \j-\sy) {\RTTaskLabelSize $\RTTaskSymbol_{\pgfmathprintnumber[int trunc]{\task}}$};
     }
     \else\relax
     \fi
          
    %% Horizontal axes
    \if\RTAxisInvisible\RTDefAxisInvisible
      \begin{pgfonlayer}{foreground} 
      \foreach \i [evaluate = \i as \j using (\hy -3*\i*\sy)] in {0,...,\numexpr \ntasks - 1}{
      \draw [very thick,-\RTArrowStyle] (\sx,\j-3*\sy) -- (\RTWindowLength - \sx,\j-3*\sy);
      }
      \end{pgfonlayer} 
    \fi 
}
 
\def\@RTDefaultValues{%
  \setkeys{RT}{height}%
  \setkeys{RT}{width}%
  \setkeys{RT}{labelsize}%
  \setkeys{RT}{numbersize}%
  \setkeys{RT}{symbol}%
  \setkeys{RT}{fillstyle}%
  \setkeys{RT}{color}
  \setkeys{RT}{linecolor}%
  \setkeys{RT}{xscale}%
  \setkeys{RT}{nosymbols}%
}

\def\@RTExecDefaultValues{
  \setkeys{RT}{color}%
  \setkeys{RT}{execlabel}%
  \setkeys{RT}{linecolor}%
}

\def\RTGridEnd{
    \end{tikzpicture}%
    \@RTDefaultValues%
}

\def\endRTGrid{
    \end{tikzpicture}%
    \@RTDefaultValues%
}

\newcommand{\RTSet}[1]{
  \setkeys{RT}{#1}
}

\newcommand{\RTSetDefault}{
  \@RTDefaultValues
}

%% internal
\newcommand{\@compute@xx}[1]{
  \xx = #1\sx
  \divide \xx by \RTXScale
  \advance \xx by \sx
}

\newcommand{\@compute@xxx}[1]{
  \xxx = #1\sx
  \divide \xxx by \RTXScale
  \advance \xxx by \sx
}

\newcommand{\@compute@yy}[1]{
  \yy = -3\sy \multiply \yy by #1
  \advance \yy by \hy
}


\newcommand{\DrawTaskAxis}[2][nocommand=1]{%
    \setkeys{RT}{#1}%
    \@compute@yy{#2}
    \@compute@xx{0}
    \xxx = \RTWindowLength \advance \xxx by -\sx 
    \draw [\RTLineColor,-\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
    \@RTExecDefaultValues%
}

\newcommand{\DrawXYAxis}[3][nocommand=1]{%
    \setkeys{RT}{#1}%
    \@compute@yy{#2}
    \@compute@xx{0}
    \xxx = \RTWindowLength \advance \xxx by -\sx 
    \draw [\RTLineColor,-\RTArrowStyle] (\xx,\yy) -- (\xxx,\yy);
    \yyy = 3\sy \multiply \yyy by #3 \advance \yyy by \yy
    \advance \yyy by -\sy
    \draw [\RTLineColor,-\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
    \@RTExecDefaultValues%
}

\newcommand{\FLine}[5][nocommand=1]{%
    \setkeys{RT}{#1}%
    \@compute@xx{#2}
    \@compute@xxx{#4}
    \yy = #3\sy \advance \yy by 2\sy
    \yyy = #5\sy \advance \yyy by 2\sy
    \draw [\RTLineColor, line width=\RTLineWidth,\RTLineStyle] (\xx,\yy) -- (\xxx,\yyy);
    \@RTExecDefaultValues%
}

%
% TaskArrival
% Task arrival: draws an up arrow at the specified slot
% par 1  : task number from 1 to n
% par 2  : slot number from 0 to l-1
\newcommand{\TaskArrival}[3][nocommand=1]{%
    \setkeys{RT}{#1}%
    \@compute@yy{#2}
    \@compute@xx{#3}
    \yyy = \yy \advance \yyy by 2\sy%
     \begin{pgfonlayer}{foreground} 
    \draw [\RTLineColor, thick,-\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
     \end{pgfonlayer}
    \@RTExecDefaultValues%
}

%
% TaskNArrival
% Task arrivals: draws periodically up arrows from the specified slot
% par 1  : task number from 1 to n
% par 2  : slot number from 0 to l-1
% par 3  : period
% par 4  : number of instances
\newcommand{\TaskNArrival}[5][nocommand=1]{%
 \foreach \instance [evaluate = \instance as \activation using (#3 + \instance * #4)] in {0,...,\numexpr #5-1}{
 \TaskArrival[#1]{#2}{\activation}{#4}
 }
}

%
% TaskArrDead
% Task arrival and deadline: draws an up arrow and a down arrow at the specified slots
% par 1  : task number from 1 to n
% par 2  : slot number from 0 to l-1
% par 3  : relative deadline
\newcommand{\TaskArrDead}[4][nocommand=1]{
  \setkeys{RT}{#1}%
  \@compute@yy{#2}
  \@compute@xx{#3}
  \yyy = \yy \advance \yyy by 2\sy
  \begin{pgfonlayer}{foreground} 
  \draw [\RTLineColor, thick,-\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
  \end{pgfonlayer}
  \advance \xx by #4\sx
  \begin{pgfonlayer}{foreground} 
  \draw [\RTLineColor, thick, -\RTArrowStyle] (\xx,\yyy) -- (\xx,\yy);
  \end{pgfonlayer}
  \@RTExecDefaultValues
}

%
% TaskNArrDead
% Task arrivals and deadlines: draws periodically up arrows and down arrows from the specified slots
% par 1  : task number from 1 to n
% par 2  : slot number from 0 to l-1
% par 3  : relative deadline
% par 4  : period
% par 5  : number of instances

\newcommand{\TaskNArrDead}[6][nocommand=1]{
 \foreach \instance [evaluate = \instance as \activation using (#3 + \instance * #5)] in {0,...,\numexpr #6-1}{
 \TaskArrDead[#1]{#2}{\activation}{#4}
 }
}

%
% TaskDeadline
% Task deadline: draws a down arrow at the specified slot
% par 1  : task number from 1 to n
% par 2  : slot number from 0 to l-1
\newcommand{\TaskDeadline}[3][nocommand=1]{
  \setkeys{RT}{#1}%
  \@compute@yy{#2}
  \@compute@xx{#3}
  \yyy = \yy \advance \yyy by 2\sy
  \begin{pgfonlayer}{foreground} 
  \draw [\RTLineColor, thick, \RTArrowStyle-] (\xx,\yy) -- (\xx,\yyy);
  \end{pgfonlayer}
  \@RTExecDefaultValues
}

%
% TaskNDeadline
% periodic task deadlines: draws periodically down arrows from the specified slot 
% par 1  : task number from 1 to n
% par 2  : slot number from 0 to l-1
% par 3  : period
% par 4  : number of instances
\newcommand{\TaskNDeadline}[5][nocommand=1]{%
 \foreach \instance [evaluate = \instance as \activation using (#3 + \instance * #4)] in {0,...,\numexpr #5-1}{
 \TaskDeadline[#1]{#2}{\activation}{#4}
 }
}

%
% TaskExecution
% Task execution: draws an execution from start time to finish time
% par 1:  task
% par 2:  start time
% par 3:  finish time
\newcommand{\TaskExecution}[4][nocommand=1]{
  \setkeys{RT}{#1}%
  \@compute@yy{#2}
  \@compute@xx{#3}
  \yyy = \yy \advance \yyy by \RTExecHeight\sy
  \@compute@xxx{#4}
  \draw [fill=\RTTaskColor,\RTTaskFill,draw=\RTLineColor, thick] (\xx,\yy) rectangle (\xxx,\yyy);
  \advance \xx by \xxx \xx = .5\xx
  \advance \yy by .5\RTExecHeight\sy
  \draw (\xx,\yy) node[font=\rtfont] {\RTNumberLabelSize \RTExecLabel};%\RTNumberLabelSize
  \@RTExecDefaultValues
}
%
% Task Lock
% par 1:  task 
% par 2:  time
% par 3:  resource
%
\newcommand{\TaskLock}[4][nocommand=1]{
  \setkeys{RT}{#1}%
  \@compute@yy{#2}
  \@compute@xx{#3}
  \yyy = \yy \advance \yyy by \sy
  \advance \yyy by .5\sy
  \node[font=\rtfont] at (\xx , \yyy) {\RTNumberLabelSize L(#4)}; %\RTNumberLabelSize
  \@RTExecDefaultValues
}
%
% TaskUnlock
% par 1:  task 
% par 2:  time
% par 3:  resource
%
\newcommand{\TaskUnlock}[4][nocommand=1]{
  \setkeys{RT}{#1}%
  \@compute@yy{#2}
  \@compute@xx{#3}
  \yyy = \yy \advance \yyy by \sy
  \advance \yyy by .5\sy
  \node[font=\rtfont] at (\xx , \yyy) {\RTNumberLabelSize U(#4)}; %\RTNumberLabelSize
  \@RTExecDefaultValues
}
%
% Label
% par 1:  number of vertical slot 
% par 2:  time
% par 3:  label
%
\newcommand{\Label}[4][nocommand=1]{
  \setkeys{RT}{#1}%
  %\@compute@yy{#2}
  \@compute@xx{#3}
  \yy = -\sy \multiply \yy by #2
  \advance \yy by \hy
  \yyy = \yy \advance \yyy by 2\sy   %\yyy = \yy \advance \yyy by \sy

  \node[font=\rtfont, fill = white, draw=\RTLineColor, thin,  drop shadow = {color = black}] at (\xx , \yyy) {\RTNumberLabelSize #4}; %\RTNumberLabelSize
  \@RTExecDefaultValues
}
%
% Inherit
% par 1:  higher priority task (from) 
% par 2:  lower priority task (to)
% par 3:  time
%
\newcommand{\Inherit}[4][nocommand=1]{
  \setkeys{RT}{#1}%
  \@compute@yy{#2}
  \@compute@xx{#4}
  \yyy = -3\sy \multiply \yyy by #3 \advance \yyy by \sy
  \advance \yyy by \hy \advance \yyy by -\sy % \RTWindowHeight
  \begin{pgfonlayer}{foreground} 
  \draw [dashed, thick,-\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
  \end{pgfonlayer}
  \@RTExecDefaultValues
}

% 
% Activation
% par 1:  activating task (from) 
% par 2:  signal start time 
% par 3:  activated task (to)
% par 4:  signal arrival time

\newcommand{\Activation}[5][nocommand=1]{
  \setkeys{RT}{#1}%
  \@compute@yy{#2}
  \@compute@xx{#3}
  \yyy = -3\sy \multiply \yyy by #4 %\advance \yyy by \sy
  \advance \yyy by \hy %\advance \yyy by -\sy %\RTWindowHeight
  \xxx = #5\sx \advance \xxx by \sx
   \begin{pgfonlayer}{foreground} 
  \draw [dashed, thick,-\RTArrowStyle] (\xx,\yy) -- (\xxx,\yyy);
   \end{pgfonlayer}

}

% 
% RTBox
% par 1:  time1
% par 2:  time2
%
\newcommand{\RTBox}[3][nocommand=1]{
  \setkeys{RT}{#1}%
  \yy = 0cm
  \advance \yy by \hy
    \yyy = 0cm  %  \yyy = \sy
  \@compute@xx{#2}
  \@compute@xxx{#3}
   \draw [pattern color=lightgray, draw=\RTLineColor, pattern=crosshatch, rounded corners, thin](\xx,\yy) rectangle (\xxx,\yyy);
  \@RTExecDefaultValues
}


%
% TaskInterval : specify an interval with an horizontal double arrow
% par 1: task
% par 2: start time
% par 3: finish time
% par 4: label

\newcommand{\TaskInterval}[5][nocommand=1]{
\setkeys{RT}{#1}
\@compute@yy{#2}
\@compute@xx{#3}
\@compute@xxx{#4}
\advance \yy by .5\sy
\draw [\RTLineColor, thick, \RTArrowStyle-\RTArrowStyle] (\xx,\yy) -- (\xxx,\yy);
\advance \xx by \xxx \xx = .5\xx
%\advance \yy by .5\RTExecHeight\sy
\draw (\xx,\yy) node[above,font=\rtfont] {\RTTaskLabelSize #5};%

\@RTExecDefaultValues

}

% TaskEnd
% Task end: draws a circle when the job terminates
% par 1: task number from 1 to n
% par 2: slot number from 0 to l-1
\newcommand{\TaskEnd}[3][nocommand=1]{%
  \setkeys{RT}{#1}%
  \@compute@yy{#2}
  \@compute@xx{#3}
  \yyy = \yy \advance \yyy by 2\sy%
  \begin{pgfonlayer}{foreground} 
  \draw[fill] (\xx,\yy) circle (1.5pt);
  \end{pgfonlayer}
  \@RTExecDefaultValues%
}

%
% TaskNEnd
% Task ends: draws periodically a circle when the job terminates
% par 1  : task number from 1 to n
% par 2  : slot number from 0 to l-1
% par 3  : period
% par 4  : number of instances
\newcommand{\TaskNEnd}[5][nocommand=1]{%
 \foreach \instance [evaluate = \instance as \activation using (#3 + \instance * #4)] in {0,...,\numexpr #5-1}{
 \TaskEnd[#1]{#2}{\activation}{#4}
 }
}



%% %
% % par 1: task
% % par 2: first instant (arrival)
% % par 3: second instant (deadline)
% %
% \newcommand{\Interval}[4][nocommand=1]{
%   \setkeys{RT}{#1}%
%   \@compute@yy{#2}
%   \advance \yy by 2.5\sy
%   \@compute@xx{#3}
%   \@compute@xxx{#4}
%   % da cambiare con psarc
%   \pscurve*[linecolor=\RTLineColor]{-}(\xx,\yy)(\xxx,\yy)
%   \@RTExecDefaultValues  
% }
%


% 
% RowLabel
% par 1:  task
% par 2:  label
%
\newcommand{\RowLabel}[3][nocommand=1]{
  \setkeys{RT}{#1}%
  \@compute@yy{#2}
  \advance \yy by 2\sy
  \xx = \RTRowLabelOffset %\advance \xx by \sx
  \node[below left,font=\rtfont] at (-\xx , \yy) {\RTTaskLabelSize #3};%\RTTaskLabelSize
}

% 
% TaskExecDelta
% Task execution delta: draws an execution from start time during delta time
% par 1:  task
% par 2:  start time
% par 3:  delta
%
\newcommand{\TaskExecDelta}[4][nocommand=1]{
  \setkeys{RT}{#1}%
  \@compute@yy{#2}
  \@compute@xx{#3}
  \yyy = \yy \advance \yyy by \RTExecHeight \sy
  %\@compute@xxx{#4}
  \xxx = \xx \advance \xxx by #4\sx
   \draw [fill=\RTTaskColor,\RTTaskFill,draw=\RTLineColor, thick] (\xx,\yy) rectangle (\xxx,\yyy);
  \advance \xx by \xxx \xx = .5\xx
   \draw (\xx,\yy) node[above, font=\rtfont] {\RTTaskLabelSize \RTExecLabel}; %\RTNumberLabelSize
  \@RTExecDefaultValues
}

% 
% TaskNExecDelta
% Task execution deltas: draws periodically executions from start time during delta time
% par 1:  task
% par 2:  start time
% par 3:  delta
% par 4:  period
% par 5:  number of instances

\newcommand{\TaskNExecDelta}[6][nocommand=1]{
  \foreach \instance [evaluate = \instance as \activation using (#3 + \instance * #5)] in {0,...,\numexpr #6-1}{
    \TaskExecDelta[#1]{#2}{\activation}{#4}
  }
}



% 
% TaskRespTime
% par 1:  task
% par 2:  start time
% par 3:  finish time
%
\newcommand{\TaskRespTime}[4][nocommand=1]{
  \setkeys{RT}{#1}
  \@compute@yy{#2}
  \@compute@xx{#3}
  \yyy = \yy \advance \yyy by \sy  
  \xxx = \xx \advance \xxx by #4\sx
  \draw [pattern color=\RTTaskColor,draw=\RTLineColor, pattern=crosshatch, thin] (\xx,\yy) rectangle (\xxx,\yyy);
  \@RTExecDefaultValues
}

\@ifclassloaded{beamer}{
  \renewcommand<>{\TaskArrival}[3][nocommand=1]{
    \only#4{\beameroriginal{\TaskArrival}[#1]{#2}{#3}}
  }
  \renewcommand<>{\TaskNArrival}[5][nocommand=1]{
    \only#6{\beameroriginal{\TaskNArrival}[#1]{#2}{#3}{#4}{#5}}
  }
  \renewcommand<>{\TaskArrDead}[4][nocommand=1]{
    \only#5{\beameroriginal{\TaskArrDead}[#1]{#2}{#3}{#4}}
  }
 \renewcommand<>{\TaskNArrDead}[6][nocommand=1]{
    \only#7{\beameroriginal{\TaskNArrDead}[#1]{#2}{#3}{#4}{#5}{#6}}
  }
  \renewcommand<>{\TaskDeadline}[3][nocommand=1]{
    \only#4{\beameroriginal{\TaskDeadline}[#1]{#2}{#3}}
  }
  \renewcommand<>{\TaskNDeadline}[5][nocommand=1]{
    \only#6{\beameroriginal{\TaskNDeadline}[#1]{#2}{#3}{#4}{#5}}
  }
  \renewcommand<>{\TaskExecution}[4][nocommand=1]{
    \only#5{\beameroriginal{\TaskExecution}[#1]{#2}{#3}{#4}}
  }
  \renewcommand<>{\TaskExecDelta}[4][nocommand=1]{
    \only#5{\beameroriginal{\TaskExecDelta}[#1]{#2}{#3}{#4}}
  }
  \renewcommand<>{\TaskNExecDelta}[6][nocommand=1]{
    \only#7{\beameroriginal{\TaskNExecDelta}[#1]{#2}{#3}{#4}{#5}{#6}}
  }
  \renewcommand<>{\TaskRespTime}[4][nocommand=1]{
    \only#5{\beameroriginal{\TaskRespTime}[#1]{#2}{#3}{#4}}
  }
  \renewcommand<>{\TaskLock}[4][nocommand=1]{
    \only#5{\beameroriginal{\TaskLock}[#1]{#2}{#3}{#4}}
  }
  \renewcommand<>{\TaskUnlock}[4][nocommand=1]{
    \only#5{\beameroriginal{\TaskUnlock}[#1]{#2}{#3}{#4}}
  }
  \renewcommand<>{\Label}[4][nocommand=1]{
    \only#5{\beameroriginal{\Label}[#1]{#2}{#3}{#4}}
  }
  \renewcommand<>{\Inherit}[4][nocommand=1]{
    \only#5{\beameroriginal{\Inherit}[#1]{#2}{#3}{#4}}
  }
  \renewcommand<>{\Activation}[5][nocommand=1]{
    \only#6{\beameroriginal{\Activation}[#1]{#2}{#3}{#4}{#5}}
  }
  \renewcommand<>{\RTBox}[3][nocommand=1]{
    \only#4{\beameroriginal{\RTBox}[#1]{#2}{#3}}
  }  
  \renewcommand<>{\FLine}[5][nocommand=1]{
    \only#6{\beameroriginal{\FLine}[#1]{#2}{#3}{#4}{#5}}
  }  
  \renewcommand<>{\TaskInterval}[5][nocommand=1]{
    \only#6{\beameroriginal{\TaskInterval}[#1]{#2}{#3}{#4}{#5}}
  }
  \renewcommand<>{\TaskEnd}[3][nocommand=1]{
    \only#4{\beameroriginal{\TaskEnd}[#1]{#2}{#3}}
  }
  \renewcommand<>{\TaskNEnd}[5][nocommand=1]{
    \only#6{\beameroriginal{\TaskNEnd}[#1]{#2}{#3}{#4}{#5}}
  }
}
{\typeout{beamer not loaded}}

\endinput


