|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑 3 T; p# i' q- ?3 _5 J5 u3 x! c
. R3 v- r! r Y1 t% pFlexsim可以通过isclasstype函数判断实体类型。
4 ?3 M6 S& Q( M# l5 bisclasstype (obj object, num/str classtype)
/ u4 A# U5 E1 F- B/ j$ [6 H! A7 n2 E1 ~9 j$ n$ [
Compares the object to classtype, returns 1 for yes, 0 for no
; q, a! |1 F7 k3 i I% QDescription
4 X* r: f/ G# L8 ^1 uReturns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
" Y" C9 P8 u; s3 Q' u KCLASSTYPE_FLEXSIMOBJECT
2 I/ k6 h& s8 j: J( Z# Z2 XCLASSTYPE_FIXEDRESOURCE
# L7 o6 I. D8 w6 TCLASSTYPE_TASKEXECUTER/ ^ D) T! d1 O3 a. L
CLASSTYPE_NETWORKNODE
4 s7 G( r- [" b t6 G6 |; ]2 p) {etc.
# S- ~) @/ n8 H$ k/ D1 V# I; ~4 ?, m- r: V, s% C' x
Example* l2 l+ ^" l7 x8 g" D' s
isclasstype(current, CLASSTYPE_DISPATCHER);
5 U, Z' C( a" t$ j
# u# t0 M5 p9 ` U" }. p6 e( A" E* L$ f. G! J8 ~7 m6 ]$ P% F4 y
! F- ?, m/ y9 Z. o; ?0 [% r* T4 P: mFlexism有以下实体类型:0 v' p6 s- |5 P1 b5 H a; H
- isclasstype(current,CLASSTYPE_CONVEYOR);
i7 M9 \2 G$ K1 ^$ S - isclasstype(current,CLASSTYPE_DISPATCHER);
) p3 X6 s6 O7 ~" n - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);! d f4 H0 ^- C$ i7 F) d/ t1 e
- isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);
2 O" a- V9 ~$ G/ S - isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);
" f* t) c1 }" R* l S% G% _. y' Y7 h - isclasstype(current,CLASSTYPE_FLUIDOBJECT);- x; w8 L; B, g
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);' {3 Q: s; i* n) Y7 Y0 g
- isclasstype(current,CLASSTYPE_LINECONTROLLER);
( e4 U: [- o# M6 W - isclasstype(current,CLASSTYPE_MERGESORT);
. A3 w" ~5 \1 ?% p B - isclasstype(current,CLASSTYPE_MTBFMTTR);
: R/ ]0 Q4 _) d2 c/ m& G/ l) p7 u$ r - isclasstype(current,CLASSTYPE_NAVIGATOR);
$ B8 [ P, M. {6 ^ - isclasstype(current,CLASSTYPE_NETWORKNODE);
: _) f/ @0 G9 m - isclasstype(current,CLASSTYPE_ODT);( X6 B: b {4 V' n3 e6 _; L
- isclasstype(current,CLASSTYPE_OWNERDRAWN);5 R6 r8 s; @* `
- isclasstype(current,CLASSTYPE_PROCESSOR);2 y/ A+ k6 f! b- {5 P, I
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);
* z0 I4 V* p: E4 ]: N2 j5 A - isclasstype(current,CLASSTYPE_TASKEXECUTER);3 `' V Q- N+ ?% k
- isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
% ?1 I$ a. y5 m2 g u/ P. Q) D - isclasstype(current,CLASSTYPE_VISUALTOOL);
8 X. M0 G$ L9 {4 e& L4 J - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 . R8 [( a% Y; A: I2 p7 v
/ n. t1 @5 N* xisclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者8 j9 o0 U! L; J8 `
7 ]5 L T& ?* C' R1 j2 K
在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。
" B5 n; C- V- k) l/ \Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
& ~$ N- x' {2 u- X4 m( U. `) b7 K* n$ _
+ z9 [4 J' |, k: I0 L- ~! `7 u: L4 Z L4 Y* E8 t( @+ n U/ w
|
|