|
本帖最后由 zorsite 于 2022-10-28 14:14 编辑 ' c( I, s9 P2 Y, ^' U
( K) F) L" G3 Q! e0 @Flexsim可以通过isclasstype函数判断实体类型。
/ x( d! T" @! N5 z" Bisclasstype (obj object, num/str classtype)9 S! j) s6 j2 C' I
9 F4 {$ P3 A$ E$ L) iCompares the object to classtype, returns 1 for yes, 0 for no
- w3 ^ w. ~3 H- h( PDescription
, O6 ?3 J1 A0 zReturns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
0 t2 u5 s7 k! y& ?CLASSTYPE_FLEXSIMOBJECT1 c& H1 r& @7 y9 q! \/ G" \8 g- f
CLASSTYPE_FIXEDRESOURCE) |- ?5 p7 o$ J# S# w, Z2 z
CLASSTYPE_TASKEXECUTER
% a Q# S( M, T; MCLASSTYPE_NETWORKNODE5 f$ g' c# D" _
etc.) w9 e3 g. F# m! Q
& B w6 {% T7 l w( m% ?( V. q% ]Example. ^( W2 n5 ?) c2 Z7 a
isclasstype(current, CLASSTYPE_DISPATCHER);9 r: E: S5 z: `' P3 b
" n6 b& Y( ?! T9 `/ ?1 ~
7 g/ A* t$ {! g
, _: |$ J' |! C2 iFlexism有以下实体类型:! a. P9 L) o8 R3 b( w
- isclasstype(current,CLASSTYPE_CONVEYOR);
& g- ]- |, P" t. ^0 s - isclasstype(current,CLASSTYPE_DISPATCHER);, _, c9 L9 q* M8 L$ J' m% j
- isclasstype(current,CLASSTYPE_FIXEDRESOURCE);
; b4 Q9 M6 e7 q$ s - isclasstype(current,CLASSTYPE_FLEXSIMEVENTHANDLER);
8 y" t4 i& x5 a! B) } y - isclasstype(current,CLASSTYPE_FLEXSIMOBJECT);# u; ]" Y5 V8 v' n. T. X$ Z2 @
- isclasstype(current,CLASSTYPE_FLUIDOBJECT);
6 D# E( G1 h; L9 U5 d; w - isclasstype(current,CLASSTYPE_FLUIDOBJECT2);
& [' V6 |5 v* d7 y, h6 t) S - isclasstype(current,CLASSTYPE_LINECONTROLLER);$ ?. {7 i& ~$ v, p, T& o
- isclasstype(current,CLASSTYPE_MERGESORT);9 T7 E" u9 u: j Z& Z5 K: v
- isclasstype(current,CLASSTYPE_MTBFMTTR);
* E2 r" X7 ~, ^- I4 [9 P - isclasstype(current,CLASSTYPE_NAVIGATOR);
& ?3 {5 f* |7 R - isclasstype(current,CLASSTYPE_NETWORKNODE);
" U0 N# k1 a( N" { - isclasstype(current,CLASSTYPE_ODT);
/ X- R8 h; ^9 q. d9 M - isclasstype(current,CLASSTYPE_OWNERDRAWN);
! R- |# ?5 o1 a! \! O9 s% z - isclasstype(current,CLASSTYPE_PROCESSOR); u& L& m+ ~1 C+ o
- isclasstype(current,CLASSTYPE_SYSTEMCONTROLLER);, I) Y, z) r4 z( ~! n( o
- isclasstype(current,CLASSTYPE_TASKEXECUTER);5 E1 v4 A3 t! s5 H0 S0 d& n
- isclasstype(current,CLASSTYPE_TRAFFICCONTROLLER);( J2 F1 M* G0 _. o. F
- isclasstype(current,CLASSTYPE_VISUALTOOL);7 Y; g$ v" m3 O* [; U
- isclasstype(current,CLASSTYPE_WANTCONNECTLOGIC);
复制代码 ) Y/ X; ]0 n; ]9 [" g( J# C
( L& i: O2 ~& W* p* t
isclasstype 的第2个参数应该是数字或文本,正常情况下函数应该写作:- isclasstype(current,"Processor");
复制代码 或者. H5 a3 X4 R+ m0 ]5 j- V3 X6 `& m
4 b r$ \" _6 h在代码中使用数字不便于理解代码,使用文本时需要注意大小写,而且需要加引号,也常会出现拼写错误。
z- M/ I$ m& I# cFlexsim将常用实体类型设置为常量,可以在代码中直接引用,不仅可以自动补全,也便于代码的阅读和理解。) I& R3 M9 ]4 `* X% D T( T* O* D
5 j- q8 D$ K8 G/ x3 n g: h
: k% I6 ^ s% y4 O/ F7 z1 a
7 c0 |3 d9 D) i, C0 @ i I |
|