-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhalfstar_wtv.c
More file actions
47 lines (39 loc) · 1.56 KB
/
halfstar_wtv.c
File metadata and controls
47 lines (39 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* halfstar_wtv.c - gegenereerd met TLCGen 12.4.0.18 */
#include "halfstar_wtv.h"
#if (!defined AUTOMAAT && !defined AUTOMAAT_TEST) || defined VISSIM
#include "xyprintf.h"/* voor debug infowindow */
#include <stdio.h> /* declaration printf() */
#endif
/* Functie voor berekenen van maximale wachttijden tijdens halfstar regelen.
De functie wordt normaliter gebruikt bij toepassing van wachttijdvoorspellers */
void max_wachttijd_halfstar(mulv twacht[], /* wachttijd (in tienden van seconden) */
count h_plact, /* PL regelen actief */
count pl) /* actieve plan */
{
count fc;
if (!H[h_plact]) return;
/* Basis-wachttijd: Tijd tot TXB-moment. */
if (SH[h_plact])
{
for (fc = 0; fc < FCMAX; ++fc)
{
twacht[fc] = NG;
}
}
for (fc = 0; fc < FCMAX; ++fc)
{
twacht[fc] = TOTXB_PL[fc];
/* als de richting al (versneld primair) is gerealiseerd of als deze een OS heeft gekregen,
dan de max. cyclustijd bij wachttijd optellen */
/* Op start TXD moment wordt PG gereset. Op TXD + 1 wordt de waarde van TOTXB_PL weer gevuld.
Om te voorkomen dat in die ene seconde de wachttijd 0 wordt en de leds snel aflopen, moet worden
gewacht totdat TOTXB_PL weer wordt gevuld */
if (PG[fc] || !TOTXB_PL[fc])
twacht[fc] += 10 * TX_max[pl]; /* twacht in hele seconden! */
if (RA[fc] && !RR[fc] && !BL[fc])
{
twacht[fc] = max_wachttijd_conflicten(fc);
}
if (G[fc] || GL[fc]) twacht[fc] = 0;
}
}