|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑 ' O4 z/ O$ A$ z5 @- g
8 j8 s P- J. X% k5 i. w
Flexsim可以通过isclasstype函数判断实体类型。
( a4 S, U+ z! B3 l5 W& p1 yisclasstype (obj object, num/str classtype)
! x: ]% l; v6 C; o% h: X- r/ Y. x% o! _8 m
Compares the object to classtype, returns 1 for yes, 0 for no7 t' n" f: f { ?. W8 Y/ z$ Z% `
Description6 {" Z+ ^8 Q7 G, z
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:; y( m8 }6 G7 E$ O9 `. ]
CLASSTYPE_FLEXSIMOBJECT
7 v; u5 g/ l/ ]CLASSTYPE_FIXEDRESOURCE
* ]* m" l$ w3 C9 z5 g2 y% eCLASSTYPE_TASKEXECUTER
( M* p/ W# S) q1 L# A- rCLASSTYPE_NETWORKNODE1 G/ L8 ~! \/ f6 x
etc.( o' K5 t& g5 r ~5 g/ F8 L
& s; M% n7 I4 d* [! X& Y i
Example. [4 Q# l* E) ?1 j* `
isclasstype(current, CLASSTYPE_DISPATCHER);+ D* B' T' n9 i: N$ |' f& a0 v
! q1 {: V3 m( N+ s" v
# ^+ r, J' R/ \! o" X9 [( |: F
Flexism有以下实体类型:4 p' n8 a4 k2 a9 j8 d8 {; T
- isclasstype(current,CLASSTYPE_CONVEYOR);
9 l7 h1 h& l) t: h+ W7 i/ z - isclasstype(current,CLASSTYPE_DISPATCHER);
% [0 l. a8 B# q; ~1 E - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
- c6 x4 ], j2 W3 [4 {; X" z6 M - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);$ O6 Q; @3 Q! a- f2 Y+ i9 v" g
- isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);! A4 k6 W+ }. E" B$ l
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);$ R, z) S, O4 Y" t" ?" u' r
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);- e7 ?7 Z# v; y7 w5 n2 J6 F
- isclasstype(current,CLASSTYPE_LINECONTROLLER);
2 m# ]$ @$ I* \ - isclasstype(current,CLASSTYPE_MERGESORT);
7 D3 U; n$ l1 x7 W - isclasstype(current,CLASSTYPE_MTBFMTTR);
: B8 {5 W% n8 W - isclasstype(current,CLASSTYPE_NAVIGATOR);! V8 [* q- |/ N# }* H
- isclasstype(current,CLASSTYPE_NETWORKNODE);
7 }- }* `. m6 H - isclasstype(current,CLASSTYPE_ODT);+ T$ d% J3 u2 e. L$ p. n
- isclasstype(current,CLASSTYPE_OWNERDRAWN);
# k) x4 }: @5 V. e: U6 Q( E' w" B - isclasstype(current,CLASSTYPE_PROCESSOR);3 f) ~, c3 M: S7 X8 V* P7 u
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);
0 W7 A. c: L. L0 [3 y - isclasstype(current,CLASSTYPE_TASKEXECUTER);5 g" K9 t" Z/ y+ R$ [& o
- isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
1 l3 ~2 a) C0 S. `# o8 |5 P - isclasstype(current,CLASSTYPE_VISUALTOOL);
! R6 Q) U S1 w' G2 L - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码
6 X: h9 s: h& P# Y: \2 x* I l2 p. X, i- q4 L
isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者5 l! s3 C3 @) h2 s2 q7 q
& W9 A+ g, `/ U. b, N! Y, ]8 x* @, E
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。2 x1 H& f" d0 j* z
Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。8 H# j( |2 p! W! `4 P
+ r4 i. A! `* t Y! h/ ? o. x% \2 |' _. N. [! a
2 a5 N7 K% r8 V$ o0 W |
|