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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Translate the entire conversation x

Symbolic solver unit conversion with further substitution

Ivan_Pat
12-Amethyst

Symbolic solver unit conversion with further substitution

Dear PTC Mathcad Community,

I want to ask for clarification on the behaviour of units and symbolic substitution in Mathcad Prime (similar topics have already been raised, but I still haven't found an appropriate answer for my issue).

 So I try to find a symbolic expression for epsilon_c2, which is a parameter of the equation N.

Solver succeeded with the issue, but with incompatible units (see picture)

Ivan_Pat_0-1765875279227.png

So, I have tried to find out the solution in the community, but the advice of @Werner_E  with calculation options didn't resolve the issue (see the picture)

Ivan_Pat_1-1765875431392.png

So my issues are: 

1. How to make the symbolic solving more "seamless" with appropriate units' manipulation in the solutions?

2. Why does Mathcad not see the assigned values of the  epsilon_c2 obtained in the previous solution?

Ivan_Pat_2-1765875677338.png

 

After some time, when the file has been refreshed, some magic happened, and now I can use the roots of epsilon c1 and c2 in a "normal" manner.

Ivan_Pat_1-1765882285970.png

But the next issue is that it doesn't let me substitute the obtained symbolic solution into the following step calculation for the moment M calculation.

Ivan_Pat_0-1765882122108.png

As it can be seen, the factual equation is real, with proper units,

Nevertheless, Mathcad is still not satisfied with...

 

I am still convinced of Mathcad's power, but each time I get stuck with such a misunderstanding of Mathcad logic, I feel broken, exhausted and unable to continue to the next step - automation of my manual solution.

 

Any clarification, examples, or references to documentation would be greatly appreciated.
I am trying to align my workflow with my Mathcad Prime 10.0.0.0 internal logic rather than fight against it.

Thank you very much for your time and support.

 

The file with the manual calculation of M is attached.

 

51 REPLIES 51

Hi Ivan

Version 4 of the file.  Have found a couple of issues on checking my work.  First to answer your questions.

 

"h" is not used in my worksheet.  d is indeed h-as.  the depth from top compression fiber to bottom steel layer.

The curvature is derived from e/kd not (ec1-ec2)/h.  It is the same result.

 

Calculations for ecu1_cd/2 are an example only, I used as a check.  they could be taken out and the sheet would still work.

 

The steel grade chosen like A400C is applied to both layers of steel.  In practice it would not be a good idea to mix grades as errors on site of misplacing grades in wrong positions could occur.

 

I have found some errors in my sheet upon checking.  That is why version 4.

Used the wrong column of DBN for fcd.  This is corrected.

Used fyk and Es to set the max yield strain, then wound back the resulting stress by gamma s.

This means the steel stress strain diagram is altered.

 

Changes in yellow.

Capture.JPG

Results in very close answers to MQN.com. 383 to 385.

Capture3.JPG

Capture4.jpg

For some reason not getting the same stress values for the reinforcement?

 

Have corrected the stress calculations with s1 being the top reinforcement and s2 being the bottom reinforcement as per MQN.com.

 

Will continue to look for errors.

 

Do not be put of by the numeric integral calculus it gets the same result for compressive force in concrete as equation 4.3 is the mathematical equivalent:

Using the calculus it is easy to swap to Eurocode stress block.

Capture2.JPG

I do not understand the second integration of compressive block in equation 4.4?  If you take moments about the centroid of compressive force you eliminate that force from the moment calculation.  What is X1 in equation 4.4?

 

I am checking for more errors as time permits so be prepared for version 5.

 

Not sure why your system does not find the text files.  Try using the full path in Prime READFILE statements.

 

Cheers

Terry

@terryhendicott  I am really impressed by your level of understanding and MathCAD mastery, Terry.
It'll help me a lot.
Trying to digest the material...

Regarding your question about X1

X1=ec1/א, where the א - curvature =1/h*(ec1-ec2)

 

 I still can't get from the formula why do you put plus after the first member As*fs*(d-kd)...

Ivan_Pat_0-1766436573837.png

The "+" sign depends on the distance d' from the most compressed part of the beam and comparison with kd. Whether the d ' is bigger than kd - the reinforcement is situated in the tensile zone, and the total moment will be equal to the lever arm (d-Centroid) produced by the sum of the reinforcement, which is in the tensile zone.

 

Hi Ivan,

Version 5 which can accommodate multiple layers of reinforcement defined in vectors "vAs" and "vd".

Capture2.JPG

To do this have made some changes,

a) Reinforcement stress strain diagram accepts positive and negative strains.

Capture3.JPG

The calculation of "kd" has been changed to read the reinforcement layers

Capture4.jpg

The calculation of the moment has been changed to read the reinforcement layers.

Capture5.JPG

You had questions about the signs of tension (-) and compression (+) and moment (+ anticlockwise around concrete stress block centroid).

How this sign convention works is in the enclosed graphic.

 

Cheers

Terry

@terryhendicott Hi Terry!

The effort you've put in is much appreciated and has been very helpful in solving my issue.

Thanks to your enclosed graphic, it is now much easier for me to investigate your assignments to characters in the code. Thank you so much for the time and goodwill you've spent on the problem solution.🙏

 

Ivan_Pat
12-Amethyst
(To:Werner_E)

@Thank you for the clarification and the script modification, Werner.

 

I modified your script a little to include ORIGIN :0 in the hope that it'll give me zero values on the first iteration step, like here.

Ivan_Pat_2-1766333832581.png

by providing a conditional statement and counting a coefficient from  zero to four:

Ivan_Pat_0-1766333608189.png

But somehow MathCAD do see the error still:

Ivan_Pat_1-1766333683698.png

(((

Prime 10.0.0.0 is attached.

Can you explain why MathCAD sees it as an error?

As well as a few questions in the script, highlighted in colour.

 

Werner_E
25-Diamond I
(To:Ivan_Pat)

i <- 0 is a local assignment!

In a conditional you have to use the comparison equal (Boolean equal)

Werner_E_0-1766343066256.png

See modifications in attached sheet.

If you just wanted all values to be zero in front it would have been easier to work from the previous sheet and simple add the zero values on top 😉

 

According your comments in the sheet - I don't see what you seemed to have seen. I only see errors because ec2 is not defined, etc.

 

You changed ORIGIN from 1 to it default value 0.

When you had a sum running from 1 to rows(...) it will not work that way, because vector indexing start with 0 now.

You are better of letting the sum run from ORIGIN to last(...). That way you are independent from the setting of ORIGIN.

 

 

Ivan_Pat
12-Amethyst
(To:Werner_E)

@Werner_E Thank you for correcting the code, Werner.😁

Now, I really have the perspective to move forward to upgrade the code ))🙏

Werner_E
25-Diamond I
(To:Werner_E)

To make clear what I meant with my remark

"If you just wanted all values to be zero in front it would have been easier to work from the previous sheet and simple add the zero values on top"

You simply have to replace the bottom line of the program

Werner_E_1-1766402940795.png

with

Werner_E_2-1766402964039.png

to get

Werner_E_3-1766402997540.png

and

Werner_E_4-1766403125339.png

ORIGIN was not changed, its still 1..

 

I also noticed that the variables sigma_s1_2 and also x1 which you calculate are never used !?? So these calculations

Werner_E_5-1766404372265.png

and

Werner_E_6-1766404969177.png

could be deleted.

Ivan_Pat
12-Amethyst
(To:Werner_E)

@Werner_E Yes, it will be more considerable!))

Thanks for your desire to help, Werner!!!

Werner_E
25-Diamond I
(To:Werner_E)

I played around a little bit and turned the calculations into individual functions rather than just working with vectors.

I had hoped that the maximum Moment value could be calculated with more precision using the derivative. Unfortunately Prime chokes on that - probably because of the if-statements and the resulting discontinuities in the derivative.

Nonetheless it may be useful. I also made all calculations ORIGIN-independent.

Prime 10 sheet attached

Ivan_Pat
12-Amethyst
(To:Werner_E)

@Werner_E Thank you very much, Werner!

I have been pleasantly amazed with your analysis being performed.


@Werner_E wrote:

I played around a little bit and turned the calculations into individual functions rather than just working with vectors.

I had hoped that the maximum Moment value could be calculated with more precision using the derivative. Unfortunately Prime chokes on that - probably because of the if-statements and the resulting discontinuities in the derivative.


Yeah, I still have some hopes, regarding the Mathcad Symbolic engine. But in my case, the three reinforcement layers provide no symbolic solution.

Ivan_Pat
12-Amethyst
(To:Werner_E)

@Werner_E Thank you for your patience and desire to assist with my issue, Werner!

I still can't catch where the term "alef" is assigned from?? I have found no such assignment in the code, but I understand it is assigned elsewhere... Why is it important? Because I need to analyse the dependence (Moment Curvature = alef). And the point that alef is not the Curvature in terms of values.

Ivan_Pat_0-1766675926629.png

Ivan_Pat_1-1766676243089.png

 

Prime 10.0.0.0 file attached.

 

Werner_E
25-Diamond I
(To:Ivan_Pat)

"alef" is on of the return values of your large iteration program. Its the last of the six returned results 

Werner_E_0-1766706421813.png

And the values in "alef" correspond to the vector of values which you called "alef_dash" in your program.

Werner_E_1-1766706537754.png

As I have no experience whatsoever in your field of work I can't say if or why it may be important or what the meaning of those values would be. Its one of the vectors of values you calculated in your program, so I returned it so you can examine them in the sheet. If they have no importance, simply remove this return value.

 

Note that a program in Prime cannot alter variables defined in the worksheet nor can your worksheet look at the variables calculated in a program. If you need values which were calculated in the program you have to explicitly return them as the result of your program. To return more than one value you have to put them in a vector or matrix.

To return something from a program you may use the explicit "return" statement. Otherwise the result of the last line executed  is the returned value. That's the reason why I did not need touse "return" in the last line.

But you sure can use 

Werner_E_2-1766707133296.png

it may be good style anyway.

 

 

Hi

Version 6 of calculations now allows for choice of DBN or Eurocode stress block.

Capture.JPG

Capture2.JPG

 

All the sample/checking calculations are removed leaving the bare bones.

 

Calculation of kd using the root() function is essentially the solution of a quadratic so a negative value is possible (especially at low curvature) the guess value could lead to the negative solution.  Negative value of kd messes up the moment curvature graph at low curvature.  The workaround is to use a better guess for kd at half the maximum steel depth instead of 30 mm.  Graph glitches go away.

Capture3.JPG

Cheers

Terry

 

@terryhendicott Hi Terry!

I tried a little bit to analyse your Moment equation. Thus, according to the analysis of equation (4.4)

Ivan_Pat_0-1766776207599.png

We do need to consider the moment of equivalent concrete centroid (first member of the equation), or by your assignment:

Ivan_Pat_1-1766776305386.png

 

Since it affects the total M value, it creates a moment that is taken with the lever arm cg (according to your assignment) against the clockwise direction. M=Centroid*cg

Ivan_Pat_2-1766776525133.png

In my case it has a significant influence on the total moment M 

I take the curvature as the maximum of design depth vd1, which'll be constant and not depend on the first assumption of kd=30 mm, as in your sample.

Ivan_Pat_4-1766777026301.png

 

Ivan_Pat_3-1766777001285.png

As I see from your moment calculation, you ignore the centroid input to the total moment M. You use only the moment produced by reinforcement multiplied by the respective lever arms. Why?

Ivan_Pat_5-1766777213359.png

Ivan_Pat_6-1766777359014.png

Also, I didn't catch why you don't put ec1u_cd as the maximum compressed strain of concrete instead of etop?

File attached.

 

 

Hi,

The trick is in where to take moments about for the moment equilibrium calculation.

Version 6 takes moments in the section about the centroid of the concrete section.

Equation 4.4 takes moments about the bottom of the concrete stress block.

Here is a diagram and calculations of the difference.

Capture.JPG

Capture2.JPG

@terryhendicott Hi Terry!

Thank you for your explanation, but I'm still concerned about the correctness of my interpretation of your file and logic embedded in v.6/

 I don't want to be annoying, but it seems to me that you misunderstand equation 4.4.

In my graph, you can see how the logic of equation 4.4 is built ( probably you've got it earlier, but still I want to express it by picture, maybe here is the point of your misunderstanding)

Ivan_Pat_1-1766856419097.png

 

 

Hi,

It does not matter if you take moments about the moment centroid of the compressive stress block, or moments about the bottom of the concrete stress block you get the same answer for section moment.

 

When using the centroid of the concrete stress block as point to take moments about, lever arm of the tensile reinforcement is longer and gets the same overall moment.

When using the bottom of the concrete stress block as point to take moments about, lever arm of the tensile reinforcement is shorter and gets the same overall moment.

 

Here is sample calculation of both:

Capture4.jpg

Cheers

Terry

Ivan_Pat
12-Amethyst
(To:Werner_E)

@Werner_E Thank you for your explicit explanation, Werner!

The lack of MathCAD nuances does not stop me from exploring its power!))

As far as I caught the idea, you can only use the data from the program if you saved it in the return [...] manner (matrices, if we have more than one variable, and without square brackets if we need to return only one value. Isn't it?

I'll try to exercise it a little.

Werner_E
25-Diamond I
(To:Ivan_Pat)


As far as I caught the idea, you can only use the data from the program if you saved it in the return [...] manner (matrices, if we have more than one variable, and without square brackets if we need to return only one value. Isn't it?


Correct. For a worksheet being able to use the value(s) calculated in a program, the program must return these values to the calling instance, the worksheet.

And the data structure used to hold multiple values is a matrix/vector.

Ivan_Pat
12-Amethyst
(To:Werner_E)

@Werner_E Hi Werner!

Maybe I don't understand the logic of MathCAD, but why in one case (Case of one-layer reinforcement), where I assigned the Curvature value by

Ivan_Pat_0-1766860519396.png

Everything was seamless. 

But unfortunately, after hard work with several mistakes corrected and thorough input, the same Curvature value for double reinforcement caused an error in MathCAD...

Ivan_Pat_1-1766860777878.png

I'm on the edge of being broken.

With my "coarse" understanding of MathCAD logic, it seems to be the unexplainable issues, for me at least. 

Sorry for annoying you, but I'm really trying to understand where there are possible **bleep**ups and to fix my issue.

File attached

 

Werner_E
25-Diamond I
(To:Ivan_Pat)

Your program is impossible to read for me and i was hardly able to play around with it because Prime gets unacceptably slow in reaction.

I tried to throw in a try-on_error statement at the position of the error to see when the error occurs and would return "i" and the vector "ec2" in case of an error.

It showed me that the error occurs when i=3, but my attempt to show the returned vector ec2 failed because Prime would crash.
I saw the error "Unknown error: The method or operation is not implemented" without any clue as to which 'operation or method" the message would refer to.

I looked closer (not too close as of the prohibiting large expressions) at the definition of ec2 and noticed, that you don't return a value in case none of the conditions in your many if, elseif statements is met.

So I added an "else" at the end which guarantees that ec2_i would get a value in any case.

This at least makes the program work but chances are you get some wrong values because of the arbitrary value 12345 used. This means that you should recheck the logic of the calculation - there seems to be at least one case which you did not consider correctly.

And, as I already wrote in a prior reply, your if, if else,... calculations should always return a value. This usually may be achieved by using a simple "else" as the last statement. This is where you land if none of the other conditions are met.

Werner_E_0-1766873378464.png

 

EDIT:

I modified the program so that ec2 would be returned as well and so I can see that all values starting with i=3 do not meet any of your conditions and so now all are 12345. Sure not what you had intended:

Werner_E_1-1766873574268.png

 

P.S.: You really should try to shorten the expressions and the program. Maybe its possible to split the calculations or define functions for some of them which then could use in your program.

A simple example:

Instead of

Werner_E_2-1766874781902.png

you could define functions for the condition as well as for the resulting value

Werner_E_3-1766874841697.png

and use them in your program

Werner_E_4-1766874881289.png

If you then use meaningful function names that perhaps correspond to your application, this will not only make your program easier to read, but also easier and faster to edit.

Announcements

Top Tags