|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑
6 t6 m3 h( }( J, f& J0 L: ]; m) f9 _$ D
Flexsim可以通过isclasstype函数判断实体类型。0 w }* g6 v7 X+ e r
isclasstype (obj object, num/str classtype)
1 c% [/ C) t) G
/ v* Y2 F! `5 M' o+ U& e0 V8 gCompares the object to classtype, returns 1 for yes, 0 for no
% J4 K7 a3 c8 o. t/ K% O, N2 vDescription
3 u: b: m& j, q4 @7 pReturns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:1 R0 L3 v% j% F6 O0 D
CLASSTYPE_FLEXSIMOBJECT. A9 X) ^+ ]. l2 g. {6 U
CLASSTYPE_FIXEDRESOURCE
0 I9 a9 G- |/ QCLASSTYPE_TASKEXECUTER8 p/ A& v7 Z8 M2 l' g7 z
CLASSTYPE_NETWORKNODE0 f; D% L" d$ a; @2 B
etc.1 A* o. @' y$ w" ?
: j0 Z( B: G; A; |* z, UExample; y( ~' g3 G3 S8 }
isclasstype(current, CLASSTYPE_DISPATCHER);1 d3 \& M- s O M L: h. h
! ^: `7 }0 a6 }/ A2 K3 I! E5 @, f
1 S$ S( ?; |4 Y
' e7 p5 \) O7 \+ @ L6 ~0 iFlexism有以下实体类型: U5 p: P9 f3 G- q
- isclasstype(current,CLASSTYPE_CONVEYOR);
6 p& |( B' T7 F5 l - isclasstype(current,CLASSTYPE_DISPATCHER);$ ?. @3 J* p$ R; d" D! ?7 Y7 H
- isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
& Y: Q' @9 k0 [' @. F8 m8 ^ - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);
7 `- E% J6 v4 U/ A1 Y - isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);
& p* C9 M& t9 _8 @ - isclasstype(current,CLASSTYPE_FLUIDOBJECT);4 u' F8 A8 C( t7 f- ?
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);
$ d/ X8 H. B) p4 c8 @ - isclasstype(current,CLASSTYPE_LINECONTROLLER);
" T' V# g! q1 P4 @2 m - isclasstype(current,CLASSTYPE_MERGESORT);3 S( x0 c; k% @+ z+ `
- isclasstype(current,CLASSTYPE_MTBFMTTR); |+ w( P$ A% Q( }3 D4 j# Z
- isclasstype(current,CLASSTYPE_NAVIGATOR);
; S" b, H& s `. i9 z9 @3 a - isclasstype(current,CLASSTYPE_NETWORKNODE);
1 R3 t3 _/ o: L" x1 N! m - isclasstype(current,CLASSTYPE_ODT);
3 ?$ Z0 E2 c1 I- H% Y - isclasstype(current,CLASSTYPE_OWNERDRAWN);) W d0 J% R0 g: i, r
- isclasstype(current,CLASSTYPE_PROCESSOR);+ Z E2 |( X+ z9 h1 C2 e
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);
$ u( H, r9 \: _" ^! F/ \( p8 h! s - isclasstype(current,CLASSTYPE_TASKEXECUTER);
6 `& V+ K: ?3 U- j) ` - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
# h D- f% m. c4 |3 Y- d: i- K - isclasstype(current,CLASSTYPE_VISUALTOOL);9 x( x' h: y: j2 U
- isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 0 M2 } g H8 i/ B; D
' U0 u: l1 J0 b& w/ X2 T* I! ~2 Iisclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者5 C0 o; z' ~1 U. t9 B
6 Z- K j# K- d1 o! k在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。* G ^! Z1 T0 p" b7 U
Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
0 C% b; a! V5 X" Z2 [+ e6 t
% x* [2 a% ~% g$ r5 E% `: W/ ?& O+ i# e+ @+ U6 L! \
6 f: ?. o3 r& z7 K$ c) P |
|