Skip to main content
13-Aquamarine
September 17, 2024
Solved

Mathcad programming

  • September 17, 2024
  • 2 replies
  • 2319 views

Hello everyone,
In the attached file i have two programs r and q.
program 'r' arranges the bars in one layer of beam cross section and 'q' is for the second layer.
Here the number of layers are decided based on 'gqo' values.
If they are positive, one layer of the bars are sufficient, i have to repeate the proceedure until it is positive (which means i have to arrange the bars in several layers).

How can i automate y1....yn, d1....dn, n1.....nn, so that one program is sufficient to give the results for the bars in several layers. (y1,y2), (d1,d2), (n1,n2) belongs to first layer, (y3,y4).... for second layer, (y5,y6) for third layer and soo on.
Attached mathcad 10 file.

Best answer by StuartBruff

What is the purpose of the variable i within the r and q programs.  AFAICT, you increment i within the d1 loop in r but not in d3 in q (i remains at 0 throughout).  Putting i into the d3 loop raises an indexing error (the indexed value of ds doesn't exist)

 

Also, why do you return six rows for r and q? Is it for debugging purposes, and would you expect to just return the top Res row in the fully developed worksheet?

 

Considering the previous paragraph, in q, you pick n1, d1, n2, and d2 with i set to 0, which selects the values from the 1st row of r.  Did you intend to pick the values from different rows of q for subsequent layers?  It makes more sense to me if you only want to return one Res row from each layer and then index into that for subsequent layers.

 

Finally, for now, the obvious thing to do is generalize q.  This leaves the problem of dealing with r.  If you use q's program to calculate r, are there "initial" values that could be used for n1, d1, n2 & d2?  I had thought 0, as this would seem to leave the calculated values alone ... except for that 9th and 4th power roots.  Do powers of the roots change with each layer, or is the 1st layer a special case?

 

Stuart

2 replies

Catalina
Community Moderator
September 23, 2024

Hi @NM_10165576,

Thank you for your question!

Your post appears well documented but has not yet received any response. I am replying to raise awareness. Hopefully, another community member will be able to help.

Also, feel free to add any additional information you think might be relevant.

 

Best regards,

Catalina | PTC Community Moderator
7-Bedrock
September 24, 2024

 Good morning NM_10165576 , What is your objective here?    It kind of sounds like you are trying to calculate cross sectional properties.  Would you be able to supplement your Mathcad sheet with a detailed sketch of the physical problem with detailed dimensions and variable/parameter labeling?   Please add additional details so we can try to help!

13-Aquamarine
October 1, 2024

Hello @Structures_401 
i have attached a picture here.
as shown in the picture i have to take output from program 'r' and then run program 'q'.
How can i combine both the programs. It should also work for multiple layers.

NM_10165576_0-1727756600967.png

 

23-Emerald V
October 1, 2024

What is the purpose of the variable i within the r and q programs.  AFAICT, you increment i within the d1 loop in r but not in d3 in q (i remains at 0 throughout).  Putting i into the d3 loop raises an indexing error (the indexed value of ds doesn't exist)

 

Also, why do you return six rows for r and q? Is it for debugging purposes, and would you expect to just return the top Res row in the fully developed worksheet?

 

Considering the previous paragraph, in q, you pick n1, d1, n2, and d2 with i set to 0, which selects the values from the 1st row of r.  Did you intend to pick the values from different rows of q for subsequent layers?  It makes more sense to me if you only want to return one Res row from each layer and then index into that for subsequent layers.

 

Finally, for now, the obvious thing to do is generalize q.  This leaves the problem of dealing with r.  If you use q's program to calculate r, are there "initial" values that could be used for n1, d1, n2 & d2?  I had thought 0, as this would seem to leave the calculated values alone ... except for that 9th and 4th power roots.  Do powers of the roots change with each layer, or is the 1st layer a special case?

 

Stuart