设为首页收藏本站

最大的系统仿真与系统优化公益交流社区

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 23045|回复: 4

Arena周报的一个小技巧Boolean Expression推荐给大家

  [复制链接]
发表于 2016-6-30 17:17:22 | 显示全部楼层 |阅读模式
Boolean Expressions
Melanie Barker's avatar
By Melanie Barker, Arena Simulation Consultant

In this issue of Tips and Tricks we’re going to go over Boolean expressions. Boolean expressions are logical statements, such as 2 + 2 == 4, which can be evaluated as either true or false. Within the statements, AND (&&) and OR (||) can be used to build more complex expressions. With the statements built, a truth table like the one below can be developed to understand the potential results of the expressions.



When Arena evaluates a Boolean expression, it assigns a value of 0 to false statements and 1 to true statements. Boolean expressions can become useful in Arena when they use variables or attributes. For example, if a part of type 2 needs a longer delay than other part types, this can be done by adding a Boolean expression to evaluate if the part is type 2 and then multiplying the additional delay by the result of that statement.



Boolean expressions can also use other system variables, like TNOW. If a production line will make better parts as the simulation progresses, the inspection pass rate can be based on the system time. As the time increases, the pass rate increases.



One final note – if you will be using Boolean expressions to evaluate TNOW or other time-based statements, consider using a function like HoursToBaseTime() to convert the value to the base time units even if the base time units are already in hours. This will protect your statement if the base time units are changed later.


原帖:
utm_campaign=Newsletter&utm_source=hs_email&utm_medium=email&utm_content=25762347&_hsenc=p2ANqtz-_frEKsQ7Cyw_38O2jzVNbmOGFrZFCIHXOBFJ3DxI5E-yWxVvVZ54wTyJTd9aMMwi7G9OljPm4QwI2HAmkiuWbMkBIuIA&_hsmi=25762347[/url]

评分

参与人数 1仿真币 +20 收起 理由
苘苘 + 20 赞一个!

查看全部评分

发表于 2016-6-30 23:11:20 | 显示全部楼层
本帖最后由 asax 于 2016-6-30 23:16 编辑

感谢分享,这是一个非常实用的小技巧,灵活运用后可以大量减少不必要 Decide 模块,令可读性更强。

另外,提醒一下,条件判定后一定需要加运算符,否则之后的表达式将简单变成0或1。比如 6 +(1==2)4 只会返回6,6 +(1==2)4 只会返回7.
发表于 2016-7-8 09:34:36 | 显示全部楼层
感谢分享
发表于 2016-8-31 16:11:22 | 显示全部楼层
谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|SimulWay 道于仿真   

GMT+8, 2024-3-28 19:10 , Processed in 0.016329 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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