I am working on a calculation sheet to design a bridge deck overhang. The last check I need to do is to calculate the cutoff length of the supplemental bars that are used. In order to do this, you need to solve/find the location where the applied moments become less than the moment resistance of the overhang without the supplemental bars. The only way I can think to achieve this is to use a solve block, however, this becomes a problem if/when the applied moments are less than moment resistance at the cutoff location. See the images below.
For this example the variable Mr_co is the moment resistance at the cut-off location. I have set up functions to calculate the ultimate strength moments for 2 different cases. As you can see by the graph, the ultimate strength moment for the one case does not quite reach the cut-off moment resistance. I would like to set up the solve block so that if/when this happens, the return is 0, but I am not sure if this is possible because when the solve block cannot find a solution, it returns a "variable is undefined" error.
I have tried putting this in an if statement block, but the issues seems to be that the return of the Find function when it cannot find a solution. Has anyone else run into this issue and found a solution around it? I have also tried using the 'on error' operator and that does not work either.
Any help would be much appreciated! Thank you!
Can you attach your worksheet, or else (even better) a worksheet that specifically shows the problem.
Success!
Luc
Attached is the file. The 'Find' function is at the very end of the worksheet where I compute the theoretical cut-off location, page 52. I have tried using a programming block with 'if' statements as well as the 'on error' function and the issue seems to be that the return of the 'Find' function is undefined.
Yep, the 'on error' cannot be used with a Find, probably because you cannot use Find in a program, and 'on error' is a programming construct.
I've been trying to define a function IsUndefined(var) that should check if var is undefined, in the past, and recently after I read your post. So far no luck. The problem with 'undefined' is that the variable is numerically undefined and this is caught by Mathcad at the calling of any use of an undefined variable. It only survives symbolic evaluation. But the problem with symbolic evaluation is that only certain IF statements work as desired.
Seems like you have to find other ways to determine (conditions where) Find will not find what you need, and test for those.
Success!
Luc
@Upsers wrote:
I am working on a calculation sheet to design a bridge deck overhang. The last check I need to do is to calculate the cutoff length of the supplemental bars that are used. In order to do this, you need to solve/find the location where the applied moments become less than the moment resistance of the overhang without the supplemental bars. The only way I can think to achieve this is to use a solve block, however, this becomes a problem if/when the applied moments are less than moment resistance at the cutoff location. See the images below.
For this example the variable Mr_co is the moment resistance at the cut-off location. I have set up functions to calculate the ultimate strength moments for 2 different cases. As you can see by the graph, the ultimate strength moment for the one case does not quite reach the cut-off moment resistance. I would like to set up the solve block so that if/when this happens, the return is 0, but I am not sure if this is possible because when the solve block cannot find a solution, it returns a "variable is undefined" error.
I have tried putting this in an if statement block, but the issues seems to be that the return of the Find function when it cannot find a solution. Has anyone else run into this issue and found a solution around it? I have also tried using the 'on error' operator and that does not work either.
Any help would be much appreciated! Thank you!
Just delete the equal after Find. Mathcad 15 don't like vectors with different units.
Deleting the equal after Find does not work because the definition of the variable is predicated on the 'Find' function. Since the the solver cannot find a solution, the return of the 'Find' function is undefined, which is the ultimate problem.
Unfortunately "on error" does not work directly with "Find", but as a workaround you can turn the solve block into a function with a dummy argument and then you can use this function in an "on error" statement:
Instead of the "dummy" argument you may use x.guess2 as function argument so you don't have to define the guess value in front of the solve block and can call it trying different guesses.
Instead of using a solve block you may consider using the "root" function, which can be used with "on error".
Either the variant where you provide a guess value
or the one where you provide a range