npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

opentetsu

v0.0.9

Published

An open source API standard for train simulators and plugins

Readme

OpenTetsu API Standard

OpenTetsu is an open source API standard for Japanese train simulators and third-party software/plugins to communicate with each other harmoniously.

Originally created to support development of Tanuden TIMS for TRAIN CREW.

[!TIP] This documentation is available in English & Japanese このドキュメントは英語版と日本語版があります。

lang - en 言語 - ja

📖 Why create a standard?

Handling and supporting data structures for multiple platforms and train simulator software can be hard and sometimes even tedious to do so.

OpenTetsu was designed with the following goals:

  • Platform & software agnostic
  • Unify data structures between simulator software
  • Data transmission over REST API (using JSON)
  • Sensible and logical data structure

🔌 Adapter

As OpenTetsu is just an API standard, you will need to use/write an adapter in order to translate the raw simulator data to OpenTetsu API.

Current list of adapters:

  • TRAIN CREW

[!NOTE] As of time of writing this, the only available adapter for OpenTetsu API is for TRAIN CREW.

If you wish to write an adapter for other simulators, please open a pull request to contribute to our list of adapters!

📂 Installation

To install OpenTetsu into your project:

  1. Go to the releases section to download the latest OpenTetsu API library DLL file.
  2. In the same section, download the adapter DLL file.
  3. Reference OpenTetsu in your project.
  4. Install required dependency Newtonsoft.Json from NuGet.
  5. All good to go!

⌨️ Usage

With adapter

This example is written using OpenTetsu.Adapters.TrainCrewAdapter for usage on TRAIN CREW.

using TrainCrew; // Library provided by the simulator
using OpenTetsu.Commons;
using OpenTetsu.Adapters;

public static class Program
{
    public static void Main
    {
        // Get Raw data from the simulator
        TrainCrewInput.Init();
        var trainCrewState = TrainCrewInput.GetTrainState();
        TrainCrewInput.RequestData(DataRequest.Signal);
        var trainCrewSignalList = TrainCrewInput.signals;

        // Convert to OpenTetsu
        OpenTetsuData convertedData = TrainCrewAdapter.FromTrainCrew(trainCrewState, trainCrewSignalList)

        ...
    } 
}

Without adapter - Bring your own adapter

Using OpenTetsu API without an adapter requires you to populate OpenTetsuData classes manually.

You can view the list of classes below and reference the code of an existing adapter to write your own adapter (Existing adapters can be found in OpenTetsu.Adapters in this repository).

  • OpenTetsu.Commons
    • Ats
      • AtsState
    • Controller
      • ControllerState
    • Route
      • Direction
      • NextStation
      • Diagram
      • Station
      • StationTimings
      • StopType
    • SignalState
      • Signal
      • SignalType
      • Transponder
    • Train
      • CarProperties
      • CarState
      • Lamps
      • LampsAts
      • NextSpeedLimit
      • SpeedLimitType
      • TrainState

Sample Data

{
  "runNumber": "573",
  "currentTime": "2024-03-23T05:19:34.233+08:00",
  "diagram": {
    "direction": "Outbound",
    "boundFor": "館浜",
    "remainingDistance": 9690.928,
    "serviceType": "普通",
    "stations": [
      {
        "distanceFromKmZero": 0,
        "index": 0,
        "name": "浜園上り本線",
        "positionName": "浜園駅入換下り",
        "stopType": "OperationStop",
        "timings": {
          "arrival": "2024-03-23T05:16:10+08:00",
          "departure": "2024-03-23T05:19:30+08:00"
        }
      },
      {
        "distanceFromKmZero": 192.4,
        "index": 1,
        "name": "浜園",
        "positionName": "浜園駅下り",
        "stopType": "PassengerStop",
        "timings": {
          "arrival": "2024-03-23T05:20:15+08:00",
          "departure": "2024-03-23T05:21:05+08:00"
        }
      },
      {
        "distanceFromKmZero": 1722.6,
        "index": 2,
        "name": "津崎",
        "positionName": "津崎駅3番下り",
        "stopType": "PassengerStop",
        "timings": {
          "arrival": "2024-03-23T05:22:45+08:00",
          "departure": "2024-03-23T05:23:10+08:00"
        }
      },
      {
        "distanceFromKmZero": 3698.2,
        "index": 3,
        "name": "虹ケ浜",
        "positionName": "虹ケ浜駅下り",
        "stopType": "PassengerStop",
        "timings": {
          "arrival": "2024-03-23T05:25:05+08:00",
          "departure": "2024-03-23T05:25:25+08:00"
        }
      },
      {
        "distanceFromKmZero": 5638.4,
        "index": 4,
        "name": "海岸公園",
        "positionName": "海岸公園駅下り",
        "stopType": "PassengerStop",
        "timings": {
          "arrival": "2024-03-23T05:27:20+08:00",
          "departure": "2024-03-23T05:27:40+08:00"
        }
      },
      {
        "distanceFromKmZero": 6958.6,
        "index": 5,
        "name": "河原崎",
        "positionName": "河原崎駅下り",
        "stopType": "PassengerStop",
        "timings": {
          "arrival": "2024-03-23T05:29:15+08:00",
          "departure": "2024-03-23T05:29:35+08:00"
        }
      },
      {
        "distanceFromKmZero": 7990.6,
        "index": 6,
        "name": "駒野",
        "positionName": "駒野駅3番下り",
        "stopType": "PassengerStop",
        "timings": {
          "arrival": "2024-03-23T05:31:00+08:00",
          "departure": "2024-03-23T05:31:30+08:00"
        }
      },
      {
        "distanceFromKmZero": 9703.6,
        "index": 7,
        "name": "館浜",
        "positionName": "館浜駅4番下り",
        "stopType": "PassengerStop",
        "timings": {
          "arrival": "2024-03-23T05:34:55+08:00",
          "departure": "2024-03-23T05:35:25+08:00"
        }
      }
    ]
  },
  "nextStation": {
    "distanceFromTrain": 179.732,
    "distanceFromKmZero": 192.4,
    "index": 1,
    "name": "浜園",
    "positionName": "浜園駅下り",
    "stopType": "PassengerStop",
    "timings": {
      "arrival": "2024-03-23T05:20:15+08:00",
      "departure": "2024-03-23T05:21:05+08:00"
    }
  },
  "trainState": {
    "carStates": [
      {
        "amperage": 482.8885,
        "bcPressure": 0,
        "carNo": 1,
        "isDoorClosed": true,
        "model": "5300",
        "properties": {
          "pantograph": false,
          "driverCab": true,
          "conductorCab": true,
          "motor": true,
          "cabDirection": "Outbound"
        }
      },
      {
        "amperage": 0,
        "bcPressure": 0,
        "carNo": 2,
        "isDoorClosed": true,
        "model": "5300",
        "properties": {
          "pantograph": true,
          "driverCab": false,
          "conductorCab": false,
          "motor": false,
          "cabDirection": null
        }
      },
      {
        "amperage": 0,
        "bcPressure": 0,
        "carNo": 3,
        "isDoorClosed": true,
        "model": "5300",
        "properties": {
          "pantograph": false,
          "driverCab": false,
          "conductorCab": false,
          "motor": false,
          "cabDirection": null
        }
      },
      {
        "amperage": 482.8885,
        "bcPressure": 0,
        "carNo": 4,
        "isDoorClosed": true,
        "model": "5300",
        "properties": {
          "pantograph": false,
          "driverCab": true,
          "conductorCab": true,
          "motor": true,
          "cabDirection": "Inbound"
        }
      }
    ],
    "consist": 4,
    "lamps": {
      "ats": {
        "brakeApplication": false,
        "inOperation": true,
        "isolated": false
      },
      "eBrake": false,
      "ebTimer": false,
      "overload": false,
      "pilot": true,
      "regenBrake": false
    },
    "mrPressure": 700,
    "nextSpeedLimit": {
      "distance": -1,
      "limit": -1,
      "type": "SpeedLimit"
    },
    "speed": 15.51307,
    "speedLimit": 25,
    "speedLimitType": "Signal",
    "gradient": -3,
    "distanceFromKmZero": 12.672
  },
  "signalStates": [],
  "atsState": {
    "stopPattern": null,
    "speed": 30,
    "state": "無表示"
  },
  "controllerState": {
    "notch": 3,
    "reverser": 1
  }
}

💾 Tanuden OSS

OpenTetsu is Open Source Software (OSS), licensed under Mozilla Public License 2.0. You may freely distribute, use and modify code provided to you in repository in accordance with MPL-2.0.

A copy of the license can be found at the root of the repository here.

💝 Support

Tanuden Discord Server | Twitter | YouTube

Tanukigawa Electric Railway | Copyright (c) 2024 Haruyuki Tanukiji.