Skip to content

Instantly share code, notes, and snippets.

@Nithanim
Created August 8, 2021 11:40
Show Gist options
  • Save Nithanim/9706045a7e85399c67373915d65aeafc to your computer and use it in GitHub Desktop.
Save Nithanim/9706045a7e85399c67373915d65aeafc to your computer and use it in GitHub Desktop.
File format of hybrid tunnel locomotive log file
//------------------------------------------------
//--- 010 Editor v10.0.2 Binary Template
//
// File: LO_6827.LOG
// Authors:
// Version:
// Purpose: Log file format of something like this hybrid tunnel locomotive: https://www.schoema.de/media/schoema_datenblatt_hybrid-tunnellokomotiven_en.pdf
// Category:
// File Mask:
// ID Bytes:
// History:
//------------------------------------------------
struct FileHeader1 {
byte unknown1[24];
ushort nEntries;
byte u[256-24-2];
} fileHeader1;
struct FileHeader2 {
// the second header is nearly identica to the first one except some bits near the beginning
byte u[256];
} fileHeader2;
struct EntryHeader {
ushort unknown1; // FF FF; maybe header identification
ushort category; // FF FF or EE EE; FF yes, EE no; following entries are grouped under last FF
int32 driver;
ubyte year;
ubyte month;
ubyte day;
ubyte hours;
ubyte minutes;
ubyte seconds;
ubyte unknown2[2];
};
struct EntryData {
// first byte
ubyte btEmcyStop : 1;
ubyte btDeadm : 1;
ubyte btRelBr : 1;
ubyte notchPBrLever : 1;
ubyte BrApplBrLever: 1;
ubyte BrRelBrLever: 1; // unverified
ubyte TopBtnBrLever: 1; // unverified
ubyte BtTrainOnOff: 1; // unverified
// second byte
ubyte KeySwDeskActive: 1; // unverified
ubyte BtParkingBr: 1; // unverified
ubyte BtFastSlow: 1; // unverified
ubyte BtBatDischarge: 1; // unverified
ubyte BtSanding: 1; // unverified
ubyte BtHorn: 1;
ubyte BtAnalog: 1; // unverified
ubyte BtGenAutom: 1; // unverified
// third byte
ubyte none; // half is shown as graph but no text attached; probably reserved
// 4th byte
ubyte MVlocoBrApp: 1;
ubyte MVlocoBrRel: 1;
ubyte manualMode: 1; // unverified
ubyte btMotStart: 1; // unverified
ubyte wheelspin: 1; // unverified
ubyte sliding: 1; // unverified
ubyte : 2;
// 5th byte "Operational Data"
ubyte u5; // bottom half of "Operational Data"
ubyte u6; // top half of "Operational Data"
// 7th byte "Loc. Status"
ubyte : 6;
ubyte SlaveLoc: 1;
ubyte : 1;
// 8th byte "Loc. Status"
ubyte warningActive : 1;
ubyte speedLim1: 1;
ubyte speedLim2 : 1; // unverified
ubyte CtrBrake : 1; // unverified
ubyte EmcyBrake : 1; // unverified
ubyte BrakeAndEngStop : 1; // unverified
ubyte DeskEngSide : 1; // unverified
ubyte DeskCabSide : 1; // unverified
ubyte v_real; // (km/h * x)
ubyte v_real_negative; // same as v_real but used insted and is interpreted as negative speed
ubyte p_BrCyl; // (bar * x)
ubyte p_BrPipe; // (bar * x)
ubyte v_set; // (km/h * x)
ubyte v_set_negative;
ubyte ubat; // Volt * x
ubyte u16; // ?
};
struct Entry {
EntryHeader header;
local int nEntry = (51200 - sizeof(EntryHeader)) / sizeof(EntryData);
EntryData data[nEntry];
};
Entry entries[fileHeader1.nEntries];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment