cancel
Showing results for
Did you mean:
cancel
Showing results 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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
21-Topaz I
(To:JC_10409281)

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

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.

Cheers

Terry

22 REPLIES 22
24-Ruby V
(To:JC_10409281)

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.

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".

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.

5-Regular Member
(To:Werner_E)

@Werner_E ,

Becasue I can't find the if else cmd in the Mathcad 15

24-Ruby II
(To:JC_10409281)
24-Ruby V
(To:JC_10409281)

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.

21-Topaz I
(To:JC_10409281)

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

21-Topaz I
(To:terryhendicott)

Hi,

Are you using Mathcad 15 or Prime 8?

Cheers

Terry

21-Topaz I
(To:terryhendicott)

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

21-Topaz I
(To:terryhendicott)

Hi,

Have programmed the equations from the article and reproduced the graphs

Figure from the article.

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

Figure from the article

Calculation using root function for Fxmin and Kmax

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

Cheers

Terry

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

21-Topaz I
(To:Werner_E)

Hi,

Thanks

It looks familiar clearly the same

Cheers

Terry

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.

5-Regular Member
(To: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.

21-Topaz I
(To:JC_10409281)

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

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.

Cheers

Terry

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.

21-Topaz I
(To:JC_10409281)

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.

5-Regular Member
(To:terryhendicott)

Thanks.

5-Regular Member
(To:terryhendicott)

Sorry to ask a question again,

May I know what's different between these two?

if I use fx I will get different results.

24-Ruby V
(To:JC_10409281)

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.

5-Regular Member
(To:Werner_E)

I got it.

Mant thanks.

21-Topaz I
(To:JC_10409281)

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.

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

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.

Three:

Use indexed element by element scalar input to the K function

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

Cheers

Terry

5-Regular Member
(To:terryhendicott)

I understand!

Many thanks.

Announcements
Top Tags