Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - satan165

Pages: [1]
1
QB64 Discussion / Re: assistance with 'subscript out of range' error
« on: April 25, 2021, 09:13:13 pm »
Quote
I include my changes to the original code below, it shows the 'I' in lower case, which was what caught my eye. I also added some comments that highlight those lines that are to be changed if altering the 1986 standards. Happy bug hunting...

Amazing - thank you so much!

Very good eye on the 'I' (pun intended).  Whatever the programmer was trying to accomplish wasn't successful, but that statement didn't crash the whole program, so I guess it is just dead weight.

After running the program about a million times, I figured out that the suitable responses for 'predicted coke stability' is a number between 1-20.  I still cannot fathom what unit of measurement that is in.  I have slightly more knowledge about coke making than programming but it still eludes me.  I spent about an hour messing with formatting to get it to output a cleaner text file, but there are still some miscalculations in there.  Some of the output is a percentage like 2400% and that doesn't make sense. But perhaps this program never actually worked and was only in the testing stages.  I think that whoever wrote this was someone who probably had a degree in chemical engineering and perhaps learned BASIC as a hobby so I'll give them kudos for creating something that sort of worked.

I think it is pretty cool that I found a hardcopy from 30 years ago in an abandoned building and got it to run.  Whatever issues it has I'm going to guess it always had, I'm thrilled that it runs and does seem to calculate some/most things correctly.

v2.0 is from 1991 and I recognize that some of the code is the same but via 48 'DATA' statements (and 48 REM statements, of course) it has all the quality data for 48 coals already written into the program so you don't have to input it.  Will be interesting to see how/if this works.  If it does I'll share the code and an output file if anyone is interested.

OldMoses - thank you so much for taking the time to look at this messy code, I really appreciate it!

2
QB64 Discussion / Re: assistance with 'subscript out of range' error
« on: April 25, 2021, 06:54:13 pm »
Just got home and immediately went back to just inputting data.  Honestly, sorry for wasting everyone's time on checking code when I just didn't spend enough time trying different input values.

I got it to output on the first try

number of coals = 2
coal quality data = 5,50,10,50,15,16,3,15,12000
petcoke = no
predicted coke stability = 4

so as I just said an hour ago, if I can get the program to calculate and output the data, I am satisfied.  now I can have some fun fixing the formatting and messing around and trying to understand the upper/lower limits for these values

I think I will work on the second set of code I found, I may return with some questions on the missing bits there

you guys are awesome - thanks for humoring an idiot like me.  If you are interested in the iron making industry, or urban exploration, or chicago history you can check out my site www.acmecoke.com . ill be putting up a post about this program in the next week or so and ill be sure to give the forum a shout out.

thanks again, so much! made my day. 

3
QB64 Discussion / Re: assistance with 'subscript out of range' error
« on: April 25, 2021, 05:59:19 pm »
Quote
Line 45 :The question is asking for 10 data items (1-Cost per Ton, 2-%wet Petcoke, 3-%coal H2O ... 10-BTU/LB)
Line 50 : The arrays being filled - 1 Cost/ton at C(n1), 2 - %Wet Petcoke at A(N,1), 3- %coal H2O at (B(n,5) but as you go along there are only 9 array items. I'm not sure where the BTU's per pound is being used. Likely there but it's not jumping out for me.

There are nine.  I added numbers to each to illustrate

(1) COST/TON, (2) %WET COAL IN BLEND, (3) %COAL H20, AND (DRY BASIS) (4) %FIXED CARBON, (5) %ASH, (6) %VOLATILE MATTER, (7) %SULFUR, (8) %OXYGEN, (9) BTU/LB

The "And (Dry Basis)" is distinguishing the remaining 5 variables as being measured while dry.  Superfluous comment for sure.

Quote
If answer to "the number of coals in the blend" can exceed 20 you should generate the range error limit.
In reality, I think it is doubtful that anyone would have a coal blend of more than 4-5 types.

You may be right that there is a small window of acceptable answers for 'S' I perhaps I just need to continue to experiment with that

Quote
Because this old fashion BASIC program doesn't check the input given from user.
Changing the input I have got different errors at runtime at different lines of code.
Cause it is a simpler huge math task, you can port those calculations into a spreedsheet like excel or similar.

I agree completely.  As far as recreating the program in Excel, I have done this once before already.  I found some documentation that described a 'program' but I did not have the code, but it was simpler so I just built it in Google Sheets https://docs.google.com/spreadsheets/d/12MwtYzWKHrRA_lldHyX30KwqV4_MCTDckFx7eApC8wg/edit?usp=sharing

I think I may be out of my depth in trying to institute the changes you described but perhaps I will try.  If I can get this program to output finished data one time, I will be satisfied.

I actually found a second version of this program (another hard copy), but that one is a bit better because rather than asking you to input the nine variables, it simply lets you type the name of the coal, the program already has the nine variables for a variety of coals so no need to input manually.  However, that hard copy was not printed correctly, so some of the longer lines are cut off.  I may try to input it anyways and figure out what the rest of the missing line is.

Thank you all for your patience and help, if anyone can output a file and get the program to run all the way through, or can just help in specifying with the lower/upper limits for the input on these variables is please share.

Thank you all so much.

4
QB64 Discussion / Re: assistance with 'subscript out of range' error
« on: April 25, 2021, 04:14:06 pm »
Quote
I am looking to not have to answer a million questions about coal which I know nothing about, just to check out some code for you.

I apologize - I thought you were referring to the code itself. 

I was remiss not to have offered this data initially....in my mind it didn't matter, it seemed that the program would crash regardless of what I entered.

For the first question the program asks for the number of coals in the blend.  Answer '2'.

The following question asks for nine values regarding the coal quality.  Here are some suitable values (these are based on real world values, so I assume the code will accept these):
5,50,10,50,15,16,3,15,12000

the unit of measurement for 'S' is not given by the program, but typically this is expressed as a % (coal stability factor) so 50 should work

Quote
If you input S too high or low, easy to get out of bounds error, what is safe S?
what do you see as a safe value based on the code?

Quote
I was thinking the out of range error could be associated with the value being inputted for S
i tried a number of different values but the program crashed regardless.  i did not consider that my input is what was crashing it, i assumed it was a problem with the code but you may be right.  What range do you see is acceptable based on the code?

I am not at home right now to continue to test but I will later today for sure.  if you are able to get the program to run beyond line 44 let me know what values you used.

Thank you both so much!


5
QB64 Discussion / Re: assistance with 'subscript out of range' error
« on: April 25, 2021, 03:30:15 pm »
I’m not sure what you are looking for, I must not understand because if I had the “correct solution” I would not need any help.

I guess what I am asking is for someone to review the code, if there is a glaring error and can point me in that direction it would be helpful.

6
QB64 Discussion / Re: assistance with 'subscript out of range' error
« on: April 25, 2021, 02:30:37 pm »
sorry i dont know what that means, but i did attach the entire program to my initial post

7
QB64 Discussion / assistance with 'subscript out of range' error
« on: April 25, 2021, 01:56:06 pm »
   Hello.  I am historian/archeologist in Chicago studying an abandoned coke plant (coke is a processed version of coal used in iron making). 

I have been exploring the laboratory and came across the hard copy of what I recognized as a BASIC program used to evaluate coal. 

I am far from a computer programmer but I figured out enough to input the whole thing into Notepad, then I got it to run on  QB45 on Dosbox.  I used that to debug my many typos.  Then I installed QB64 which is obviously much easier to work with.

The first issue I had was that the program was written to output it's results to a printer.  I don't have a printer and even if I did, that isn't efficient.  So after some experimentation I was able to make the changes so that it would output to a file instead.  That seems to be working well now.  The program does start up and it is starting to output to the file before it crashes.

I am getting another error and this one is a bit over my head.  I am getting a 'subscript out of range' error on the following lines:

   
Code: QB64: [Select]
  1. 210 E(1, 5) = E(1, 5) + A(N, 1) * B(N, 5) / 100
  2.    220 E(1, 1) = E(1, 1) + A(N, 1) * ((100 - B(N, 5)) / 100) * B(N, 1) / 100
  3.    230 E(1, 2) = E(1, 2) + A(N, 1) * ((100 - B(N, 5)) / 100) * B(N, 2) / 100
  4.    240 E(1, 3) = E(1, 3) + A(N, 1) * ((100 - B(N, 5)) / 100) * B(N, 3) / 100
  5.    250 E(1, 4) = E(1, 4) + A(N, 1) * ((100 - B(N, 5)) / 100) * B(N, 4) / 100
  6.    260 E(1, 21) = E(1, 21) + A(N, 1) * ((100 - B(N, 5)) / 100) * B(N, 21) / 100
  7.    270 E(1, 22) = E(1, 22) + A(N, 1) * ((100 - B(N, 5)) / 100) * B(N, 22) / 100

I suspect this is related to the way the 'E' variable is defined in the DIM statement on line 10:

Code: QB64: [Select]
  1. 10 Dim A(40, 40), E(20, 50), B(20, 50), Z(20, 20), C(20, 20), A$(50), B$(50)

I saw another post where someone got this error and the 'OPTION _EXPLICIT" command was recommended.  I tried that, but then other variables start to have issues.

I have attached the entire program and I plan on scanning the hard copy.  I don't see any typo here so hopefully it isn't something that dumb.

I am way outside my depth and quietly proud that I made it this far.  If anyone thought they'd like to help that would be much appreciated.  Thank you very much.

Pages: [1]