|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑
. @6 h. A* _, V
. q7 g. {6 v0 `; x0 @# GFlexsim可以通过isclasstype函数判断实体类型。
; _/ I6 D# ]0 ]4 w4 z" M% Y& Iisclasstype (obj object, num/str classtype)6 e, O- L8 [; J9 n
0 {+ J1 _1 H: e/ {8 q3 xCompares the object to classtype, returns 1 for yes, 0 for no
+ N! N4 ^5 Q9 M- |" B' JDescription$ a5 l- _, h! s, P& B: R# |
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:9 Q8 f. d- s U5 j
CLASSTYPE_FLEXSIMOBJECT* L: z! \& u5 Y1 ?
CLASSTYPE_FIXEDRESOURCE
W/ G- V, i5 rCLASSTYPE_TASKEXECUTER
* ^* o1 n& d+ o# A5 }, [+ V7 ZCLASSTYPE_NETWORKNODE* l; S6 H2 |' V0 F- Z
etc.
$ ]0 ?1 D, `: q) U* ?2 Y' h/ {8 D7 y( J
Example
# J/ r! p( @! q( o. yisclasstype(current, CLASSTYPE_DISPATCHER);- W" Q6 _" Z" U% h. c8 E. @
v: w! n7 s" |
- U9 ?. `& `. S+ v* `+ C H' j8 \9 a
1 ~. ], A, ^. r; pFlexism有以下实体类型:
0 d, |# g% \ s, N3 a- isclasstype(current,CLASSTYPE_CONVEYOR);) A* _5 a1 _0 P9 h
- isclasstype(current,CLASSTYPE_DISPATCHER);
$ Z+ d2 t6 e. {0 ]2 ` - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
X% K5 N5 J! q7 q$ [8 L - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);
& Q; o: u) T( \4 |* E; {. R - isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);
! ~. l) g. Z$ T - isclasstype(current,CLASSTYPE_FLUIDOBJECT);2 n$ m2 n# x p, G1 }5 u+ b
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);
7 a# `( H `. H+ O* D% ~ - isclasstype(current,CLASSTYPE_LINECONTROLLER);
- v' Z( p6 Z) k - isclasstype(current,CLASSTYPE_MERGESORT);
& E9 y& \1 F' _( O: g - isclasstype(current,CLASSTYPE_MTBFMTTR);
* a" U1 B2 f3 M; [ j - isclasstype(current,CLASSTYPE_NAVIGATOR);5 A; u# X8 q3 T) m
- isclasstype(current,CLASSTYPE_NETWORKNODE);! R& A/ a: v0 U7 K
- isclasstype(current,CLASSTYPE_ODT);
4 l* r( t- Q4 |" Q, H - isclasstype(current,CLASSTYPE_OWNERDRAWN);6 l' d+ J( A. J/ s+ f9 ~3 {
- isclasstype(current,CLASSTYPE_PROCESSOR);1 O. F1 q( n6 a" q
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);; Q8 S$ ~8 G, X2 Z) k
- isclasstype(current,CLASSTYPE_TASKEXECUTER);& E4 }) H7 ?8 T! }7 U1 S* u, ~
- isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);& g/ B( k2 u% H' O( q+ I$ e
- isclasstype(current,CLASSTYPE_VISUALTOOL);0 g& D) j5 s0 c) [
- isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 0 L! G: m' w5 H! Z1 ^& z0 n8 J
4 g2 x1 q) V7 K2 x- i; ]0 w# Q7 B
isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者; b1 J0 O t8 ~# e+ V1 U) E
& N( G8 U% J" M# O7 K8 a- d1 N1 d
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。
, P3 g& _. I+ k9 }. SFlexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。/ p$ S! C0 ^3 `: {' j
8 v2 p# r7 F; X& i) D5 p
9 ]3 T' j8 A; h$ C- ?. R6 |7 |( i0 R7 O
|
|