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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Piece-wise model with system of equations

ptc-4921095
1-Newbie

Piece-wise model with system of equations

Hello, I am trying to develop a piece-wise model. Normally I would just use a matrix with i+1 and i. In this case however there is a system of equations that needs to be solved for each piece. I was using the 'given' and 'find' operators for the system of equations but I can't figure out how to do integrate this process with a step-wise procedure. Please find attached my file. I solved the first few pieces by hand just to illustrate more clearly what I am trying to do. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
6 REPLIES 6

I haven't looked at your worksheet in detail, but my first impression is that you need to rewrite your ΔC and J equations as functions of i. If you can do this, then you should be able to have one solve block and assign that output from the "Find" to a function and then call that by iterating over i.

If you need to incorporate values from one value of i to the next call, then you will need to add the variable parameters to your function definition; you're probably better of in this instance using a programmed 'for' loop rather than a range variable.

Stuart

Thanks for your reply and sorry for the delay on my side... I am not sure if I understand your suggestion. I have tried to rework the problem in another way but without any luck (it is attached). How would I use a for loop given that there is a system of equations that needs to be solved 'inside' the loop? Thanks

Just to explain further, This is an intermediate step, eventually I would like to set up the model to consider a range of dP. I've attached a file to show where I hope to go with all this...

It looks like Y.r is a function only of Q.r (D= constant) similarly for Y.s / Q.s, so redefine as Y.r(Q.r) and Y.s(Q.s).

This allows the solve block to be arranged as a function of Q.r, Q.s, C.1 & C.5 and the guess values.

Once you have this then the piecewise part becomes a repeating pattern that should be easy to perform as a programmed function.

Regards

Andy

Thanks Andy, it's along those lines. But now I am also trying to consider a range for deltaP. The discussion has kind of moved over to my other post (sorry for multiple threads). http://communities.ptc.com/message/199910#199910

As explained there, I am trying to write a Matlab code as a Mathcad program and also trying to improve it so it considers deltaP over a range x.

Top Tags