Hp-41 structural analysis pac porting to hp49g+ - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: Hp-41 structural analysis pac porting to hp49g+ (/thread-221064.html) Hp-41 structural analysis pac porting to hp49g+ - giancarlo - 05-12-2012 Hello,   I bought some weeks ago the hp41 structural analysis pac and i am very happy about it. I was porting the equations used in the manual to my hp49g+  but i am having an issue with a formula. I am asking to other mechanical engineers or mathematicians if they did it with success. The formula i am referring to has been extracted from Felix Wojiechowski book, properties of plane cross sections, machine design, p. 150, jan 22, 1976. Given the coordinates of a section i would like to calculate the product of inertia Ixy. The formula starts like this: Sum for i=0 to N where N is the number of coordinates for            1  ----------- *  [ 1/8*(........)]    (xi+1 - xi) It is obvious that if xi+1 and x1 are the same (vertical points) the division leads to infinite. The hp-41 with the ROM does not stop because of this issue... Any help is apreciated, Thanks Giancarlo Re: Hp-41 structural analysis pac porting to hp49g+ - Luiz C. Vieira (Brazil) - 05-12-2012 Hi. Just to make it faster for us to locate, would you please tell which of the structural analysis pac program(s) you are using AND what part of it? I mean, is there any specific example in the manual so we could follow? Chances are that in the case you specify, the HP41 program checks if the values are equal to each other - or if the difference between them is equal to or too close to zero - and then it uses a different approach. Inspecting program line contents might lead to an alternate routine or calculation. So, if we know were to look for at first place it might be faster. At least I am considering it has been written in user code (FOCAL); if it is in machine code, just a few (a couple of guys, maybe) of us here might be able to track the lines. Cheers. Luiz (Brazil) Edited: 12 May 2012, 3:51 p.m. Re: Hp-41 structural analysis pac porting to hp49g+ - giancarlo - 05-12-2012 Hello Luiz and thank for helping. The program name is 'SECTION' and the formula crashes in my hp-49g+ with the first example of the manual ( you can find'em in the museum DVD) at page 13. These are the points to enter: (0,0) (0,5) (3,5) (3,0) (0,0) The formula i mentioned in the post crashes in my hp-49g+ because the first two points share the same distance from the origin (0 on the x axis). If you do 1/(0-0) you got the error... The issue is in me (most probably) or in the formula, Thanks Giancarlo Re: Hp-41 structural analysis pac porting to hp49g+ - Luiz C. Vieira (Brazil) - 05-14-2012 Hi, Giancarlo. I took some time this weekend to delve into the program and I found something interesting. Please, download the progam listing (PDF) and look at the steps with light-blue background in first page. Notice that R05 stores Ixy summation, and R06 is the variable containing (x(i+1)-x(i)). If R06 is NOT zero, the program computes the division and adds the result in X-register to R05; otherwise, zero is added. Please, download the program execution trace listing (PDF) and you'll see the sequence of events. The program itself is about 400 steps long (not that long), but it iterates a lot. I commented the relevant events on first page, up until finding the x(i+1)-x(i) occurrence and in which register was it being held. Then I found the point where it is compared to zero. I guess this is what should be done in the HP49G version: either you detect the occurrence of a zero prior to compute the whole summation or you discard it. Something like:```(...) IF (variable name with (x(i+1)-x(i))) DUP 0 = THEN (partial summation) * ELSE (partial summation) SWAP / END (...) (continues with Ixy summation computing)```Or, even smaller: ```(...) IF (variable name with (x(i+1)-x(i))) DUP 0 != THEN (partial summation) SWAP / END (...) (continues with Ixy summation computing)```Chances are it will work fine, now. Let us know how it goes. Success! Luiz (Brazil) Edited: 14 May 2012, 5:44 a.m. Re: Hp-41 structural analysis pac porting to hp49g+ - Gilles Carpentier - 05-14-2012 "Notice that R05 stores Ixy summation, and R06 is the variable containing (x(i+1)-x(i)). If R06 is NOT zero, the program computes the division and adds the result in X-register to R05; otherwise, zero is added." Hi The blue sequence could be : ``` R06 DUP { / } { NIP } IFTE 'R05' STO+ ``` The 'real' translation is ``` R06 DUP { / } IFT 'R05' STO+ ``` But i fear this could leave unnecessary data on the stack (49 has an unlimited stack...). Edited: 14 May 2012, 3:34 p.m. Re: Hp-41 structural analysis pac porting to hp49g+ - giancarlo - 05-14-2012 Hello Luiz and Gilles, thank you so much for debugging my issue. i am not very familiar with the hp-41 even if i like it a lot. Without your help it wouldn't have been possible for me find the solution. May i ask you how you 'downloaded' the data from the ROM? I like porting programs a lot and such feature would be very useful. The original formula for calculating the product of inertia Ixy doesn't mention such particular behaviour. I will print and dig into the program so i can familiarize with the flow of the hp-41 programs. Using formulas like indicated in the hp-41 module manuals have some risks like this one. You won a pizza in Italy if one day you decide to come in Italy, thanks Giancarlo Hp-41 structural analysis pac porting to hp49g+ (+ one question) - Luiz C. Vieira (Brazil) - 05-14-2012 Hi, Gilles. Thanks for your remarks.Quote:But i fear this could leave unnecessary data on the stack (49 has an unlimited stack...).In this case, you bet this is a big problem because the original HP41 program actually leaves some 'trash' in the stack once division is performed or not. That's why I took if...then...end complete structure into account instead of the shorter IFT (IfThen), valuable tool in many cases. Considering the original program structure, stack manipulations are limited to the X and Y contents in that particular passage, i.e., Z and T contents are neglected. In other parts of the program, Z-contents are used. In any case, not taking care of what is left in the stack when converting programs with controlled loops will surely leave a lot of trash. Inspecting a trace listing is as important as a program list, some facts may not 'pop out' of the program list as they do in the trace list. This is what I use to generate the trace list: I know it could be done by other means, but in this case I keep my HP48G in use, running inprt.gx with rechargeable batteries - as it is the HP41. (now for the question) One fact: running programs stored in ROM modules while TRACE is active does not generate a complete sequence of events - detailed trace as shown -, instead acts as NORM mode. I had to COPY the program to RAM memory and rearrange XROM calls so the detailed trace list came out. I tried with the HP82143A and had the same behavior. Have not found yet any info about this. Anyone, please? Cheers. Luiz (Brazil) Edited: 14 May 2012, 4:17 p.m. Re: Hp-41 structural analysis pac porting to hp49g+ - Gilles Carpentier - 05-14-2012 My mother is native from Italia near Bologna So perhaps ;)