设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 4664|回复: 1

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

[复制链接]
发表于 2010-5-21 14:24:47 | 显示全部楼层 |阅读模式
让小车红灯停,绿灯行出现以下情况不能解决:4 g' c! j$ t$ N+ X# A/ C
1)is
2 j( p! p; q: bdo  n+ y% ^" Y* v7 H8 j( K2 ^7 ]. F
if light="green"4 i; p5 J3 y( u- A
then @.stopped:=false;
4 D. g2 d  d$ L+ b  else* v! M: O9 c5 X: ?, i) n
   @.stopped:=true;
. O# L: {0 U& U6 j& A% `# m: T  end;9 X- Q! }  h: x1 F" {" S
end;
% I+ a$ W" o& N4 {8 C9 e
0 I$ e6 p5 J9 U# Q# ]用if else then,只会停止,不能运动,停了以后Method 不会再被调;1 Y3 a" Z' B* `+ F  j6 b+ `
2)is, h. z* O% l# B# X
do8 }# i$ e7 j( o$ ~) u8 P  f0 X* x! |
if light="green"2 t( C2 g1 j4 d) U' R5 u
then @.stopped:=false;% }0 L8 L0 s5 t  j: s8 E7 D) ~( U
  else. y3 J1 g; z4 S. @; w
   @.stopped:=true;
. F+ A& w$ U! d1 c4 a  end;: }1 R+ l3 b$ R8 M
@.move;--加了这个以后则不管红绿灯都是一直运动的,$ s3 M$ k+ z! m! o5 q# T
end;" W$ J* p+ w, U  m- I/ r" Y" z/ F
3)用ispect-when-when-else,出现同样的情况
. W1 ?1 l5 `/ f! e4 W求高手解决。
发表于 2010-5-21 14:47:29 | 显示全部楼层
{:3_47:}  ^5 L9 h, G, E! n$ S
逻辑混乱。随便弄一个吧. ]2 L5 s4 D/ H* O
is
# M: }: Y: Y  c% a+ Ddo
! s. u$ w/ q4 T" B& M/ d7 zif light="green" then
4 f/ d- B  H; \@.continue;$ H# f9 F* @5 n" d
else* p$ x) ?& {3 S# T3 P! b& _
@.stop;1 K% I  d$ g- m0 l' P* e
end;: s" l& {! q# S7 w5 }$ J
end;

评分

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

查看全部评分

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

本版积分规则

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

GMT+8, 2026-7-14 20:38 , Processed in 0.013640 second(s), 16 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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