Counter-camparison in Dispatcher?
 

Counter-camparison in Dispatcher?

Begonnen von Per Olsen, 27. März 2022, 08:49:02

Vorheriges Thema - Nächstes Thema

Per Olsen

Hello.

Is there a way (in Dispatcher) to compare 2 counters, and if the difference between them is a certain value, do the action? I cannot figure it out :) 

I use counters a lot, and love them :)  but I haven't found how to do just this :)  Is it possible?

Best regards,
Per
  • Win-Digipet-Version:
    WinDigiPet 2021
  • Anlagenkonfiguration:
    Tams Master Control. Maerklin C-tracks. 6xBolls boosters.  2xLittfinski HSI-88 USB.  Bolls RMDs.  Viessmann and Bolls switch-decoders.
  • Rechnerkonfiguration:
    Windows 11 2,7GHz CPU, 16Gb RAM.

Bernd Senger

Hi Per,

sure, you can do that. Within the dispatcher you'll find the condition "counter comparism" (expertmode is mandatory). Here you are able to set the conditions between two counters (e.g. not-equal). The corresponding action in your case could be "counter calculation".
Viele Grüße vom Rand Berlins
Bernd Senger
+++

----------------------------------------
Sonstiges
biete gerne Hilfe an, Sprachen: Deutsch, Englisch
  • Win-Digipet-Version:
    WDP 2025.x Beta
  • Anlagenkonfiguration:
    N-Anlage Neubau, ECoS II, TAMS mc2, YaMoRC YD7001, MDec.LDT, digikeijs LocoNet Rückm. (190 RMK)
  • Rechnerkonfiguration:
    AMD A10-7850K, 8 GB RAM, 34" UWQHD 3440x1440 Windows 10 64; Samsung Galaxy S21+

Per Olsen

Hello!

Thank you.  I already know this.  This works if the 2 counters are equal, or if one is bigger (smaller) than the other.  But I want this to be true ONLY if the difference between the two, are for example 4.  Can I do that?

Regards,
Per.
  • Win-Digipet-Version:
    WinDigiPet 2021
  • Anlagenkonfiguration:
    Tams Master Control. Maerklin C-tracks. 6xBolls boosters.  2xLittfinski HSI-88 USB.  Bolls RMDs.  Viessmann and Bolls switch-decoders.
  • Rechnerkonfiguration:
    Windows 11 2,7GHz CPU, 16Gb RAM.

Stefan Lersch

Hello Per,

I don't have WDP open right now but I would use a third counter. This counter is always the second counter minus 4. Now you can compare the first and the third counter.
Viele Grüße,
Stefan
  • Win-Digipet-Version:
    WDP 2021.x Beta
  • Anlagenkonfiguration:
    N-Anlage im Bau, Minitrix & Co., Tams MC 2.2.3, DCC
  • Rechnerkonfiguration:
    Quad Core 8 GB mit Win 10, 32"quot Bildschirm

Per Olsen

Hello, Stefan!

Yes, I was thinking something like that myself.  But I was hoping there was an easier way :)

Regards,
Per.
  • Win-Digipet-Version:
    WinDigiPet 2021
  • Anlagenkonfiguration:
    Tams Master Control. Maerklin C-tracks. 6xBolls boosters.  2xLittfinski HSI-88 USB.  Bolls RMDs.  Viessmann and Bolls switch-decoders.
  • Rechnerkonfiguration:
    Windows 11 2,7GHz CPU, 16Gb RAM.

Per Olsen


Stefan, can you show me an example?  I am actually struggling with this..

Regards,
Per.
  • Win-Digipet-Version:
    WinDigiPet 2021
  • Anlagenkonfiguration:
    Tams Master Control. Maerklin C-tracks. 6xBolls boosters.  2xLittfinski HSI-88 USB.  Bolls RMDs.  Viessmann and Bolls switch-decoders.
  • Rechnerkonfiguration:
    Windows 11 2,7GHz CPU, 16Gb RAM.

Per Olsen

Hi again.

My problem is:  How do I make "Counter 2" always 4 (or any other value) higher (or lower) "Counter 1" ?  To be true always when "Counter 1" changes value.

Regards,
Per.
  • Win-Digipet-Version:
    WinDigiPet 2021
  • Anlagenkonfiguration:
    Tams Master Control. Maerklin C-tracks. 6xBolls boosters.  2xLittfinski HSI-88 USB.  Bolls RMDs.  Viessmann and Bolls switch-decoders.
  • Rechnerkonfiguration:
    Windows 11 2,7GHz CPU, 16Gb RAM.

Stefan Lersch

Hi Per,


I'm a little short of time at the moment. But I will think about your problem.
Viele Grüße,
Stefan
  • Win-Digipet-Version:
    WDP 2021.x Beta
  • Anlagenkonfiguration:
    N-Anlage im Bau, Minitrix & Co., Tams MC 2.2.3, DCC
  • Rechnerkonfiguration:
    Quad Core 8 GB mit Win 10, 32"quot Bildschirm

Stefan Lersch

Hi Per,

I found the solution yesterday when lying in my bed. :) The point is that a dispatcher fires only if a condition becomes true. It does not fire if it is already true. Counter 1 is your starting point and counter 2 should be counter 1 plus 4. So you need a condition that changes when you change counter 1.

You need 4 counters. There are the above mentioned counters 1 and 2 and then there are the helpers 1 and 2. Helper 2 is always 4. Helper 1 stores the last value of counter 1.

So at the beginning counter 1 and helper 1 have the same value. In the dispatcher you compare the values of counter 1 and helper 1. If you change the value of counter 1 the dispatcher will fire. It will set counter 2 to the value of counter 1. Then it will add the value of helper 2 (here: 4) on top. Finally helper 1 is set to the value of counter 1.

So this will add 4 as you wished and it will always fire whenever you change the value of counter 1. See attechments.
Viele Grüße,
Stefan
  • Win-Digipet-Version:
    WDP 2021.x Beta
  • Anlagenkonfiguration:
    N-Anlage im Bau, Minitrix & Co., Tams MC 2.2.3, DCC
  • Rechnerkonfiguration:
    Quad Core 8 GB mit Win 10, 32"quot Bildschirm

Per Olsen

Hello.

Yes, I know it fires only when there is a change. 
I tested your suggestion, and it works fine!  So now I will implement it to my layout.  It should work nicely :)

Thanks again, for super help, Stefan!

Best regards,
Per.
  • Win-Digipet-Version:
    WinDigiPet 2021
  • Anlagenkonfiguration:
    Tams Master Control. Maerklin C-tracks. 6xBolls boosters.  2xLittfinski HSI-88 USB.  Bolls RMDs.  Viessmann and Bolls switch-decoders.
  • Rechnerkonfiguration:
    Windows 11 2,7GHz CPU, 16Gb RAM.