⚲
Project
General
Profile
Sign in
Home
Projects
Help
Search
:
BLAST
All Projects
Linux Driver Verification
»
BLAST
Overview
Activity
Roadmap
Issues
News
Wiki
Files
Repository
Download (1.35 KB)
Support #3662
ยป Simplest.c
Roopak Sinha
, 11/07/2012 01:54 AM
// This file is generated by FBC.
#include
<string.h>
#include
<stdio.h>
/* Function block initialization function */
int
main
()
{
//INIT
int
state
=
0
;
int
LightsStatus
=
3
;
// MAKING ORIGIN ONE THING
int
Origin
=
150
;
int
RoadLength
=
40
;
int
MinHeadWay
=
5
;
int
SPEED_LIMIT
=
2
;
//INIT - VTL
int
VTLSpan
=
30
;
//INITCAR
int
ns
=
Origin
+
RoadLength
;
int
sn
=
Origin
-
RoadLength
;
int
ew
=
Origin
+
RoadLength
;
int
we
=
Origin
-
RoadLength
;
//INITIALIZE VTL
//RUN
for
(;;)
{
//RUN CARS
if
(
!
(
ns
<
Origin
)
||!
(
sn
>
Origin
))
{
if
((
LightsStatus
==
1
)
||
(
LightsStatus
==
3
))
{
//NS
ns
=
ns
-
SPEED_LIMIT
;
//SN
sn
=
sn
+
SPEED_LIMIT
;
}
}
if
(
!
(
ew
<
Origin
)
||!
(
we
>
Origin
))
{
if
((
LightsStatus
==
2
)
||
(
LightsStatus
==
3
))
{
//EW
ew
=
ew
-
SPEED_LIMIT
;
//WE
we
=
we
+
SPEED_LIMIT
;
}
}
//RUN VTL
if
(
((
ns
>
Origin
)
&&
(
ns
<
(
Origin
+
VTLSpan
)))
||
((
sn
<
Origin
)
&&
(
sn
>
(
Origin
-
VTLSpan
)))
)
{
if
(
((
ew
>
Origin
)
&&
(
ew
<
(
Origin
+
VTLSpan
)))
||
((
we
<
Origin
)
&&
(
we
>
(
Origin
-
VTLSpan
)))
){
LightsStatus
=
1
;
continue
;
}
}
LightsStatus
=
3
;
//Check for collision of heads
if
(
((
ns
==
Origin
))
&&
((
ew
==
Origin
)))
{
ERROR:
goto
ERROR
;
}
}
}
(1-1/1)
Loading...