Pokaż wiadomości

Ta sekcja pozwala Ci zobaczyć wszystkie wiadomości wysłane przez tego użytkownika. Zwróć uwagę, że możesz widzieć tylko wiadomości wysłane w działach do których masz aktualnie dostęp.


Wiadomości - Touny

Strony: [1]
1
EU07 Simulator English forum / Odp: Maszyna with Arduino
« dnia: 09 Lipca 2020, 22:46:55 »
Since byte has 8 bits (0-7). Am I right then, that to send 10th bit, do I need to write it like this?
bitWrite(doPC[1], 2, !digitalRead(33));
Does that mean, that switch group equals byte in brackets? [ ]
While i think this is generally correct, there's a bit more to it, see below:

Cytuj
If yes, then in Maszyna UART xml doc "Numer bajtu struktury" should work for inputs. But for outputs, column "Nr bajtu transmisji danych" works just fine. (atleast for me) Is this right? I find it rather confusing (maybe because i dont understand Polish much). I was looking into column "Nr B danych" and was confused why 0 was used here. bitWrite(doPC[0], 7, !digitalRead(41));         // przycisk CA/SHP

"Numer bajtu danych" indicates the byte of the data package sent from the simulator to the external device. The first four bytes of this package hold fixed header, EFEFEFEF, which is why "numer bajtu struktury" i.e. the byte id for each piece of actual data is shifted by 4 (the 1st byte of data is the 5th byte of the package, and so on)
The xls table describes (fixed) layout of data which the simulator sends to the external device. What you send back to the simulator is left largely up to you, as long as you inform the simulator how to interpret the data, using the eu07_input-uart.ini but there's one caveat -- the first four bytes in the package you sent also need to contain EFEFEFEF

This is probably the source of your problem #1, in your code you set the content of first byte to a different value by setting one of its bits. As a result, the header is no longer EFEFEFEF and the simulator doesn't accept your data. So i'm guessing the data which in the .ini file is described as "bit 1" should be recorded as doPC[4], 0 and so on. However this is just a guess, as i have no personal experience with Arduino.

EDIT: for a better idea of what's going on, you can add string
uartdebug yes
to the file eu07.ini

2
EU07 Simulator English forum / Odp: Electric brake in EP09 locomotive
« dnia: 06 Stycznia 2017, 23:45:20 »
It's implemented and dependend of presure in brake cylinder.
Here's part of the code:
if (DynamicBrakeType=dbrake_automatic) then
   begin
    if (((Hamulec as TLSt).GetEDBCP<0.25)and(Vadd<1))or(BrakePress>2.1) then
      DynamicBrakeFlag:=false
    else if (BrakePress>0.25) and ((Hamulec as TLSt).GetEDBCP>0.25) then
      DynamicBrakeFlag:=true;
    DynamicBrakeFlag:=DynamicBrakeFlag and ConverterFlag;   
   end;
So you have to have converter on and have preassure in brake cylinder over 0.25 bar caused by continous brake.

Strony: [1]