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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Equation not referencing all values in vector

ptc-5294376
1-Newbie

Equation not referencing all values in vector

I'm not that great a Mathcad and I apologize if some of my terminology is wrong but I'm having a problem. I'm trying to ultimately determine outlet temperatures in a set of parallel counterflow heat exchangers. At one point I have the worksheet solve for the minimum number of exchangers in parallel needed to satisfy a maximum pressure drop given a range of possible lengths. Everything seems to work fine but I noticed my temperatures were way off so looking back through the worksheet and starting the UA calculations, all the values are wrong. It appears as though the values aren't being pulled in the same order from all the vectors. If I reference the first value in each of the relevant vectors, I get the correct answer, but if I let Matchcad just run through and give the 10 answers, they are all wrong. It's as if its pulling random values. I've attached the worksheet for reference. Thanks for any help.

1 ACCEPTED SOLUTION

Accepted Solutions

By solving the equation by hand i get around 1.3*10^5. If I change the equation to reference the 1st value of all the relevant variables, I get an answer of 1.285*10^4 which is what I expected. So it

I hope your manual calc gave you 10^4, not 10^5 !?

OK, as I expected - vectorization is needed.

h.ann and A.o are both vectors. In the formula for UA they are multiplied. Mathcad evaluates using the dot product (vector scalar product) but we need Mathcad to wade through the vectors element by element and the results being collected in a vector. This is what vectorization is intended for. You get this operator from the matrix palette or by typing Ctrl and the minus sign/hyphen. You may apply it on spec to all the calculation which utilize vectors.

I also attached two more simple ways to calculate the vector n.ex

UA1.png

UA2.png

View solution in original post

12 REPLIES 12

Can you elaborate on which values are wrong and what values you expected.

You think the values n.1 ... are already wrong?

Maybe there is some vectorization necessary in parts of your calculation if they deal with vectors.

One example is with the UA calculations (total heat transfer resistance). Mathcad shows the 1st calculated value to be 2.237*10^5 .

By solving the equation by hand i get around 1.3*10^5. If I change the equation to reference the 1st value of all the relevant variables, I get an answer of 1.285*10^4 which is what I expected. So it seems like the wrong values are being used somehow.

UA+calc.png

Can you send the Mathcad sheet?

May be it will be useful for you:

http://twt.mpei.ac.ru/MCS/Worksheets/Thermal/T-T-2-Chapter-3-3-3-1.xmcd

Valery Ochkov wrote:

Can you send the Mathcad sheet?

It was attached in the first post.

By solving the equation by hand i get around 1.3*10^5. If I change the equation to reference the 1st value of all the relevant variables, I get an answer of 1.285*10^4 which is what I expected. So it

I hope your manual calc gave you 10^4, not 10^5 !?

OK, as I expected - vectorization is needed.

h.ann and A.o are both vectors. In the formula for UA they are multiplied. Mathcad evaluates using the dot product (vector scalar product) but we need Mathcad to wade through the vectors element by element and the results being collected in a vector. This is what vectorization is intended for. You get this operator from the matrix palette or by typing Ctrl and the minus sign/hyphen. You may apply it on spec to all the calculation which utilize vectors.

I also attached two more simple ways to calculate the vector n.ex

UA1.png

UA2.png

Thank you so much! Thats's exactly what I needed to do. It's little things like that which cause me to want to throw the computer out the window sometimes lol. I appreciate the help

You are welcome.

There are some subjects which often are the reason for confusion when working with Mathcad: range variables vs. vectors, vectorization & vector index vs literal index.

Just noticed that in the file (and the screenshot) you would have to move the solveblock upwards abit or the eval of nex2 downwards to see the correct results and not the guess values.

After a little more work I have another question that I hope you might know the answer to. Now that I have new temperature values, I need to evaluate fluid properties based on them. Is there a way to have an if-then statement if the constraint is referencing a vector? I keep getting an error stating that the "This value must be a scalar" . I'm attaching my updated worksheet. The error occurs at the very end. Thanks.

Find attached two different ways to achieve what you want - the first using a function which then is used vectorized and the second makes use of a range variable.

You are awesome.Can I buy you a beer? lol

Thanks again

What a pity - the virtual beers do not taste particularly good.

Werner Exinger wrote:

What a pity - the virtual beers do not taste particularly good.

In this Mathcad bottle:

bottle.png

( see http://twt.mpei.ac.ru/ochkov/Lace/Lace_eng.htm )

Top Tags