|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑
9 n- U3 o2 R/ W" a1 @" G9 |2 T9 S* D2 K) b9 O) l: d. l
Flexsim可以通过isclasstype函数判断实体类型。: ]; }2 ^2 q" v! l. r, r$ x
isclasstype (obj object, num/str classtype)
8 c& f2 B% i: O6 B9 t
/ M) n9 _, l# |' p7 O7 mCompares the object to classtype, returns 1 for yes, 0 for no. N$ y2 d z$ x) N
Description
1 E! ^9 R, k: B5 uReturns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:5 {: _/ I0 r# s( i0 \" a
CLASSTYPE_FLEXSIMOBJECT
& U- a7 m5 N; n6 VCLASSTYPE_FIXEDRESOURCE V* T) D! f$ d1 j. y" m
CLASSTYPE_TASKEXECUTER0 }% @* P; X5 p$ G' U
CLASSTYPE_NETWORKNODE
3 B, }% Y0 g6 g, Hetc.
* q' g4 x5 F7 i% e6 L0 {+ ^7 S, z/ |
Example0 d7 j% c9 A: ?3 L- c
isclasstype(current, CLASSTYPE_DISPATCHER);
! O( E' Y1 x& n. B6 K; f! N: e; w$ o5 L& z$ W0 F5 F
! @; ?( o1 H; L/ U2 z
% q m2 v: g a9 A9 h) Q9 }
Flexism有以下实体类型: [- D7 p0 g( L6 u4 }7 I1 |
- isclasstype(current,CLASSTYPE_CONVEYOR);
' P. q% G" \- D, E" Z/ A9 T - isclasstype(current,CLASSTYPE_DISPATCHER);- [& n" V1 }: Z
- isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
$ v; q! Y a+ U e1 K& B9 K) C - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);- X- w) P) N0 L1 z
- isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);
9 _. T7 [* O* v7 w4 o - isclasstype(current,CLASSTYPE_FLUIDOBJECT);
6 T# M* Z6 [/ a# l( [/ J* B. h6 G. S - isclasstype(current,CLASSTYPE_FLUIDOBJECT2);" e3 a1 U5 G8 t Z; P* x c
- isclasstype(current,CLASSTYPE_LINECONTROLLER);
! o: t% Q2 K3 f. f& N - isclasstype(current,CLASSTYPE_MERGESORT);
% i: {6 P3 Y O - isclasstype(current,CLASSTYPE_MTBFMTTR);
5 Z. m8 Q9 [1 e5 k! Z* k# z - isclasstype(current,CLASSTYPE_NAVIGATOR);$ P" p3 g4 j. U
- isclasstype(current,CLASSTYPE_NETWORKNODE);
& d- R3 B3 s6 K- | - isclasstype(current,CLASSTYPE_ODT);9 E# l* K. E, Q g2 G- Q3 x6 D
- isclasstype(current,CLASSTYPE_OWNERDRAWN);
# W. \6 h5 }& N6 D/ ~ - isclasstype(current,CLASSTYPE_PROCESSOR);! O$ X* s* y" _. m
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);. N$ Y, Y* `* C( |
- isclasstype(current,CLASSTYPE_TASKEXECUTER);
: Z3 g) [ H/ a% { - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
* C) h1 a' ]/ `8 R - isclasstype(current,CLASSTYPE_VISUALTOOL);2 v: d' z/ V- ^
- isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码
: D: P7 x4 c3 S: p6 d6 |( b6 o+ z1 K" S; Z0 a
isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者
$ k7 L! e6 a& ~9 ^& J3 V' Z e3 h' E! E
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。
L$ O9 B! m9 `Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
( l/ o$ w& ^8 K3 z3 C% E: e( i7 Y: L
7 J! v* R3 n4 q
7 z( ?) ]% i; s/ Q; ]3 V: e) L+ i5 \9 G1 q9 A
|
|