<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta charset="utf-8" /> <title>Simutrans_CalcBasic</title> <style type="text/css"> body {font-family: sans-serif; line-height: 1.2em; } h3 {color:#ffffff; border-top:dotted 1px #527c53; border-bottom:dotted 1px #527c53; padding:2px;width:90%; background-color:#586338;} .orange {color:#089903;font-size:1.2em;background-color:#daf7d9;} th {padding:4px;} label {color:#586338;} input {border:solid 1px #009999;} select {border:solid 1px #015A03;color:#993333;font-size:1.1em;} </style> </head> <body> <div> <h3>Simutrans Calc Vehicle for Version 2.1</h3> <form> <table> <tbody> <tr> <th><label>Waytype</label></th> <td> <select name="waytype" onchange="calculate()"> <option value="track">track</option> <option value="road">road</option> <option value="water">water</option> <option value="air">air</option> <option value="tram_track">tram-track</option> <option value="maglev_track">maglev-track</option> <option value="monorail_track">monorail-track</option> <option value="narrowgauge_track">narrowgauge-track</option> </select> </td> </tr> <tr> <th><label>Power</label></th> <td><input name="power" type="text" onchange="calculate()" /></td> </tr> <tr> <th><label>Speed</label></th> <td><input name="speed" type="text" onchange="calculate()" /></td> </tr> <tr> <th><label>Weight</label></th> <td><input name="weight" type="text" onchange="calculate()" /></td> </tr> <tr> <th><label>Payload</label></th> <td><input name="payload" type="text" onchange="calculate()" /></td> </tr> <tr> <th><label>Inro Year</label></th> <td><input name="introyear" type="text" onchange="calculate()" value="1900" /></td> </tr> <tr> <th><label>Earnings</label></th> <td> <select name="earnings" type="text" onchange="calculate()"> <option value="0">0 (no payload)</option> <option value="10" selected="selected">10 (e.g. passengers, post, wood)</option> <option value="12">12 (e.g. coal )</option> <option value="15">15 (e.g. oil )</option> <option value="20">20 (e.g. general cargo, cattle)</option> <option value="30">30 (steel)</option> <option value="60">60 (cars)</option> </select> </td> </tr> <tr> <tr> <th colspan="2"><hr /></th> </tr> <tr> <th><label>Cost purchase</label></th> <td><input name="cost_purchase" type="text" readonly="readonly" /> ct</td> <td><input name="cost_purchasesum" type="text" readonly="readonly" /> st</td> </tr> <tr> <th></th> <td><input name="cost_purchase2" type="text" readonly="readonly" /> st</td> </tr> <tr> <th><label>Running cost</label></th> <td><input name="running_cost" type="text" readonly="readonly" /> ct</td> <td><input name="running_costsum" type="text" readonly="readonly" /> ct</td> </tr> <tr> <th></th> <td><input name="running_cost2" type="text" readonly="readonly" /> st</td> </tr> <tr> <th><label>Fix cost</label></th> <td><input name="fix_cost" type="text" readonly="readonly" /> ct</td> <td><input name="fix_costsum" type="text" readonly="readonly" /> ct</td> </tr> </tbody> </table> </form> </div> <script type="text/javascript"> function calculate() { var waytype = document.forms[0].waytype.value; var power = document.forms[0].power.value; var speed = document.forms[0].speed.value; var weight = document.forms[0].weight.value; var introyear = document.forms[0].introyear.value; var payload = document.forms[0].payload.value; var earnings = document.forms[0].earnings.value; var cost_purchase1 = (power * speed * 100); var cost_purchase2 = (weight * 10000); var cost_purchase3 = (payload * speed * 150 * earnings); var cost_purchase = cost_purchase1 + cost_purchase2 + cost_purchase3/2; var cost_purchase_sum = (cost_purchase1/100).toFixed(0) + " + " + (cost_purchase2/100).toFixed(0) + " + " + (cost_purchase3/200).toFixed(0); if (waytype == 'air') { cost_purchase = payload * speed * 2 * 150 * earnings; cost_purchase_sum = cost_purchase.toFixed(1); } if (waytype == 'water') { var cost_purchase = cost_purchase1 + cost_purchase3/2; var cost_purchase_sum = (cost_purchase1/100).toFixed(1) + " + " + (cost_purchase3/200).toFixed(1); } var speed_kor = (speed * Math.max(30,(2040-introyear))) / 100; if (waytype == 'air') speed_kor = speed_kor / 4; var running_costs = ((speed_kor * speed_kor) / 6) / 150; if (waytype == 'air') var running_costl = (power * speed_kor * speed_kor) / 5000000; else var running_costl = (power * speed_kor) / 1000; var running_costw = (weight * speed_kor * speed_kor) / 30000; var running_costp = payload * earnings * 15 / 100; var running_cost = running_costs + running_costl + running_costw + running_costp; var running_cost_sum = running_costs.toFixed(1) + " + " + running_costl.toFixed(1) + " + " + running_costw.toFixed(1) + " + " + running_costp.toFixed(1); var fix_costp = (payload * speed * 150 * earnings * 2 / (12 * 400)); var fix_cost = fix_costp + running_costs * 25 + running_costl * 25 + running_costw * 25; var fix_cost_sum = fix_costp.toFixed(0) + " + " + (running_costs *25).toFixed(0) + " + " + (running_costl *25).toFixed(0) + " + " + (running_costw *25).toFixed(0); document.forms[0].cost_purchase.value = cost_purchase.toFixed(0); document.forms[0].running_cost.value = running_cost.toFixed(4); document.forms[0].fix_cost.value = fix_cost.toFixed(4); document.forms[0].cost_purchase2.value = (cost_purchase / 100).toFixed(2); document.forms[0].running_cost2.value = (running_cost / 100).toFixed(2); document.forms[0].cost_purchasesum.value = cost_purchase_sum; document.forms[0].running_costsum.value = running_cost_sum; document.forms[0].fix_costsum.value = fix_cost_sum; } </script> </body> </html>
empty