设为首页收藏本站

最大的系统仿真与系统优化公益交流社区

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 4781|回复: 1

[求助] 有谁用EM-PLANT做过红绿灯仿真啊?急求控制程序编码。。。。

[复制链接]
发表于 2010-5-21 14:24:47 | 显示全部楼层 |阅读模式
让小车红灯停,绿灯行出现以下情况不能解决:
8 x2 a. t: V6 a, R1)is
$ E+ e8 u0 c3 `5 Cdo
7 V! r3 |+ W9 S2 g$ S if light="green"
+ Z0 `) A- }% x" ]  A; E5 _/ L then @.stopped:=false;
+ V& ~# F6 F) W& o  else1 z% ~2 B+ C0 t
   @.stopped:=true;
! ], o& ^0 p4 V' W# h6 `' }6 l  end;$ n( M; c( A# M) s2 p
end;
; a7 K' R  s# W( O7 l4 }. U; K) c' j
$ c# |& i' k& E, H5 J用if else then,只会停止,不能运动,停了以后Method 不会再被调;: A  }: @3 J9 P' V; A  m. E# ^" V
2)is+ E% _/ b5 ~. B, W# j: _
do
* O: `' n# a9 d if light="green"8 E% v  P6 j% c7 p- x2 w/ P, Z4 }
then @.stopped:=false;# `- P* n* C# c) J
  else
: a1 [4 m8 V1 C4 J# e( i! E   @.stopped:=true;
5 {# Q+ S& |0 K- T  end;. o2 ]7 @! F; t2 s# d
@.move;--加了这个以后则不管红绿灯都是一直运动的,* J' |6 P7 k* U+ }( |) T. g
end;; U0 ^2 x- i7 h
3)用ispect-when-when-else,出现同样的情况" q, x+ {3 Y  g3 [$ n- h* V
求高手解决。
发表于 2010-5-21 14:47:29 | 显示全部楼层
{:3_47:}  N/ a- l+ L9 `1 P
逻辑混乱。随便弄一个吧
  _/ z$ I! g5 V/ s6 W, d: v6 uis+ M2 I/ h) P1 d; q
do0 _3 {% R: g$ S6 Q, Y- `
if light="green" then0 ~6 ]; U' g# `- ]4 {  o
@.continue;  l) `6 \# J( l8 \( Y
else
- ^! P* {" ]) i* H+ d8 g* F@.stop;
3 e5 J" n- r9 ?- j( P  j2 \end;! g8 I. o3 q. C4 ]  z6 L" E
end;

评分

参与人数 1仿真币 +10 收起 理由
苘苘 + 10

查看全部评分

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|SimulWay 道于仿真   

GMT+8, 2026-8-6 15:13 , Processed in 0.013676 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表