|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑 ' R+ F! @3 r7 h
, `. p, X4 B4 n7 r# f- i
Flexsim可以通过isclasstype函数判断实体类型。1 C: U1 n' x* Q7 m. A
isclasstype (obj object, num/str classtype)
) V6 G6 d: Q6 V/ V. B2 _+ S1 \6 S8 P( F7 t9 F9 y% w
Compares the object to classtype, returns 1 for yes, 0 for no3 }$ }8 j" x% |+ J+ Q% |6 V8 j
Description/ H" q' p8 I7 [. v' l; G
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
) N# n: I$ I: R1 r5 W5 t. \; |CLASSTYPE_FLEXSIMOBJECT! e; _7 c' C2 p9 A1 v+ O
CLASSTYPE_FIXEDRESOURCE
* S6 i' Z% q. w3 }8 B7 e9 ]* v* K0 OCLASSTYPE_TASKEXECUTER) Z0 I% r, S5 u9 x: k
CLASSTYPE_NETWORKNODE
% j, b) y) x5 v. X- P( [. g6 m$ I" Letc.* B3 e2 r0 |2 d" i% ]5 t8 d
( p' h2 g. ^9 D" p! E
Example
5 l2 H( h1 }7 b. Z. | {8 d1 c! visclasstype(current, CLASSTYPE_DISPATCHER);
' I8 S# c; d4 d5 @5 w
' g- p( {/ Q, b$ o: s
; g* E) ?) ]- _( j. u6 w
6 J6 D7 I, U/ f' j3 t' ]Flexism有以下实体类型:
" B: ]5 G5 U# M8 _- V$ C7 k- isclasstype(current,CLASSTYPE_CONVEYOR);& K, p3 V0 [( m% L1 t
- isclasstype(current,CLASSTYPE_DISPATCHER);
2 F& w5 E; q: S5 k5 q. P - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);$ S5 U& \4 H1 h9 J0 a0 [
- isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);
7 g, m$ |; \- R. V8 ~ - isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);; L- Q" ?7 }9 s* o0 ^. B
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);$ {9 o# l* J$ {' n) T" c
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);
! `8 U! U" e! q6 ]& F$ `- w - isclasstype(current,CLASSTYPE_LINECONTROLLER);
6 u+ g, d2 u' H - isclasstype(current,CLASSTYPE_MERGESORT);
; P" u5 P9 a# i" W6 w" i1 t - isclasstype(current,CLASSTYPE_MTBFMTTR);1 N* R6 b: V: N/ F6 o
- isclasstype(current,CLASSTYPE_NAVIGATOR);2 _% j3 ^! c4 K8 p: k
- isclasstype(current,CLASSTYPE_NETWORKNODE);8 [5 J0 C, B7 J9 s. x4 H0 E+ q& y7 I
- isclasstype(current,CLASSTYPE_ODT);
$ R+ _2 H9 u. b" Q - isclasstype(current,CLASSTYPE_OWNERDRAWN);
8 I/ d9 p8 y ]+ a8 d - isclasstype(current,CLASSTYPE_PROCESSOR);
' q b6 L4 J4 c! ], i, G( j% C" W a$ N r - isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);
/ B5 d6 s! u' v2 q7 T2 u. s - isclasstype(current,CLASSTYPE_TASKEXECUTER);* ], w- W- w. k% i8 b, t& x
- isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);# M A& t0 C S, G" Q. \
- isclasstype(current,CLASSTYPE_VISUALTOOL);& l, G! P& c4 o
- isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码
; A: m4 P9 ]& e4 U( w- x9 c9 R8 V- \% ]7 ]( _
isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者5 Q) |/ H' I# b. `9 h# f% P
6 Y \7 t" G8 g3 L# A# |在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。
9 ?% G9 K( P5 _7 R6 n8 C9 D2 d6 {Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。- Y4 i/ O& e- J+ P6 K# B
5 Y" |! A( q R3 r; U
! c+ q" a2 g, X7 F; K% {9 A6 D! j" H @- ]+ z g2 O
|
|