设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7074|回复: 4

[求助] 请问如何使用代码实现随机数种子的设置?

[复制链接]
发表于 2008-12-11 23:28:08 | 显示全部楼层 |阅读模式
5仿真币
我的license不支持experiment manager对象。。。- ], }9 J7 G, \( R: I8 R

9 D) s1 _3 ?) N. E& o9 ]1 T/ ]2 A所以请问使用代码可以实现吗?就比如像c++或者java里面,取当前时间作为种子,填入stream中?
- p$ B' d$ F+ d+ r% d) q! h5 e- e" X% _8 b. G
如何写?用到哪些方法?和属性?" \! i+ n1 y9 T  G! N6 w0 U

+ U  _* ~) T4 ^谢谢了

最佳答案

查看完整内容

用到这个.Stream := ; 如果你要设置singleProc的处理时间(proctime)的随机种子为当前的仿真时间,可以这样: singleProc.proctime.Stream :=time_to_num( root.eventController.simTim);
发表于 2008-12-11 23:28:09 | 显示全部楼层
用到这个<attribute_path>.Stream := <integer>;. G2 k. f* R8 H3 x
如果你要设置singleProc的处理时间(proctime)的随机种子为当前的仿真时间,可以这样:/ n/ h- q$ p! e
singleProc.proctime.Stream :=time_to_num( root.eventController.simTim);
 楼主| 发表于 2008-12-12 14:02:55 | 显示全部楼层
对了,系统时间如何获得啊?
 楼主| 发表于 2008-12-14 15:56:21 | 显示全部楼层
time_to_num()这个函数不存在,只存在这些函数:  t9 Y2 z/ H  m# F, {$ _
Conversion Method  Data Type of the Return Value
& a- X, E& G0 [, H1 u  Z! l5 I* Xbool_to_num(<boolean>) real ; @5 c6 G" P5 d* ?7 y) i; v, Q4 m
num_to_bool(<integer>) boolean ) h- l8 K# h5 N% ]
str_to_bool(<string>) boolean
* ?7 P$ O! P1 j8 m$ H$ j( sstr_to_date(<string>) time
  M3 E/ Z; M  m+ b2 Cstr_to_datetime(<string>) datetime : W7 R: C- f( N0 I8 u1 m; v3 ]/ g/ U
str_to_length(<string>) length - l  Q2 Y7 ]. y9 l% T6 G
str_to_num(<string>) real % m6 g' f, j, X2 @- ~& y# z/ V
str_to_obj(<string>) object
7 E. z6 @2 Y. i, Kstr_to_speed(<string>) speed
, L: k$ h$ p( @5 B1 v1 F# rstr_to_time(<string>) time
6 O$ E- B6 T* G2 Estr_to_weight(<string>) weight $ d. d: `8 p$ X1 ^7 n. N
to_str(<any>, ...) string
+ {+ |7 p. n( f8 W4 H# D/ Y# a; ^我的是7.0版,不知道8.1有没有。
 楼主| 发表于 2008-12-14 16:17:52 | 显示全部楼层
我的解决办法:% }6 C- L, L9 K$ j) O2 b
singleProc.proctime.Stream :=str_to_num(to_str( timeOfDay(sysDate)*100000));
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-3-12 01:07 , Processed in 0.016061 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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