Zusi Display with Train Simulator 2015??

Die Zusi-Display Software von Jens Haupert simuliert Führerraumanzeigen (Buchfahrplan, Diagnose, FIS, ...)

Moderator: Jens Haupert

Nachricht
Autor
Benutzeravatar
gazz
Beiträge: 64
Registriert: 23.01.2011 08:44:47
Aktuelle Projekte: BR 111 Drivers Desk
Mini universal drivers desk with 3D printed parts
Omsi : NG272 Drivers Workplace (I WILL make progress this year)
Wohnort: England, Scarborough
Kontaktdaten:

Re: Zusi Display with Train Simulator 2015??

#41 Beitrag von gazz »

Clock is working nicely,
i presume it takes the date from the computer as railworks doesn't output date data.

Benutzeravatar
gazz
Beiträge: 64
Registriert: 23.01.2011 08:44:47
Aktuelle Projekte: BR 111 Drivers Desk
Mini universal drivers desk with 3D printed parts
Omsi : NG272 Drivers Workplace (I WILL make progress this year)
Wohnort: England, Scarborough
Kontaktdaten:

Re: Zusi Display with Train Simulator 2015??

#42 Beitrag von gazz »

:O i am an idiot,
i've been messing around using TrainSim-Helper to get the data out of Railworks, and when making changes to the code to add new control calls i've been changing them in the trainsim-helper LUA file as well as in the main trainsim-helper program,

this means the new control call's are displayed on the screen.... which is not really something i want anyway, but i thought i had to do that to get the data out so the RWzusiconverter could read the data.

of course, the LUA file in the plugins folder is what gets the data from the sim and writes it to the text file, no need for trainsim-helper to be running to do that :wand

i will still need to use TrainSim-Helper for the joystick part, but i'm sure the program can be stripped right down to only give the joystick functionality,

So now i'm going to concentrate on adding the control calls to the LUA file only as i should have been doing in the beginning.

These are the control calls i've found for the BR 423:

Code: Alles auswählen

CONTROL NAME "(Acceleration)",						MIN VALUE "(-1000)",	MAX VALUE "(1000)",		DEFAULT VALUE "(0)"
CONTROL NAME "(Accelerometer)",						MIN VALUE "(-320)",		MAX VALUE "(320)",		DEFAULT VALUE "(0)"
CONTROL NAME "(Active)",			  				     MIN VALUE "(0)",		MAX VALUE "(1)",		DEFAULT VALUE "(0)"
CONTROL NAME "(Ammeter)",							MIN VALUE "(-600)",		MAX VALUE "(600)",		DEFAULT VALUE "(0)"
CONTROL NAME "(Amp)",								MIN VALUE "(-600)",		MAX VALUE "(600)",		DEFAULT VALUE "(0)"
CONTROL NAME "(AWS)",1000hz light					MIN VALUE "(0)",		MAX VALUE "(1)",		DEFAULT VALUE "(0)"
CONTROL NAME "(AWSClearCount)",Clear trigger	 MIN VALUE "(0)",		MAX VALUE "(2e+009)",	DEFAULT VALUE "(0)"
CONTROL NAME "(AWSReset)",PZB ack. SW				MIN VALUE "(0)",		MAX VALUE "(1)",		DEFAULT VALUE "(0)"
CONTROL NAME "(AWSWarnCount)",Danger trigger		MIN VALUE "(0)",		MAX VALUE "(1)",		DEFAULT VALUE "(0)"
CONTROL NAME "(BrakePipePressureBAR)",				MIN VALUE "(0)",		MAX VALUE "(12)",		DEFAULT VALUE "(0)"
CONTROL NAME "(Cmd_40)",							MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(Cmd_Free)",							MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(CompressorState)",					MIN VALUE "(0)",		MAX VALUE "(1)",		DEFAULT VALUE "(0)"
CONTROL NAME "(Current)",							MIN VALUE "(0)",		MAX VALUE "(100000)",	DEFAULT VALUE "(0)"
CONTROL NAME "(DoorsOpenCloseLeft)",				MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(DoorsOpenCloseRight)",				MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(Dummy)",PZB 55 lamp					MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(LZB_Buzzer)",						MIN VALUE "(0)",		MAX VALUE "(1)",		DEFAULT VALUE "(0)"
CONTROL NAME "(LZB_End)",Ende lamp					MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(LZB_G)",								MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(LZBActive)",U lamp					MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(LZBEnable)",B lamp					MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(LZBEnding)",							MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(MainReservoirPressureBAR)",			MIN VALUE "(0)",		MAX VALUE "(12)",		DEFAULT VALUE "(0)"
CONTROL NAME "(PZB_1000)",							MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(PZB_1000hz_Control)",				MIN VALUE "(0)",		MAX VALUE "(1)",		DEFAULT VALUE "(0)"
CONTROL NAME "(PZB_2000hz_Control)",				MIN VALUE "(0)",		MAX VALUE "(1)",		DEFAULT VALUE "(0)"
CONTROL NAME "(PZB_40)",							MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(PZB_500)",							MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(PZB_500hz_Control)",					MIN VALUE "(0)",		MAX VALUE "(1)",		DEFAULT VALUE "(0)"
CONTROL NAME "(PZB_70)",							MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(PZB_85)",							MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(PZB_Distant_Passed)",				MIN VALUE "(0)",		MAX VALUE "(1)",		DEFAULT VALUE "(0)"
CONTROL NAME "(PZBEnable)",							MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(RawSpeedTarget)",					MIN VALUE "(0)",        MAX VALUE "(300)",      DEFAULT VALUE "(0)"
CONTROL NAME "(RawTargetDistance)",					MIN VALUE "(0)",        MAX VALUE "(9999)",     DEFAULT VALUE "(0)"
CONTROL NAME "(RegulatorSpeed)",					MIN VALUE "(0)",		MAX VALUE "(1)",		DEFAULT VALUE "(0)"
CONTROL NAME "(Reverser)",							MIN VALUE "(-1)",		MAX VALUE "(1)",		DEFAULT VALUE "(0)"
CONTROL NAME "(ServiceBrake)",						MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(SpeedometerKPH)",					MIN VALUE "(0)",		MAX VALUE "(180)",		DEFAULT VALUE "(0)"
CONTROL NAME "(TargetDistanceBar)",					MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(TargetDistanceDigits100)",			MIN VALUE "(-1)",       MAX VALUE "(9)",        DEFAULT VALUE "(0)"
CONTROL NAME "(TargetDistanceDigits1000)",			MIN VALUE "(-1)",       MAX VALUE "(9)",        DEFAULT VALUE "(0)"
CONTROL NAME "(TargetSpeed1)",						MIN VALUE "(-1)",       MAX VALUE "(9)",        DEFAULT VALUE "(0)"
CONTROL NAME "(TargetSpeed10)",						MIN VALUE "(-1)",       MAX VALUE "(9)",        DEFAULT VALUE "(0)"
CONTROL NAME "(TargetSpeed100)",					MIN VALUE "(-1)",       MAX VALUE "(9)",        DEFAULT VALUE "(0)"
CONTROL NAME "(TractiveEffort)",					MIN VALUE "(-1000)",	MAX VALUE "(1000)",		DEFAULT VALUE "(0)"
CONTROL NAME "(vAccelerometer)",					MIN VALUE "(-320)",		MAX VALUE "(320)",		DEFAULT VALUE "(0)"
CONTROL NAME "(VigilAlarm)",						MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(VigilEnable)",						MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(VigilLight)",						MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(VigilReset)",						MIN VALUE "(0)",        MAX VALUE "(1)",        DEFAULT VALUE "(0)"
CONTROL NAME "(VSoll)",								MIN VALUE "(0)",		MAX VALUE "(180)",		DEFAULT VALUE "(0)"

Benutzeravatar
gazz
Beiträge: 64
Registriert: 23.01.2011 08:44:47
Aktuelle Projekte: BR 111 Drivers Desk
Mini universal drivers desk with 3D printed parts
Omsi : NG272 Drivers Workplace (I WILL make progress this year)
Wohnort: England, Scarborough
Kontaktdaten:

Re: Zusi Display with Train Simulator 2015??

#43 Beitrag von gazz »

How do i figure out which bits of data need 'singleitems' or 'boolitems' or any other '*items' for the data in the RailworksMaster.cs bit that is adding the zusi command numbers to the railworks data names?

All the lights and gauge readings only work with 'SingleItems' at the moment, but that is because the TrainSim-Helper.LUA puts all calls into floats, but i think that needs changing... as the .LUA file i am modifying seems to have all entries as float formats, i.e. :

Code: Alles auswählen

 local LZB_G   
   if Call("*:ControlExists", "LZB_G", 0) == 1 then
      LZB_G = Call("*:GetControlValue", "LZB_G", 0)
   end
   if LZB_G then data = data.."LZB_G: "..string.format(FloatFormat,LZB_G).."\n" end
Every single entry is like that, gauges, lights, digits etc.

I have the global float format set to %.2 to give me 2 digits after the decimal point, that's all the precision needed i think.

am i right in thinking that things like lights that can only be 0 or 1 should not be a float? but what should i change them to in the railworks LUA so they are read properly as 'BoolItems' in the RailworksMaster.cs file.

Benutzeravatar
F. Schn.
Beiträge: 6607
Registriert: 24.10.2011 18:58:26

Re: Zusi Display with Train Simulator 2015??

#44 Beitrag von F. Schn. »

You figured out the main disadvantage of the software architecture of the RailworksMaster example.

Well, you'll find the data types in the commandset.xml.

All indicator lamps (Leuchtmelder, LM) in Zusi can be either on or off. So there is usually no need to use flotas, so we use bools. And in the RailworksMaster example I did not intent to convert singles to bools.

You see, there are some difficults if you use this kind of converter. Maybe the best solution is stil to use the DLL in Lua using NLua - without using a text file. But I can not test it, so I don't know if it works and how to do it...

The date of the DateTime value is the current date of your computer. This may make problems when you play over midnight or Railworks pass midnight. But I think I can't imagine how to improove it.

Finally: If you want to publish your changes you can sign in github and fork both my and Hanvers project and create pull requests.
Diese Signatur möchte folgendes bekannter machen: ZusiWiki · ZusiSK: Streckenprojekte · YouTube: Objektbau für Zusi · euirc: Zusi-Chat

Benutzeravatar
gazz
Beiträge: 64
Registriert: 23.01.2011 08:44:47
Aktuelle Projekte: BR 111 Drivers Desk
Mini universal drivers desk with 3D printed parts
Omsi : NG272 Drivers Workplace (I WILL make progress this year)
Wohnort: England, Scarborough
Kontaktdaten:

Re: Zusi Display with Train Simulator 2015??

#45 Beitrag von gazz »

yeah, it would be nice to have the LUA file that sits in the railworks plugins folder send the data directly to zusidisplay,

but whilst it is clunky to operate (start the TCP server, start the railworks-zusi converter, start zusidisplay, start railworks, start trainsim-helper to get the joysticks working) i am very pleased that i am even able to get a semi working MFA on the second monitor actually responding to railworks, something the makers of railworks never intended... they don't care about things like this, their core market is people who just want to play at being a train driver and just want to load a train and drive it with a couple of keyboard presses.

I am working through my list of railworks control calls and adding the zusi control numbers,
i've found 295 control calls from the trains i have, but a lot of them are just different words for the same data, due to the way loads of companies make the models for railworks, each one is free to put in what ever function and control they want, there is no real set standard like there is in zusi, some cant even use the same keyboard map (Space is used for horn, but a few use it for SiFa reset)
of course the best ones are made by Virtual Railroads, their BR111 has 87 separate control calls, some of them for the levers and switches,


So, as the trainsim-helper LUA file is sending all the control calls as floats, they seem to work with the converter,

However i have found one that does not, if i have the either of the following entries in the RailworksMaster.cs file :

master.SingleItems.Add("VSoll", 2578); //AFB bug
master.SingleItems.Add("TargetSpeed", 2573); //LZB target speed

The program crashes at start up, the target speed ones i figured is down to the LUA combining the 10's,, 100's etc with this code :

Code: Alles auswählen

 local TargetSpeed
   if Call("*:ControlExists", "TargetSpeed", 0) == 1 then
      TargetSpeed = Call("*:GetControlValue", "TargetSpeed", 0)
   elseif Call("*:ControlExists", "TargetSpeed100", 0) == 1 or
      Call("*:ControlExists", "TargetSpeed10", 0) == 1 or
      Call("*:ControlExists", "TargetSpeed1", 0) == 1
   then
      local ts = {}
      ts[100] = TryGetControlValue("TargetSpeed100")
      ts[10] = TryGetControlValue("TargetSpeed10")
      ts[1] = TryGetControlValue("TargetSpeed1")
      TargetSpeed = 0
      if ts[100] and ts[100] > 0 then
	 TargetSpeed = TargetSpeed + ts[100] * 100
      end
      if ts[10] and ts[10] > 0 then
	 TargetSpeed = TargetSpeed + ts[10] * 10
      end
      if ts[1] and ts[1] > 0 then
	 TargetSpeed = TargetSpeed + ts[1]
      end
   end
   if TargetSpeed then data = data.."TargetSpeed: "..string.format(FloatFormat,TargetSpeed).."\n" end
But the Vsoll call does not have anything changed about it in the LUA file, am i right in thinking VSoll is for the red triangle 'bug' that moves around the speedometer so show the speed the AFB is set to OR the LZB speed is?

Benutzeravatar
F. Schn.
Beiträge: 6607
Registriert: 24.10.2011 18:58:26

Re: Zusi Display with Train Simulator 2015??

#46 Beitrag von F. Schn. »

gazz hat geschrieben:The program crashes at start up
I can imagine only one thing, that might happen, that will cause a crash: If you call master.SingleItems.Add("TargetSpeed", ... ) TWICE .Net will throw an System.ArgumentException, that will cause a crash. (It is not intented to add the same value twice to the dictionary.) Usually you should see the error in the console. If it's not this, I think I need the whole file.

I'm not sure, but I think one is the lever (I think 2578), and the other is the red triangle in the display (I think 2574). 2573 may be the yellow number in the speed display.
Zuletzt geändert von F. Schn. am 09.12.2014 21:10:38, insgesamt 1-mal geändert.
Diese Signatur möchte folgendes bekannter machen: ZusiWiki · ZusiSK: Streckenprojekte · YouTube: Objektbau für Zusi · euirc: Zusi-Chat

Benutzeravatar
gazz
Beiträge: 64
Registriert: 23.01.2011 08:44:47
Aktuelle Projekte: BR 111 Drivers Desk
Mini universal drivers desk with 3D printed parts
Omsi : NG272 Drivers Workplace (I WILL make progress this year)
Wohnort: England, Scarborough
Kontaktdaten:

Re: Zusi Display with Train Simulator 2015??

#47 Beitrag von gazz »

Sorry i have been quiet on this subject for the past 2 months,

i have had problems with my eyes since the beginning of January, and at one point i could not see much at all and had to go to the emergency eye hospital, a viral eye infection has caused severe dry eye, which they say is for life now,
but it has damaged the surface of my left eyeball, and only time will tell if i can get my proper sight back in that eye.... i can see out of it, but i can not focus on anything, and glasses are unable to help in this situation.

Gradually i am getting used to using one eye, but it is very tiring for me to use a computer for too long, so my concientration is not good enough to be figuring out programming right now.

But i had most of the features of the zusi display program responding to railworks values, just problems with the traction meter i was trying to figure out when my eyes went bad,

Hopefully i can get back to working on this project soon, i wonder if any of the other people who were playing with this made any progress?

Benutzeravatar
gazz
Beiträge: 64
Registriert: 23.01.2011 08:44:47
Aktuelle Projekte: BR 111 Drivers Desk
Mini universal drivers desk with 3D printed parts
Omsi : NG272 Drivers Workplace (I WILL make progress this year)
Wohnort: England, Scarborough
Kontaktdaten:

Re: Zusi Display with Train Simulator 2015??

#48 Beitrag von gazz »

I am really sorry i suddenly went quiet for the past years,

Some very bad things hapened in my life shortly after my last post in 2015 that i am only just now coming to the end of.... Next month i find out if i have to disapeer again or keep my freedom :(


I am trying to get back into the railworks - zusi display thing again, unfortunately i have forgotten a lot of what i was learning back then, so i will need to refresh my memory and re-learn the programming side, i struggle with absorbing and retaining data in my brain, but i am partially diagnosed with Bi-Polar and possibly autistic traits... and i certianly have the obscessions that go with those diagnosises... once i get stuck into a project i do nothing else untill i either finish it, run out of money from buying things for the project, or burn out and am forced to stop.



Recently someone over on the 'Rail-Sim.de' site has written a program that takes railworks data using the 'raildriver' .dll that everyone has in their railworks install, and sends it to android based tablets via TCP (or locally in windows to extra screens)
'TS_MFD' it's called, and one good thing... no patching of LUA loco files... however this 'may' be an issue for getting certain bits of data out, as if the raildriver .dll dosent read it, you can't use it.


It's pretty amazing, the EBuLa side is great, it can adjust the station stop times to suit the scenario you are driving if the EBuLa page you are using matches the route and stops, but not the train times,
And the diamond bug thing moves with your train position up the page... with a 50m error... unfortunately it shows up a downside to railworks again.... a lot of routes have no hectometer boards!!! so you can not locate yourself using the EBuLa info... thankfully some people have made 'deluxe' versions of some routes with hectometer boards installed.


The MFD/MFA side of 'TS_MFD' are, for me at least... very notchy in operation... i.e. the needles do not move smoothly, they jump positions as they move, also the MFD lights lose sync with the in-game trains MFD/A, especially noticeable for BR110 Wittenberger Steuerwagens with 'linusf' sound mods that adds relay clicks as the MFA lights go on and off.

There's also the usual problem of every train in railworks having different control calls, annoyingly some of the Virtual Railroads loco's use what they call 'nodes' to turn the MFA lights on and off, and these can't be seen by the usual control call function :(



So,
I'd like to get back into this railworks to zusi display thing again, mostly so i can play with the way the data is extracted and do the nessisary 'maths' functions to get the data in a format that works with zusi display.

It would be nice to be able to use the 3D rendered MFA displays people have made as well.
but i am not sure if it would be possible to make the zusi displays work on android tablets, i have to admit that is a really good thing about TS_MFD..

i bought a few very cheap tablets with broken front screens and usually broken charging usb ports on the lenovo ones, which i replace for the cost of about £10 for the parts plus some micro soldering for the usb port, and have a fully working android tablet for a fraction of the cost of a fully working one sells for.


Anyay, i'll now read up on what has changed in the last few years... i know Zusi3 is out now, i've had a little play with the demo.. but i'm not sure it comes near railworks for the "pretty trains and scenery" part... of course the realistic train operation and ease of adding real controls and displays makes up for that in a way.... but i still like the railworks 'eye candy'
but i must admit it's hard to get a good idea of zusi3 from the 10 minute demo's i've tried.

Benutzeravatar
F. Schn.
Beiträge: 6607
Registriert: 24.10.2011 18:58:26

Re: Zusi Display with Train Simulator 2015??

#49 Beitrag von F. Schn. »

remarks: The topic was some kind of continued here: https://forum.zusi.de/viewtopic.php?f=73&t=14796" target="_blank
jonathanp seems to have another solution using the Zusi 3 protocol.
Diese Signatur möchte folgendes bekannter machen: ZusiWiki · ZusiSK: Streckenprojekte · YouTube: Objektbau für Zusi · euirc: Zusi-Chat

JippiMonster
Beiträge: 2
Registriert: 11.10.2022 11:33:16

Re: Zusi Display with Train Simulator 2015??

#50 Beitrag von JippiMonster »

Is on YouTube a Tutorial how to make it?

Antworten