本帖最后由 zorsite 于 2016-4-7 11:54 编辑
6 B" p* d v# }) r3 j
F9 h0 D* {3 d4 ~模型中有四个实体:4 m; s( f6 P- S+ p% Y6 D. e& `& P% Y
发生器,处理器,暂存区,独立暂存区。
0 _2 ~3 ?! ], B J1 d! ?6 ~3 [发生器,处理器,暂存区依次A连接。
3 K1 a* z1 p2 f/ I l$ W( e3 G独立暂存区不与任何实体相连。* }* j8 P$ C6 Z @
- k9 z8 {( a# @
发生器中产生两种类型的临时实体,
{1 w: x; ?; S. D# p' d, o. N第一种临时实体加工后传送到暂存区,: l, @/ X4 \" S, Y: T' C
第二种临时实体加工后“移动”到独立暂存区。
+ V0 I4 a" t8 C! [* R0 x- ]2 V0 Y9 ^) H p; k$ D: i
发生器中创建触发中代码如下:
* h2 `) `$ d. j4 O6 ^setitemtype(item,duniform(1,2));
g& x: j0 |& @colorarray(item,getitemtype(item));3 x! W5 r! @' C: M5 ~
/ I/ m% A$ t; X处理器的“加工结束触发”中加入以下代码:
4 A& j( z8 i8 @1 `" oif (getitemtype(item)==2) moveobject(item,node("独立暂存区", model()));5 S' g& I+ z* X$ A* e
" E" m; l* j& w) e1 j
各种触发器触发时间的先后顺序为:1 T e5 q0 b/ _6 M$ R
重置触发à进入触发à预置结束触发à加工结束触发à发送至端口à使用运输工具à离开触发
- Q5 Y' B5 ?7 Q- _加工结束触发在发送至端口触发之前,
6 u" V. T5 i' }0 J; s4 o理论上来讲,第二种临时实体加工完成后先应该先被移动到独立暂存区。
; d% d' b2 |" Y7 u
; U8 \& \! Q: _可是模型运行起来并不是这样子,所有的临时实体全部堆积在暂存区。9 D" w; \ c3 S* A; [% R3 \
没有任何临时实体进入“独立暂存区”。$ z3 G2 ^9 A! G6 }6 {
请问问题出在哪里?" F0 ?" m: l$ t2 i/ S
. O3 L2 L0 p) ]
moveobject (obj object, obj location[, num outport])
; O5 r0 \# q4 O- N YMoves object to the specified location
/ o; n5 g) x/ @* |, v移动对象到指定位置。% Y7 p" c! x* m0 O
Description1 p8 A4 E# e6 x$ X4 k( O
This command moves the object to the specified location through the specified port.
# a8 N) I1 e/ I% d8 L可以指定从哪个端口输出。6 s4 ?- k9 z) Y/ s" j0 Q$ s) ^4 \
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.
% k5 ~8 z- _) V+ c u( ?+ X这个端口并不一定要真正存在,主要是为了告诉接收方对象是通过哪个端口进入的。
, K: h% P- i1 F4 CWhen an object moves into location, the OnReceive event function of location is executed.
6 B" j4 J! r2 @0 m/ G; R; [3 n当对象移动到指定位置时,将激活(执行)接收方的“接收触发”事件。(什么实体会有接收触发?)
$ U/ c1 O' n! {6 v: {! z& VThis includes the OnEntry trigger function. % o8 B( r2 k; ^
这包括“进入触发”。(什么意思?接收方的进入触发吗?这句话有什么含义?)
' k7 }0 i( i' i% t8 [- r# OExplicitly calling this on a flowitem with events queued up for it may cause problems. ; P: [8 \ V9 G$ I+ C- Y1 Q
如果临时实体有事件要执行时使用这个命令将会引发不可预知的错误。
% a$ C+ ^" A6 y& j- YOnly use when you know that no events are pending for the object being moved.$ t$ w' x7 R1 @7 o r
只有被移动的对象没有任何事件要执行的时候才能使用这个命令。
1 q& H$ G6 W6 c# r2 M* P |