|
|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑
& r& q/ F/ J% g0 @8 Q" M$ W* d0 [/ e- A, K8 H
Flexsim可以通过isclasstype函数判断实体类型。
: J$ B2 F" [0 kisclasstype (obj object, num/str classtype)
% P6 N/ M6 I4 x8 v! e: j' t _0 W5 d3 U" O
Compares the object to classtype, returns 1 for yes, 0 for no- o5 f$ G2 |. F8 A
Description+ T9 R/ h$ {9 q5 T! i7 u% [
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
( n7 B6 k( Y+ A0 l0 mCLASSTYPE_FLEXSIMOBJECT
; ^. l2 X6 L& D- rCLASSTYPE_FIXEDRESOURCE& {7 z, C8 n( |' O
CLASSTYPE_TASKEXECUTER) K/ P) @: H: \, m* ^8 c1 P
CLASSTYPE_NETWORKNODE9 D% a4 P1 {. o9 z5 W
etc.
8 \4 i4 Z- J d; q8 r3 N
9 \ F5 C9 A$ e( eExample. b& X' z! l5 R3 [% X, u
isclasstype(current, CLASSTYPE_DISPATCHER);
/ b3 }1 f7 D8 m: K3 A
8 ? i1 I& `7 l( }& q+ d- L! w1 J: v: t8 J& S: O3 Y' Y
: H! r; `$ t; V$ ~5 r# w% J7 BFlexism有以下实体类型:* L( z& _- F' J2 a9 U3 ?
- isclasstype(current,CLASSTYPE_CONVEYOR);
/ ?0 G+ w4 ]) n h - isclasstype(current,CLASSTYPE_DISPATCHER);& c$ C; T4 d3 X0 M" w% W
- isclasstype(current,CLASSTYPE_FIXEDRESOURCE);: M& k( i+ m& l. S! Y
- isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);
0 S1 {3 S$ R" D. I0 E1 P- f - isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);
0 `( p% {% ~9 R6 \ - isclasstype(current,CLASSTYPE_FLUIDOBJECT);
, C4 `/ s2 q' G; \$ m; @ - isclasstype(current,CLASSTYPE_FLUIDOBJECT2);% S, p! \! t1 A- k% R0 H
- isclasstype(current,CLASSTYPE_LINECONTROLLER);# }! Q% Q" g4 G/ _! _+ A
- isclasstype(current,CLASSTYPE_MERGESORT);
$ H- N8 @+ N6 Z3 |3 r9 D# k - isclasstype(current,CLASSTYPE_MTBFMTTR);/ r6 P% p. y( Y* @
- isclasstype(current,CLASSTYPE_NAVIGATOR);8 V, R$ ^2 l( L
- isclasstype(current,CLASSTYPE_NETWORKNODE);
, c: J" W( M7 g/ q6 H# c+ X8 m+ g - isclasstype(current,CLASSTYPE_ODT);/ ]: P9 f Q( W" `
- isclasstype(current,CLASSTYPE_OWNERDRAWN);
. }5 K8 k# d. ]1 c* J, _ - isclasstype(current,CLASSTYPE_PROCESSOR);. |0 s1 P3 \0 |2 r/ j/ ]" z
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);
% C4 H2 z/ C) }* N5 n3 f9 ] - isclasstype(current,CLASSTYPE_TASKEXECUTER);
0 q1 Z* c2 l* ?/ } - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
- q. P+ r- W3 g - isclasstype(current,CLASSTYPE_VISUALTOOL);
, P1 r+ B" `5 i- e. p3 G - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 9 `7 W% b5 T0 [6 j
# D3 ~2 k/ l3 H$ n& p
isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者
3 v! f7 `9 H4 K7 T* J, J4 @; z# y$ K4 k2 _
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。0 l; n9 A7 M0 u0 t5 {; y5 W8 _; N
Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。( }5 u- j$ i+ z/ G; `5 V' P. K
B1 I7 _6 B/ Y
+ C: E' y) l6 W6 r' ]/ E+ D+ A$ _
2 ^4 }0 |; D5 |9 M2 ]
|
|