|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑 5 W$ p: i) [7 _# a
# h2 F% Z* A2 b- s2 D* @Flexsim可以通过isclasstype函数判断实体类型。. O( t9 k- w# s, U# @8 C
isclasstype (obj object, num/str classtype)
5 X8 p t% H* ~' e" J- y! Z6 l/ y9 ]$ n; |. d2 R) b
Compares the object to classtype, returns 1 for yes, 0 for no }: g9 M% a. S. ^: J3 y9 C' b/ f
Description- O0 J7 i$ G; I4 w9 N1 R* g
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:9 u6 j6 K0 o9 ]: @
CLASSTYPE_FLEXSIMOBJECT
! F+ e8 k9 ~5 A& |# \; BCLASSTYPE_FIXEDRESOURCE
+ h4 a$ Y4 ]" n! f5 c0 _CLASSTYPE_TASKEXECUTER
0 `% @ Q/ z- g. [/ ^; z: zCLASSTYPE_NETWORKNODE
) o D0 @6 d" p8 \$ Aetc.
$ |: k. ~0 }6 O; B6 ~& T$ ?$ J5 {! y. j+ Q# [/ Y& R
Example
. n* z v1 f3 @: Risclasstype(current, CLASSTYPE_DISPATCHER);
" [$ ] B! {; a3 K' J" F) c2 ]& G6 s- g; P
8 `) ~. I% Z4 ~# P. o/ w$ Y$ D2 n- E+ x: \% M. t
Flexism有以下实体类型:) m( ?7 @. _5 D6 f
- isclasstype(current,CLASSTYPE_CONVEYOR);
" Q# V' g% F2 i, D; w1 h - isclasstype(current,CLASSTYPE_DISPATCHER);
?8 u$ P* N% Z: A& \2 T - isclasstype(current,CLASSTYPE_FIXEDRESOURCE);( X `/ G+ H5 ?1 J9 S
- isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);# \4 A! {' A8 `9 N6 v4 D! w! Z2 Q2 o4 x
- isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);7 P4 m4 X" a# L9 @; c4 Z: D
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);; d2 P- e. S( v8 k" G9 O6 g' C1 \9 ?
- isclasstype(current,CLASSTYPE_FLUIDOBJECT2);
1 M+ D' |+ p% ]# e5 b1 L! \3 n- W. J - isclasstype(current,CLASSTYPE_LINECONTROLLER);% T0 z# F9 P- \7 F( \% A
- isclasstype(current,CLASSTYPE_MERGESORT);
- J$ h6 P, j1 h. d- L% L. R - isclasstype(current,CLASSTYPE_MTBFMTTR);/ x9 w" H& k7 ^- P' A7 h
- isclasstype(current,CLASSTYPE_NAVIGATOR);6 ~! z& a( n5 r+ \& c4 R( m4 G3 d
- isclasstype(current,CLASSTYPE_NETWORKNODE);
9 R% |6 v# ]$ x) y- g5 Z - isclasstype(current,CLASSTYPE_ODT);2 t$ Q( Z7 d. |6 r
- isclasstype(current,CLASSTYPE_OWNERDRAWN);
4 @) r8 Y3 k2 C- X( X+ E3 T# r - isclasstype(current,CLASSTYPE_PROCESSOR);
( E/ X/ l Z# N* c4 E( T. S/ m1 }5 }+ Q, u - isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);7 \! K4 o3 E1 ?
- isclasstype(current,CLASSTYPE_TASKEXECUTER);
/ X9 B2 f: ]' y5 j1 E - isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);
% I: s3 ~8 W- e# {/ g - isclasstype(current,CLASSTYPE_VISUALTOOL);7 R/ E3 v5 |" q7 H
- isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 . f+ y! J9 v) P# w% M
7 Z9 | {( g: a5 Q0 _& pisclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者
" \ L3 A+ o8 n. D) L( l9 I
3 c# F |. D+ X; \在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。. c H5 t+ j5 H0 X6 Y0 ~' y
Flexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。$ V4 ~ Q7 ^) `8 ]3 \- h# V
- e2 O: U( r, f% X7 a1 S; }- p# g% ~8 o$ B: p% P9 V' F
% i& S$ U+ f$ @
|
|