|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑 5 [7 ?& Y) _0 D. {4 @5 v9 U" K
1 @2 O6 f, o; h9 a+ DFlexsim可以通过isclasstype函数判断实体类型。
2 E% f0 s5 ]: U3 N% t i1 Sisclasstype (obj object, num/str classtype)7 t# k. O3 [" \
3 ^/ S- V. o _# H& ?7 Y0 cCompares the object to classtype, returns 1 for yes, 0 for no
# x; B. H& l; X0 pDescription6 p" t5 j2 L) a
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
. Y2 \/ d X5 D0 ]! { CCLASSTYPE_FLEXSIMOBJECT7 g9 S7 A7 u# @! {7 J* g
CLASSTYPE_FIXEDRESOURCE
* Q9 v9 ~+ c* E4 }; R" qCLASSTYPE_TASKEXECUTER
8 W+ f) ^+ b) L+ d- h- UCLASSTYPE_NETWORKNODE
- D0 C4 O# \6 _4 uetc.
; l- j# @3 W0 I. F& y* o) w$ z8 }! q1 M5 t4 w! x
Example
u2 ?% d1 n; Tisclasstype(current, CLASSTYPE_DISPATCHER);
5 J$ X0 a* b$ k( ]0 f
3 d; M ?; r; u! L. d6 f4 F
! Y$ f5 L E; R& l" |9 ` q- B* ~
r* i# D2 b+ i* @& |/ E vFlexism有以下实体类型:9 [5 s O" I4 n* J+ `$ r
- isclasstype(current,CLASSTYPE_CONVEYOR);
( D' N( k+ L1 j9 M/ W: W7 u# X - isclasstype(current,CLASSTYPE_DISPATCHER);/ l$ P7 F# x9 L6 s1 X% I- \- {
- isclasstype(current,CLASSTYPE_FIXEDRESOURCE);. ]; y0 Z/ S- F; ] P ~/ Q/ ]
- isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);
. Q. R5 m6 ^, {5 ?, N1 x0 W8 X1 n - isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);
% @* M7 h( @- C; B- a - isclasstype(current,CLASSTYPE_FLUIDOBJECT);
* J, N8 b$ [2 N" U5 J0 `% a - isclasstype(current,CLASSTYPE_FLUIDOBJECT2);# H/ }6 O0 `3 r6 t
- isclasstype(current,CLASSTYPE_LINECONTROLLER);; t L7 u% i; J. r9 y* M
- isclasstype(current,CLASSTYPE_MERGESORT);$ ?2 _$ W; G; O& r, q/ `
- isclasstype(current,CLASSTYPE_MTBFMTTR);, F, X. i/ B3 z1 p
- isclasstype(current,CLASSTYPE_NAVIGATOR);& t1 V: W4 a' w! `7 ~2 o
- isclasstype(current,CLASSTYPE_NETWORKNODE);
/ A7 O3 W0 K# U- E( z2 W2 I - isclasstype(current,CLASSTYPE_ODT);6 v: m) e! L5 f' G1 u" W+ y" Y% |: p
- isclasstype(current,CLASSTYPE_OWNERDRAWN);6 @0 Y6 x7 ?9 m* v1 R3 h! m% ^
- isclasstype(current,CLASSTYPE_PROCESSOR);
- D: y8 s" C! x$ K1 T. [, N1 T# m - isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);
, W# T. Z3 Q2 P0 x# F. K- W9 g6 e0 J - isclasstype(current,CLASSTYPE_TASKEXECUTER);* t O6 ?! R) S8 V7 }5 a1 G t
- isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
- M/ g) p+ [) A$ K& K* |4 U5 \ - isclasstype(current,CLASSTYPE_VISUALTOOL);
$ ^2 X, n8 `) i& N! K% j. U - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 5 d" ^/ l2 z6 @
; v( P+ f9 s0 G2 K
isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者, g4 v1 h% H( j4 P: ~5 {/ u; B) F
( q" k+ u" Z# t& u- _
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。
0 r! g B+ f+ {: v* ?; fFlexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
* P* r7 O4 l* U
' ]: {# k( [) g8 g8 @
( R$ ^) E% Z8 w
$ E, A K* i! V' } |
|