|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑
* x* G8 S' W. G) j: {% {# k& C7 c3 ~& `3 q: u! d( } X8 d
Flexsim可以通过isclasstype函数判断实体类型。1 A, f: q! Y$ i9 b0 G/ C' N7 T
isclasstype (obj object, num/str classtype)
! v/ I( ]: ?) L1 f4 E: W6 _* L1 o, O, v" m( v8 A0 \) h$ L
Compares the object to classtype, returns 1 for yes, 0 for no
2 ~- d7 q Z) }- R. s- ODescription# W+ i1 V8 M* n
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
0 Q4 `# m2 ^# C4 N5 M4 V" ]' y) K" L- wCLASSTYPE_FLEXSIMOBJECT
# c9 P; T* q! E, \$ }# ^CLASSTYPE_FIXEDRESOURCE
- u- Z/ B* H* A# `; r, j, _CLASSTYPE_TASKEXECUTER4 a5 d! }3 s0 v' P* I0 T% V
CLASSTYPE_NETWORKNODE
+ a' I: X6 ^- x/ V' xetc.# ^0 M- e3 ~' ]! _& M! g, Z% \+ q
7 h( b1 N3 U u+ w
Example# G% X" r7 C& q h; N5 h2 M( z. Z1 B
isclasstype(current, CLASSTYPE_DISPATCHER);
; [8 V# E4 X/ J3 F# P
+ l% c0 [" I# G
7 `# v! k O( h9 ^; Y& ^: c) @
0 ~/ f! i2 Y* |' j/ F3 sFlexism有以下实体类型:
( R1 @* w( N( g" q9 f- isclasstype(current,CLASSTYPE_CONVEYOR);) H( {3 o8 N# V
- isclasstype(current,CLASSTYPE_DISPATCHER);& L6 z2 p. H7 e9 j' c/ y+ J* F
- isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
% H+ L# m& C$ j7 c/ g1 l3 u% x" c - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);
t1 ~. ^* G; P+ A/ q+ w) C - isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);9 I$ i, {6 m& Y: W+ c, M3 R
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);
% l3 h( f! T$ }3 U+ ~) Q - isclasstype(current,CLASSTYPE_FLUIDOBJECT2);0 F% U6 O* ^7 r* A
- isclasstype(current,CLASSTYPE_LINECONTROLLER);
5 v4 I1 `, F4 W% r+ a& P# G - isclasstype(current,CLASSTYPE_MERGESORT);
1 R5 g# e+ k! Z - isclasstype(current,CLASSTYPE_MTBFMTTR);: q/ a# F+ ]) L- c$ h( n% p1 x
- isclasstype(current,CLASSTYPE_NAVIGATOR);
4 s; I0 O, h4 G - isclasstype(current,CLASSTYPE_NETWORKNODE);
+ Y l# y1 f) X! k) R - isclasstype(current,CLASSTYPE_ODT);
7 m1 z. u" A. D: l1 E - isclasstype(current,CLASSTYPE_OWNERDRAWN);7 R3 z0 w' u& `1 Z, O1 o
- isclasstype(current,CLASSTYPE_PROCESSOR);
9 R) P( D u1 [1 v - isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);
- N1 T4 b/ h; G; k$ }" Q, X5 | - isclasstype(current,CLASSTYPE_TASKEXECUTER);1 }' z8 ]/ ^5 z$ s0 _0 A4 ~& Y
- isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
7 P9 u% ^3 P2 p - isclasstype(current,CLASSTYPE_VISUALTOOL);
4 q6 y' |+ y, R# M - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 * w: ^6 I7 X+ X" V9 m4 z
2 C# F/ x0 Y5 Wisclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者
1 J, ]) \5 E6 ]4 e, u ^! @; X b1 m& L/ N% P% i: N9 |
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。
+ y% e# V% y9 ?; ?" V! V% {Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
, H& D* Y; H: k; b3 g: @
& e( u7 t/ U3 _ m+ `4 }' A Y8 ]1 x7 I3 ?: E
; t$ A2 q" m' i/ J |
|