设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 5770|回复: 4

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

[复制链接]
发表于 2008-12-11 23:28:08 | 显示全部楼层 |阅读模式
5仿真币
我的license不支持experiment manager对象。。。
; C5 x+ c* G( W4 {0 l; ~, K, u3 _1 @+ I$ R- P0 J& a
所以请问使用代码可以实现吗?就比如像c++或者java里面,取当前时间作为种子,填入stream中?
  u" P3 n) N! }# e( p, W! [' h
& n' ^5 J, e. p7 j/ V如何写?用到哪些方法?和属性?
) A7 @! S1 w- b; P4 Q2 D
( ?% o& ^7 Z+ u/ a0 V+ `谢谢了

最佳答案

查看完整内容

用到这个.Stream := ; 如果你要设置singleProc的处理时间(proctime)的随机种子为当前的仿真时间,可以这样: singleProc.proctime.Stream :=time_to_num( root.eventController.simTim);
发表于 2008-12-11 23:28:09 | 显示全部楼层
用到这个<attribute_path>.Stream := <integer>;6 ?& {% W  t9 c) R
如果你要设置singleProc的处理时间(proctime)的随机种子为当前的仿真时间,可以这样:
. V- w; p! q4 f; j1 d  @$ GsingleProc.proctime.Stream :=time_to_num( root.eventController.simTim);
 楼主| 发表于 2008-12-12 14:02:55 | 显示全部楼层
对了,系统时间如何获得啊?
 楼主| 发表于 2008-12-14 15:56:21 | 显示全部楼层
time_to_num()这个函数不存在,只存在这些函数:7 T, h& k5 t/ X9 _: a6 k
Conversion Method  Data Type of the Return Value 2 e4 F6 ]( ]3 w6 A8 X
bool_to_num(<boolean>) real 4 a9 |  x* M1 ^7 e2 H# s1 W
num_to_bool(<integer>) boolean / l% N2 F1 D+ r5 y
str_to_bool(<string>) boolean 5 g$ f- U% b. w$ T" N
str_to_date(<string>) time 5 j3 e4 n* G( ~
str_to_datetime(<string>) datetime
) L9 o* y4 s9 Astr_to_length(<string>) length
/ Y2 r! A* I/ F! Dstr_to_num(<string>) real
0 \0 E7 Y0 a% [9 \, [* P+ M  y% Dstr_to_obj(<string>) object : X$ ^+ {  i( f; c& ]) l/ i; F0 c* Y
str_to_speed(<string>) speed 0 t: M) x4 Z5 G" q1 K/ X
str_to_time(<string>) time
" a8 ]$ ^, }2 q$ @( `" X0 dstr_to_weight(<string>) weight
% D2 I$ |. L; w/ F* m6 J" a$ V6 fto_str(<any>, ...) string
% c3 a4 I5 v/ w& D% W1 ]& ]2 v7 A我的是7.0版,不知道8.1有没有。
 楼主| 发表于 2008-12-14 16:17:52 | 显示全部楼层
我的解决办法:
% k; ^8 G" ?* V+ p" r6 l! ]singleProc.proctime.Stream :=str_to_num(to_str( timeOfDay(sysDate)*100000));
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-7-6 18:03 , Processed in 0.015258 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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