cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Automatic generation of a stoichiometric matrix

HarveyHensley
12-Amethyst

Automatic generation of a stoichiometric matrix

The Problem

Has this happened to you?

 

You are involved in the development of a new process.  At this early stage in the development, the catalyst developer has some indication of success, but there has been no kinetic study conducted.  Thus, the reaction network is only partly known, if that.  Because the development team is following the Scale Down development method (see earlier blog article), you have been assigned the task of creating conceptual process alternatives using a commercial process simulation program.  This early process study may reveal information that may help the catalyst developer "tweak" the catalyst toward the more economical set of selectivities.  Also, getting an early start on the entire process design will help prepare for more focused optimization later in the development.

 

For the reactor model in the process simulation, you will be using the stoichiometric reactor option.  You have been given the list of reactants and known products and byproducts.  You now need a simple set of reactions that use all of the reactants and produce all of the products.  With a set of balanced reactions, you will provide individual conversions in a sensitivity study.

 

The Solution

The attached worksheet produces a simple stoichiometric matrix based on the molecular formulas and ionic charges of the reactants and products.  This worksheet is based on an algorithm by R. W. Missen and W. R. Smith (see reference in worksheet).  The resulting set of reactions satisfy all elemental and charge balances.

 

The stoichiometric matrix assumes that rows in the matrix represent reactions and columns represent components.  In addition the Atom matrix has rows as components, columns as elements.  Missen and Smith and others use the opposite conventions: the worksheet has been developed to account for those differences in convention.  Choice of convention is just a matter of preference.  I prefer the "rows as reactions" convention because reactions are always written as horizontal lines, one reaction below another.

 

The matrix "stoich" produces may show reactions going the wrong direction for your application.  Just multiply the entire matrix by -1 and it should useful.

 

The Fine Print

Use "stoich" at your own risk.  In particular, the stoichiometric matrix it produces most likely doesn't represent a kinetic mechanism.  One tipoff of a non mechanistic reaction is more than three molecules reactiing.  As the process development progresses, you will need to use a kinetic model based on a more representative reaction mechanism.

 

The worksheet was written using the template for the "International J. of Chemical Reactor Engineering".  I probably haven't paid attention to the paragraph requirements of the journal, but the fonts specifications were met.

 

A Workaround for M010 and Prime Users

I've attached a second file, stoich_mod.xmcd that has a workaround for the later versions.  It uses a symbolic solution (all numbers?) for stoich which is correct.  They have determined that the numerical result is incorrect.  I have also removed the "key" parameter from the progam and the worksheet.

16 REPLIES 16

I had this error ("This array index is invalid for this array.") when opening the file in Mathcad 15 M010:

Pic_1.PNG

Vladimir,

I downloaded it and opened it in Mathcad 15 M005 with no problem.  I made sure it was opening the downloaded file and not my original.

I notice the snippet shows the key=7 in an unusual place.  My download has it below the program, yours has it to the left.  Could there be something else that is out of order?

The "key" variable is no longer needed: it was left from a previous version.  See my other comment to the post.

I suggest you submit the worksheet to the support group and see if they can test in M010.  I would do it but if they "fix it", then I can't test it whereas you can.

Thanks for bringing this to my attention.  Please let the us know if you get a fix.

Harvey

To All,

The "key" argument in the program is no longer needed.  You may remove it from the program arguments, both in the program definition and in the call to stoich.

There appears to be a problem with M010 version opening this file.  Anyone else having problems?

Harvey

Harvey,

I downloaded the file on the link specified above. Opening the file I did not change it, but just scrolled through the document until the end. I will check also this file on Monday on my working computer.

Vladimir,

Check to make sure ORIGIN = 0.  I get the error you experienced if ORIGIN = 1.  If that is the cause, I don't know how it gets changed when you open it.

Harvey

ORIGIN = 0 in the document and in document settings "Worksheet Options":

Pic_2.PNG

Harvey Hensley wrote:

                       

...The "key" variable is no longer needed: it was left from a previous version...

                   

In that case, why do not you attach to the topic the latest version of the file?

Using the "Trace Error" leads immediately to a variable "col":

Pic_3.PNG

Good morning Mr. Hensley,

I was looking at your model but I had the same problem that Mr. Vladimir, so, I try to figure out what your program do. I had a question about the way to find the linearly independent columns in the reduced matrix because the erl funtion doesn't returns only 1 and 0 all the times.

Regards,

Oscar J:

Oscar, hello!

What version of Mathcad are you using (include a service release)? Also, I noticed that this error occurs in Mathcad Prime 1.0 (after converting the original file in to new Prime format ".mcdx"). I tested this file in Mathcad 15 M010 and Mathcad Prime 1.0 and in both versions there is a same error.

Just tested the file in version Mathcad 11a, everything works fine:

MC_11a.PNG

It appears that the errors that some people are having may be due to version.  I see that PTC made a change to rref function for version M010, so it may have caused the problem.

I am going to log this as a case with the support group.

The support group has determined that the rref function is getting different answers in version M005 and M010 (and Prime).  That is the source of the problem.  When I hear more, I will post an update.  Until then, this program will not work with anything later than MC 15, M005.

Harvey,

Thanks.

I've posted another worksheet in the original document above, stoich_mod.xmcd.  It is the workaround that the support team has provided.  They will have to correct rref in a later release.

draagekreik
5-Regular Member
(To:HarveyHensley)

Did they correct it?  Does it work for symbolic calculation of rref for a complex matrix?

Announcements

Top Tags