本帖最后由 zorsite 于 2016-4-7 11:54 编辑
7 H8 e4 G9 C- I3 B4 P0 U0 ?( `0 g9 b) r) c9 a8 o) Y
模型中有四个实体:7 U9 Y8 ?& l7 [5 Y( |: H6 s$ {
发生器,处理器,暂存区,独立暂存区。
( [5 ]7 C A1 V- v8 Q! m发生器,处理器,暂存区依次A连接。
j. h' q& ?9 |% J独立暂存区不与任何实体相连。
- A* X, D5 @6 X6 H
- l5 E% g, ]/ V# j发生器中产生两种类型的临时实体,
3 u; H% X! ?0 t( ]第一种临时实体加工后传送到暂存区,
! i. H, R% S, Z第二种临时实体加工后“移动”到独立暂存区。
+ t0 W% A) f# o/ j: T; \/ {; \% P0 X f1 \5 S4 x1 V
发生器中创建触发中代码如下:
; C/ H: Q4 ~9 Dsetitemtype(item,duniform(1,2)); 2 w$ x9 p- L1 g E
colorarray(item,getitemtype(item));
g% U" L) e4 x" P9 g( K" t+ O$ B# X5 S# O0 c* F" ]) l6 l) @. `
处理器的“加工结束触发”中加入以下代码:
3 M: V. [# R! D) e7 z8 uif (getitemtype(item)==2) moveobject(item,node("独立暂存区", model()));) ]% ^( G Z4 n! K4 {' M
7 @" F E+ g c$ B0 j9 ?! g* P* K8 _各种触发器触发时间的先后顺序为:
9 k3 s' O H. I重置触发à进入触发à预置结束触发à加工结束触发à发送至端口à使用运输工具à离开触发
: r& w1 k2 |) ^' u0 @# M: G加工结束触发在发送至端口触发之前,; E$ J+ Q B! O# H
理论上来讲,第二种临时实体加工完成后先应该先被移动到独立暂存区。
9 W" X0 m2 n, }! Z- o
# s) t3 _9 {2 G可是模型运行起来并不是这样子,所有的临时实体全部堆积在暂存区。' a# l! |) Q4 X: I
没有任何临时实体进入“独立暂存区”。' @7 F: X8 n' o3 m' {' O/ V' Q/ O- e. z
请问问题出在哪里?
) T# q8 {3 o/ j8 U( g! y5 `5 y
" ]1 _$ F- k- I6 Ymoveobject (obj object, obj location[, num outport])
2 o+ k9 @2 w3 ~ J7 |# qMoves object to the specified location
/ E1 V- @3 v; n8 T移动对象到指定位置。
& _9 c" _$ f# IDescription
" a' G4 O1 I! q0 {This command moves the object to the specified location through the specified port. 6 S! r% s% n" ?: t" `/ ]; z$ G! E# y
可以指定从哪个端口输出。3 B, J; O# D" B3 K j
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.
8 N u- |% w# K( @$ P4 Z7 M这个端口并不一定要真正存在,主要是为了告诉接收方对象是通过哪个端口进入的。
% D- h1 c) m8 y! p( }" h C+ G; tWhen an object moves into location, the OnReceive event function of location is executed.
1 H- J; J/ t$ l" Q2 w当对象移动到指定位置时,将激活(执行)接收方的“接收触发”事件。(什么实体会有接收触发?)5 f4 ~6 t/ F3 I3 u6 `
This includes the OnEntry trigger function.
$ M, Z2 y& N. f" h这包括“进入触发”。(什么意思?接收方的进入触发吗?这句话有什么含义?)! C' p0 ~3 d1 T2 O: i
Explicitly calling this on a flowitem with events queued up for it may cause problems. # g7 w9 E3 q5 R9 r/ B
如果临时实体有事件要执行时使用这个命令将会引发不可预知的错误。
; c( m0 V. y _+ j% b; p( }! f4 K* ~Only use when you know that no events are pending for the object being moved.
* X0 K6 J4 O+ K6 n; ^/ x" [5 g+ i% @只有被移动的对象没有任何事件要执行的时候才能使用这个命令。
1 m7 g" [- h' }$ v( E: q4 T0 ] |