《南京邮电大学系统工程实验报告》由会员分享,可在线阅读,更多相关《南京邮电大学系统工程实验报告(17页珍藏版)》请在金锄头文库上搜索。
1、课内实验报告课程名:系统工程任课教师:专业:学号:姓名:一二至二0 三年度第1学期南京邮电大学经济与管理学院系统工程课程实验报告实验内容及基本要求:实验项目名称:实验类型:设计每组人数:1实验内容及要求:1)了解Netlogo编程语言的特点和基本语法。2)用系统动力学建模工具完成狼吃羊生态系统模型的仿真和仿真流程分析。实验过程与结果:一系统动力学建模第一步:羊群繁殖(1)在NetLogo里打开一个新模型,并启动系统动力学建模工具Uit-fc it led Ne-tLoeoFile Edi tT oolsZo om Tah s Helplitter facef OEdi t D el qLt.H
2、altob al w M oni t o上一Tuet tl & Mo+ crP :=L + C h M LITL1 t O fLink LIoni + crCl o m a All Age nt M citli + or kHi deC uiriFTi:ajTLil C ent erC + t l+Sl。三h3E Vi swCtrl+Shi ft+IColor Swatch.esTuartl a WhmpQs Edi t orLixik Shapes E di t orBeKavi cn-SpacjeCtrl+Stii Et+BSyst理 m DyTLami c e Mo del er Ctr
3、l+Stii Et+DHuLtKe t Cl i ent Edi t cit-Hu.bHe t Contr ol C enterCtrH-Slii ft+H(2)该模型中包括狼群和羊群,从羊群开始建模。首先创建一个存 量Stock,保存羊的数量。该存量命名为sheep,初始值设为 240,并选择羊群始终不能为负。(3)创建一个进入羊群存量的流量Flow,来表示伴随着羊的出生而 导致的数量的增加,命名为sheep-births,设置其表达式为 sheep-birth-rate * sheepsire tp(4)创建一个变量Variable作为羊的出生率,命名为sheep-birth-rate,设
4、置它的值是 0.04(7) NetLogo流图产生的代码O Syst e Dynasics lodelerEdit TabsDiagram Frocednres;System dynaniics model globals global s ;constantssheep-bi rth-rate;stock valuessheep;size of 已 auzh step, see SYSTEM-DYNAMICS-GOdt;Initi al izes the system dynami(ZE model.;Cal 1 this in your model s 5ETLIP procedure.t
5、o system-dynaniics-5etupreset-ti cksset dt 1.0;i niti al ize constant val uesset sheep-birth-rate 0.04;i rriti al ize stock va.1 uesset sheep 24Qend;Step through the system dynami ce model by perform! ng next iteration of Euler ;Cal 1 this in your model 1s GO procedure.to systein-dynarrii cs-go;comp
6、ute va.riabl e and fl ow val ues once per steplet local-sheep-li rths sheep-bi rths;update stock values;use temporary vari abl so order of computation tloesn t affect result.1et new-sheep mm( 1ist ( sheep + 1口匚al-sheep-births )set sheep new-sheep匚k-advan匚已 dtend;Report valje of flowto-raport sheep-b
7、irthsreport ( sheep-birth-rate * sheep)+ dtendNetLogo 集成)构建NetLogo模型来运行由流图产生的代码,构建system-dynamics-setup 和 system-dynamics-go 例程,代码如下:(4)创建sheep监视器(5)创建绘图populations,提供画笔sheep和wolves一系统仿真狼捕食羊(1)在原有基础上增加一个存量Stock,命名为wolves,设初值为 90ES-E3 创建相应的变量、流和连接,如图:(3)给各个变量、流和连接命名,设置初值表达式,分别为:(4)添加一条从wolves到sheep-d
8、eaths的连接,一条从wolves到wolves-deaths的连接,如图所示:运行程序(1)运行过程,如图所示:(2)运行结果,如图所示:3210JsKeepin|w olve siJsheep3030.&1五程序代码;System dynamics model globals globals ;constantssheep-birth-ratepredation-ratewolf-death-ratepredator-efficiency;stock valuessheepwolves;size of each step, see SYSTEM-DYNAMICS-GO dt;Initia
9、lizes the system dynamics model.;Call this in your models SETUP procedure.to system-dynamics-setupreset-ticksset dt 1.0;initialize constant valuesset sheep-birth-rate 0.04set predation-rate 3.0E-4set wolf-death-rate 0.15set predator-efficiency .8;initialize stock valuesset sheep 240set wolves 90end;
10、Step through the system dynamics model by performing next iteration of Euler,s method.;Call this in your models GO procedure.to system-dynamics-go;compute variable and flow values once per steplet local-sheep-births sheep-birthslet local-sheep-deaths sheep-deathslet local-wolf-births wolf-birthslet
11、local-wolf-deaths wolf-deaths;update stock values;use temporary variables so order of computation doesnt affect result.let new-sheep max( list 0 ( sheep + local-sheep-births - local-sheep-deaths ) let new-wolves ( wolves + local-wolf-births - local-wolf-deaths ) set sheep new-sheep set wolves new-wo
12、lvestick-advance dtend;Report value of flowto-report sheep-birthsreport ( sheep-birth-rate * sheep)* dtend;Report value of flowto-report sheep-deathsreport ( sheep * predation-rate * wolves)* dtend;Report value of flowto-report wolf-birthsreport ( wolves * predator-efficiency * predation-rate * shee
13、p)* dtend;Report value of flowto-report wolf-deathsreport ( wolves * wolf-death-rate)* dtend;Plot the current state of the system dynamics models stocks;Call this procedure in your models GO procedure.to system-dynamics-do-plotif plot-pen-exists? ”sheepset-current-plot-pen sheepplotxy ticks sheepif
14、plot-pen-exists? wolvesset-current-plot-pen wolvesplotxy ticks wolves六结果分析由运行结果我们可以看出随着羊的数量的增加,狼的数量也逐渐 增加,羊的数量增加的幅度远远大于狼数量的增加速度。当羊的数量 增加到一定峰值时,狼的数量仍然增加,当羊的数量从峰值开始下降, 直到下降到某一点时,狼的数量达到最大值,随后狼的数量随着羊的 数量的减少而减少,如此周而复始,呈现出一定的周期变化规律。假 设让羊有无限的草可以吃,让狼有无限的样可以吃,结果是它们两者 都会灭绝,而假设草被吃掉再生长,这样草、羊、狼构成一个模型整 体,这样羊和狼的数量会趋于相对的稳定,这样我们可以发现,越复 杂的系统越稳定。七心得与体会通过此次实验,我更好的理解了系统工程的思想和作用及其它的 用处。首先我学会如何安装NetLogo软件如何打开该系统,如何使用 NetLogo的各种工具方针操作并得出操作结果。其次,我学会如何按 照步骤