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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

How to use Mathcad to create a flow chart

JC_10409281
5-Regular Member

How to use Mathcad to create a flow chart

Hi Experts,

 

I am a beginner to use Mathcad.

and I have a question about the flow chart.

Please see the below figure, I can do the below figure by using Matlab, but I am confused about how to use Mathcad to do the same thing, can someone give an example of how to do it, thanks.

JC_10409281_0-1662563509747.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

Here is the total solution from the article. It uses a solve block instead of the flow chart in steps 3 and 4

Problem inputs

Capture.JPG

Steps 3 and 4 are the flow chart iterations.  In Mathcad they can be done using a solve block it takes care of all the iteration to a closed solution.

Capture2.JPG

Cheers

Terry

View solution in original post

22 REPLIES 22

I would suggest that you start a try and then post the (probably not correctly working) worksheet here for corrections to be made.

 

There may be some modifications necessary because Mathcad unfortunately does not provide a loop with end-condition (something like do ... while, or repeat ... until). And of course Mathcad supports no  goto   😉

 

You would also have to specify what "select ..." and "Find ..." and "solve for ..." would actually mean, how much m should be in/decreased, etc.

It might be that a solve block with "find" or "minerr" could be more appropriate to get the value of K.max (or rather m may be the value of interest?), but as a start here is a possible outline of the function. Arguments may be Qmax and m (so you won't need the first two lines). The third line is just to make sure that for the first time the condition of the while loop will fail.

Werner_E_0-1662564917324.png

Note that there is a slight difference here to the flow chart: When "Find Kmax" found a value equal to gain.required, the value of m is increased (which is not the case when we follow the flow chart. If this is an issue, an easy way to fix it would be to decrease m after the loop and before "solve for resonant ...".
Another way would be to replace "else" for "elseif Kmax > ganin.required".

 

JC_10409281
5-Regular Member
(To:Werner_E)

Hi @Werner_E

Ok, I will put my worksheet next time when I have questions.

 

Based on your suggestions, I will try to do it and see if it could work or not.

 

because Matlab if more sensitive to me, it is hard for me to transfer to Mathcad.

 

and thanks for your help, I am very appreciate it.

 

 

 

JC_10409281
5-Regular Member
(To:Werner_E)

@Werner_E ,

Do you use Mathcad 15? 
Becasue I can't find the if else cmd in the Mathcad 15

JC_10409281_1-1662639174319.png

 

As you did not provide a worksheet with a first try and also not stated  which version of Mathcad you intend to use, I assumed it will be the current Prime (as Mathcad 15 fortunately is not available anymore anyway).

As you intend to use Mathcad 15 (older, but much more capable) instead of "ifelse" you can use "otherwise" (which is what normally is called "else" and then use a new "if" statement.

But I already suspected that other methods (solve block or root function) might be more appropriate compared to doing the iteration like in the flow chart. And I see that Terry already provided a full solution further down in this thread.

Hi,

Can you elaborate on the equations using Qmax and m to calculate Fxmin, Kmax. What is the required gain

Mathcad can use a root function or solve block that can iterate the value of m to solve the problem without using programming 

Hi,

Are you using Mathcad 15 or Prime 8?

Cheers

Terry

Hi The web  is a marvelous thing have found the article with the flow chart ,  So have the equations and example.

Application Note AN 2012-09
V1.0 September 2012
Resonant LLC Converter: Operation and Design
250W 33Vin 400Vout Design Example
Sam Abdel-Rahman
Infineon Technologies North America (IFNA) Corp

https://www.infineon.com/dgdl/Application_Note_Resonant+LLC+Converter+Operation+and+Design_Infineon.pdf?fileId=db3a30433a047ba0013a4a60e3be64a1

Please be patient

Hi,

Have programmed the equations from the article and reproduced the graphs

Figure from the article.

Capture.JPG

Figure from Mathcad 15 worksheet.  Can be converted to Prime worksheet

Capture2.JPG

Figure from the article

Capture3.JPG

Calculation using root function for Fxmin and Kmax

Capture4.jpg

Will now work through the example from the article to find m

Cheers

Terry

Hmm, reminds me of this thread (and the other two that were related): https://community.ptc.com/t5/Mathcad/Math-equation-problem-of-finding-too-many-different-answer/m-p/821733/highlight/true#M202462

Guess there could be a possibility that you are doing someone else's homework ....

 

Hi,

Thanks

It looks familiar clearly the same

Cheers

Terry

JC_10409281
5-Regular Member
(To:Werner_E)

Hi @Werner_E,

 

 

I also see this article too, so I try to use this way to draw my figure.

 

I don't do anyone's homework, because I am recently learning how to design the LLC converter, so I will do some research on the PTC community.

 

Sorry to let you misunderstand.

JC_10409281
5-Regular Member
(To:terryhendicott)

Hi @terryhendicott 

 

Thanks, I also find other article talking about how to draw the figure, and your file is ok with me, I will keep studying how to finish my flow chart, thanks.

 

Hi,

Here is the total solution from the article. It uses a solve block instead of the flow chart in steps 3 and 4

Problem inputs

Capture.JPG

Steps 3 and 4 are the flow chart iterations.  In Mathcad they can be done using a solve block it takes care of all the iteration to a closed solution.

Capture2.JPG

Cheers

Terry

JC_10409281
5-Regular Member
(To:terryhendicott)

@terryhendicott 

May I know what does below equation mean?

I try to use "help" to know the unifspace, but I don't find it.

 

JC_10409281_0-1662650443217.png

 

Hi,

"unifspace" is a user defined function (not in help) that creates a matching range variable and a column scalar vector of uniformly spaced points.

It is used in the solution to create 501 points from 0.1 to 10 to graph the lines in all the plots.

Capture.JPG

 

JC_10409281
5-Regular Member
(To:terryhendicott)

Hi @terryhendicott 

 

 

Thanks.

 

 

JC_10409281
5-Regular Member
(To:terryhendicott)

Hi @terryhendicott ,

 

Sorry to ask a question again,

 

May I know what's different between these two?

JC_10409281_0-1662993805816.png

if I use fx I will get different results.

JC_10409281_1-1662993870676.png

 

 

fx is a vector, but fx[ifx is not!

Try to vectorize the function calls of function K in the second plot where you don't use the index ifx and see what happens.

JC_10409281
5-Regular Member
(To:Werner_E)

Hi @Werner_E 

 

 

I got it.

 

Mant thanks.

 

 

 

Hi,

It is a good question.  The difference is subtle.

There are three ways to get the correct plot and one way to get the wrong plot,

I will show why you get the wrong plot and then the three ways to get the correct plot.  All three are just as valid.

 

Wrong plot:

The subtlety that gets the wrong plot is that you can pass a defined function a scalar or a vector and the function will behave differently.

Capture.JPG

This function is defined as if Q, m, and Fx are scalar.  But it will accept a vector for Q, m or Fx and get an entirely different value due to the now vector arithmetic that returns a vector result.

In short you should only pass a succession of scalar terms for Fx in K function to get the desired result.

 

The three correct ways to get scalar values of Fx into the graph.

One:

Use a range variable (this is not a vector) on each axis.  The range variable is assumed by Mathcad as element by element arithmetic.

It enters a scalar value into the K function

Capture2.JPG

Two:

Deliberately use the vectorization operator to ensure you get element by element scalar input into the K function

This is plotting two similar sized vectors against each other.

Capture3.JPG

Three:

Use indexed element by element scalar input to the K function

This needs a defined index and a matching value vector. hence unifspace()

Capture4.jpg

 

Cheers

Terry

JC_10409281
5-Regular Member
(To:terryhendicott)

Hi @terryhendicott ,

 

 

I understand!

 

Many thanks.

 

 

 

Top Tags