电离平衡
Model was written in NetLogo 6.4.0
•
Viewed 68 times
•
Downloaded 2 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
; Li Ying created this module at Shaanxi Normal University in 2024. If you mention this model in a publication, we ask that you include the citations below. ;Ying, L. (2024). Ionization Equilibrium. School of Chemistry and Chemical Engineering, Shaanxi Normal University. breed [mode5_h2o_t mode5_h2o] breed [mode5_h_t mode5_h] breed [mode5_oh_t mode5_oh] breed [mode5_na_t mode5_na] breed [mode5_cl_t mode5_cl] breed [mode5_nh4_t mode5_nh4] breed [mode5_nh3h2o_t mode5_nh3h2o] breed [mode5_ac_t mode5_ac] breed [mode5_hac_t mode5_hac] breed [mode5_nacl_t mode5_nacl] breed [mode5_naac_t mode5_naac] breed [mode5_nh4cl_t mode5_nh4cl] breed [mode5_nh4ac_t mode5_nh4ac] globals[ Init_flag Up_T_flag add_CH3COOH_flag add_hcl_flag add_NaOH_flag add_CH3COONa_flag add_nh3_flag add_NH4Cl_flag add_water_flag h_count oh_count ac_count hac_count nh3h2o_count nh4_count plot1 plot2 plot3 plot4 plot5 plot6 Up_T_figure_flag add_CH3COOH_figure_flag add_hcl_figure_flag add_NaOH_figure_flag add_CH3COONa_figure_flag add_nh3_figure_flag add_NH4Cl_figure_flag add_water_figure_flag ] to setup clear-all ;设置画布颜色白色 ask patches [ set pcolor white ] ;;初始化海龟 set-default-shape mode5_ac_t "ac" set-default-shape mode5_h_t "h" set-default-shape mode5_oh_t "oh" set-default-shape mode5_hac_t "hac" set-default-shape mode5_naac_t "naac" set-default-shape mode5_na_t "na" set-default-shape mode5_nh3h2o_t "nh3h20" set-default-shape mode5_nh4_t "nh4" set-default-shape mode5_nh4cl_t "nh4cl" set-default-shape mode5_cl_t "cl" if (Compound = "CH3COOH")[ create-mode5_hac_t (20) [ setxy random-xcor random-ycor set size 3 ] ] if (Compound = "NH3.H2O")[ create-mode5_nh3h2o_t (20) [ setxy random-xcor random-ycor set size 3 ] ] set Init_flag 0 set Up_T_flag 0 set add_CH3COOH_flag 0 set add_hcl_flag 0 set add_NaOH_flag 0 set add_CH3COONa_flag 0 set add_nh3_flag 0 set add_NH4Cl_flag 0 set add_water_flag 0 reset-ticks end to go if ticks mod 300 = 0 [ Hydrolytic_separation ask turtles [ fd 1 ;; move turtles around randomly rt random 360 lt random 360 ] if (Compound = "CH3COOH")[ set h_count count mode5_h_t set ac_count count mode5_ac_t set hac_count count mode5_hac_t set oh_count count mode5_oh_t ] if (Compound = "NH3.H2O")[ set nh3h2o_count count mode5_nh3h2o_t set nh4_count count mode5_nh4_t set h_count count mode5_h_t set oh_count count mode5_oh_t ] ] tick end ;;解离 to Hydrolytic_separation if (Compound = "CH3COOH")[ if Init_flag = 0[ let temp_number count mode5_hac_t if temp_number > 15[ if ticks mod 3000 = 0 [ let mode5_hac_t_molecule one-of turtles with [breed = mode5_hac_t] ;;将一个hac分子变成h + ac ask mode5_hac_t_molecule [ set breed mode5_h_t set size 2 ];;创建一个oh create-mode5_ac_t (1) [ setxy random-xcor random-ycor set size 3 ] ] ] if temp_number = 15[ set Init_flag 1 ] ] ] if (Compound = "NH3.H2O") [ if Init_flag = 0[ let temp_number count mode5_nh3h2o_t if temp_number > 15[ if ticks mod 3000 = 0 [ let mode5_nh3h2o_t_molecule one-of turtles with [breed = mode5_nh3h2o_t] ;;将一个hac分子变成h + ac ask mode5_nh3h2o_t_molecule [ set breed mode5_nh4_t set size 3 ];;创建一个oh create-mode5_oh_t (1) [ setxy random-xcor random-ycor set size 3 ] ] ] if temp_number = 15[ set Init_flag 1 ] ] ] end ;;加入按键 to add end ;;升温按键 to Up_T set Up_T_figure_flag 1 if (Compound = "CH3COOH")[ if Up_T_flag = 0[ if ticks mod 3000 = 0 [ let x 0 let y 0 if (count mode5_hac_t > 10)[ let turtle_mode5_hac_t n-of 1 mode5_hac_t ask turtle_mode5_hac_t [ set x xcor set y ycor set breed mode5_h_t set size 2 ] create-mode5_ac_t 1 [ setxy x y set size 3 ] ] if (count mode5_hac_t = 10)[ set Up_T_flag 1 ] ] ] ] if (Compound = "NH3.H2O")[ if Up_T_flag = 0[ if ticks mod 3000 = 0 [ let x 0 let y 0 if (count mode5_nh3h2o_t > 10)[ let turtle_mode5_nh3h2o_t n-of 1 mode5_nh3h2o_t ask turtle_mode5_nh3h2o_t [ set x xcor set y ycor set breed mode5_oh_t set size 3 ] create-mode5_nh4_t 1 [ setxy x y set size 3 ] ] if (count mode5_nh3h2o_t = 10)[ set Up_T_flag 1 ] ] ] ] end ;;加CH3COOH按键 to add_CH3COOH set add_CH3COOH_figure_flag 1 if (Compound = "CH3COOH")[ if ticks mod 3000 = 0 [ if add_CH3COOH_flag = 1[ let turtle_xys [] ; 创建一个空列表来存储坐标对 let turtle_mode5_hac_t n-of 2 mode5_hac_t ask turtle_mode5_hac_t [ let xys list xcor ycor ; 创建一个包含当前乌龟坐标对的列表 set turtle_xys lput xys turtle_xys ; 将当前乌龟的坐标对添加到列表中 set breed mode5_h_t set size 2 ] foreach turtle_xys [ xy -> create-mode5_ac_t 1 [ setxy (item 0 xy) (item 1 xy) ; 根据坐标对生成乌龟 set size 3 ; 可根据需要设置乌龟颜色 ] ] set add_CH3COOH_flag 2 ] if add_CH3COOH_flag = 0[ create-mode5_hac_t 10 [ setxy random-xcor random-ycor set size 3 ] set add_CH3COOH_flag 1 ] ] ] end ;;加水按键 to add_water set add_water_figure_flag 1 if (Compound = "CH3COOH")[ if add_water_flag = 0[ if ticks mod 3000 = 0 [ let x 0 let y 0 if (count mode5_hac_t > 8)[ let turtle_mode5_hac_t n-of 1 mode5_hac_t ask turtle_mode5_hac_t [ set x xcor set y ycor set breed mode5_h_t set size 2 ] create-mode5_ac_t 1 [ setxy x y set size 3 ] ] if (count mode5_hac_t = 8)[ set add_water_flag 1 ] ] ] ] if (Compound = "NH3.H2O")[ if add_water_flag = 0[ if ticks mod 3000 = 0 [ let x 0 let y 0 if (count mode5_nh3h2o_t > 8)[ let turtle_mode5_nh3h2o_t n-of 1 mode5_nh3h2o_t ask turtle_mode5_nh3h2o_t [ set x xcor set y ycor set breed mode5_oh_t set size 3 ] create-mode5_nh4_t 1 [ setxy x y set size 3 ] ] if (count mode5_nh3h2o_t = 8)[ set add_water_flag 1 ] ] ] ] end ;;加CH3COONa按键 to add_CH3COONa set add_CH3COONa_figure_flag 1 if (Compound = "CH3COOH")[ if ticks mod 3000 = 0 [ if add_CH3COONa_flag = 2[ ask mode5_ac_t [ let meeting-mode5_h_t mode5_h_t in-radius 10 if count meeting-mode5_h_t > 0 [ ; 在半径2的范围内相遇时,创建新的turtle let turtles-here-mode5_ac_t turtles with [breed = mode5_ac_t] let turtles-here-mode5_h_t turtles with [breed = mode5_h_t] let turtle_mode5_ac_t one-of turtles-here-mode5_ac_t in-radius 2 let turtle_mode5_h_t one-of turtles-here-mode5_h_t in-radius 2 if turtle_mode5_ac_t != nobody and turtle_mode5_h_t != nobody [ if count mode5_ac_t > 6[ ask turtle_mode5_ac_t [ set breed mode5_hac_t set size 3 ] ; 删除原来的mode4_h_t turtle ask turtle_mode5_h_t [ die ] ] if count mode5_ac_t = 6[ set add_CH3COONa_flag 3 ] ] ] ] ] if add_CH3COONa_flag = 1[ let turtle_xys [] ; 创建一个空列表来存储坐标对 let turtle_mode5_naac_t n-of 5 mode5_naac_t ask turtle_mode5_naac_t [ let xys list xcor ycor ; 创建一个包含当前乌龟坐标对的列表 set turtle_xys lput xys turtle_xys ; 将当前乌龟的坐标对添加到列表中 set breed mode5_ac_t set size 3 ] foreach turtle_xys [ xy -> create-mode5_na_t 1 [ setxy (item 0 xy) (item 1 xy) ; 根据坐标对生成乌龟 set size 3 ; 可根据需要设置乌龟颜色 ] ] set add_CH3COONa_flag 2 ] if add_CH3COONa_flag = 0 [ create-mode5_naac_t 5 [ setxy random-xcor random-ycor set size 3 ] set add_CH3COONa_flag 1 ] ] ] end ;;通HCL to add_hcl set add_hcl_figure_flag 1 if (Compound = "CH3COOH")[ if ticks mod 3000 = 0 [ if add_hcl_flag = 1[ ask mode5_ac_t [ let meeting-mode5_h_t mode5_h_t in-radius 10 if count meeting-mode5_h_t > 0 [ ; 在半径2的范围内相遇时,创建新的turtle let turtles-here-mode5_ac_t turtles with [breed = mode5_ac_t] let turtles-here-mode5_h_t turtles with [breed = mode5_h_t] let turtle_mode5_ac_t one-of turtles-here-mode5_ac_t in-radius 2 let turtle_mode5_h_t one-of turtles-here-mode5_h_t in-radius 2 if turtle_mode5_ac_t != nobody and turtle_mode5_h_t != nobody [ if count mode5_ac_t > 2[ ask turtle_mode5_ac_t [ set breed mode5_hac_t set size 3 ] ; 删除原来的mode4_h_t turtle ask turtle_mode5_h_t [ die ] ] if count mode5_ac_t = 2[ set add_hcl_flag 2 ] ] ] ] ] if add_hcl_flag = 0 [ create-mode5_h_t 5 [ setxy random-xcor random-ycor set size 2 ] set add_hcl_flag 1 ] ] ] if (Compound = "NH3.H2O")[ if ticks mod 3000 = 0 [ if add_hcl_flag = 2 [ let turtle_xys [] ; 创建一个空列表来存储坐标对 let turtle_mode5_nh3h2o_t n-of 8 mode5_nh3h2o_t ask turtle_mode5_nh3h2o_t [ let xys list xcor ycor ; 创建一个包含当前乌龟坐标对的列表 set turtle_xys lput xys turtle_xys ; 将当前乌龟的坐标对添加到列表中 set breed mode5_oh_t set size 3 ] foreach turtle_xys [ xy -> create-mode5_nh4_t 1 [ setxy (item 0 xy) (item 1 xy) ; 根据坐标对生成乌龟 set size 3 ; 可根据需要设置乌龟颜色 ] ] set add_hcl_flag 3 ] if add_hcl_flag = 1[ let turtle_mode5_oh_t n-of 5 mode5_oh_t let turtle_mode5_h_t n-of 5 mode5_h_t ask turtle_mode5_oh_t [ die ] ask turtle_mode5_h_t [ die ] set add_hcl_flag 2 ] if add_hcl_flag = 0 [ create-mode5_h_t 5 [ setxy random-xcor random-ycor set size 2 ] set add_hcl_flag 1 ] ] ] end ;;通NH3 to add_nh3 set add_nh3_figure_flag 1 if (Compound = "NH3.H2O")[ if ticks mod 3000 = 0 [ if add_nh3_flag = 1[ let turtle_xys [] ; 创建一个空列表来存储坐标对 let turtle_mode5_nh3h2o_t n-of 2 mode5_nh3h2o_t ask turtle_mode5_nh3h2o_t [ let xys list xcor ycor ; 创建一个包含当前乌龟坐标对的列表 set turtle_xys lput xys turtle_xys ; 将当前乌龟的坐标对添加到列表中 set breed mode5_oh_t set size 3 ] foreach turtle_xys [ xy -> create-mode5_nh4_t 1 [ setxy (item 0 xy) (item 1 xy) ; 根据坐标对生成乌龟 set size 3 ; 可根据需要设置乌龟颜色 ] ] set add_nh3_flag 2 ] if add_nh3_flag = 0[ create-mode5_nh3h2o_t 10 [ setxy random-xcor random-ycor set size 3 ] set add_nh3_flag 1 ] ] ] end ;;加NaOH to add_NaOH set add_NaOH_figure_flag 1 if (Compound = "CH3COOH")[ if ticks mod 3000 = 0 [ if add_NaOH_flag = 2 [ let turtle_xys [] ; 创建一个空列表来存储坐标对 let turtle_mode5_hac_t n-of 8 mode5_hac_t ask turtle_mode5_hac_t [ let xys list xcor ycor ; 创建一个包含当前乌龟坐标对的列表 set turtle_xys lput xys turtle_xys ; 将当前乌龟的坐标对添加到列表中 set breed mode5_h_t set size 2 ] foreach turtle_xys [ xy -> create-mode5_ac_t 1 [ setxy (item 0 xy) (item 1 xy) ; 根据坐标对生成乌龟 set size 3 ; 可根据需要设置乌龟颜色 ] ] set add_NaOH_flag 3 ] if add_NaOH_flag = 1[ let turtle_mode5_oh_t n-of 5 mode5_oh_t let turtle_mode5_h_t n-of 5 mode5_h_t ask turtle_mode5_oh_t [ die ] ask turtle_mode5_h_t [ die ] set add_NaOH_flag 2 ] if add_NaOH_flag = 0 [ create-mode5_oh_t 5 [ setxy random-xcor random-ycor set size 3 ] set add_NaOH_flag 1 stop ] ] ] if (Compound = "NH3.H2O")[ if ticks mod 3000 = 0 [ if add_NaOH_flag = 1[ ask mode5_nh4_t [ let meeting-mode5_oh_t mode5_oh_t in-radius 10 if count meeting-mode5_oh_t > 0 [ ; 在半径2的范围内相遇时,创建新的turtle let turtles-here-mode5_nh4_t turtles with [breed = mode5_nh4_t] let turtles-here-mode5_oh_t turtles with [breed = mode5_oh_t] let turtle_mode5_nh4_t one-of turtles-here-mode5_nh4_t in-radius 2 let turtle_mode5_oh_t one-of turtles-here-mode5_oh_t in-radius 2 if turtle_mode5_nh4_t != nobody and turtle_mode5_oh_t != nobody [ if count mode5_nh4_t > 2[ ask turtle_mode5_nh4_t [ set breed mode5_nh3h2o_t set size 3 ] ; 删除原来的mode4_h_t turtle ask turtle_mode5_oh_t [ die ] ] if count mode5_nh4_t = 2[ set add_NaOH_flag 2 ] ] ] ] ] if add_NaOH_flag = 0 [ create-mode5_oh_t 5 [ setxy random-xcor random-ycor set size 3 ] set add_NaOH_flag 1 ] ] ] end ;;加NH4Cl to add_NH4Cl set add_NH4Cl_figure_flag 1 if (Compound = "NH3.H2O")[ if ticks mod 3000 = 0 [ if add_NH4Cl_flag = 2[ ask mode5_nh4_t [ let meeting-mode5_oh_t mode5_oh_t in-radius 10 if count meeting-mode5_oh_t > 0 [ ; 在半径2的范围内相遇时,创建新的turtle let turtles-here-mode5_nh4_t turtles with [breed = mode5_nh4_t] let turtles-here-mode5_oh_t turtles with [breed = mode5_oh_t] let turtle_mode5_nh4_t one-of turtles-here-mode5_nh4_t in-radius 2 let turtle_mode5_oh_t one-of turtles-here-mode5_oh_t in-radius 2 if turtle_mode5_nh4_t != nobody and turtle_mode5_oh_t != nobody [ if count mode5_nh4_t > 6[ ask turtle_mode5_nh4_t [ set breed mode5_nh3h2o_t set size 3 ] ; 删除原来的mode4_h_t turtle ask turtle_mode5_oh_t [ die ] ] if count mode5_nh4_t = 6[ set add_NH4Cl_flag 3 ] ] ] ] ] if add_NH4Cl_flag = 1[ let turtle_xys [] ; 创建一个空列表来存储坐标对 let turtle_mode5_nh4cl_t n-of 5 mode5_nh4cl_t ask turtle_mode5_nh4cl_t [ let xys list xcor ycor ; 创建一个包含当前乌龟坐标对的列表 set turtle_xys lput xys turtle_xys ; 将当前乌龟的坐标对添加到列表中 set breed mode5_nh4_t set size 3 ] foreach turtle_xys [ xy -> create-mode5_cl_t 1 [ setxy (item 0 xy) (item 1 xy) ; 根据坐标对生成乌龟 set size 3 ; 可根据需要设置乌龟颜色 ] ] set add_NH4Cl_flag 2 ] if add_NH4Cl_flag = 0 [ create-mode5_nh4cl_t 5 [ setxy random-xcor random-ycor set size 3 ] set add_NH4Cl_flag 1 ] ] ] end
There is only one version of this model, created 6 months ago by Ying Li.
This model does not have any ancestors.
This model does not have any descendants.