本帖最后由 zorsite 于 2016-4-7 11:54 编辑
$ B& {1 u1 E' A9 _; @0 p$ [6 S& t
模型中有四个实体:, G) d$ g2 ^4 N6 b! M# m
发生器,处理器,暂存区,独立暂存区。1 S) z+ k/ s4 c* y
发生器,处理器,暂存区依次A连接。- n" q! Q; H: q. Q
独立暂存区不与任何实体相连。
! S& @/ H8 p& T& N& ~2 w4 A1 `0 H6 |4 Y# s7 k' J0 _5 R {
发生器中产生两种类型的临时实体,$ Z% U& b0 g" j" i
第一种临时实体加工后传送到暂存区,! A7 z$ ^ w* j- }9 U: `
第二种临时实体加工后“移动”到独立暂存区。
$ z( L+ {0 @. `# m5 E
. T1 }0 Z, V& l, q发生器中创建触发中代码如下:' _0 p z* E6 x6 n" v
setitemtype(item,duniform(1,2));
, k4 D* p( q1 ucolorarray(item,getitemtype(item));3 z& l" f2 N6 w* ~, ^( q& \
2 a$ p5 k0 c7 t9 K s
处理器的“加工结束触发”中加入以下代码:# c, @ A$ z. W
if (getitemtype(item)==2) moveobject(item,node("独立暂存区", model()));
" w& K3 u7 I3 K1 Q0 ?
# g. p8 N6 X% F" A5 @各种触发器触发时间的先后顺序为:
O% o& `. [0 S重置触发à进入触发à预置结束触发à加工结束触发à发送至端口à使用运输工具à离开触发% D: V! x8 {! W3 U* N7 ]
加工结束触发在发送至端口触发之前,
g8 Z: a- l6 a( g理论上来讲,第二种临时实体加工完成后先应该先被移动到独立暂存区。
8 Z8 H/ W- X( M5 ?( ]' b- n. Y) w9 q# D- n7 ]( g
可是模型运行起来并不是这样子,所有的临时实体全部堆积在暂存区。
& K" B, `! @( e8 c) q) g6 p' K2 e没有任何临时实体进入“独立暂存区”。
# S7 N: b/ s8 g4 D% m$ _+ S2 l请问问题出在哪里?3 D% L& p3 h$ K
1 s- p4 ]/ ]# U$ i
moveobject (obj object, obj location[, num outport])5 v" }- P0 g# Z; r
Moves object to the specified location* \ L3 x2 s# ]
移动对象到指定位置。: Q( c1 n9 q+ w% n5 }1 z
Description
$ j! e( |" J: e" o6 EThis command moves the object to the specified location through the specified port.
- j! o* ` V5 \+ [1 b( O1 {/ Y可以指定从哪个端口输出。" Y: I& ~/ Y2 I& z
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. ( _- v( Z; K2 y j% ]4 y8 \" p
这个端口并不一定要真正存在,主要是为了告诉接收方对象是通过哪个端口进入的。" F! i6 d+ Y: i- n7 J
When an object moves into location, the OnReceive event function of location is executed. ( e" `1 q* C5 L/ g- E" \0 S. X
当对象移动到指定位置时,将激活(执行)接收方的“接收触发”事件。(什么实体会有接收触发?)8 c' z; ^' }9 v
This includes the OnEntry trigger function.
) b! n3 P% `, P% Y这包括“进入触发”。(什么意思?接收方的进入触发吗?这句话有什么含义?)" K, a; F, L4 x
Explicitly calling this on a flowitem with events queued up for it may cause problems. 5 w# _4 R+ L! B# ^3 N. c3 a
如果临时实体有事件要执行时使用这个命令将会引发不可预知的错误。
" ]3 g" i0 O2 N/ qOnly use when you know that no events are pending for the object being moved.' B7 q7 K$ `7 I- B. j* J
只有被移动的对象没有任何事件要执行的时候才能使用这个命令。
# U( X: G5 F$ { |