Setting up a reaction package #403
-
Hello! I am trying to set up a reaction package, but I'm having a few difficulties. I am utilizing the following page in the documentation as my reference: https://idaes-pse.readthedocs.io/en/stable/user_guide/components/property_package/general_reactions/generic_reactions.html I prefer to use the config dictionary at the moment, but it's not quite working, even if I copy paste things exactly from the documentation and assign random numbers to the parameters (ex: constant_dh_rxn = -21E3). Thus, even though the dictionary is correctly expressed and initialized, there seems to be a syntax error when I use: m.fs.reaction_properties = GenericReactionParameterBlock(default={ "property_package": m.fs.properties, config_dict }). The error relates to config_dict, and upon hovering over the red underlining of config_dict, I read: Dictionary entries must contain key/value pairs. Pylance. Could you please help me debug this issue? In addition, I am not exactly sure how to express values for the variables in config_dict. I understand what the heat of reaction (constant_dh_rxn) would require, as it is a simple number, but what about rate_form (power_law_rate) for instance? I have not found an example to give me a baseline reference to what they could be filled in with. The documentation for these parameters is not too clear when it comes to assigning the corresponding values. I did understand that I would need to define a function for these parameters, but I would like an example on how to set up a function that would be accepted by the solvers. Could I get some sort of example for such values/parameters or functions? Thank you in advance. I hope I was clear. Please let me know if you need more information! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
@dimi3saad I believe your problem is that you need to "unpack" the config dict (note the
From you questions about providing parameters for the config dict, I think you will need to be a bit more specific about what you are asking, as not all methods require parameters and there are different parameters for different forms. For power law type functions, there are no requires parameters, although there is a set of optional parameters. A power law form is:
For an elementary reaction, |
Beta Was this translation helpful? Give feedback.
-
@dimi3saad Glad to hear that you got your example working. |
Beta Was this translation helpful? Give feedback.
@dimi3saad I believe your problem is that you need to "unpack" the config dict (note the
**
):m.fs.reaction_properties = GenericReactionParameterBlock(default={ "property_package": m.fs.properties, **config_dict })
From you questions about providing parameters for the config dict, I think you will need to be a bit more specific about what you are asking, as not all methods require parameters and there are different parameters for different forms. For power law type functions, there are no requires parameters, although there is a set of optional parameters. A power law form is:
r = k*prod(x[i]**o[i] for i in component_list)
For an elementary reaction,
o
can be calculated from the reaction …