Vehicle Cost Calculation

From PikkaWiki
(Difference between revisions)
Jump to: navigation, search
(Variable Running Cost)
(Blanked the page)
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
This page outlines some basic cost calculations I use in my vehicle sets, both pre-calculated spreadsheet numbers, and the code used for variable running costs in the game.  When designing a set in a spreadsheet, it's probably best to use standard numbers first, then fudge values for vehicles which you think need to be more or less expensive.
 
  
==Base Costs==
 
I use the following base costs:
 
*0F/4B8E for locomotive purchase, multiplier 08
 
*10/4B94 for wagon purchase, multiplier 0A
 
*2A/4C30 for locomotive running, multiplier 0B
 
*2B/4C36 for wagon running, multiplier 05
 
 
The NFO looks like this:
 
<pre>
 
  1 * 7 00 08 01 01 0F 08 08 // loco cost
 
  1 * 7 00 08 01 01 10 08 0A // wagons cost
 
  1 * 7 00 08 01 01 2A 08 0B // running cost
 
  1 * 7 00 08 01 01 2B 08 05 // wagon running cost
 
</pre>
 
 
__TOC__
 
 
=Trains=
 
==Locomotives==
 
===Purchase Cost===
 
====Steam Locomotives====
 
'''Weight in Tons * ProdCost'''
 
*''ProdCost'' is usually 0.25, but can be fudged between 0.2 and 0.3.
 
 
*Example:  [[4-6-0 Jubilee]], 126 * 0.25 = 32
 
 
====Diesel and Electric Locomotives====
 
'''Weight in Tons * ProdCost * (Horsepower / BaseHP )'''
 
*''ProdCost'' starts at 0.4 for early experimental diesels, 0.3 for 1960s production units, down to 0.22 for 21st century designs.  Again, these numbers are fudgable if you think a particular vehicle should be more or less expensive.  For electric locomotives, early vehicles are 0.5, and is down to 0.4 by the end of the century.
 
*''BaseHP'' is a "typical" power output for engines of that type/era.  For diesels, I use 2000 for models designed before 1975, 2500 from 1975 to 1990, and 3000 after 1990.  For large electrics, I use 4000.
 
 
*Example:  [[EE Type 3]], 107 * 0.3 * (1750 / 2000) = 28
 
 
===Running Cost===
 
'''(Horsepower * EffCost) / (SuspCost - MaxSpeed)'''
 
*''EffCost'' is the efficency of the design, where a higher number is worse; 5 for pre-WWI steam locomotives, down to 4.5 for the latest post-WWII designs.  4 for early diesels, with 3.75 for production diesels from the 1960s down to 3.5 for modern designs.  3 for most electrics.  Very powerful locomotives may need lower numbers and very underpowered vehicles (eg railbusses) may need higher numbers.
 
*''SuspCost'' represents the wear and tear on the traction system and track, and is a number roughly imagined as the speed at which the vehicle will fall apart.  I use 200 for steam locomotives and 300 for modern electric locomotives, 225 for first generation diesels and 250 for modern diesels.
 
 
*Example:  [[4-6-0 Jubilee]], (1550 * 4.75) / (200 - 90) = 67
 
*Example:  [[EE Type 3]], (1750 * 3.75) / (225 - 80) = 45
 
 
===Variable Running Cost===
 
====NFO: UKRS2 subroutines====
 
<pre>
 
// ============ diesel engine running cost subroutine (action 2 98)
 
 
  403 * 11 02 00 80 81 7D 01 00 FF 00 00 80  // return value in 7D 01
 
  404 * 28 02 00 81 81 7D 01 20 FF \2u/ 1A 20 \b10 \2+ 7D 01 20 FF \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value +10%, resave to 7D 01
 
  405 * 27 02 00 82 81 7D 01 20 FF \2u/ 1A 20 \b03 \2* 1A 20 \b02 \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value -33%, resave to 7D 01
 
  406 * 23 02 00 83 81 7D 01 20 FF \2u/ 1A 20 \b02 \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value -50%, resave to 7D 01
 
  407 * 23 02 00 84 81 7D 01 20 FF \2u/ 1A 20 \b03 \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value -66%, resave to 7D 01
 
  408 * 23 02 00 85 81 7D 01 20 FF \2u/ 1A 20 \b04 \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value -75%, resave to 7D 01
 
// bonuses:
 
 
// hybrid bonuses for Junker:
 
  409 * 14 02 00 82 81 C6 00 FF 01 83 00 5C 5C 82 00 // -33 becomes -50
 
  410 * 14 02 00 83 81 C6 00 FF 01 84 00 5C 5C 83 00 // -50 becomes -66
 
  411 * 14 02 00 84 81 C6 00 FF 01 85 00 5C 5C 84 00 // -66 becomes -75
 
 
  // running (+10% for running hard, -33% for running idle, -66% when stationary)
 
  412 * 18 02 00 97 82 98 20 FF \2- B4 00 FF 01
 
82 00 00 0C //running idle
 
81 00  // running hard
 
  413 * 14 02 00 97 82 B4 00 FF 01 97 00 02 FF 84 00 // stationary
 
  414 * 17 02 00 97 86 90 00 FF FF 01 97 00 00 00 00 00 84 00 // at signal/station/depot?
 
 
  // running -25% = (0 for running hard, -50% for running idle, -66% when stationary)
 
//  551 * 18 02 00 96 82 98 20 FF \2- B4 00 FF 01
 
// 83 00 00 0C //running idle
 
// 80 00  // running hard
 
//  552 * 14 02 00 96 82 B4 00 FF 01 96 00 02 FF 84 00 // stationary
 
//  553 * 17 02 00 96 86 90 00 FF FF 01 96 00 00 00 00 00 84 00 // at signal/station/depot?
 
 
// running - 50% = (-33% for running hard, -50% for running idle, -75% when stationary)
 
  415 * 18 02 00 95 82 98 20 FF \2- B4 00 FF 01
 
83 00 00 0C //running idle
 
82 00  // running hard
 
  416 * 14 02 00 95 82 B4 00 FF 01 95 00 02 FF 85 00 // stationary
 
  417 * 17 02 00 95 86 90 00 FF FF 01 95 00 00 00 00 00 85 00 // at signal/station/depot?
 
 
// position (50% for > 0)
 
  418 * 14 02 00 97 81 40 00 FF 01 97 00 00 00 95 00
 
 
  419 * 27 02 00 22 81 7D 01 20 FF \2u/ 1A 20 \b4 \2* 1A 20 \b3 \2s 1A 00 \b01 01 97 00 00 00 97 00 // ai run cost - 75%
 
  420 * 14 02 00 97 81 43 10 FF 01 22 00 01 01 97 00 // AI company?
 
 
// base calculations:
 
// add the base, max 220, resave to 7D 01
 
  421 * 27 02 00 97 81 1C 20 FF \2+ 7D 01 20 FF \2u< 1A 20 \b220 \2s 1A 00 \b01 01 97 00 00 00 97 00
 
//  add age of loco\2
 
  422 * 26 02 00 97 85 C0 60 FF FF 00 00 \w730 \2+ 1C 00 FF FF 01 97 00 00 00 00 00 97 00
 
// (low) add 1 per 3 years after 1970 up to max 20
 
  423 * 20 02 00 94 81 01 60 FF CE 02 \2u< 1A 00 \b20 01 97 00 00 00 97 00
 
// (medium) add 1 per 2 years after 1970 up to max 30
 
  424 * 20 02 00 96 81 01 60 FF CE 02 \2u< 1A 00 \b30 01 97 00 00 00 97 00
 
// (high) add 1 per year after 1970 up to max 50
 
  425 * 20 02 00 98 81 01 60 FF CE 01 \2u< 1A 00 \b50 01 97 00 00 00 97 00
 
  426 * 19 02 00 98 81 7D 01 00 FF 02 94 00 00 \b50 96 00 \b51 \b75 98 00 // add different fuel costs based on original runcost
 
 
  427 * 14 02 00 97 81 1A 00 00 01 97 00 00 00 97 00 // set 1C to 0
 
  428 * 14 02 00 98 81 01 00 FF 01 97 00 00 \b50 98 00
 
 
// the base loco running cost is stored in 7D 01.
 
 
// =========== end of diesel engine running cost subroutine
 
 
// ============ steam engine running cost subroutine (action 2 97)
 
  429 * 11 02 00 80 81 7D 01 00 FF 00 00 80  // return value in 7D 01
 
  430 * 27 02 00 81 81 7D 01 20 FF \2u/ 1A 20 \b04 \2* 1A 20 \b03 \2s 1A 00 \b01 01 80 00 00 00 80 00 //  -25%, resave to 7D 01
 
  431 * 23 02 00 82 81 7D 01 20 FF \2u/ 1A 20 \b02 \2s 1A 00 \b01 01 80 00 00 00 80 00 // -50%, resave to 7D 01
 
// bonuses:
 
  432 * 14 02 00 97 82 B4 00 FF 01 80 00 02 FF 82 00 // stationary
 
  433 * 14 02 00 96 82 B4 00 FF 01 81 00 02 FF 82 00 // stationary
 
 
  434 * 17 02 00 97 86 90 00 FF FF 01 97 00 00 00 00 00 82 00 // at signal/station/depot?
 
  435 * 17 02 00 96 86 90 00 FF FF 01 96 00 00 00 00 00 82 00 // at signal/station/depot?
 
 
// position (-25% for > 0)
 
  436 * 14 02 00 97 81 40 00 FF 01 97 00 00 00 96 00
 
 
  437 * 27 02 00 22 81 7D 01 20 FF \2u/ 1A 20 \b4 \2* 1A 20 \b3 \2s 1A 00 \b01 01 97 00 00 00 97 00 // ai run cost - 75%
 
  438 * 14 02 00 97 81 43 10 FF 01 22 00 01 01 97 00 // AI company?
 
 
// base calculations:
 
// add the base, max 220, resave to 7D 01
 
  439 * 27 02 00 97 81 1C 20 FF \2+ 7D 01 20 FF \2u< 1A 20 \b220 \2s 1A 00 \b01 01 97 00 00 00 97 00
 
//  add age of loco\3
 
  440 * 26 02 00 97 85 C0 60 FF FF 00 00 \w1095 \2+ 1C 00 FF FF 01 97 00 00 00 00 00 97 00
 
// add 1 per 2 years after 1940 up to max 40
 
  441 * 20 02 00 96 81 01 60 FF EC 02 \2u< 1A 00 \b40 01 97 00 00 00 97 00
 
  442 * 14 02 00 97 81 1A 00 00 01 97 00 00 00 97 00 // set 1C to 0
 
  443 * 14 02 00 97 81 01 00 FF 01 97 00 00 \b20 96 00
 
 
// the base loco running cost is stored in 7D 01.
 
 
// =========== end of steam engine running cost subroutine
 
 
  // ============ electric engine running cost subroutine (action 2 96)
 
 
  444 * 11 02 00 80 81 7D 01 00 FF 00 00 80  // return value in 7D 01
 
  445 * 28 02 00 81 81 7D 01 20 FF \2u/ 1A 20 \b10 \2+ 7D 01 20 FF \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value +10%, resave to 7D 01
 
  446 * 27 02 00 82 81 7D 01 20 FF \2u/ 1A 20 \b03 \2* 1A 20 \b02 \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value -33%, resave to 7D 01
 
  447 * 23 02 00 83 81 7D 01 20 FF \2u/ 1A 20 \b02 \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value -50%, resave to 7D 01
 
  448 * 23 02 00 85 81 7D 01 20 FF \2u/ 1A 20 \b04 \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value -75%, resave to 7D 01
 
// bonuses:
 
 
  // running (+10% for running hard, -33% for running idle, -75% when stationary)
 
  449 * 18 02 00 94 82 98 20 FF \2- B4 00 FF 01
 
82 00 00 0C //running idle
 
81 00  // running hard
 
  450 * 14 02 00 94 82 B4 00 FF 01 94 00 02 FF 85 00 // stationary
 
  451 * 17 02 00 94 86 90 00 FF FF 01 94 00 00 00 00 00 85 00 // at signal/station/depot?
 
 
// running - 50% = (-33% for running hard, -50% for running idle, -75% when stationary)
 
  452 * 18 02 00 95 82 98 20 FF \2- B4 00 FF 01
 
83 00 00 0C //running idle
 
82 00  // running hard
 
  453 * 14 02 00 95 82 B4 00 FF 01 95 00 02 FF 85 00 // stationary
 
  454 * 17 02 00 95 86 90 00 FF FF 01 95 00 00 00 00 00 85 00 // at signal/station/depot?
 
 
// position (50% for > 0)
 
  455 * 14 02 00 95 81 40 00 FF 01 94 00 00 00 95 00
 
  456 * 30 02 00 95 81 C6 00 FF 05                          // skip this check for EMUs
 
  94 00 76 77                                                      // Met Cam, southern
 
  94 00 7B 7B                                                      // renewal
 
  94 00 67 69                                                      // AM10, 321, Atrain
 
  94 00 7A 7A                                                      // networker
 
  94 00 80 80                                                      // electrostar
 
  95 00
 
 
 
 
 
  457 * 27 02 00 22 81 7D 01 20 FF \2u/ 1A 20 \b4 \2* 1A 20 \b3 \2s 1A 00 \b01 01 95 00 00 00 95 00 // ai run cost - 75%
 
  458 * 14 02 00 95 81 43 10 FF 01 22 00 01 01 95 00 // AI company?
 
 
// base calculations:
 
// add the base, max 220, resave to 7D 01
 
  459 * 27 02 00 95 81 1C 20 FF \2+ 7D 01 20 FF \2u< 1A 20 \b220 \2s 1A 00 \b01 01 95 00 00 00 95 00
 
//  add age of loco\2
 
  460 * 26 02 00 95 85 C0 60 FF FF 00 00 \w730 \2+ 1C 00 FF FF 01 95 00 00 00 00 00 95 00
 
  461 * 14 02 00 96 81 1A 00 00 01 95 00 00 00 95 00 // set 1C to 0
 
 
// the base loco running cost is stored in 7D 01.
 
 
// =========== end of electric engine running cost subroutine
 
 
// =========== electric engine power subroutine (95)
 
  462 * 12 02 00 80 85 7D 01 00 FF FF 00 00 80 // return base value
 
  463 * 22 02 00 81 85 7D 01 20 FF FF \2u/ 1A 20 \w03 \2* 1A 00 \w02 00 00 80 // return base value -33%
 
//  199 * 17 02 00 83 85 7D 01 20 FF FF \2u/ 1A 00 \w02 00 00 80 // return base value -50%
 
 
// position (-33%)
 
  464 * 14 02 00 95 81 40 00 FF 01 80 00 00 00 81 00
 
  // the base loco power is stored in 7D 01.
 
 
  // =========== end of electric engine power subroutine 
 
</pre>
 
====NFO: UKRS2 locomotive hook====
 
<pre>
 
// RUNNING COSTS (subroutine 97) =============
 
4858 * 11 02 00 22 81 7E 97 00 FF 00 00 80 // gogo gadget subroutine
 
  //                                vv
 
4859 * 18 02 00 21 81 1A 20 \b33 \2s 1A 00 \b01 01 22 00 00 00 22 00 // store the running cost
 
4860 * 14 02 00 21 81 10 00 FF 01 21 00 0D 0D 11 00
 
4861 * 14 02 00 11 81 0C 00 FF 01 21 00 36 36 11 00 // cb36
 
</pre>
 
 
 
[[Category:NFO]]
 

Latest revision as of 02:30, 9 February 2013

Personal tools