全球FlexSim系统仿真中文论坛

搜索
查看: 10741|回复: 3
打印 上一主题 下一主题

Flexsim常用数学函数简介

[复制链接]
跳转到指定楼层
1#
zorsite 发表于 2017-5-31 02:14:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 zorsite 于 2017-5-31 03:15 编辑
' p) T. i# u- h: H' u- G! H
7 C# }0 M3 x# C; _
ceil+ t  _+ m5 |) i7 B$ ?& x, c% j/ |
(num num)
天花板,向上取整。
Example
double myval =ceil(2.3); // Sets myval to 3. 5 Z1 [8 L2 v! q' b' W4 W
double myval = ceil(3.8); // Sets myval to 4. ! q0 g* p  P1 B% T0 h! L% N
double myval = ceil(-2.3); // Sets myval to -2. 7 N# q; Y! j& K& @- Y( J
double myval = ceil(-3.8); // Sets myval to -3.
3 q; |4 B5 ~/ K; H
+ [/ G/ ]" U& ?; j  h4 ]1 y: Y. k$ z
floor
3 `( Q/ e6 c* U( U(num num)
地板,向下取整。
Example
double myval = floor(2.3); // Sets myvalto 2.
" F; x+ F; I7 a+ n; vdouble myval = floor(3.8); // Sets myval to 3.
( y1 K1 n3 _4 R% D2 Kdouble myval = floor(-2.3); // Sets myval to -3.
+ i7 f- Y7 g$ d  M( {- ydouble myval = floor(-3.8); // Sets myval to -4. 6 C; w  _$ A1 _7 b* R

4 N  a0 h1 b% e: W5 U
round
3 i8 i( f% o) z) M(num value[, num precision])
根据指定的小数位数进行四舍五入。
Example
int mynum1 = round(3.6269);
/ g3 w% [( v% ^& F3 S) I6 Eint mynum2 = round(3.6269,2);! ~% @$ s" L+ H/ l2 Z

: W  ?& a. i9 Pmynum1 will be 4, and mynum2 will be 3.63. 6 p+ B7 `+ e7 I- _
  F/ n% M% E0 H9 S$ }0 s
trunc/ r1 ?* {) g% c+ G- z& s* L  q
(num value)
去除小数部分取整。Truncation
Example
trunc(2.478), returns 2% k" H+ f3 D# K- G2 {  E( l; x
/ v1 Y; G4 i& {! e7 j: v8 c" g: @
trunc(2.95), returns 2

# T5 M- Q! B1 x  y# o
frac, X! Z# [( T8 N/ a3 P& c
(num value)
取小数点之后的部分。
Example
frac(3.124) returns 0.124, I9 b( ^! @& ^2 B
frac(-16.12) returns -0.12& ~2 _! m3 _$ G, g$ U6 m( Q- @* q
frac(12) returns 0.0 . N3 I- d7 U2 i9 f# O4 _; j- t, W

$ p6 t7 @& A/ Y! z9 |" }
sign, f" |( s: s& R5 D
(num value)
决断正负零,正数返回1,负数返回-10返回0
Example
sign(-1) 5 J! p/ ]# `7 q! G- O8 v# Y

; G) X7 i5 S" F3 c# p0 {+ @7 f
fabs
9 H2 N* p& L5 B8 U: i6 Q: c(num value)
绝对值。
Example
if(fabs(x1 - x2) > 5) : N  Y+ ?1 @& @8 M& N/ j+ }4 P

( O7 R% ^' j  q1 y: ]6 N0 f
factorial
+ @$ C5 F, N. _4 ^+ A5 o! N( v(num value)
阶乘。
Example
factorial(5) $ W2 i# F# T" Y0 w  H

# b& i& x. G3 yThis calculates the factorial of 5, which is 1*2*3*4*5 = 120 0 g% R4 q' y% o4 l/ q2 n* L

* Z  f9 {1 R/ v3 f# j, T6 \
fmod
2 d9 D+ n/ Z/ d4 Y6 d. O) M( I1 K(num value1, numvalue2)
取余。
Description
Remainder of value1/value2. fmod returnsthe floating-point remainder of value1 / value2. If the value of b is 0.0, fmodreturns a quiet NaN.
. j" `$ W% T$ g- jThis command is great for getting a repeating set ofnumbers because no matter what value1 is, so long as value2 is unchanged, fmodwill return a set of numbers that keeps repeating itself.
Example
fmod(10,3) This returns the remainder of 10/3, which is 1.0
( q4 c0 \' {0 L+ a8 n' }5 [8 E9 J% s
if(fmod(current.stats.output,10) == 0)
& s- W% U  q8 R5 v
7 @( S6 W4 T+ X9 ~" n9 z  YIf this condition was in the OnExit of an object in the model, it would be truewith every 10th flowitem that exits, starting with the 10th flowitem. * n  n; x  [# s$ _& u* @
# R0 e1 H" N; Q6 S
pow
; G2 }( g' j, [) j7 i& a; I: M+ x- R(num num1, numnum2)
乘方。
Example
double myval = pow(2,3); Sets myval to 8. : T- H! F' _& J4 W! z( G

9 Z2 w. \  [6 Y
sqr+ C- V0 Z1 }; ~1 e) ^
(num value)
平方Square of value.
Example
sqr(2)
  K+ F; X6 X  d  v& w
7 P+ h% _8 u9 P% B  a
sqrt
+ v# S' n6 R' F/ z% Y5 b(num value)
平方根Square root of value
Example
sqrt(10) This expression will return 3.16
9 O- I- _8 w0 r! S" _7 l  b9 C, R$ i

6 B9 r1 G6 l9 E+ ~3 ~) z) P+ O+ t; |/ p
8 T: _8 o& k/ P9 I2 s) E
比如,我们要计算托盘上有多少层货物。
% \' V% z: d8 U& w4 U; A% K默认情况下,pallet上面每层可以放置4个box。也就是说,1,2,3,4个box都算1层,5,6,7,8个box都算是2层。
( s& u0 h; t! {4 B此时可以用ceil函数向上取整,ceil(content(pallet)/4)即可得到正确的层数。
3 {% Z5 o0 e# S0 {" _

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

评分

参与人数 2威望 +24 收起 理由
lulu-luka + 9 谢谢分享~
慧娴亚伦 + 15

查看全部评分

2#
我很强壮 发表于 2017-6-1 08:41:09 | 只看该作者
这个真的很有用~谢谢加老师、
3#
lulu-luka 发表于 2017-6-2 12:01:02 | 只看该作者
Mark~谢谢加老师的分享
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|全球FlexSim系统仿真中文论坛 ( 京ICP备14043114号-2 )

GMT+8, 2025-9-6 05:56 , Processed in 0.067725 second(s), 18 queries .

Powered by Discuz! X3.3© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表