Browse Source

Merge pull request #4 from abertout/master

multido package is no longer necessary to repeat commands
Giuseppe Lipari 9 years ago
parent
commit
0f14b5b7fc
3 changed files with 227 additions and 145 deletions
  1. 8
    8
      rtsched-beamer-doc.tex
  2. 125
    121
      rtsched-doc.tex
  3. 94
    16
      rtsched.sty

+ 8
- 8
rtsched-beamer-doc.tex View File

76
       }
76
       }
77
       \RTBox<23>{6}{10}
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
       % no simple formula for lowest priority, sorry!
88
       % no simple formula for lowest priority, sorry!
89
       \TaskExecution{2}{1}{4}
89
       \TaskExecution{2}{1}{4}
90
       \TaskExecution{2}{6}{8}
90
       \TaskExecution{2}{6}{8}

+ 125
- 121
rtsched-doc.tex View File

2
 
2
 
3
 \usepackage{rtsched}
3
 \usepackage{rtsched}
4
 \usepackage{url}
4
 \usepackage{url}
5
-\usepackage{multido}
6
 
5
 
7
 \title{The \texttt{rtsched} package for \LaTeX \\ (version 2.0)}
6
 \title{The \texttt{rtsched} package for \LaTeX \\ (version 2.0)}
8
 \author{Giuseppe Lipari}
7
 \author{Giuseppe Lipari}
69
 \noindent where \texttt{i} is the task index (from 1 to \texttt{n}
68
 \noindent where \texttt{i} is the task index (from 1 to \texttt{n}
70
 included), \texttt{t} is the arrival time, and \texttt{reld} is the
69
 included), \texttt{t} is the arrival time, and \texttt{reld} is the
71
 relative deadline; an absolute deadline will be drawn at \texttt{t +
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
 In this example there are a lot of repetitions. These can be avoided
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
 To draw the execution rectangle, you can use the following command:
99
 To draw the execution rectangle, you can use the following command:
79
 \begin{verbatim}
100
 \begin{verbatim}
160
 \begin{figure}[!htbp]
181
 \begin{figure}[!htbp]
161
   \centering
182
   \centering
162
   \begin{RTGrid}{2}{20}
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
     % no simple formula for lowest priority, sorry!
192
     % no simple formula for lowest priority, sorry!
173
     \TaskExecution{2}{1}{4}
193
     \TaskExecution{2}{1}{4}
174
     \TaskExecution{2}{6}{8}
194
     \TaskExecution{2}{6}{8}
178
 
198
 
179
 \begin{verbatim}
199
 \begin{verbatim}
180
   \begin{RTGrid}{2}{20}
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
     % no simple formula for lowest priority, sorry!
209
     % no simple formula for lowest priority, sorry!
191
     \TaskExecution{2}{1}{4}
210
     \TaskExecution{2}{1}{4}
192
     \TaskExecution{2}{6}{8}
211
     \TaskExecution{2}{6}{8}
194
     \TaskExecution{2}{13}{16}    
213
     \TaskExecution{2}{13}{16}    
195
   \end{RTGrid}
214
   \end{RTGrid}
196
 \end{verbatim}
215
 \end{verbatim}
197
-  \caption{Using multido to avoid repetitions}
216
+  \caption{Using periodic commands to avoid repetitions}
198
   \label{fig:ex1a}
217
   \label{fig:ex1a}
199
 \end{figure}
218
 \end{figure}
200
 
219
 
201
 \begin{figure}[!htbp]
220
 \begin{figure}[!htbp]
202
   \centering
221
   \centering
203
   \begin{RTGrid}{3}{14}
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
     \TaskExecDelta{2}{4}{1}
232
     \TaskExecDelta{2}{4}{1}
214
     \TaskExecDelta{2}{7}{1}
233
     \TaskExecDelta{2}{7}{1}
215
     \TaskExecDelta{2}{11}{1}
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
     \TaskExecDelta{3}{1}{1}
239
     \TaskExecDelta{3}{1}{1}
221
     \TaskExecDelta{3}{8}{1}
240
     \TaskExecDelta{3}{8}{1}
222
     \TaskExecDelta{3}{12}{1}
241
     \TaskExecDelta{3}{12}{1}
224
 
243
 
225
 \begin{verbatim}
244
 \begin{verbatim}
226
   \begin{RTGrid}{3}{14}
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
     \TaskExecDelta{2}{4}{1}
255
     \TaskExecDelta{2}{4}{1}
236
     \TaskExecDelta{2}{7}{1}
256
     \TaskExecDelta{2}{7}{1}
237
     \TaskExecDelta{2}{11}{1}
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
     \TaskExecDelta{3}{1}{1}
262
     \TaskExecDelta{3}{1}{1}
243
     \TaskExecDelta{3}{8}{1}
263
     \TaskExecDelta{3}{8}{1}
251
 \begin{figure}[!htbp]
271
 \begin{figure}[!htbp]
252
   \centering
272
   \centering
253
   \begin{RTGrid}[width=8cm]{2}{15}
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
   \end{RTGrid}
276
   \end{RTGrid}
259
 \begin{verbatim}
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
 \end{verbatim}
282
 \end{verbatim}
265
   \caption{Deadlines less than periods}
283
   \caption{Deadlines less than periods}
266
   \label{fig:ex1c}
284
   \label{fig:ex1c}
273
 \begin{figure}
291
 \begin{figure}
274
   \centering
292
   \centering
275
   \begin{RTGrid}{2}{20}
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
   \end{RTGrid}  
310
   \end{RTGrid}  
294
 \begin{verbatim}
311
 \begin{verbatim}
295
   \begin{RTGrid}{2}{20}
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
 \end{verbatim}
330
 \end{verbatim}
311
   \caption{Example with TaskRespTime}
331
   \caption{Example with TaskRespTime}
312
   \label{fig:resp-time}
332
   \label{fig:resp-time}
323
   \centering
343
   \centering
324
   %% no grid and no symbols
344
   %% no grid and no symbols
325
   \begin{RTGrid}[nogrid=1,nosymbols=1]{2}{20}
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
     \TaskExecution{2}{1}{4}
349
     \TaskExecution{2}{1}{4}
332
     \TaskExecution{2}{6}{8}
350
     \TaskExecution{2}{6}{8}
333
     \TaskExecution{2}{9}{10}
351
     \TaskExecution{2}{9}{10}
336
 \begin{verbatim}
354
 \begin{verbatim}
337
   %% no grid and no symbols
355
   %% no grid and no symbols
338
   \begin{RTGrid}[nogrid=1,nosymbols=1]{2}{20}
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
     \TaskExecution{2}{1}{4}
360
     \TaskExecution{2}{1}{4}
345
     \TaskExecution{2}{6}{8}
361
     \TaskExecution{2}{6}{8}
346
     \TaskExecution{2}{9}{10}
362
     \TaskExecution{2}{9}{10}
366
   %% specification of the symbol, as the symbol is already used in a
382
   %% specification of the symbol, as the symbol is already used in a
367
   %% math environment inside the macro
383
   %% math environment inside the macro
368
   \begin{RTGrid}[width=8cm,symbol=\gamma,nonumbers=1,labelsize=\small]{2}{20}
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
     %% here, the border changes to cyan, and the fill to white
388
     %% here, the border changes to cyan, and the fill to white
376
     \TaskExecution[linecolor=cyan,color=white]{2}{1}{4}
389
     \TaskExecution[linecolor=cyan,color=white]{2}{1}{4}
377
     %% the next two boxes are filled with red instead of gray
390
     %% the next two boxes are filled with red instead of gray
387
   %% specification of the symbol, as the symbol is already used in a
400
   %% specification of the symbol, as the symbol is already used in a
388
   %% math environment inside the macro
401
   %% math environment inside the macro
389
   \begin{RTGrid}[symbol=\gamma,nonumbers=1,labelsize=\Large]{2}{20}
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
     %% here, the border changes to cyan, and the fill to white
406
     %% here, the border changes to cyan, and the fill to white
397
     \TaskExecution[linecolor=cyan,color=white]{2}{1}{4}
407
     \TaskExecution[linecolor=cyan,color=white]{2}{1}{4}
398
     %% the next two boxes are filled with red instead of gray
408
     %% the next two boxes are filled with red instead of gray
424
     \RowLabel{1}{Server}
434
     \RowLabel{1}{Server}
425
     %% the symbol for the second row
435
     %% the symbol for the second row
426
     \RowLabel{2}{$\Pi_2$}
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
     \TaskExecution{2}{1}{4}
441
     \TaskExecution{2}{1}{4}
434
     \TaskExecution{2}{6}{8}
442
     \TaskExecution{2}{6}{8}
435
     \TaskExecution{2}{9}{10}
443
     \TaskExecution{2}{9}{10}
442
     \RowLabel{1}{Server}
450
     \RowLabel{1}{Server}
443
     %% the symbol for the second row
451
     %% the symbol for the second row
444
     \RowLabel{2}{$\Pi_2$}
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
     \TaskExecution{2}{1}{4}
457
     \TaskExecution{2}{1}{4}
452
     \TaskExecution{2}{6}{8}
458
     \TaskExecution{2}{6}{8}
453
     \TaskExecution{2}{9}{10}
459
     \TaskExecution{2}{9}{10}
505
   \centering
511
   \centering
506
   \begin{RTGrid}{2}{20}
512
   \begin{RTGrid}{2}{20}
507
     \RTBox{12}{16}
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
     \TaskArrival{2}{10}
516
     \TaskArrival{2}{10}
512
     \TaskExecDelta[exeheight=1.5]{2}{10}{3}
517
     \TaskExecDelta[exeheight=1.5]{2}{10}{3}
513
     \Activation{1}{8}{2}{10}
518
     \Activation{1}{8}{2}{10}
516
 \begin{verbatim}
521
 \begin{verbatim}
517
   \begin{RTGrid}{2}{20}
522
   \begin{RTGrid}{2}{20}
518
     \RTBox{12}{16}
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
     \TaskArrival{2}{10}
526
     \TaskArrival{2}{10}
523
     \TaskExecDelta[exeheight=1.5]{2}{10}{3}
527
     \TaskExecDelta[exeheight=1.5]{2}{10}{3}
524
     \Activation{1}{8}{2}{10}
528
     \Activation{1}{8}{2}{10}

+ 94
- 16
rtsched.sty View File

112
 \newcount\nhl % number of horizontal lines
112
 \newcount\nhl % number of horizontal lines
113
 \newcount\nvl % number of vertical lines
113
 \newcount\nvl % number of vertical lines
114
 \newcount\ntasks % number of tasks
114
 \newcount\ntasks % number of tasks
115
-\newcount\ntaskslessone %number of tasks less one
116
 \newcount\tmp % temp
115
 \newcount\tmp % temp
117
 
116
 
118
 
117
 
124
 \def\@mygrid@begin[#1]#2#3{\setkeys{RT}{#1}%
123
 \def\@mygrid@begin[#1]#2#3{\setkeys{RT}{#1}%
125
   %% get the number of tasks
124
   %% get the number of tasks
126
   \ntasks = #2
125
   \ntasks = #2
127
-  \ntaskslessone = \ntasks
128
-  \advance \ntaskslessone by -1
129
   %% number of horizontal steps in the grid
126
   %% number of horizontal steps in the grid
130
   \nsx = #3 \advance \nsx by 2 %
127
   \nsx = #3 \advance \nsx by 2 %
131
   %% real length of the window (approx)
128
   %% real length of the window (approx)
174
 
171
 
175
     %% Task Names
172
     %% Task Names
176
     \if\RTWriteSymbols\RTDefWriteSymbols
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
       \pgfmathsetmacro\task{\i + 1};
175
       \pgfmathsetmacro\task{\i + 1};
179
       \node[below, font=\rtfont] at (-\sx , \j-\sy) {\RTTaskLabelSize $\RTTaskSymbol_{\pgfmathprintnumber[int trunc]{\task}}$};
176
       \node[below, font=\rtfont] at (-\sx , \j-\sy) {\RTTaskLabelSize $\RTTaskSymbol_{\pgfmathprintnumber[int trunc]{\task}}$};
180
      }
177
      }
184
     %% Horizontal axes
181
     %% Horizontal axes
185
     \if\RTAxisInvisible\RTDefAxisInvisible
182
     \if\RTAxisInvisible\RTDefAxisInvisible
186
       \begin{pgfonlayer}{foreground} 
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
       \draw [very thick,-\RTArrowStyle] (\sx,\j-3*\sy) -- (\RTWindowLength - \sx,\j-3*\sy);
185
       \draw [very thick,-\RTArrowStyle] (\sx,\j-3*\sy) -- (\RTWindowLength - \sx,\j-3*\sy);
189
       }
186
       }
190
       \end{pgfonlayer} 
187
       \end{pgfonlayer} 
278
     \@RTExecDefaultValues%
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
 \newcommand{\TaskArrival}[3][nocommand=1]{%
283
 \newcommand{\TaskArrival}[3][nocommand=1]{%
285
     \setkeys{RT}{#1}%
284
     \setkeys{RT}{#1}%
286
     \@compute@yy{#2}
285
     \@compute@yy{#2}
289
      \begin{pgfonlayer}{foreground} 
288
      \begin{pgfonlayer}{foreground} 
290
     \draw [\RTLineColor, thick,-\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
289
     \draw [\RTLineColor, thick,-\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
291
      \end{pgfonlayer}
290
      \end{pgfonlayer}
292
-
293
     \@RTExecDefaultValues%
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
 \newcommand{\TaskArrDead}[4][nocommand=1]{
313
 \newcommand{\TaskArrDead}[4][nocommand=1]{
301
   \setkeys{RT}{#1}%
314
   \setkeys{RT}{#1}%
302
   \@compute@yy{#2}
315
   \@compute@yy{#2}
312
   \@RTExecDefaultValues
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
 \newcommand{\TaskDeadline}[3][nocommand=1]{
348
 \newcommand{\TaskDeadline}[3][nocommand=1]{
320
   \setkeys{RT}{#1}%
349
   \setkeys{RT}{#1}%
321
   \@compute@yy{#2}
350
   \@compute@yy{#2}
327
   \@RTExecDefaultValues
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
 \newcommand{\TaskExecution}[4][nocommand=1]{
378
 \newcommand{\TaskExecution}[4][nocommand=1]{
331
   \setkeys{RT}{#1}%
379
   \setkeys{RT}{#1}%
332
   \@compute@yy{#2}
380
   \@compute@yy{#2}
475
 
523
 
476
 % 
524
 % 
477
 % TaskExecDelta
525
 % TaskExecDelta
526
+% Task execution delta: draws an execution from start time during delta time
478
 % par 1:  task
527
 % par 1:  task
479
 % par 2:  start time
528
 % par 2:  start time
480
 % par 3:  delta
529
 % par 3:  delta
492
   \@RTExecDefaultValues
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
 % TaskRespTime
562
 % TaskRespTime
513
   \renewcommand<>{\TaskArrival}[3][nocommand=1]{
578
   \renewcommand<>{\TaskArrival}[3][nocommand=1]{
514
     \only#4{\beameroriginal{\TaskArrival}[#1]{#2}{#3}}
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
   \renewcommand<>{\TaskArrDead}[4][nocommand=1]{
584
   \renewcommand<>{\TaskArrDead}[4][nocommand=1]{
517
     \only#5{\beameroriginal{\TaskArrDead}[#1]{#2}{#3}{#4}}
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
   \renewcommand<>{\TaskDeadline}[3][nocommand=1]{
590
   \renewcommand<>{\TaskDeadline}[3][nocommand=1]{
520
     \only#4{\beameroriginal{\TaskDeadline}[#1]{#2}{#3}}
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
   \renewcommand<>{\TaskExecution}[4][nocommand=1]{
596
   \renewcommand<>{\TaskExecution}[4][nocommand=1]{
523
     \only#5{\beameroriginal{\TaskExecution}[#1]{#2}{#3}{#4}}
597
     \only#5{\beameroriginal{\TaskExecution}[#1]{#2}{#3}{#4}}
524
   }
598
   }
525
   \renewcommand<>{\TaskExecDelta}[4][nocommand=1]{
599
   \renewcommand<>{\TaskExecDelta}[4][nocommand=1]{
526
     \only#5{\beameroriginal{\TaskExecDelta}[#1]{#2}{#3}{#4}}
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
   \renewcommand<>{\TaskRespTime}[4][nocommand=1]{
605
   \renewcommand<>{\TaskRespTime}[4][nocommand=1]{
529
     \only#5{\beameroriginal{\TaskRespTime}[#1]{#2}{#3}{#4}}
606
     \only#5{\beameroriginal{\TaskRespTime}[#1]{#2}{#3}{#4}}
530
   }
607
   }
554
 
631
 
555
 \endinput
632
 \endinput
556
 
633
 
634
+

Loading…
Cancel
Save