|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑 8 N5 V' h, x& r+ g8 n+ }
9 D( S* U- I0 }! p+ fFlexsim可以通过isclasstype函数判断实体类型。' ~ B& Y' r& \; K- y
isclasstype (obj object, num/str classtype)
) g+ M- n3 n( K- E# U8 Q
% x( k" N* ]. ]& eCompares the object to classtype, returns 1 for yes, 0 for no
' ? ]2 i# b; o+ n5 j! t0 K6 |$ bDescription
! I- @0 x8 M* g- C; j& b- ~Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
* _0 }+ J5 E9 i/ NCLASSTYPE_FLEXSIMOBJECT! V7 L- D9 @" ~$ ?/ q8 V$ T
CLASSTYPE_FIXEDRESOURCE
: {. b$ q6 a! L- b# O2 xCLASSTYPE_TASKEXECUTER
3 U! o: T6 N, d# F5 J0 yCLASSTYPE_NETWORKNODE
$ a/ _6 W9 |7 i4 B7 K/ p* Tetc.; J0 @2 s, [" a; q
7 [, ~: ^4 Q+ X$ M* ~Example; d: w& @4 k# c
isclasstype(current, CLASSTYPE_DISPATCHER);
/ [! T! ~ T% h$ I, O4 q8 {) ~0 F6 ]& E( m$ x
* k8 r, y* V: |8 ~. {/ ?
* e" z( F, @$ h7 J8 C8 k% V
Flexism有以下实体类型:
4 R7 S9 z. ?" N- isclasstype(current,CLASSTYPE_CONVEYOR);1 @7 q1 D, s3 ^! e1 V6 j
- isclasstype(current,CLASSTYPE_DISPATCHER);
Y0 M. V8 o. m; E1 h - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
# G& }* E# p& j& a' F) G: n - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);8 W" u' L. d% E+ ^
- isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);4 y L* D% W# V2 r: ^* c( U) K2 o
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);* z6 x! v) {8 j4 B; c
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);
' B. {) `. _) J7 c: y - isclasstype(current,CLASSTYPE_LINECONTROLLER);, V# J# k9 W1 }% R1 z" _0 D7 {
- isclasstype(current,CLASSTYPE_MERGESORT);& P9 n0 h# r" Q; H
- isclasstype(current,CLASSTYPE_MTBFMTTR);( U) ]; E: h; W( e
- isclasstype(current,CLASSTYPE_NAVIGATOR);" g" m+ V( |( }3 r- R2 S
- isclasstype(current,CLASSTYPE_NETWORKNODE);
2 j, S: D1 q2 k& S+ S$ ] - isclasstype(current,CLASSTYPE_ODT);
! T: ~; p i- k' ~/ R* c - isclasstype(current,CLASSTYPE_OWNERDRAWN);1 r7 `* @: K O7 w+ r+ `- w; k
- isclasstype(current,CLASSTYPE_PROCESSOR);7 D8 e5 x* m" \
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);
& E( ]" U2 R7 U7 {4 R5 u* b - isclasstype(current,CLASSTYPE_TASKEXECUTER);
5 A3 ~2 ~" _5 C: _ - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
, h% A n9 {/ i5 g9 G: r2 C! h - isclasstype(current,CLASSTYPE_VISUALTOOL);
4 V' E, ^ ~8 Q8 b" b* t* U - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 2 X. H6 g( P3 ^# Q4 E
2 |7 N' V4 j: m& W7 K
isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者
( u/ o# ?; s2 R% W- I- o' r
2 J. G' L; ]/ J, \2 K6 M在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。: r* T3 M. f" S
Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
# j x; [6 Y4 `7 z, g: H5 @+ l5 _" N! b: J4 b5 }7 _3 u
. _3 N" c( n, u+ B D, _$ _
3 f# J; e/ r0 N; B1 \, U7 C/ d |
|