|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑 + m; ^! {0 O/ A" N/ i
$ Z. |$ ?+ d/ H6 v
Flexsim可以通过isclasstype函数判断实体类型。8 v9 d v& \. U% L
isclasstype (obj object, num/str classtype)
k$ R1 |& I9 ^. O& `/ D
|# C& Y( `% ` N- q1 ZCompares the object to classtype, returns 1 for yes, 0 for no
% i6 t6 u; |/ U5 b1 MDescription
& S- u& Q" Q5 F( ^9 QReturns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:- S5 d9 r; m* B
CLASSTYPE_FLEXSIMOBJECT
) A( | ^/ ^. F( uCLASSTYPE_FIXEDRESOURCE# N( E% b% ^! X+ W8 o' q
CLASSTYPE_TASKEXECUTER3 J4 e3 ~+ d, |3 A
CLASSTYPE_NETWORKNODE
2 \+ D% Z7 @/ p# E. V. K$ q$ zetc.# N: V+ V: M& |- V( G2 Z
9 Q! L: P9 f) v1 m9 z
Example! \5 `& F- n, N* z( Q& _
isclasstype(current, CLASSTYPE_DISPATCHER);
w1 N1 M3 }7 L p8 j4 d( H9 j/ y3 A0 ~. B1 F9 Y! e, a
5 q2 N, H% D* t' ]0 ~
7 k" O% q: a5 V; n1 s. `Flexism有以下实体类型:+ `7 d/ m: j1 ?3 j0 e( f1 B) @
- isclasstype(current,CLASSTYPE_CONVEYOR);
! o- i( S, \3 }, E8 c, x - isclasstype(current,CLASSTYPE_DISPATCHER);
* O+ A7 q/ N$ ^" e; I+ C - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
2 T- u; q% C. |$ H0 `, @ - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);) v6 m" k3 ^" F/ E- V6 G2 L7 D
- isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);3 r/ G( T5 [1 O' F* a
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);' }2 {) z* m! b$ @! S: x
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);
0 u9 R4 i4 Z+ g - isclasstype(current,CLASSTYPE_LINECONTROLLER);+ L t" |/ j/ U4 p8 x! a- [ M, N
- isclasstype(current,CLASSTYPE_MERGESORT);, e6 k' h* p/ H, i4 P; F& y4 B' s
- isclasstype(current,CLASSTYPE_MTBFMTTR);
9 Z- s1 p6 \0 o: [- R. a7 K* s/ r' Y - isclasstype(current,CLASSTYPE_NAVIGATOR);
9 k* J: k/ U2 Q1 p - isclasstype(current,CLASSTYPE_NETWORKNODE);
" d* S& L( G. i. f - isclasstype(current,CLASSTYPE_ODT);
* H3 `- [1 [% ]8 e9 T# e D - isclasstype(current,CLASSTYPE_OWNERDRAWN);% t, w) s/ ^+ v" K' A- g
- isclasstype(current,CLASSTYPE_PROCESSOR);
* ] S3 U: c4 _( R* t5 V7 R - isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);
( A9 h1 X3 I* @: @ - isclasstype(current,CLASSTYPE_TASKEXECUTER);. g9 v; r/ j6 x- u% V
- isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
% f c5 y; s( P3 x2 }1 t4 f - isclasstype(current,CLASSTYPE_VISUALTOOL);* D. O, ]* d( N- i
- isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码
- V( O/ _$ s* L8 ]( q
" H: n3 ]7 A. d% { o4 @isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者+ ^* w0 A) |* B6 j% R) H
7 q& B4 T( z: }" F& K在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。2 a5 N, A, P: h2 r0 @ d7 |
Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。- z0 c% ]; B7 Y
0 |+ s- q; S0 p6 H8 u- _
5 m8 E0 [) F& l& u$ P
2 g5 b7 M( q2 X; R# N& g+ ~& v |
|