|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑
8 Q+ e( n) T! R: F: m+ w; T S& I d( V( b+ O+ _* w/ W
Flexsim可以通过isclasstype函数判断实体类型。
/ X }0 Q/ ^' L( Misclasstype (obj object, num/str classtype)
5 t) T9 [4 l( D* O' B& {% K
. L8 o; J( o( V- Q iCompares the object to classtype, returns 1 for yes, 0 for no
1 b- Q* \3 C* e+ ~' HDescription
3 d" E# K0 B! k4 m0 w# AReturns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
+ r: O/ U6 W0 C, _. T* ^CLASSTYPE_FLEXSIMOBJECT' f2 g$ ]+ H) H
CLASSTYPE_FIXEDRESOURCE
" g* {6 N. F8 b1 F0 ACLASSTYPE_TASKEXECUTER( k& J+ T8 b% D$ q$ R- c( s
CLASSTYPE_NETWORKNODE- C) v# h4 L' }* |3 `$ k( |/ P
etc.
5 F3 `3 v. \+ v* J5 R6 |
9 J0 u7 W# C) M: {3 DExample
2 U! |0 q7 y1 i6 hisclasstype(current, CLASSTYPE_DISPATCHER);
* P! C7 `) S0 P& i6 {- B5 B% B1 \. J; J# P3 [& }3 ~- l* s
3 e. G2 n' f% g, i( L# e8 x
k' p) h! p% D/ k- v4 h5 {( f/ {
Flexism有以下实体类型:* N( {% k$ F3 [2 x f; Y
- isclasstype(current,CLASSTYPE_CONVEYOR);3 x- f7 p& U* g) q. {6 O% f
- isclasstype(current,CLASSTYPE_DISPATCHER);
5 i d# q8 F- _ - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
# f& z9 t" T4 m$ j, t: |3 @+ \1 V - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);) U" ]$ z' H& \3 X
- isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);
( {3 Z6 s9 ]) h# P0 F# g - isclasstype(current,CLASSTYPE_FLUIDOBJECT);
: Q* ]! C5 e4 {& C* c/ M - isclasstype(current,CLASSTYPE_FLUIDOBJECT2);7 n0 A" [4 V& @ F: m3 j
- isclasstype(current,CLASSTYPE_LINECONTROLLER);: P1 T( [# R/ `5 [0 @0 C! [# A
- isclasstype(current,CLASSTYPE_MERGESORT);
+ F/ }0 {: I* J- k( {5 r - isclasstype(current,CLASSTYPE_MTBFMTTR);
/ { `* t. r+ X+ H3 ]. j( p - isclasstype(current,CLASSTYPE_NAVIGATOR); `% r# d& _' \: X
- isclasstype(current,CLASSTYPE_NETWORKNODE);
0 d) H# N( t1 x2 ?3 y - isclasstype(current,CLASSTYPE_ODT);: C2 v9 i( z( z2 J( H) F
- isclasstype(current,CLASSTYPE_OWNERDRAWN);
) U3 y2 d8 {( y5 b# @9 n; O - isclasstype(current,CLASSTYPE_PROCESSOR);& C+ @1 @" q9 M ^' p$ M2 h4 _
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);1 e7 H7 T- [ S8 E
- isclasstype(current,CLASSTYPE_TASKEXECUTER);6 w, l8 [" O0 \
- isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);# a9 z7 c q0 Y' ] L. W7 N
- isclasstype(current,CLASSTYPE_VISUALTOOL);
$ q! u# Z+ }4 D ^ - isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 * G- o g% K3 k2 k
4 ? B3 u( K. b% }- r* D/ w7 m
isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者
2 U# M% {; B6 l6 M* N& p% p. O# k
; o+ p2 I: t7 ]* X8 a9 Y3 J在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。6 F$ f/ J' ^% w3 A" Q
Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。
6 d( Y. I2 G5 S3 {( P) @) t q1 l, L3 V1 s& [7 \# |% q
0 ?5 O5 l8 ]* w4 S: G
( B- w/ U% V1 `+ z |
|