SHENZHEN I/O

SHENZHEN I/O

评价数不足
SELF-DRIVING TRAIN
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
更新日期
7.917 KB
2022 年 1 月 16 日 上午 7:53
2022 年 2 月 13 日 上午 7:10
2 项改动说明 ( 查看 )

订阅以下载
SELF-DRIVING TRAIN

描述
Create a working design for a self-driving train, which must speed up or slow down to the maximum permitted speed for any given section of track, and come to a complete stop at each station.

---

max is an simple input that returns the maximum permitted speed for a given section of track.

station is a simple input connected to a sensor that detects when the train has reached a station.

accelerator is a simple output that increases the train's speed by 10 for each time unit.

brake is a simple output that decreases the train's speed by 10 for each time unit.

speed is a simple output connected to the train's speedometer.

For safety, the max is always set to 10 when approaching a station.

The train should accelerate or brake until its speed reaches the max for any given section of track.

The train's current speed should be output to speed.

When the train reaches a station, the train should come to a complete stop and then remain stationary for 5 time units before setting off again.

The brake should remain applied when the train is stationary.