|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑 * U) A d* d& V$ I
/ G& O! g% ^' p
Flexsim可以通过isclasstype函数判断实体类型。
2 t% |6 U K; V7 eisclasstype (obj object, num/str classtype): T/ ~7 {/ b+ N7 h# \! m- K5 [9 G% w* H3 N
- i6 M8 {- ?0 H! JCompares the object to classtype, returns 1 for yes, 0 for no% a" x4 j) h) {& ^
Description
; w2 { }1 w. S' M. Y) LReturns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
) B0 u6 E+ W! q( \7 \1 p3 _. `CLASSTYPE_FLEXSIMOBJECT* V0 V9 b( j1 J
CLASSTYPE_FIXEDRESOURCE
9 w" O/ S* M3 u+ v" _ b: f) |5 VCLASSTYPE_TASKEXECUTER
- l. P; Y' ?% w6 e$ W5 \- s, C MCLASSTYPE_NETWORKNODE) p' I$ Y [4 w* m2 A8 c3 O6 X
etc.* a9 ^' I* y6 H9 V$ p
" e* F) I. p7 U; V/ rExample. d8 s2 D7 }: t8 q+ f( N; A
isclasstype(current, CLASSTYPE_DISPATCHER);
$ w( S( E# I9 A, q: Z9 [
5 u$ a# w) w4 G
7 L7 o' { O' U5 \! b- \! l
* }2 z# k+ U$ J2 g' LFlexism有以下实体类型:0 x/ N) u# j; a, \1 C# U
- isclasstype(current,CLASSTYPE_CONVEYOR);! _1 W! t$ ~+ }
- isclasstype(current,CLASSTYPE_DISPATCHER);, r5 G) l' Y9 S# L% g' d' a& x' o
- isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
! A( G% ^, L8 V6 q" u - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);& I% e2 n# u- c% I( e
- isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);" v5 j- R5 e- ^! u/ [+ n+ W/ N
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);1 Z. m* U' v7 Y% R, \, q
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);8 G' o" Q8 \* V/ v8 ~+ ^5 a3 `
- isclasstype(current,CLASSTYPE_LINECONTROLLER);
0 M3 V4 L( |7 f u, ?' x J, } - isclasstype(current,CLASSTYPE_MERGESORT);
9 w) r6 |8 b% K, y - isclasstype(current,CLASSTYPE_MTBFMTTR);
: e" |5 S3 {; M+ V7 D4 K - isclasstype(current,CLASSTYPE_NAVIGATOR);% b- d/ ~) L y5 T
- isclasstype(current,CLASSTYPE_NETWORKNODE);) F( ]. P8 Q& c* k9 c, {
- isclasstype(current,CLASSTYPE_ODT);
2 _' Z, _; c0 n0 e0 } - isclasstype(current,CLASSTYPE_OWNERDRAWN);& l% q4 G0 P f& h; k1 U3 f, E( P
- isclasstype(current,CLASSTYPE_PROCESSOR);9 ?- R/ p* g2 _) m6 d g- L; n% d
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);
. s+ _; w; V P, ^ H - isclasstype(current,CLASSTYPE_TASKEXECUTER);
4 n- i# L& T8 ?" W) f5 Y - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);( a4 t0 k( X5 n2 O- R. }9 I) c
- isclasstype(current,CLASSTYPE_VISUALTOOL);3 B4 R9 }* q9 T9 n q8 }
- isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 l8 W4 j( f& { a% K
9 v* A3 ^9 n' G7 |isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者. L5 a2 U2 T3 [5 a. Q* \: p
( L# R( v9 d5 I. a
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。" F8 w2 Z5 R1 ]" |# _
Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。- z2 ?: _9 s5 l/ Q
6 A7 w7 K- Q" n# b9 B/ q
1 _3 [. K+ K" e+ [- Y* a: e9 Q3 j8 X
, k9 z3 u/ c3 Y4 \- T9 ? |
|