Elvas Tower: Looking for FCalC code - Elvas Tower

Jump to content

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Looking for FCalC code Rate Topic: -----

#1 User is offline   NickonWheels 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 327
  • Joined: 05-December 19
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 01 April 2020 - 04:11 AM

Hi,

I´m looking for the program code of FCalC, don´t know whether it is used to be included when downloadable from trainsim or not. Otherwise it´s not that possible to understand the internal workings (calculations) of it but I want to make an up-to-date version of it. Any davice on how to where to get could help.

Nick

#2 User is offline   R H Steele 

  • Executive Vice President
  • Group: Status: R.I.P. or just Retired
  • Posts: 3,562
  • Joined: 14-March 13
  • Gender:Male
  • Location:known universe
  • Simulator:Open Rails
  • Country:

Posted 01 April 2020 - 09:18 AM

Hi Nick, of course you are going to abide by the "Terms and Limitations" found the in documents that are provided with FCalc2. Also there is a document entitled "Methodology and Theory of FCalc 2.doc" that may provide you with valuable insight into how the equations work. As to the code...not in my skill set.





#3 User is offline   slipperman 

  • Foreman Of Engines
  • Group: Posts: Contributing Member
  • Posts: 855
  • Joined: 09-February 12
  • Gender:Male
  • Location:North Nottinghamshire
  • Simulator:MSTS & ORTS
  • Country:

Posted 01 April 2020 - 09:38 AM

Hi Nick,
Although it's shown as FCALC v2.0, the version available from UKTS appears to contain earlier files than the one available from trainsim.com. However, probably of more importance to you, the UKTS version does contain the source code - Fcalc_20.c. If you are a member, it may be downloaded as UKTS_10104_FCalc_20.

You should read the "Terms & Limitations" in the readme from the UKTS version, but you may be interested in this one :

Quote

2)You may use the source code as part of another program provided I am given credit for
the idea and the use of my source code. I also require that you send me the final
version of your program and source code so that I can verify that it does the
calculations correctly.


Cheers,
Ged

#4 User is offline   NickonWheels 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 327
  • Joined: 05-December 19
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 01 April 2020 - 09:40 AM

Thanks Ged, I´m a member of UKTS indeed. I´ll try this...

#5 User is offline   slipperman 

  • Foreman Of Engines
  • Group: Posts: Contributing Member
  • Posts: 855
  • Joined: 09-February 12
  • Gender:Male
  • Location:North Nottinghamshire
  • Simulator:MSTS & ORTS
  • Country:

Posted 01 April 2020 - 10:03 AM

Hi Nick,
Unfortunately, neither of the versions of FCALC in the UKTS download (DOS & Windows) will work with 64-bit Windows, being 16-bit programs.

The trainsim.com version does work in 64-bit Windows. I wouldn't think the actual source code will be different, only the compilation of it into the executable file, but I know nothing about C!

Cheers,
Ged

#6 User is offline   NickonWheels 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 327
  • Joined: 05-December 19
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 01 April 2020 - 11:52 AM

View Postslipperman, on 01 April 2020 - 10:03 AM, said:

Unfortunately, neither of the versions of FCALC in the UKTS download (DOS & Windows) will work with 64-bit Windows, being 16-bit programs.


Oh, another reason as to why a replacement is needed.

#7 User is offline   R H Steele 

  • Executive Vice President
  • Group: Status: R.I.P. or just Retired
  • Posts: 3,562
  • Joined: 14-March 13
  • Gender:Male
  • Location:known universe
  • Simulator:Open Rails
  • Country:

Posted 01 April 2020 - 01:03 PM

View PostNickonWheels, on 01 April 2020 - 11:52 AM, said:

Oh, another reason as to why a replacement is needed.
No, not really, you overlooked the fact that Ged said

Quote

The trainsim.com version does work in 64-bit Windows.

I am using FCalc2 on 64 bit WIN7 professional OS...works quite well and more importantly I trust Mr. Realmuto's methodology and transparency in the programs documents.
Why not just develop your own code and program independent of any previous efforts and see how that develops. Why the need to dissect something already being used and well regarded? Just invent something that is uniquely yours. Put it out there and let the work be judged on its' own merits.

#8 User is offline   Genma Saotome 

  • Owner Emeritus and Admin
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin Group
  • Posts: 15,653
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 01 April 2020 - 06:00 PM

Beating a dead horse: The .eng and .wag files should hold the parameter values that are inputs to the several Davis formulas and the OR program should compute the A, B, and C values that Fcalc produces. The Davis formulas don't ever change (tho new ones are occasionally created) so there is no real risk of this adding to code maintenance time.

Several of these parameters could be used in other functions or features (e.g., MassEmpty(), MassLoaded()).

Some time ago I posted to the file library an experimental spreadsheet that produces parameters for .wags. In it are formulas for the original Davis formula. Find the A, B, C output cells and follow the references back to wher ethe computation occurs.

#9 User is offline   NickonWheels 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 327
  • Joined: 05-December 19
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 02 April 2020 - 01:00 AM

View PostR H Steele, on 01 April 2020 - 01:03 PM, said:

Why not just develop your own code and program independent of any previous efforts and see how that develops. Why the need to dissect something already being used and well regarded? Just invent something that is uniquely yours. Put it out there and let the work be judged on its' own merits.


I´m indeed developing my own calculation of friction, the thing is just ORTS using the old MSTS friction settings is a little bit more faithful in regards to starting friction than Davis implementations. As you can read here I actually made a working code extension were you can simply enter starting friction and merge speed, but the downloadable ORTS code has (at least this is what I encountered) a built-in bug seemingly decreasiong usable RAM space i. e. a nearly objectless route works fine but quite intensive routes crash immediately after loading. Such an extension could be useful for many although this might be subjective. Using FCalc extensively nowadays looks like a mediocre compromise to me, but not knowing how this program works internally makes realistic values even harder to come by.

#10 User is offline   NickonWheels 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 327
  • Joined: 05-December 19
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 02 April 2020 - 04:29 AM

Well, I have read Methodology and Theory of FCalc 2.txt to the best of my understanding. FCalC puts out five values termed C1, E1, V2, C2, E2. I noticed C1 basicly being Davis A, E1 being something to differenciate between bearing types and V2 being merge speed. But the document does not include an explanation on how the values of C2 and E2 got calculated, but this is the crucial part here. That one explanation on C2 puts out neative values, so whether it´s false or Imissed the clue behind it.

#11 User is offline   NickonWheels 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 327
  • Joined: 05-December 19
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 02 April 2020 - 07:14 AM

FCalc 2.0 Standard Freight.xls does contain the equation for C2, but uses fixed values for E2, which the actual program does not. Still something missing...

#12 User is offline   dajones 

  • Open Rails Developer
  • Group: Posts: Contributing Member
  • Posts: 433
  • Joined: 27-February 08
  • Gender:Male
  • Location:Durango, CO
  • Country:

Posted 02 April 2020 - 09:58 AM

Based on the description in the document, it looks like E2 was calculated numerically to minimize the squared difference between the davis equation and the MSTS equation. In other words, pick a value for E2. Loop over all integer speeds from 5 to 80 mph and calculate the difference between the davis equation and the MSTS equation. Sum the square of this difference over all speeds. Then pick a different value for E2 and repeat the calculation. Select the E2 that gives the smaller sum. Repeat until the sum doesn't change too much.

The hard part is picking good E2 values. I'm not sure what method the fcalc code used, but I would probably use golden section search.

Doug

#13 User is offline   NickonWheels 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 327
  • Joined: 05-December 19
  • Gender:Male
  • Simulator:ORTS
  • Country:

Posted 02 April 2020 - 10:41 AM

Thanks for your advise

I managed to download the source code from UKTS and now looking through it, hope I can find the missing pieces.

#14 User is offline   Genma Saotome 

  • Owner Emeritus and Admin
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin Group
  • Posts: 15,653
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 02 April 2020 - 11:27 AM

View PostNickonWheels, on 02 April 2020 - 04:29 AM, said:

Well, I have read Methodology and Theory of FCalc 2.txt to the best of my understanding. FCalC puts out five values termed C1, E1, V2, C2, E2.


Those are MSTS parameters, not Davis parameters. In the early stages of creating FCalc OR was not on the scene and the objective was values for MSTS's Friction() parameter. That is NOT the same as Davis -- close, but different.

AFAIK what you want to produce are the A, B, C values going into OR.

#15 User is offline   ebnertra000 

  • Superintendant
  • Group: Posts: Elite Member
  • Posts: 1,258
  • Joined: 27-February 17
  • Gender:Male
  • Location:East-Central Minnesota
  • Simulator:OR/TSRE
  • Country:

Posted 02 April 2020 - 12:36 PM

I'm pretty sure there is an option in FCalc specifically for Davis Coefficients. Unless that's not in all versions...that could be

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users