|
|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑 ! C) U! w- b/ @& h* n. D
8 j! C) a: N+ z8 qFlexsim可以通过isclasstype函数判断实体类型。) d( G# {+ G2 ]4 l
isclasstype (obj object, num/str classtype)
1 N. c; R! y8 U% }3 C2 ~- c) I+ K. L; b! m: ?1 }
Compares the object to classtype, returns 1 for yes, 0 for no
3 z9 e! q! H9 zDescription( h8 k& f R0 v1 \ \
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:! @0 y# T0 C8 I7 t
CLASSTYPE_FLEXSIMOBJECT; _& B8 R) m }- p8 i3 z
CLASSTYPE_FIXEDRESOURCE
) T4 P6 U; x5 q1 o1 LCLASSTYPE_TASKEXECUTER+ p9 J# w7 B9 Q' Y$ v) \ @
CLASSTYPE_NETWORKNODE1 a! G8 W- I* D1 z3 m) N
etc.$ K; s% o6 w P2 U" `1 P
5 ^$ `% D) _6 t% U* ]( I7 @2 Z
Example' r! W9 l0 u8 B7 x2 l
isclasstype(current, CLASSTYPE_DISPATCHER);4 s- @& P/ V' M& s0 b
8 `( \- F/ G D! H! B$ M/ ?4 W
! O3 G- H% z5 P% r
' a: B+ l* @3 S& F, `2 ~; BFlexism有以下实体类型:
' v8 s6 h5 `5 @% }- isclasstype(current,CLASSTYPE_CONVEYOR);! O) [9 |3 V4 U$ v7 Y$ b
- isclasstype(current,CLASSTYPE_DISPATCHER);
0 I; Z) D7 I$ s3 B - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
* A$ B# c. Y" G" _ - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);
, w; ]7 i) j) g% w/ G7 r - isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);& v% t5 q$ H+ b
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);% w; R8 s4 [/ G3 W3 X
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);
/ ?9 A! L& G- M3 n - isclasstype(current,CLASSTYPE_LINECONTROLLER);
! z, `1 v) ]) o, W1 s$ T) C - isclasstype(current,CLASSTYPE_MERGESORT);
+ d! b0 [- ? l; R! O* P% l - isclasstype(current,CLASSTYPE_MTBFMTTR);
6 |5 q5 t; y3 M/ z: ^ - isclasstype(current,CLASSTYPE_NAVIGATOR);4 d7 l# ]( d1 h' U
- isclasstype(current,CLASSTYPE_NETWORKNODE);3 V" G( t5 h4 r, [+ Q5 S
- isclasstype(current,CLASSTYPE_ODT);7 d/ J; E1 T" _) p3 L6 G
- isclasstype(current,CLASSTYPE_OWNERDRAWN);
1 e/ @7 [+ O3 a5 J - isclasstype(current,CLASSTYPE_PROCESSOR);
: ~- p/ d5 L% c* m+ W1 x ^ - isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);, L. K% R, k& E7 P- Q' e
- isclasstype(current,CLASSTYPE_TASKEXECUTER);
7 k0 D0 @$ ?# z: R( Q$ r" t8 z6 |, x - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
& h$ U7 U) u3 |8 r - isclasstype(current,CLASSTYPE_VISUALTOOL);
( ^2 W- B% e2 S+ K7 [2 j C - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 / B* h" @7 U$ b0 a" t
3 X, j8 V: n, a& b* Cisclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者4 v0 D6 ^, L3 b8 J8 H8 c& t# Z
- n6 `( l: G/ |" S
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。/ W$ ?2 W1 o4 r! x! f6 N5 e# V/ p- m
Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。) d) B3 t* R; ^ i
8 w& b! z- ]4 c- f. |: }9 t6 @5 Q) L1 c6 D3 a
6 L! r( E3 z- A- e- A+ J$ V
|
|