|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑
; V; G) F) E- Q
( q n O. J* `( PFlexsim可以通过isclasstype函数判断实体类型。
. h% c/ x4 M7 b! X) uisclasstype (obj object, num/str classtype)7 Z2 U% O' d. c- N8 _7 j* A; g: |
3 M* {. ?& M0 @) f! ]1 k
Compares the object to classtype, returns 1 for yes, 0 for no. e m$ e; I1 A0 X$ k
Description; V- p8 h4 T1 h [7 \! l3 J
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
. _- d* E. z5 C" G PCLASSTYPE_FLEXSIMOBJECT
9 ^/ D0 d0 J' B2 I" M. N5 L; ?CLASSTYPE_FIXEDRESOURCE( E7 x' B5 Z/ g) s% Q3 p
CLASSTYPE_TASKEXECUTER
4 k7 H0 t7 y& ^: kCLASSTYPE_NETWORKNODE& ?; q `6 x3 k) a
etc./ P9 a) |! y5 {9 E, v
: P: ]+ B+ \2 ^Example
+ ~; S# b: z% Yisclasstype(current, CLASSTYPE_DISPATCHER);9 C4 d9 R2 g/ L3 }' |9 I j# N. v
" _' I+ T, w& T" f B+ Y% ]
8 E5 l$ x& e6 x+ ^, { q! L. h7 j$ G. v" A
Flexism有以下实体类型:; U+ e! l8 @! C$ N
- isclasstype(current,CLASSTYPE_CONVEYOR);' N0 a- Z; i4 Q2 v: K; J& O0 Z
- isclasstype(current,CLASSTYPE_DISPATCHER);
' F& n7 Q9 s" S4 U - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
5 g: r, g& D; }# v5 A - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);! g# Q3 n0 c: @8 F) [
- isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);( S; O8 a% `& {" A; X
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);/ B- s7 Y7 ~5 s7 y9 ^! I
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);: h* D B+ q5 z `4 Q* E) M
- isclasstype(current,CLASSTYPE_LINECONTROLLER);
; F7 Q3 h, v4 v9 \ - isclasstype(current,CLASSTYPE_MERGESORT);
; y0 N. o! K6 M* u7 r- |, o5 a - isclasstype(current,CLASSTYPE_MTBFMTTR);6 e0 S7 T. \3 ]" V% ~: Z2 T
- isclasstype(current,CLASSTYPE_NAVIGATOR);# ?# l9 s' s; b7 |
- isclasstype(current,CLASSTYPE_NETWORKNODE);" ^8 C2 X; p) e% H3 A
- isclasstype(current,CLASSTYPE_ODT);7 N- l& ]9 o9 P8 J$ s) |
- isclasstype(current,CLASSTYPE_OWNERDRAWN);
d- x5 k, W9 `$ e' N$ r - isclasstype(current,CLASSTYPE_PROCESSOR);
! [0 L; I4 q/ W6 j0 F0 F9 A+ ~ | - isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);
@0 {+ r5 L$ m( m# Y - isclasstype(current,CLASSTYPE_TASKEXECUTER);% R! E" l+ T* |, v7 b
- isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
u2 O6 c. g! r" ` - isclasstype(current,CLASSTYPE_VISUALTOOL);
; ]+ T* g1 B2 L- l - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 ; f( X4 S ^9 B9 R
; `: y! F# t2 W- Z- f0 X8 Cisclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者1 ?5 j. b! J3 `8 G3 L
$ [4 k* S$ o) E1 O
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。+ l& B5 K% f8 k( ^. ?) ~! A9 h
Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
2 ~. y" B' X2 U6 F; f# Y5 u
% S! A0 V; X7 `3 r5 B- W4 z. p
0 C! e$ ^2 Y1 U5 J/ w% R6 h
! z% z8 J' B0 w& Q4 k$ l- N |
|