本帖最后由 zorsite 于 2016-4-7 11:54 编辑 3 H5 H3 |& a/ }6 D( ?
6 O$ u1 w, s, D% I1 D
模型中有四个实体: l2 G; d5 O, W8 g& b
发生器,处理器,暂存区,独立暂存区。
7 C5 I; ]7 ?& f5 x6 \+ c发生器,处理器,暂存区依次A连接。
1 |% Y$ h% U0 Y' b7 n( x独立暂存区不与任何实体相连。4 X7 i) _! E' f. \* `3 Y B
# e( e2 a( u6 [+ p$ [6 b
发生器中产生两种类型的临时实体,* J" ~ s+ c. Q9 Y, k% b
第一种临时实体加工后传送到暂存区,- K. m# G# }) A6 n' |
第二种临时实体加工后“移动”到独立暂存区。- ?' J6 Y. x. W3 |" d L
% c0 m$ x% ~* l1 j发生器中创建触发中代码如下:
" j& f& n* U( f1 v# N k8 j3 y2 bsetitemtype(item,duniform(1,2)); - C# j5 d4 b' D0 R- g A- ]
colorarray(item,getitemtype(item));9 g' R) F/ t- S: Z. N0 q
+ D& |' k+ T* [1 x; i! K- U3 p处理器的“加工结束触发”中加入以下代码:
H9 }$ ]: z9 |! l$ Iif (getitemtype(item)==2) moveobject(item,node("独立暂存区", model()));
; L' ?' N- z6 o- V5 B8 [% ]5 T$ f
. H+ h: R, E. p7 ]4 F( t2 ^& ^各种触发器触发时间的先后顺序为:
0 d, T$ ]6 Y I, |重置触发à进入触发à预置结束触发à加工结束触发à发送至端口à使用运输工具à离开触发
! f- p3 ?8 t Y, C& ^加工结束触发在发送至端口触发之前,7 ^$ p4 O$ K1 j% l% @: g
理论上来讲,第二种临时实体加工完成后先应该先被移动到独立暂存区。
; V1 Y8 l e( b* j+ J# o% ^$ X+ k" {& C( R8 F% [+ ?
可是模型运行起来并不是这样子,所有的临时实体全部堆积在暂存区。
7 }- E' x" m U ^) P没有任何临时实体进入“独立暂存区”。
; F+ Y" S% B9 i/ O& F" l0 B请问问题出在哪里?( t; J6 ~+ w/ a: b5 b0 D4 S r
0 I; a% v5 _6 B, t
moveobject (obj object, obj location[, num outport])/ j9 ~5 Z2 C4 m; B5 ~. n; F
Moves object to the specified location, c% s* E* Y4 V7 a
移动对象到指定位置。9 a; r' r2 m1 X, W
Description2 p3 h7 }% ]" `) T
This command moves the object to the specified location through the specified port.
5 ` G5 Q$ i8 C) h可以指定从哪个端口输出。1 m8 C8 \6 ^4 W6 b
The specified port does not have to actually exist, this value is used by the receiving location to be able to reference the port the object came in through. " C/ T& P& r6 \! _! O( G9 }% k
这个端口并不一定要真正存在,主要是为了告诉接收方对象是通过哪个端口进入的。
& g k7 `: D) }$ u; Y/ TWhen an object moves into location, the OnReceive event function of location is executed. * [& b' [: d, J7 g! \8 T9 R
当对象移动到指定位置时,将激活(执行)接收方的“接收触发”事件。(什么实体会有接收触发?)
2 F* l* Y% h- L2 L& W( dThis includes the OnEntry trigger function.
! Z3 H+ u1 e" G/ Z: G q, l5 R: ~ _这包括“进入触发”。(什么意思?接收方的进入触发吗?这句话有什么含义?)
- L# A4 V5 U* l1 M9 z: c1 P% yExplicitly calling this on a flowitem with events queued up for it may cause problems. ( p2 k; [& Q, D( g9 V/ L: G
如果临时实体有事件要执行时使用这个命令将会引发不可预知的错误。. i* |8 }% S- l7 z. M' c: l
Only use when you know that no events are pending for the object being moved., p+ N4 [- l( m& f, V" p; d
只有被移动的对象没有任何事件要执行的时候才能使用这个命令。) \7 k. Z% k$ y2 S" q2 E
|