开发者

NetLogo- how to put balanced chemical equations into a model?

I was wondering if it was possible to put balanced chemical equations into a model - and if so, how to include state symbols in an existing NetLogo model. I have not seen any examples in the models library so was not sure if it was possible.

I wanted the model to be able to allow the user to input a balanced chemical equilibrium equation or the model provides such equations so that users can select from them if they do not want to enter their own.

Any help will be greatly appreciated, thank you.

For example:

开发者_C百科

ethane + oxygen --> carbon dioxide + steam

C2H6 + O2 --> CO2 + H2O


I know this is an old question, but it impinges on some work I've been doing lately.

You don't say what you need to do with the balanced equations once they are input. So, that makes it harder to answer your question.

In general, with NetLogo you can:

  • ask your user for input, in the form of a text string, using USER-INPUT
  • create a parser to parse the input
  • work with the results of that parsed input
  • put a chooser in the interface that presents the user with preset inputs that the parser will understand

It will be up to you to create that parser.

For example, you may split the input string into pieces (perhaps first splitting on the -> to get the input and output sides of the equation), then further parse the pieces.


Last that I checked NetLogo really can't handle symbolic manipulations, let alone the manipulations involved. If you really want to see this in Netlogo you would have to implement it by hand.


If there is a limited number of equations the user can enter, you could just use a drop-down list (drop-down button) that includes all the equations. Your code could then just set different parameters based on the equation the user entered on the drop-down.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜