ソースを参照

Merge pull request #4 from abertout/master

multido package is no longer necessary to repeat commands
Giuseppe Lipari 9年前
コミット
0f14b5b7fc
3個のファイルの変更227行の追加145行の削除
  1. 8
    8
      rtsched-beamer-doc.tex
  2. 125
    121
      rtsched-doc.tex
  3. 94
    16
      rtsched.sty

+ 8
- 8
rtsched-beamer-doc.tex ファイルの表示

@@ -76,15 +76,15 @@
76 76
       }
77 77
       \RTBox<23>{6}{10}
78 78
 
79
-      \multido{\n=0+4}{5}{        % 5 instances of period 4 
80
-        \TaskArrDead{1}{\n}{4}    % draw the arrival and deadline
81
-        \TaskExecDelta{1}{\n}{1}  % draw execution (highest priority), 
82
-        % from \n to \n+1
83
-      }
79
+           
80
+      \TaskArrDead{1}{0}{4}{4}{5}    % draws the arrivals and deadlines
81
+      \TaskExecDelta{1}{0}{1}{4}{5}  % draws execution (highest priority)
82
+                                     % for 5 instances of period 4 
83
+     
84
+            
85
+      \TaskArrDead{2}{0}{6}{6}{3}    % draws the arrivals and deadlines
86
+                                     % for 3 instances of period 6 
84 87
       
85
-      \multido{\n=0+6}{3}{        % 3 instances of period 6 
86
-        \TaskArrDead{2}{\n}{6}    % draw the arrival and deadline
87
-      }
88 88
       % no simple formula for lowest priority, sorry!
89 89
       \TaskExecution{2}{1}{4}
90 90
       \TaskExecution{2}{6}{8}

+ 125
- 121
rtsched-doc.tex ファイルの表示

@@ -2,7 +2,6 @@
2 2
 
3 3
 \usepackage{rtsched}
4 4
 \usepackage{url}
5
-\usepackage{multido}
6 5
 
7 6
 \title{The \texttt{rtsched} package for \LaTeX \\ (version 2.0)}
8 7
 \author{Giuseppe Lipari}
@@ -69,11 +68,33 @@ using the following commands:
69 68
 \noindent where \texttt{i} is the task index (from 1 to \texttt{n}
70 69
 included), \texttt{t} is the arrival time, and \texttt{reld} is the
71 70
 relative deadline; an absolute deadline will be drawn at \texttt{t +
72
-  reld}.
71
+  reld}. If you only want to draw absolute deadlines, you can simply use the following command:
72
+\begin{verbatim}
73
+\TaskDeadline{i}{t}
74
+\end{verbatim}
75
+\noindent that works in the same way as \verb+\TaskArrival{i}{t}+.
76
+
73 77
 
74 78
 In this example there are a lot of repetitions. These can be avoided
75
-if you use the \texttt{multido} macro from the \texttt{multido} package, as shown in the example of
76
-Figure \ref{fig:ex1a}.
79
+if you use the periodic versions of some commands, as shown in the example of
80
+Figure \ref{fig:ex1a}. Available periodic versions of the commands can be found in Table~\ref{tab:periodic_versions}. The periodic versions take two additional arguments corresponding to the period and to the number of instances desired.
81
+
82
+\begin{table}[!htbp]
83
+\begin{tabular}{|l|l|}
84
+ \hline
85
+  Command & Periodic version  \\
86
+ \hline
87
+ \verb+\TaskArrival{i}{t}+ & \verb+\TaskNArrival{i}{t}{p}{n}+ \\
88
+ \verb+\TaskDeadline{i}{t}+ & \verb+\TaskNDeadline{i}{t}{p}{n}+ \\
89
+ \verb+\TaskArrDeadl{i}{t}{reld}+ & \verb+\TaskNArrDeadl{i}{t}{reld}{p}{n}+  \\
90
+ \verb+\TaskExecDelta{i}{t}{delta}+ & \verb+\TaskNExecDelta{i}{t}{delta}{p}{n}+\\
91
+  \hline
92
+\end{tabular}
93
+\caption{Table of periodic commands where p stands for the period and n for the number of instances}
94
+\label{tab:periodic_versions}
95
+\end{table}
96
+
97
+
77 98
 
78 99
 To draw the execution rectangle, you can use the following command:
79 100
 \begin{verbatim}
@@ -160,15 +181,14 @@ from periods (the so-called \emph{constrained deadline tasks}).
160 181
 \begin{figure}[!htbp]
161 182
   \centering
162 183
   \begin{RTGrid}{2}{20}
163
-    \multido{\n=0+4}{5}{        % 5 instances of period 4 
164
-      \TaskArrDead{1}{\n}{4}    % draws the arrival and deadline
165
-      \TaskExecDelta{1}{\n}{1}  % draws execution (highest priority), 
166
-                                % from \n to \n+1
167
-    }
168
- 
169
-    \multido{\n=0+6}{3}{        % 3 instances of period 6 
170
-      \TaskArrDead{2}{\n}{6}    % draws the arrival and deadline
171
-    }
184
+                                   
185
+    \TaskNArrDead{1}{0}{4}{4}{5}    % draws the arrivals and deadlines
186
+    \TaskNExecDelta{1}{0}{1}{4}{5}  % draws executions (highest priority) 
187
+                                    % for 5 instances of period 4 
188
+
189
+                                    % draws the arrival and deadline
190
+    \TaskNArrDead{2}{0}{6}{6}{3}    % for 3 instances of period 6 
191
+    
172 192
     % no simple formula for lowest priority, sorry!
173 193
     \TaskExecution{2}{1}{4}
174 194
     \TaskExecution{2}{6}{8}
@@ -178,15 +198,14 @@ from periods (the so-called \emph{constrained deadline tasks}).
178 198
 
179 199
 \begin{verbatim}
180 200
   \begin{RTGrid}{2}{20}
181
-    \multido{\n=0+4}{5}{        % 4 instances of period 4 
182
-      \TaskArrDead{1}{\n}{4}    % draws the arrival and deadline
183
-      \TaskExecDelta{1}{\n}{1}  % draws execution (highest priority), 
184
-                                % from \n to \n+1
185
-    }
186
- 
187
-    \multido{\n=0+6}{3}{        % 3 instances of period 6 
188
-      \TaskArrDead{2}{\n}{6}    % draws the arrival and deadline
189
-    }
201
+                                   
202
+    \TaskNArrDead{1}{0}{4}{4}{5}    % draws the arrivals and deadlines
203
+    \TaskNExecDelta{1}{0}{1}{4}{5}  % draws executions (highest priority) 
204
+                                    % for 5 instances of period 4 
205
+
206
+   	\TaskNArrDead{2}{0}{6}{6}{3}    % draws the arrival and deadline
207
+                                    % for 3 instances of period 6 
208
+    
190 209
     % no simple formula for lowest priority, sorry!
191 210
     \TaskExecution{2}{1}{4}
192 211
     \TaskExecution{2}{6}{8}
@@ -194,29 +213,29 @@ from periods (the so-called \emph{constrained deadline tasks}).
194 213
     \TaskExecution{2}{13}{16}    
195 214
   \end{RTGrid}
196 215
 \end{verbatim}
197
-  \caption{Using multido to avoid repetitions}
216
+  \caption{Using periodic commands to avoid repetitions}
198 217
   \label{fig:ex1a}
199 218
 \end{figure}
200 219
 
201 220
 \begin{figure}[!htbp]
202 221
   \centering
203 222
   \begin{RTGrid}{3}{14}
204
-    \multido{\n=0+3}{4}{        % 4 instances of period 3, starting from 0 
205
-      \TaskArrival{1}{\n}       % draws only the arrival
206
-      \TaskExecDelta{1}{\n}{1}  % draws execution (highest priority), 
207
-                                % from \n to \n+1
208
-    }
223
+                                      
224
+    \TaskNArrival{1}{0}{3}{4}        % draws only the arrivals 
225
+    \TaskNExecDelta{1}{0}{1}{3}{4}   % draws executions (highest priority)
226
+                                     % for 4 instances of period 3 
227
+                               
209 228
  
210
-    \multido{\n=3+4}{3}{        % 3 instances of period 4, starting from 3 
211
-      \TaskArrival{2}{\n}       % draws only the arrival
212
-    }
229
+                                   
230
+    \TaskNArrival{2}{3}{4}{3}        % draws only the arrivals
231
+                                     % 3 instances of period 4, starting from 3 
213 232
     \TaskExecDelta{2}{4}{1}
214 233
     \TaskExecDelta{2}{7}{1}
215 234
     \TaskExecDelta{2}{11}{1}
216 235
 
217
-    \multido{\n=1+5}{3}{        % 3 instances of period 5, starting from 1 
218
-      \TaskArrival{3}{\n}       % draws only the arrival
219
-    }
236
+                                     % 3 instances of period 5, starting from 1 
237
+    \TaskNArrival{3}{1}{5}{3}        % draws only the arrivals
238
+
220 239
     \TaskExecDelta{3}{1}{1}
221 240
     \TaskExecDelta{3}{8}{1}
222 241
     \TaskExecDelta{3}{12}{1}
@@ -224,20 +243,21 @@ from periods (the so-called \emph{constrained deadline tasks}).
224 243
 
225 244
 \begin{verbatim}
226 245
   \begin{RTGrid}{3}{14}
227
-    \multido{\n=0+3}{4}{        % 4 instances of period 3 
228
-      \TaskArrival{1}{\n}       % draws only the arrival
229
-      \TaskExecDelta{1}{\n}{1}} % draws execution (highest priority), 
230
-                                % from \n to \n+1
246
+                                      
247
+    \TaskNArrival{1}{0}{3}{4}        % draws only the arrivals 
248
+    \TaskNExecDelta{1}{0}{1}{3}{4}   % draws executions (highest priority)
249
+                                     % for 4 instances of period 3 
250
+                               
231 251
  
232
-    \multido{\n=3+4}{3}{        % 3 instances of period 4, starting from 3 
233
-      \TaskArrival{2}{\n}}      % draws only the arrival
234
-
252
+                                   
253
+    \TaskNArrival{2}{3}{4}{3}        % draws only the arrivals
254
+                                     % 3 instances of period 4, starting from 3 
235 255
     \TaskExecDelta{2}{4}{1}
236 256
     \TaskExecDelta{2}{7}{1}
237 257
     \TaskExecDelta{2}{11}{1}
238 258
 
239
-    \multido{\n=1+5}{3}{        % 3 instances of period 5, starting from 1 
240
-      \TaskArrival{3}{\n}}      % draws only the arrival
259
+                                     % 3 instances of period 5, starting from 1 
260
+    \TaskNArrival{3}{1}{5}{3}        % draws only the arrivals
241 261
 
242 262
     \TaskExecDelta{3}{1}{1}
243 263
     \TaskExecDelta{3}{8}{1}
@@ -251,16 +271,14 @@ from periods (the so-called \emph{constrained deadline tasks}).
251 271
 \begin{figure}[!htbp]
252 272
   \centering
253 273
   \begin{RTGrid}[width=8cm]{2}{15}
254
-    \multido{\n=0+6}{3}{
255
-    \TaskArrDead{1}{\n}{3}}
256
-    \multido{\n=2+8}{2}{
257
-    \TaskArrDead{2}{\n}{5}}
274
+   \TaskNArrDead{1}{0}{3}{6}{3}
275
+   \TaskNArrDead{2}{2}{5}{8}{2}
258 276
   \end{RTGrid}
259 277
 \begin{verbatim}
260
-    \multido{\n=0+6}{3}{
261
-    \TaskArrDead{1}{\n}{3}}
262
-    \multido{\n=2+8}{2}{
263
-    \TaskArrDead{2}{\n}{5}}
278
+  \begin{RTGrid}[width=8cm]{2}{15}
279
+   \TaskNArrDead{1}{0}{3}{6}{3}
280
+   \TaskNArrDead{2}{2}{5}{8}{2}
281
+  \end{RTGrid}
264 282
 \end{verbatim}
265 283
   \caption{Deadlines less than periods}
266 284
   \label{fig:ex1c}
@@ -273,40 +291,42 @@ style. An example is in Figure~\ref{fig:resp-time} that uses command
273 291
 \begin{figure}
274 292
   \centering
275 293
   \begin{RTGrid}{2}{20}
276
-    \multido{\n=0+4}{5}{        % 5 instances of period 4 
277
-      \TaskArrDead{1}{\n}{4}    % draws the arrival and deadline
278
-      \TaskExecDelta{1}{\n}{1}  % draws execution (highest priority), 
279
-                                % from \n to \n+1
280
-    }
281
- 
282
-    \multido{\n=0+6}{3}{        % 3 instances of period 6 
283
-      \TaskArrDead{2}{\n}{6}    % draws the arrival and deadline
284
-    }
294
+  
295
+    \TaskNArrDead{1}{0}{4}{4}{5}    % draws the arrivals and deadlines
296
+    \TaskNExecDelta{1}{0}{1}{4}{5}  % draws executions (highest priority) 
297
+                                   % for 5 instances of period 4 
285 298
 
286
-    \TaskRespTime{2}{0}{4}
287
-    \TaskExecution{2}{1}{4}
288
-    \TaskRespTime{2}{6}{4}
289
-    \TaskExecution{2}{6}{8}
290
-    \TaskExecution{2}{9}{10}
291
-    \TaskRespTime{2}{12}{4}
292
-    \TaskExecution{2}{13}{16}    
299
+ 
300
+    \TaskNArrDead{2}{0}{6}{6}{3}   % draws the arrivals and deadlines
301
+                                   % for 3 instances of period 6 
302
+
303
+    \TaskRespTime{2}{0}{4}         % draws the hatched rectangle in [0,4]
304
+    \TaskExecution{2}{1}{4}        % draws execution (over the previous rectangle)
305
+    \TaskRespTime{2}{6}{4}         % draws the hatched rectangle in [6,10]
306
+    \TaskExecution{2}{6}{8}        % draws execution
307
+    \TaskExecution{2}{9}{10}       % draws execution
308
+    \TaskRespTime{2}{12}{4}        % draws the hatched rectangle in [12,16]
309
+    \TaskExecution{2}{13}{16}      % draws execution   
293 310
   \end{RTGrid}  
294 311
 \begin{verbatim}
295 312
   \begin{RTGrid}{2}{20}
296
-    \multido{\n=0+4}{5}{         
297
-      \TaskArrDead{1}{\n}{4}    
298
-      \TaskExecDelta{1}{\n}{1}}
299
-    \multido{\n=0+6}{3}{        
300
-      \TaskArrDead{2}{\n}{6}}
301
-
302
-    \TaskRespTime{2}{0}{4}    % draws the hatched rectangle in [0,4]
303
-    \TaskExecution{2}{1}{4}   % draws execution (over the previous rectangle)
304
-    \TaskRespTime{2}{6}{4}    % draws the hatched rectangle in [6,10]
305
-    \TaskExecution{2}{6}{8}   % draws execution
306
-    \TaskExecution{2}{9}{10}  % draws execution
307
-    \TaskRespTime{2}{12}{4}   % draws the hatched rectangle in [12,16]
308
-    \TaskExecution{2}{13}{16} % draws execution   
309
-  \end{RTGrid}  
313
+  
314
+    \TaskNArrDead{1}{0}{4}{4}{5}    % draws the arrivals and deadlines
315
+    \TaskNExecDelta{1}{0}{1}{4}{5}  % draws executions (highest priority) 
316
+                                    % for 5 instances of period 4 
317
+
318
+ 
319
+    \TaskNArrDead{2}{0}{6}{6}{3}   % draws the arrivals and deadlines
320
+                                   % for 3 instances of period 6 
321
+
322
+    \TaskRespTime{2}{0}{4}         % draws the hatched rectangle in [0,4]
323
+    \TaskExecution{2}{1}{4}        % draws execution (over the previous rectangle)
324
+    \TaskRespTime{2}{6}{4}         % draws the hatched rectangle in [6,10]
325
+    \TaskExecution{2}{6}{8}        % draws execution
326
+    \TaskExecution{2}{9}{10}       % draws execution
327
+    \TaskRespTime{2}{12}{4}        % draws the hatched rectangle in [12,16]
328
+    \TaskExecution{2}{13}{16}      % draws execution   
329
+  \end{RTGrid}   
310 330
 \end{verbatim}
311 331
   \caption{Example with TaskRespTime}
312 332
   \label{fig:resp-time}
@@ -323,11 +343,9 @@ task symbols.
323 343
   \centering
324 344
   %% no grid and no symbols
325 345
   \begin{RTGrid}[nogrid=1,nosymbols=1]{2}{20}
326
-    \multido{\n=0+4}{5}{         
327
-      \TaskArrDead{1}{\n}{4}    
328
-      \TaskExecDelta{1}{\n}{1}}
329
-    \multido{\n=0+6}{3}{         
330
-        \TaskArrDead{2}{\n}{6}}
346
+    \TaskNArrDead{1}{0}{4}{4}{5}    
347
+    \TaskNExecDelta{1}{0}{1}{4}{5}  
348
+    \TaskNArrDead{2}{0}{6}{6}{3}
331 349
     \TaskExecution{2}{1}{4}
332 350
     \TaskExecution{2}{6}{8}
333 351
     \TaskExecution{2}{9}{10}
@@ -336,11 +354,9 @@ task symbols.
336 354
 \begin{verbatim}
337 355
   %% no grid and no symbols
338 356
   \begin{RTGrid}[nogrid=1,nosymbols=1]{2}{20}
339
-    \multido{\n=0+4}{5}{         
340
-      \TaskArrDead{1}{\n}{4}    
341
-      \TaskExecDelta{1}{\n}{1}}
342
-    \multido{\n=0+6}{3}{         
343
-        \TaskArrDead{2}{\n}{6}}
357
+    \TaskNArrDead{1}{0}{4}{4}{5}    
358
+    \TaskNExecDelta{1}{0}{1}{4}{5}  
359
+    \TaskNArrDead{2}{0}{6}{6}{3}
344 360
     \TaskExecution{2}{1}{4}
345 361
     \TaskExecution{2}{6}{8}
346 362
     \TaskExecution{2}{9}{10}
@@ -366,12 +382,9 @@ smaller. Notice that you can directly specify colors using the TikZ
366 382
   %% specification of the symbol, as the symbol is already used in a
367 383
   %% math environment inside the macro
368 384
   \begin{RTGrid}[width=8cm,symbol=\gamma,nonumbers=1,labelsize=\small]{2}{20}
369
-    \multido{\n=0+4}{5}{         
370
-      \TaskArrDead{1}{\n}{4}    
371
-      \TaskExecDelta{1}{\n}{1}}
372
-    \multido{\n=0+6}{3}{         
373
-      \TaskArrDead{2}{\n}{6}    
374
-    }
385
+    \TaskNArrDead{1}{0}{4}{4}{5}    
386
+    \TaskNExecDelta{1}{0}{1}{4}{5}
387
+    \TaskNArrDead{2}{0}{6}{6}{3}    
375 388
     %% here, the border changes to cyan, and the fill to white
376 389
     \TaskExecution[linecolor=cyan,color=white]{2}{1}{4}
377 390
     %% the next two boxes are filled with red instead of gray
@@ -387,12 +400,9 @@ smaller. Notice that you can directly specify colors using the TikZ
387 400
   %% specification of the symbol, as the symbol is already used in a
388 401
   %% math environment inside the macro
389 402
   \begin{RTGrid}[symbol=\gamma,nonumbers=1,labelsize=\Large]{2}{20}
390
-    \multido{\n=0+4}{5}{         
391
-      \TaskArrDead{1}{\n}{4}    
392
-      \TaskExecDelta{1}{\n}{1}}
393
-    \multido{\n=0+6}{3}{         
394
-      \TaskArrDead{2}{\n}{6}    
395
-    }
403
+    \TaskNArrDead{1}{0}{4}{4}{5}    
404
+    \TaskNExecDelta{1}{0}{1}{4}{5}
405
+    \TaskNArrDead{2}{0}{6}{6}{3}  
396 406
     %% here, the border changes to cyan, and the fill to white
397 407
     \TaskExecution[linecolor=cyan,color=white]{2}{1}{4}
398 408
     %% the next two boxes are filled with red instead of gray
@@ -424,12 +434,10 @@ number in the time line, using the \texttt{numoffset=12} option.
424 434
     \RowLabel{1}{Server}
425 435
     %% the symbol for the second row
426 436
     \RowLabel{2}{$\Pi_2$}
427
-    \multido{\n=0+4}{5}{         
428
-      \TaskArrDead{1}{\n}{4}    
429
-      \TaskExecDelta{1}{\n}{1}}
430
-    \multido{\n=0+6}{3}{         
431
-      \TaskArrDead{2}{\n}{6}
432
-    }
437
+    \TaskNArrDead{1}{0}{4}{4}{5}    
438
+    \TaskNExecDelta{1}{0}{1}{4}{5}  
439
+    \TaskNArrDead{2}{0}{6}{6}{3}
440
+    
433 441
     \TaskExecution{2}{1}{4}
434 442
     \TaskExecution{2}{6}{8}
435 443
     \TaskExecution{2}{9}{10}
@@ -442,12 +450,10 @@ number in the time line, using the \texttt{numoffset=12} option.
442 450
     \RowLabel{1}{Server}
443 451
     %% the symbol for the second row
444 452
     \RowLabel{2}{$\Pi_2$}
445
-    \multido{\n=0+4}{5}{         
446
-      \TaskArrDead{1}{\n}{4}    
447
-      \TaskExecDelta{1}{\n}{1}}
448
-    \multido{\n=0+6}{3}{         
449
-      \TaskArrDead{2}{\n}{6}
450
-    }
453
+    \TaskNArrDead{1}{0}{4}{4}{5}    
454
+    \TaskNExecDelta{1}{0}{1}{4}{5}  
455
+    \TaskNArrDead{2}{0}{6}{6}{3}
456
+    
451 457
     \TaskExecution{2}{1}{4}
452 458
     \TaskExecution{2}{6}{8}
453 459
     \TaskExecution{2}{9}{10}
@@ -505,9 +511,8 @@ to highlight a portion of the schedule with \texttt{RTBox}:
505 511
   \centering
506 512
   \begin{RTGrid}{2}{20}
507 513
     \RTBox{12}{16}
508
-    \multido{\n=0+6}{4}{
509
-      \TaskArrival{1}{\n}
510
-      \TaskExecDelta{1}{\n}{2}}
514
+    \TaskArrival{1}{0}{6}{4}
515
+    \TaskExecDelta{1}{0}{2}{6}{4}
511 516
     \TaskArrival{2}{10}
512 517
     \TaskExecDelta[exeheight=1.5]{2}{10}{3}
513 518
     \Activation{1}{8}{2}{10}
@@ -516,9 +521,8 @@ to highlight a portion of the schedule with \texttt{RTBox}:
516 521
 \begin{verbatim}
517 522
   \begin{RTGrid}{2}{20}
518 523
     \RTBox{12}{16}
519
-    \multido{\n=0+6}{4}{
520
-      \TaskArrival{1}{\n}
521
-      \TaskExecDelta{1}{\n}{2}}
524
+    \TaskArrival{1}{0}{6}{4}
525
+    \TaskExecDelta{1}{0}{2}{6}{4}
522 526
     \TaskArrival{2}{10}
523 527
     \TaskExecDelta[exeheight=1.5]{2}{10}{3}
524 528
     \Activation{1}{8}{2}{10}

+ 94
- 16
rtsched.sty ファイルの表示

@@ -112,7 +112,6 @@
112 112
 \newcount\nhl % number of horizontal lines
113 113
 \newcount\nvl % number of vertical lines
114 114
 \newcount\ntasks % number of tasks
115
-\newcount\ntaskslessone %number of tasks less one
116 115
 \newcount\tmp % temp
117 116
 
118 117
 
@@ -124,8 +123,6 @@
124 123
 \def\@mygrid@begin[#1]#2#3{\setkeys{RT}{#1}%
125 124
   %% get the number of tasks
126 125
   \ntasks = #2
127
-  \ntaskslessone = \ntasks
128
-  \advance \ntaskslessone by -1
129 126
   %% number of horizontal steps in the grid
130 127
   \nsx = #3 \advance \nsx by 2 %
131 128
   %% real length of the window (approx)
@@ -174,7 +171,7 @@
174 171
 
175 172
     %% Task Names
176 173
     \if\RTWriteSymbols\RTDefWriteSymbols
177
-     \foreach \i  [evaluate = \i as \j using (\hy -3*\i*\sy)] in {0,...,\ntaskslessone}{
174
+     \foreach \i  [evaluate = \i as \j using (\hy -3*\i*\sy)] in {0,...,\numexpr \ntasks - 1}{
178 175
       \pgfmathsetmacro\task{\i + 1};
179 176
       \node[below, font=\rtfont] at (-\sx , \j-\sy) {\RTTaskLabelSize $\RTTaskSymbol_{\pgfmathprintnumber[int trunc]{\task}}$};
180 177
      }
@@ -184,7 +181,7 @@
184 181
     %% Horizontal axes
185 182
     \if\RTAxisInvisible\RTDefAxisInvisible
186 183
       \begin{pgfonlayer}{foreground} 
187
-      \foreach \i [evaluate = \i as \j using (\hy -3*\i*\sy)] in {0,...,\ntaskslessone}{
184
+      \foreach \i [evaluate = \i as \j using (\hy -3*\i*\sy)] in {0,...,\numexpr \ntasks - 1}{
188 185
       \draw [very thick,-\RTArrowStyle] (\sx,\j-3*\sy) -- (\RTWindowLength - \sx,\j-3*\sy);
189 186
       }
190 187
       \end{pgfonlayer} 
@@ -278,9 +275,11 @@
278 275
     \@RTExecDefaultValues%
279 276
 }
280 277
 
281
-%% Task Arrival: draws an up arrow at the specified slot
282
-%% #1  : task number from 1 to n
283
-%% #2  : slot number from 0 to l-1
278
+%
279
+% TaskArrival
280
+% Task arrival: draws an up arrow at the specified slot
281
+% par 1  : task number from 1 to n
282
+% par 2  : slot number from 0 to l-1
284 283
 \newcommand{\TaskArrival}[3][nocommand=1]{%
285 284
     \setkeys{RT}{#1}%
286 285
     \@compute@yy{#2}
@@ -289,14 +288,28 @@
289 288
      \begin{pgfonlayer}{foreground} 
290 289
     \draw [\RTLineColor, thick,-\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
291 290
      \end{pgfonlayer}
292
-
293 291
     \@RTExecDefaultValues%
294 292
 }
295 293
 
296
-%% Task Arrival and deadline: draws an up arrow and a down arrow at the specified slots
297
-%% #1  : task number from 1 to n
298
-%% #2  : slot number from 0 to l-1
299
-%% #3  : relative deadline
294
+%
295
+% TaskNArrival
296
+% Task arrivals: draws periodically up arrows from the specified slot
297
+% par 1  : task number from 1 to n
298
+% par 2  : slot number from 0 to l-1
299
+% par 3  : period
300
+% par 4  : number of instances
301
+\newcommand{\TaskNArrival}[5][nocommand=1]{%
302
+ \foreach \instance [evaluate = \instance as \activation using (#3 + \instance * #4)] in {0,...,\numexpr #5-1}{
303
+ \TaskArrival[#1]{#2}{\activation}{#4}
304
+ }
305
+}
306
+
307
+%
308
+% TaskArrDead
309
+% Task arrival and deadline: draws an up arrow and a down arrow at the specified slots
310
+% par 1  : task number from 1 to n
311
+% par 2  : slot number from 0 to l-1
312
+% par 3  : relative deadline
300 313
 \newcommand{\TaskArrDead}[4][nocommand=1]{
301 314
   \setkeys{RT}{#1}%
302 315
   \@compute@yy{#2}
@@ -312,10 +325,26 @@
312 325
   \@RTExecDefaultValues
313 326
 }
314 327
 
328
+%
329
+% TaskNArrDead
330
+% Task arrivals and deadlines: draws periodically up arrows and down arrows from the specified slots
331
+% par 1  : task number from 1 to n
332
+% par 2  : slot number from 0 to l-1
333
+% par 3  : relative deadline
334
+% par 4  : period
335
+% par 5  : number of instances
336
+
337
+\newcommand{\TaskNArrDead}[6][nocommand=1]{
338
+ \foreach \instance [evaluate = \instance as \activation using (#3 + \instance * #5)] in {0,...,\numexpr #6-1}{
339
+ \TaskArrDead[#1]{#2}{\activation}{#4}
340
+ }
341
+}
315 342
 
316
-%% Task Deadline: draws a down arrow at the specified slot
317
-%% #1  : task number from 1 to n
318
-%% #2  : slot number from 0 to l-1
343
+%
344
+% TaskDeadline
345
+% Task deadline: draws a down arrow at the specified slot
346
+% par 1  : task number from 1 to n
347
+% par 2  : slot number from 0 to l-1
319 348
 \newcommand{\TaskDeadline}[3][nocommand=1]{
320 349
   \setkeys{RT}{#1}%
321 350
   \@compute@yy{#2}
@@ -327,6 +356,25 @@
327 356
   \@RTExecDefaultValues
328 357
 }
329 358
 
359
+%
360
+% TaskNDeadline
361
+% periodic task deadlines: draws periodically down arrows from the specified slot 
362
+% par 1  : task number from 1 to n
363
+% par 2  : slot number from 0 to l-1
364
+% par 3  : period
365
+% par 4  : number of instances
366
+\newcommand{\TaskNDeadline}[5][nocommand=1]{%
367
+ \foreach \instance [evaluate = \instance as \activation using (#3 + \instance * #4)] in {0,...,\numexpr #5-1}{
368
+ \TaskDeadline[#1]{#2}{\activation}{#4}
369
+ }
370
+}
371
+
372
+%
373
+% TaskExecution
374
+% Task execution: draws an execution from start time to finish time
375
+% par 1:  task
376
+% par 2:  start time
377
+% par 3:  finish time
330 378
 \newcommand{\TaskExecution}[4][nocommand=1]{
331 379
   \setkeys{RT}{#1}%
332 380
   \@compute@yy{#2}
@@ -475,6 +523,7 @@
475 523
 
476 524
 % 
477 525
 % TaskExecDelta
526
+% Task execution delta: draws an execution from start time during delta time
478 527
 % par 1:  task
479 528
 % par 2:  start time
480 529
 % par 3:  delta
@@ -492,6 +541,22 @@
492 541
   \@RTExecDefaultValues
493 542
 }
494 543
 
544
+% 
545
+% TaskNExecDelta
546
+% Task execution deltas: draws periodically executions from start time during delta time
547
+% par 1:  task
548
+% par 2:  start time
549
+% par 3:  delta
550
+% par 4:  period
551
+% par 5:  number of instances
552
+
553
+\newcommand{\TaskNExecDelta}[6][nocommand=1]{
554
+  \foreach \instance [evaluate = \instance as \activation using (#3 + \instance * #5)] in {0,...,\numexpr #6-1}{
555
+    \TaskExecDelta[#1]{#2}{\activation}{#4}
556
+  }
557
+}
558
+
559
+
495 560
 
496 561
 % 
497 562
 % TaskRespTime
@@ -513,18 +578,30 @@
513 578
   \renewcommand<>{\TaskArrival}[3][nocommand=1]{
514 579
     \only#4{\beameroriginal{\TaskArrival}[#1]{#2}{#3}}
515 580
   }
581
+  \renewcommand<>{\TaskNArrival}[5][nocommand=1]{
582
+    \only#6{\beameroriginal{\TaskNArrival}[#1]{#2}{#3}{#4}{#5}}
583
+  }
516 584
   \renewcommand<>{\TaskArrDead}[4][nocommand=1]{
517 585
     \only#5{\beameroriginal{\TaskArrDead}[#1]{#2}{#3}{#4}}
518 586
   }
587
+ \renewcommand<>{\TaskNArrDead}[6][nocommand=1]{
588
+    \only#7{\beameroriginal{\TaskNArrDead}[#1]{#2}{#3}{#4}{#5}{#6}}
589
+  }
519 590
   \renewcommand<>{\TaskDeadline}[3][nocommand=1]{
520 591
     \only#4{\beameroriginal{\TaskDeadline}[#1]{#2}{#3}}
521 592
   }
593
+  \renewcommand<>{\TaskNDeadline}[5][nocommand=1]{
594
+    \only#6{\beameroriginal{\TaskNDeadline}[#1]{#2}{#3}{#4}{#5}}
595
+  }
522 596
   \renewcommand<>{\TaskExecution}[4][nocommand=1]{
523 597
     \only#5{\beameroriginal{\TaskExecution}[#1]{#2}{#3}{#4}}
524 598
   }
525 599
   \renewcommand<>{\TaskExecDelta}[4][nocommand=1]{
526 600
     \only#5{\beameroriginal{\TaskExecDelta}[#1]{#2}{#3}{#4}}
527 601
   }
602
+  \renewcommand<>{\TaskNExecDelta}[6][nocommand=1]{
603
+    \only#7{\beameroriginal{\TaskNExecDelta}[#1]{#2}{#3}{#4}{#5}{#6}}
604
+  }
528 605
   \renewcommand<>{\TaskRespTime}[4][nocommand=1]{
529 606
     \only#5{\beameroriginal{\TaskRespTime}[#1]{#2}{#3}{#4}}
530 607
   }
@@ -554,3 +631,4 @@
554 631
 
555 632
 \endinput
556 633
 
634
+

読み込み中…
キャンセル
保存