Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Functional Solve Block

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-24-2017
07:42 AM

08-24-2017
07:42 AM

Hi

I was trying to develop a function to calculate flow depth in D-shaped Tunnel. My attached sheet calculates correctly for First Tunnel section. However for second tunnel, It is giving wrong result. In fact it is not changing parrments of tunnel, which I intend to.

please have a look at attached version 14 File.

Thanks in Advance

A. Prasun.

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-24-2017
01:05 PM

08-24-2017
01:05 PM

Here you are.

As I wrote in my first answer, the problem was, that your calculations did not use the new values for B, H, etc. which you provided as function arguments and that you have to use those arguments as function arguments of Q (and all functions called by Q) as well.

Doing those changes now you get the 1.14 m you expected.

I have deleted the argument H as it is never used in the relevant calculations!

You also never use the functions "full" and "full_d", but if you intend to do so in the future, H should be an additional function argument.

In the pic I have underlined the changes made. The green underlined change of the name of the variable of integration is not mandatory, it will work with alpha, too. But from a mathematical point of view the variable of integration and the limit should never be the same name, especially as the limit is a function with the name alpha.

10 REPLIES 10

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-24-2017
08:41 AM

08-24-2017
08:41 AM

Re: Functional Solve Block

It would be better if you posted the worksheet (you have to zip it first). Based on the pdf, I suspect the problem is the guess value. Get rid of the guess value y1:=1m before the solve block, and add y1 as an argument to the depth function. Then you can try different guess values further down the worksheet by changing the last parameter in the function call.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-24-2017
10:57 AM

08-24-2017
10:57 AM

Re: Functional Solve Block

Thanks

The zipped file is attached.

A. Prasun

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-24-2017
11:15 AM

08-24-2017
11:15 AM

Re: Functional Solve Block

Given your math, the solve block is returning the correct answer:

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-24-2017
12:42 PM

08-24-2017
12:42 PM

Re: Functional Solve Block

Actually it is giving answer for tunnel of bigger size ; for B=H= 8.5 m and not for B=H= 6 m.

the answer remains same even if I modify the values of B h or slope.

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-24-2017
01:05 PM

08-24-2017
01:05 PM

Here you are.

As I wrote in my first answer, the problem was, that your calculations did not use the new values for B, H, etc. which you provided as function arguments and that you have to use those arguments as function arguments of Q (and all functions called by Q) as well.

Doing those changes now you get the 1.14 m you expected.

I have deleted the argument H as it is never used in the relevant calculations!

You also never use the functions "full" and "full_d", but if you intend to do so in the future, H should be an additional function argument.

In the pic I have underlined the changes made. The green underlined change of the name of the variable of integration is not mandatory, it will work with alpha, too. But from a mathematical point of view the variable of integration and the limit should never be the same name, especially as the limit is a function with the name alpha.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-25-2017
12:24 AM

08-25-2017
12:24 AM

Re: Functional Solve Block

Thanks werner...

@WernerExinger wrote:

Here you are.

As I wrote in my first answer, the problem was, that your calculations did not use the new values for B, H, etc. which you provided as function arguments and that you have to use those arguments as function arguments of Q (and all functions called by Q) as well.

Doing those changes now you get the 1.14 m you expected.

I have deleted the argument H as it is never used in the relevant calculations!

You also never use the functions "full" and "full_d", but if you intend to do so in the future, H should be an additional function argument.

In the pic I have underlined the changes made. The green underlined change of the name of the variable of integration is not mandatory, it will work with alpha, too. But from a mathematical point of view the variable of integration and the limit should never be the same name, especially as the limit is a function with the name alpha.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-25-2017
12:36 AM

08-25-2017
12:36 AM

Re: Functional Solve Block

A a next level of problem, I want to send following inputs from Excel into Mathcad

(a) B,H,r, Vertical --> Parameters of Tunnel

(b) Discharge, Q

(c) bed slope

Mathcad will calculate the Depth of Flow and

Then I want to Pull the output of mathcad into Excel.

Here I will keep excel in Front and Mathcad will do the calculation in the back ground and send data back to Excel in a cell.

can you suggest some ways, how to integrate this using Mathcad 14 and Excel .

Thanks once again in advance.

A. Prasun

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-25-2017
03:46 AM

08-25-2017
03:46 AM

Re: Functional Solve Block

Calling Mathcad from within Excel can be tricky and I never have seen any need to do so myself.

In the help (-> developers reference) you find some informations about Mathcad automation interfaces and links to some examples

You can also make a search here in the froum for something like "call Mathcad from Excel" and see, if the threads are of any help.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-24-2017
10:15 AM

08-24-2017
10:15 AM

Re: Functional Solve Block

As Richard already said - its better if you attach the worksheet itself and not just a static picture or pdf.

One things I noticed ist that your function depth(..) has 6 arguments but none of the first five arguments are used! All your calculations use just the values of B,H, etc. which are defined at the top of your sheet. The only argument which really influences the calculations is the last argument "dis".

This may be the reason for the wrong result as you provide differnet values for B, H, etc when you call the function the second time, but the function still uses the values defined at the top.

You would have to make Q a function with all those arguments, too!

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-24-2017
11:07 AM

08-24-2017
11:07 AM

Re: Functional Solve Block

I tried inserting y1 or guess value of flow depth in function but still same issue. wrong answer.

The function is not working if i modify the variables ( change the size or slope of tunnel).