OpenTetsu API Standard
The OpenTetsu API Standard is used by Tanuden as a standardized way to accept and transmit data across systems.
You may use the OpenTetsu API standard in your own software, free of charge.
Why create a standard?
The API standard is designed to be platform agnostic and most importantly, to unify data structures across addons and plugins for train simulators. Although originally designed for TrainCrew, this standard is sufficient and flexible for Japanese train simulators.
How does this differ from TrainCrew's API?
The API provided by TrainCrew is comprehensive, however, it lacks a clear naming convention and data structure (e.g. some variables are returned as empty strings instead of being null). OpenTetsu provides a structure in which variables are nested in groups and variable naming is more predictable.
API Example
{
"atsState": {
"classType": "普通",
"speed": 112.0,
"state": "無表示"
},
"controllerState": {
"notch": -8,
"reverser": 1
},
"currentTime": "13:05:25.8310000",
"diagram": {
"direction": "outbound",
"boundFor": "館浜",
"remainingDistance": 4292.4,
"serviceType": "普通",
"stations": [
{
"distanceFromKmZero": 0.0,
"index": 0,
"name": "虹ケ浜",
"positionName": "虹ケ浜駅下り",
"stopType": 0,
"timings": {
"arrival": "13:05:35",
"departure": "13:05:55"
}
},
{
"distanceFromKmZero": 1940.2,
"index": 1,
"name": "海岸公園",
"positionName": "海岸公園駅下り",
"stopType": 0,
"timings": {
"arrival": "13:07:50",
"departure": "13:08:10"
}
},
{
"distanceFromKmZero": 3260.3,
"index": 2,
"name": "河原崎",
"positionName": "河原崎駅下り",
"stopType": 0,
"timings": {
"arrival": "13:09:45",
"departure": "13:10:05"
}
},
{
"distanceFromKmZero": 4292.4,
"index": 3,
"name": "駒野",
"positionName": "駒野駅3番下り",
"stopType": 0,
"timings": {
"arrival": "13:11:30",
"departure": "13:12:00"
}
}
]
},
"nextStation": {
"distance": 0.0,
"index": 0,
"isStopping": true,
"name": "虹ケ浜"
},
"runNumber": "1261",
"trainState": {
"carStates": [
{
"amperage": 0.0,
"bcPressure": 440.0,
"carNo": 1,
"isDoorClosed": false
},
{
"amperage": 0.0,
"bcPressure": 440.0,
"carNo": 2,
"isDoorClosed": false
},
{
"amperage": 0.0,
"bcPressure": 440.0,
"carNo": 3,
"isDoorClosed": false
},
{
"amperage": 0.0,
"bcPressure": 440.0,
"carNo": 4,
"isDoorClosed": false
}
],
"consist": 4,
"lamps": {
"ats": {
"brakeApplication": false,
"inOperation": true,
"isolated": false
},
"eBrake": true,
"ebTimer": false,
"overload": false,
"pilot": false,
"regenBrake": false
},
"mrPressure": 700.0,
"nextSpeedLimit": {
"distance": -1.0,
"limit": -1.0,
"type": "speedlimit"
},
"speed": 0.0,
"speedLimit": 110.0,
"speedLimitType": "speedlimit"
},
"signalStates": [
{
"name": "下り閉塞59",
"type": "standard",
"phase": "G",
"distance": 11.93904,
"transponders": [
{
"type": "SigIfStop",
"speedlimit": 45.0,
"distance": -151.1066
},
{
"type": "SigIfStop",
"speedlimit": 0.0,
"distance": -36.10801
},
{
"type": "Signal",
"speedlimit": 0.0,
"distance": 3.892306
},
{
"type": "SigIfStop",
"speedlimit": 30.0,
"distance": -86.10764
}
]
}
]
}最終更新