Computing volume … estimating cycle freq

Moderator: Mike Everman

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Computing volume … estimating cycle freq

Post by WebPilot » Sat Nov 21, 2009 12:11 am

Geocities closed down their free website hosting last month. My first webpage was hosted by them.

I had the choice of downloading everything again or lose it. What a pain it was to download from that site!

Anyways, I had links on the old pulse jet forum to things I had posted there.

Image

One of these 'things' was a program I wrote in C back in 2002. I wrote this before Eric's calculator. It was compiled and ran as an executable in a console window on a µSoft windows machine.
  • It would calculate the total volume of a pulse jet made up of any number of cylinders and frustum of cones.
  • The dimensions were interactively input by the user.
  • It would also estimate the fundamental cycling frequency.
  • It would be a fairly simple matter to now incorporate an estimate of thrust.
If there is any interest, I can link to it again (somewhere).

PS It is frustum of cone, not as I misspelled it some almost 7 years ago.
Image

PyroJoe
Posts: 1743
Joined: Wed Aug 29, 2007 5:44 pm
Antipspambot question: 125
Location: Texas

Re: Computing volume … estimating cycle freq

Post by PyroJoe » Sun Nov 22, 2009 12:24 am

Would like to try the program and see how it does. Have worked with Erics calculator in the past and found it a useful tool. Could the program be used in conjunction with your other work to match a PJ body with a specific valve head frequency?

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Mon Nov 23, 2009 3:28 am

 Sorry for the delay. I do my own mechanic-ing on my cars and had to replace the water pump on my transverse mounted, Buick 3.3L, V-6 engine. It actually was pretty easy - much like an in-line V-8 except you don't have to 'pull' the radiator. I had to remove the tensioner pulley in order to remove two of the pump bolts. The pulley bearing 'rides' on a left hand threaded bolt. I just removed the bolt.

What I have is an executeable.
  • I wrote it for Win '98 SE
  • It should work on XP, maybe on Vista
  • It does not work on Linux in a command line Terminal window; enough on 'C' being portable.
  • It does not work using DosBox, but does work using Wine on Linux
Before releasing it again, I need to find the source code and my notes.

Please be patient.
Image

tufty
Posts: 887
Joined: Wed Dec 24, 2003 12:12 pm
Antipspambot question: 0
Location: France
Contact:

Re: Computing volume … estimating cycle freq

Post by tufty » Mon Nov 23, 2009 9:03 am

WebPilot wrote:What I have is an executeable.

...

[*]It does not work on Linux in a command line Terminal window; enough on 'C' being portable.
C, in source code form, is highly portable as long as it doesn't use any platform-specific libraries. Compiled executables are not, they are packaged according to the rules of the particular host system. DOS / Windows executables use PEF (which, amusingly enough, stands for "Portable Executable Format"), whilst Linux generally uses ELF. OSX uses Mach-O, the only one that really gives you multiplatform support, as it allows binaries for multiple architectures to be bundled in one file; they'll only run under OSX, but you don't have to worry about PowerPC vs 64-bit PowerPC vs Intel vs 64-bit intel, etc. Some other Unixes use COFF, which is not a million miles from PEF. There are many other formats, none of which are compatible.

So, your PEF executable, compiled under W98, should work under W95+, up to and including MS' latest crapware. It won't work under DOS, complaining that it needs to be run under windows. This is a vagary of the PEF format, there's a "stub" program that gets run when you're under DOS. Yes, that stub *is* included in every executable on your system. For the sake of redundancy, I guess. It will run under WINE, which provides a windows-alike interface for PEF executables. It won't work under BeOS, MacOS (9 or X), GEM on the Atari ST, an unexpanded ZX-81, etc.

If you can dig out the source, it should be able to be made to run on all of the above and more (with the probable exception of the ZX-81, which could only do integer maths and only had 1K of memory).

FWIW, If you were to rewrite this, I'd strongly consider using either a low-level library that gives proper numeric types as opposed to using floats / doubles, or doing it using a package like Octave or SciLab.

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Mon Nov 23, 2009 5:26 pm

 Thanks for all that, Simon. I feel like I just went to a wiki-pedi; perhaps more like a tufti-pedia.

 Really, I wasn't too surprised the .exe file did not run natively under Linux, but I am surprised the source won't compile now even though I used gcc, the GNU compiler, under µSoft windows and now under Linux. I'll figure it out but, this means that any code I write now in C, the .exe file won't run on µSoft machines unless I take the source, rewrite it a little and compile it there. That means more work, and I'd rather work more efficiently.

 Sorry, t. I'm still using floats, ints and chars

 I have used Octave, a little, but I can't imagine a large % of the forum readers are going to learn how to use that program. However, to run Octave on a µSoft machine, you have to create a small unix-like environment. If we could get the program, bc, to run in that environment, then, that would be great. It is easy to program, it's like C, and I think it would be easy for a BASIC programmer to 'pick up'. However, I'm dreaming.

 Joe, are you game?



 Here is the zipped executeable; it works on the above platforms 'as is'.
Design_Tool-exe.zip
(6.29 KiB) Downloaded 460 times
the final screen:
Design_Tool.gif
a small user guide:
User_Guide.txt
(1.66 KiB) Downloaded 417 times
this is the test case:
test_case_a.gif
Image

PyroJoe
Posts: 1743
Joined: Wed Aug 29, 2007 5:44 pm
Antipspambot question: 125
Location: Texas

Re: Computing volume … estimating cycle freq

Post by PyroJoe » Mon Nov 23, 2009 6:46 pm

Thanks Forrest,
For some reason XP didn't run it through. Just gave a "do you wish to continue: <y or n>_"
Pressing y or n will repeat the phrase.

If I had a .zip file containing the source code saved as .TXT I could try it in BASIC.
Attachments
xp.JPG

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Mon Nov 23, 2009 11:52 pm

 Joe, thanks for testing and reporting back. I have a laptop now with XP on it. I have 2 'work arounds' I want to try first. Let me get back to you later this evening. I may have an answer (and the code functioning) by then.

BTW Your error is the same error I got when I tried to run the code natively under Linux.
Image

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Tue Nov 24, 2009 4:10 am

 I transferred a copy of the code to my laptop and ran it from the command prompt in XP. The program asked me "Pick a volume shape: 1. Cylinder, or 2. Frustrum of Cone ?". IOW, it worked. I ran through the entire test case and it gave me the final expected answer.

WTF!

 Joe's getting the same error message on XP as I did in Linux ran 'round in my mind. Then it hit me. I went back and compared the executeable I posted on the forum to the one from my source files; I found 3 files with the same name of differing file sizes. The one I originally posted is a broken version. I've linked a good version in its place.

Go back up and download it again, please.

 I know this version works
  • in µSoft Windows '98 SE at the command prompt,
  • in µSoft Windows XP at the command prompt and
  • natively in Ubuntu Linux 8.04 (Hardy Heron) in a Terminal window.
 Seven years ago, I chose C in which to write code in order to program across platforms. I now know I've succeeded in bridging Windows to Linux. I originally wrote this program in a unix-like environment using GNU's gcc compiler on a Pentium II class machine running Windows '98 SE.

Yippee! It works in Linux, too.
Image

PyroJoe
Posts: 1743
Joined: Wed Aug 29, 2007 5:44 pm
Antipspambot question: 125
Location: Texas

Re: Computing volume … estimating cycle freq

Post by PyroJoe » Tue Nov 24, 2009 2:09 pm

Looking good here:
Attachments
run2.JPG

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Tue Nov 24, 2009 6:09 pm

Here too, Joe. Anyone else?

Image
Image

tufty
Posts: 887
Joined: Wed Dec 24, 2003 12:12 pm
Antipspambot question: 0
Location: France
Contact:

Re: Computing volume … estimating cycle freq

Post by tufty » Tue Nov 24, 2009 7:37 pm

How in god's name is that working, Forrest? Wine picking it up on a command line basis, or what? Mono, maybe?

Code: Select all

insurgent:Desktop simon$ file Design_Tool\ 2.exe 
Design_Tool 2.exe: PE32 executable for MS Windows (console) Intel 80386 32-bit
This has me very intrigued. Can you do a quick 'ldd' on it under linux?

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Tue Nov 24, 2009 11:05 pm

Pretty amazing, eh?

Code: Select all

$ ldd Design_Tool.exe
   not a dynamic executable
Image

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Thu Nov 26, 2009 7:26 am


 This program would not run under my fresh, Hardy Heron installation on my Toshiba Satellite lap top. There is neither wine nor a complete C compiler installation (among other things) on it. So, using my Acer desktop, I set about reading compiler 'squawks' and editing the source code until I got the the program to run. I moved the file to my Toshiba, and it ran there, too. 8)

 Here are the mods I had to make converting the program from the µSoft win to Linux versions. Actually, there were only a few.
  • compiler instructions: (link the math library)
    gcc -Wall -lm Design_Aid-L.c -o Design_Aid-L
  • comment this line out!
    /* #include <conio.h> */
  • change getch(); to getchar(); in four different lines
Image

Ghrey
Posts: 286
Joined: Fri Feb 15, 2008 8:41 am
Antipspambot question: 125
Location: Studio City, California
Contact:

Re: Computing volume … estimating cycle freq

Post by Ghrey » Fri Nov 27, 2009 5:34 am

Yup it is good under Hardy 8.04

==================================================================================

Volume of cylinder is 1.202641 in^3
Do you wish to add another volume ? (y or n) y

Pick a volume shape: 1. Cylinder, or 2. Frustrum of Cone ?1

Diameter (inches).375

Length (inch)16


Volume of cylinder is 1.767146 in^3
Do you wish to add another volume ? (y or n) n

The total volume is 12.394565 inches^3
The total length is 19.500000 inches^3

Thrust prediction is currently under development...

Cycle frequency is 229.021576 cps [Hz]

Slenderness ratio (length/mean_diameter) is 21.676105

...exitting...........press <Enter> key

===============================================================================

Dimensions approximated from one of my quasi jamjars.

Thanks Forrest This is a cool tool...
In the process of moving, from the glorified phone booth we had to the house we have.

No real time to work on jets, more space, no time.

Life still complicated.

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Fri Nov 27, 2009 7:31 pm


 You're welcome Ghrey. I thought it may still have some 'life' left in it.

 I'm curious how'd you launch it in Hardy? You do have wine installed?
Image

Post Reply