|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑
& X$ p y, s' O0 @$ S& G* o
" M* j/ k7 Z) H1 B2 O0 E: ~! ?- DFlexsim可以通过isclasstype函数判断实体类型。- z: p ]( N' M; ~/ F* J$ `, g+ ?. B
isclasstype (obj object, num/str classtype)3 y) ^" B% @" t% \) l- p
1 ]: Z; m" W' N& j
Compares the object to classtype, returns 1 for yes, 0 for no' U' ^7 T% G& @& M% {) {. H3 ]) t' J
Description( h' ~* h; m! M% ~ [% U
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:4 N* A/ @+ {; a, t: D z
CLASSTYPE_FLEXSIMOBJECT7 `* D7 B9 g" L8 s% I
CLASSTYPE_FIXEDRESOURCE
! ^# {$ u! |% C- q ?$ l, RCLASSTYPE_TASKEXECUTER* z! m3 t9 @2 z
CLASSTYPE_NETWORKNODE
$ D0 |9 v( |+ ]6 P; ~+ n& petc.* z9 t! q5 B/ B2 Z$ n
* m+ `6 X/ {8 O! `" k8 \) ]
Example& Q; w5 f) K( w* ~5 Q+ B. v# E
isclasstype(current, CLASSTYPE_DISPATCHER);
& l, `1 K3 n0 _5 ^9 }0 S0 u9 ~
' [1 ~$ l! h5 _$ _7 q5 T r
, {+ k7 {! V. W* r& }& x7 h) N: Y) k& p
Flexism有以下实体类型:; G" _! Z. T1 S
- isclasstype(current,CLASSTYPE_CONVEYOR);' Z. i+ j% O2 n# h
- isclasstype(current,CLASSTYPE_DISPATCHER);1 R" S% w# G3 l0 ?. D8 D( {1 t o
- isclasstype(current,CLASSTYPE_FIXEDRESOURCE);: H/ w5 A! y: w+ r: }
- isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);
' y- R, h- ?; l, R; d4 { - isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);
& u/ Y; Y6 h" M q' h - isclasstype(current,CLASSTYPE_FLUIDOBJECT);- L& g* h5 L& z
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);7 _: @& R8 b( _/ x2 _% C7 b
- isclasstype(current,CLASSTYPE_LINECONTROLLER);+ J3 j& J! g) ^1 Z/ H
- isclasstype(current,CLASSTYPE_MERGESORT);% T; r' ]2 ~4 x
- isclasstype(current,CLASSTYPE_MTBFMTTR);
! n, s0 M& Z( _; b - isclasstype(current,CLASSTYPE_NAVIGATOR);
1 ^6 Y6 f7 k6 K' u s - isclasstype(current,CLASSTYPE_NETWORKNODE);
- m+ p C: C, v. v9 F - isclasstype(current,CLASSTYPE_ODT);7 ?+ Y9 z( F4 o1 W% e+ z; L
- isclasstype(current,CLASSTYPE_OWNERDRAWN);
. W5 j$ B! ?0 L: x* h3 p - isclasstype(current,CLASSTYPE_PROCESSOR);4 `9 ]3 G5 I4 Z" k1 }# G
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);
" q, O. @7 r# H( K - isclasstype(current,CLASSTYPE_TASKEXECUTER); E$ d1 j! V* O# G
- isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
: }! \. k9 A- A4 y: M# ~ - isclasstype(current,CLASSTYPE_VISUALTOOL);
% B; A/ @0 {/ r: a3 u, d. t8 m - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 2 o; f6 h4 h' Q5 u% L8 }( x
/ V" Q" q5 E( h7 r
isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者7 I' `" W9 F0 l/ r' p
; \7 M" I0 x/ R6 J$ s% d
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。
- w J. o1 Z# M# T3 A N }2 L# H3 E! SFlexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
; M0 c. A7 n# w- Y* c% o
4 [2 l- C, `, {0 c' @) Z0 c+ @( i5 \6 A6 ?# W
5 Q- q; M: u! |9 [% ^
|
|