Laura 发表于 2009-4-23 12:47:34

Distribution of load creation

请教各位:
如果load 到达为伯努利过程,如何在AUTOMOD中产生loads呢?
谢谢!

zhdew 发表于 2009-4-23 12:47:35

原帖由 Laura 于 2009-4-27 23:25 发表 http://www.simulway.com/bbs/images/common/back.gif
谢谢shakie的耐心解释,我按照你的建议改了代码如下(并在window窗口定义了L_null);
begin model initialization function
create 1 load of load type L_nullto P_Creation2
create 1 load of load type L_null   ...

也许是模型有问题,也许是软件或者系统的某种bug。

尝试把模型导出到arc文件夹,删除.dir文件夹,再打开arc文件夹中的模型。这一招对某些类型的错误有特效。

zhdew 发表于 2009-4-23 19:10:49

什么叫“到达为伯努力过程”?是不是说,隔一段时间出现一个机会,产生或不产生load?
下面的代码不知道能否满足你的要求。

begin model initialization function
    create 1 load of L_null to P_creation
/*L_null is a load type of which the load create loads for the model.*/

    return true
end

begin P_creation arriving procedure
    while 1 = 1 begin
      wait for V_interval sec
/*V_interval is the interval of creation of loads, fixed or random.*/
      create 1 load of L_load to oneof(V_p : P_process, 1 - V_p : die)
/*V_p is the parameter of the distribution.*/
    end
end

begin P_process arriving procedure
/*Any process the load will be in.*/
    print "1 load created" to message
end

Laura 发表于 2009-4-26 12:26:45

非常感谢zhdew的解答
不过有些地方不太明白。
(1)L_null 和L_load 是什么关系呢?
(2)create语句出现了两次,会不会重复呢
我基本按照这个思路做了,可运行时却死掉了,不知怎么回事。
谢谢!

Laura 发表于 2009-4-27 02:55:04

create 的问题我清楚了。
因为我要产生3类load,所以代码是:
begin model initialization function
create 1 load of load type L_C2 to P_Creation2
create 1 load of load type L_C3 to P_Creation3
create 1 load of load type L_C4 to P_Creation4
return true
end

begin P_Creation2 arriving procedure
while 1=1 do
   begin
   wait for 1 sec
   create 1 load of load type L_C2 to oneof(0.2:P_In2,0.8:die)
   end
end

begin P_Creation3 arriving procedure
while 1=1 do
   begin
   wait for 1 sec
   create 1 load of load type L_C3 to oneof(0.2:P_In3,0.8:die)
   end
end   

begin P_Creation4 arriving procedure
while 1=1 do
   begin
   wait for 1 sec
   create 1 load of load type L_C2 to oneof(0.2:P_In4,0.8:die)
   end
end

可运行时说"ox100f5e09指令引用的“ox00000028"内存。 该内存不能为"read" , 就死掉了,不知怎么回事。谢谢!

Laura 发表于 2009-4-27 12:59:44

谢谢shakie的解释,还有点不明,需要定义L_null吗?不同的loadtype需要定义不同的L_null吗?定义成load type?
现在很惨,连模型都打不开了,提示:ox100f5e09指令引用的“ox00000028"内存。 该内存不能为"read"

Laura 发表于 2009-4-27 23:25:37

谢谢shakie的耐心解释,我按照你的建议改了代码如下(并在window窗口定义了L_null);
begin model initialization function
create 1 load of load type L_nullto P_Creation2
create 1 load of load type L_nullto P_Creation3
create 1 load of load type L_nullto P_Creation4
return true
end

begin P_Creation2 arriving procedure
while 1=1 do
   begin
   wait for 1 sec
   create 1 load of load type L_C2 to oneof(0.2:P_In2,0.8:die)
   end
end

begin P_Creation3 arriving procedure
while 1=1 do
   begin
   wait for 1 sec
   create 1 load of load type L_C3 to oneof(0.2:P_In3,0.8:die)
   end
end   

begin P_Creation4 arriving procedure
while 1=1 do
   begin
   wait for 1 sec
   create 1 load of load type L_C4 to oneof(0.2:P_In4,0.8:die)
   end
end

但运行时仍然出现相同的问题(提示:ox100f5e09指令引用的“ox00000028"内存。 该内存不能为"read"),无法运行。不知问题出现在哪里,请高手指点,多谢!

Laura 发表于 2009-4-30 10:24:45

谢谢shakie的回复。
如果在窗口产生load,程序运行就没问题。可在源文件里产生,就出现这个情况。而且模型无法再次打开。
另外,请问在哪里可以上传文件啊?没看到相关按钮。不好意思

Laura 发表于 2009-4-30 11:10:59

也许是模型有问题,也许是软件或者系统的某种bug。
尝试把模型导出到arc文件夹,删除.dir文件夹,再打开arc文件夹中的模型。这一招对某些类型的错误有特效。
====================
我试过了,终于成功了!!!!!!!!!
这个方法的确有特效!!!!!!!超级感谢zhdew!!!!!!!!也超级感谢shakie!!!!!!!!!!!!!!!!!!
请版主给两位仿真币!!!!!!!!!!
再次抱拳感谢!!!!!!!!!!!!!!!
页: [1]
查看完整版本: Distribution of load creation