Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
data.nodescript.signals.DB_Ks_HauptSignal.nodescript Maven / Gradle / Ivy
### Dieses Script definiert ein Accessory,
### um die 2 bis 8 LED eines Haupt-/Mehrabschnitt-Signals (DB) anzusteuern.
###
### Die Auswahl des Signaltyps und der Zusatzanzeiger wird über Checkboxen ausgewählt
###-----------------------------------------------------------------------------------
### Hardware: 2-8 Lightport (1=rt, 2=gn,
### optional: *ShZs1=ws, Sh1=ws; *Zs1=ws/Zs7=ge; Zs3=ws, Zs3v=ge, Ks2=ge, Ke=ws)
### Software: 1 accessory mit 2-8 Aspects
### 3 - 10 macros Hp0, Ks1,
### optional: Ks1H, Ks2, Ks2V, Ks1bV, Ks1bHV, Sh1, Zs1, Zs7, Ke
### 3 - 9 aspekts wie Macros.
### Achtung: Wenn mehr als 8 Aspecte erforderlich sind, muss bei NeoControl die
### Firmware NeoSig16 verwendet werden.
###
### history: 0.0 - 2021-03-11 R. Brandt - Ersterstellung
### 0.1 - 2021-03-25 R. Brandt - Prüfungen eingebaut
### 0.6 - 2021-05-08 R. Brandt - LS und KV abgetrennt
### 0.7 - 2021-12-25 R. Brandt - Kommentare verbessert
### SIGNALBILD:
### KS OPTIONAL:
### Grund- * Geschw.- +--+
### signal Hauptanzeiger |ws|
### 2-15 +--+
### +----------+ +----------+
### | | * Kennlicht |ws |
### | | | |
### Hp0 | rt | Hp0 | rt |
### | | * Mehrabschnitt | |
### Ks1 | gn | Ks1 + Ks2 | gn ge |
### Block-/Ausfahr-/Zwischen Signal oder Einfahrsignal
### | | *Rangier- | | * Vorsicht-
### | | signal | ws | signal | ge ge |
### | | 2 x ws | ws** | 3 x ge | ge |
### +----------+ **Ersatzsinal +----------+ +----------+
### *Geschw.- +--+
### Voranzeiger |ge|
### 2-15 +--+
###
### **Ersatzsignal (ws blinkend) wird in Kombination mit Rangiersignal (unten links)
### gemeinsam benutzt.
###----------- aus Wikipedie übernommen -------------------------------------------------
### In den meisten Signalschirmen für Ks-Haupt- und Mehrabschnittssignale können die
### Zusatzsignale Ersatzsignal (Zs 1) oder Vorsichtsignal (Zs 7) vorhanden sein.
### Ein Signal ist dabei in der Regel nur mit einem der beiden Zusatzsignale ausgerüstet.
### Das Vorsichtsignal (Zs 7) kommt meist an Einfahr- und Zwischensignalen zum Einsatz,
### das Ersatzsignal (Zs 1) kommt meist an Ausfahr- und Blocksignalen zu Einsatz.
### Das Ersatzsignal kommt im Ks-Signalsystem ausschließlich in der Variante als weißes
### Blinklicht zur Anwendung.
### Wenn das Signal auch Sh 1 (DS 301) bzw. Ra 12 (DV 301) zeigen kann, wird die untere
### linke Lampe dieses Signalbildes verwendet, ansonsten eine eigene weiße Lampe, die
### sich meist mittig im unteren Bereich befindet.
###--------------------------------------------------------------------------------------
#########################################
### how to use:
### A) Set checkboxes to define the signal
### In section 1 select Target
### In section 2 define the signal
### B) configure
### In section 1, define your settings (like brightness and speed)
### In section 2, define your ports
### In section 3, define the macros
### C) load and run this script
### what will happen?
### 1. the ports will be configured with the given parameters
### 2. all new macros for the aspects will be defined
### 3. these macros will be assigned to the accessory
### D) have fun
###
### -------------- A1: Select Target
##application(text:de="DB KS Haupt- und Mehrabschnitt-Signal", text:en="DB KS main and multible block signals")
##instruction(text:de="DB KS Signal: 2-9 Lichtausgänge: KS1(gn), HP0(rt); Ks2(ge), Zs3, Zs3v; Sh1.1/Zs1, Sh1.2, Zs7, Ke 2-10 Aspekte/Makros: Ks1, Hp0; Ks1H, Ks2, Ks1bV, Ks1bHV, Ks2V; Sh1, Zs1, Zs7, Ke", link="https://forum.opendcc.de/wiki/doku.php?id=konfigvorlagen:signale_db_hv_ks#db_ks_haupt-_und_mehrabschnitt-signal")
##instruction(text:en="DB KS signal: 2-8 lightports: KS1(gn), HP0(rd); Ks2(ye), Zs3, Zs3v; Sh1.1/Zs1, Sh1.2, Zs7, Ke 2-10 Aspekte/Macros: Ks1, Hp0; Ks1H, Ks2, Ks1bV, Ks1bHV, Ks2V; Sh1, Zs1, Zs7, Ke", link="https://forum.opendcc.de/wiki/doku.php?id=konfigvorlagen:signale_db_hv_ks#db_ks_haupt-_und_mehrabschnitt-signal")
###
##input($AccessoryName:string, text:de="Name des KS-Signal-Accessories: ", text:en="Name of the KS signal Accessory: ", default="KS-Sig")
##input($my_accessory:accessory, text:de="Nummer des zu erzeugenden Accessory: ", text:en="Nummber of the Accessory: ", default=0)
##input($my_macro:macro, text:de="Nummer des ersten Macros (Hp0): ", text:en="Number of the first macro: ", default=0)
##input($start_led:light, text:de="Nummer des ersten Lightport (gn LED): ", text:en="Number of the first Lightport: ", default=0)
### -------------- A2: Signal-Auswahl
### optionale Anzeigen
##input($existing_Zs3:boolean, text:de="Zs3 Geschw.Hauptanzeiger", text:en="Zs3", default=false)
##input($existing_Ks2:boolean, text:de="Ks2 Mehrabschnittsignal", text:en="Ks2", default=false)
##input($existing_Zs3v:boolean, text:de="Zs3v Geschw.Voranzeiger (zu Ks2)", text:en="Zs3V (to Ks2)", default=false)
##input($existing_Sh1:boolean, text:de="Sh1/Ra12", text:en="Sh1/Ra12", default=false)
##input($existing_Zs1:boolean, text:de="Zs1 blinkend (ErsatzSignal)", text:en="Zs1 blink", default=false)
##input($existing_Zs7:boolean, text:de="Zs7 (VorsichtSignal nur ohne Zs1)", text:en="Zs7 (only without Zs1)", default=false)
##input($existing_Ke:boolean, text:de="Kennlicht verk.Abstand", text:en="Marker light short distance", default=false)
##input($existing_Ked:boolean, text:de="Kennlicht bei betrieblich dunkel", text:en="Marker light with dark signal", default=false)
##input($prevent_replace_labels:boolean, text:de="Keine Namen füer Accessory, Makros, Ports ersetzen", text:en="Prevent replace labels for accessory, macro and ports", default=false)
####################################################################################################
############################# Ab hier werden Daten definiert ####################################
####################################################################################################
#set($led_gap = 1) ### die anderen LED sind an den folgenden Lightports angeschlossen
###
### -------------- B1: set Parameters for Ports
#set($WertbeiOff = 0)
#set($WertbeiOn = 200)
#set($Ueberblenden = 5) ### alt: 15
#set($OnTime = 0)
##set($blinka =
#if (${dimm_range} == 8) ### Es handelt sich um einen Knoten mit 8 Bit Dimming
#set($DimmzeitOff = 10)
#set($DimmzeitOn = 10)
#set($DimmzeitOffParam = "DimmOff=${DimmzeitOff}")
#set($DimmzeitOnParam = "DimmOn=${DimmzeitOn}")
#else ### Es handelt sich um einen Knoten mit 16 Bit Dimming
#set($DimmzeitOff = 2500)
#set($DimmzeitOn = 2500)
#set($DimmzeitOffParam = "DimmOff88=${DimmzeitOff}")
#set($DimmzeitOnParam = "DimmOn88=${DimmzeitOn}")
#end
####################################################################################################
############################# Ab hier werden Ligthports definiert ###############################
####################################################################################################
### Leds with Port-Parameters
### and labels: if ${prevent_replace_labels} NOT true
##################################################
#set($led_count = 0)
###
### KH, KB
#set($led_Hp0 = $led_count * $led_gap + $start_led) ### LED red an erstem lightport, der eingegeben wurde
config port ptype=light ValueOff=${WertbeiOff} ValueOn=${WertbeiOn} DimmOff=${DimmzeitOff} DimmOn=${DimmzeitOn} number=${led_Hp0}
#set($led_count = $led_count + 1)
#if (!${prevent_replace_labels})
set light ${led_Hp0} name="${AccessoryName}_${my_accessory}_${led_Hp0}_Hp0"
#end
#set($led_Ks1 = $led_count * $led_gap + $start_led) ### LED grn an nächstem lightport
#set($led_count = $led_count + 1)
config port ptype=light ValueOff=${WertbeiOff} ValueOn=${WertbeiOn} DimmOff=${DimmzeitOff} DimmOn=${DimmzeitOn} number=${led_Ks1}
#if (!${prevent_replace_labels})
set light ${led_Ks1} name="${AccessoryName}_${my_accessory}_${led_Ks1}_Ks1"
#end
###
###### Mehrabschnitt: optionale Lampen: Ks2
#if (${existing_Ks2})
#set($led_Ks2 = $led_count * $led_gap + $start_led) ### LED Ks2 an nächstem lightport
#set($led_count = $led_count + 1)
config port ptype=light ValueOff=${WertbeiOff} ValueOn=${WertbeiOn} DimmOff=${DimmzeitOff} DimmOn=${DimmzeitOn} number=${led_Ks2}
#if (!${prevent_replace_labels})
set light ${led_Ks2} name="${AccessoryName}_${my_accessory}_${led_Ks2}_Ks2"
#end
#end
### Start of optional Conditions for Distance-/Main-/Multible-signal
### optionale Lampen: Zs3, Zs3v, Sh1, Zs1, Zs7, Ke
#if (${existing_Zs3})
#set($led_Zs3 = $led_count * $led_gap + $start_led) ### LED ge an nächstem lightport
#set($led_count = $led_count + 1)
config port ptype=light ValueOff=${WertbeiOff} ValueOn=${WertbeiOn} DimmOff=${DimmzeitOff} DimmOn=${DimmzeitOn} number=${led_Zs3}
#if (!${prevent_replace_labels})
set light ${led_Zs3} name="${AccessoryName}_${my_accessory}_${led_Zs3}_Zs3"
#end
#end
#if (${existing_Zs3v})
#set($led_Zs3v = $led_count * $led_gap + $start_led) ### LED Zs3v an nächstem lightport
#set($led_count = $led_count + 1)
config port ptype=light ValueOff=${WertbeiOff} ValueOn=${WertbeiOn} DimmOff=${DimmzeitOff} DimmOn=${DimmzeitOn} number=${led_Zs3v}
#if (!${prevent_replace_labels})
set light ${led_Zs3v} name="${AccessoryName}_${my_accessory}_${led_Zs3v}_Zs3v"
#end
#end
#if (${existing_Sh1}) ## Sh1/Ra12
#set($led_Sh1_1Zs1 = $led_count * $led_gap + $start_led) ### LED1 Rs1Zs1 an nächstem lightport
#set($led_count = $led_count + 1)
#set($led_Sh1_2 = $led_count * $led_gap + $start_led) ### LED2 Rs2 an nächstem lightport
#set($led_count = $led_count + 1)
config port ptype=light ValueOff=${WertbeiOff} ValueOn=${WertbeiOn} DimmOff=${DimmzeitOff} DimmOn=${DimmzeitOn} number=${led_Sh1_1Zs1}
config port ptype=light ValueOff=${WertbeiOff} ValueOn=${WertbeiOn} DimmOff=${DimmzeitOff} DimmOn=${DimmzeitOn} number=${led_Sh1_2}
#if (!${prevent_replace_labels})
#if (${existing_Zs1})
set light ${led_Sh1_1Zs1} name="${AccessoryName}_${my_accessory}_${led_Sh1_1Zs1}_Sh1_1_Zs1"
#else
set light ${led_Sh1_1Zs1} name="${AccessoryName}_${my_accessory}_${led_Sh1_1Zs1}_Sh1_1"
#end
set light ${led_Sh1_2} name="${AccessoryName}_${my_accessory}_${led_Sh1_2}_Sh1_2"
#end
#end
#if (${existing_Zs1} and !${existing_Sh1}) ### LED RsZs1 ist Teil von Sh1/Ra12
#set($led_Sh1_1Zs1 = $led_count * $led_gap + $start_led) ### LED1 Rs1Zs1 an nächstem lightport
#set($led_count = $led_count + 1)
config port ptype=light ValueOff=${WertbeiOff} ValueOn=${WertbeiOn} DimmOff=${DimmzeitOff} DimmOn=${DimmzeitOn} number=${led_Sh1_1Zs1}
#if (!${prevent_replace_labels})
set light ${led_Sh1_1Zs1} name="${AccessoryName}_${my_accessory}_${led_Sh1_1Zs1}_Zs1"
#end
#end
#if (${existing_Zs7})
#set($led_Zs7 = $led_count * $led_gap + $start_led) ### LED Zs7 an nächstem lightport
#set($led_count = $led_count + 1)
config port ptype=light ValueOff=${WertbeiOff} ValueOn=${WertbeiOn} DimmOff=${DimmzeitOff} DimmOn=${DimmzeitOn} number=${led_Zs7}
#if (!${prevent_replace_labels})
set light ${led_Zs7} name="${AccessoryName}_${my_accessory}_${led_Zs7}_Zs7"
#end
#end
#if (${existing_Ke} or ${existing_Ked})
#set($led_Ke = $led_count * $led_gap + $start_led) ### LED Ke an nächstem lightport
#set($led_count = $led_count + 1)
config port ptype=light ValueOff=${WertbeiOff} ValueOn=${WertbeiOn} DimmOff=${DimmzeitOff} DimmOn=${DimmzeitOn} number=${led_Ke}
#if (!${prevent_replace_labels})
set light ${led_Ke} name="${AccessoryName}_${my_accessory}_${led_Ke}_Ke"
#end
#end
####################################################################################################
#set ($macro_count = 0)
#set ($end_led = $start_led + $led_count) ### set the last LED-port
#set ($end_led = $end_led - 1) ### - 1 because the counter was incremented before
#set ($macro_fail = -10)
#set ($step_max = 0)
####################################################################################################
############################# Ab hier werden Macros definiert ###################################
####################################################################################################
### -------------- B3. execute part of the script
##################################################
### labels, if ${prevent_replace_labels} NOT true
### At start of macro all LED from $tart_led to $end_led will set down
################# ab hier Haupt-/Mehrabschnittsignale ###################################
### Macro Hp0: rot
###================
#set($macroHp0 = $my_macro + $macro_count) ### need some additional macros
#set($macro_count = $macro_count + 1)
#if (!${prevent_replace_labels})
set macro ${macroHp0} name="${AccessoryName}_${my_accessory}_Hp0"
#end
select macro ${macroHp0}
config macro repeat=1 slowdown=1
### Signal dunkel
#set ($step_count = 0)
#foreach ($port in [$start_led..$end_led])
add step ptype=light action=down number=${port}
#set($step_count = $step_count + 1)
#end
### Hp0 setzten, $Ueberblenden Ticks dunkel
add step ptype=light action=up delay=${Ueberblenden} number=${led_Hp0}
#set($step_count = $step_count + 1)
#if (${step_count} > ${step_max})
#set ($step_max = $step_count)
#set ($macro_fail = $macro_count)
#end
### Ende Macro Hp0
### Macro Ks1: grün (Led Ks1)
#set($macroKs1 = $my_macro + $macro_count) ### need some additional macros
#set($macro_count = $macro_count + 1)
#if (!${prevent_replace_labels})
set macro ${macroKs1} name="${AccessoryName}_${my_accessory}_Ks1"
#end
### macro operations
select macro ${macroKs1}
config macro repeat=1 slowdown=1
### Signal dunkel
#set ($step_count = 0)
#foreach ($port in [$start_led..$end_led])
add step ptype=light action=down number=${port}
#set($step_count = $step_count + 1)
#end
### Ks1 setzten, $Ueberblenden Ticks / Kein Ke
add step ptype=light action=up delay=${Ueberblenden} number=${led_Ks1}
#set($step_count = $step_count + 1)
#if (${step_count} > ${step_max})
#set ($step_max = $step_count)
#set ($macro_fail = $macro_count - 1)
#end
### Ende Macro Ks-signal Ks1
###########################################
###################################################################
### Start of optional Conditions
#if (${existing_Zs3})
## Macro Ks1H = led_Ks1 + led_Zs3
#set($macroKs1H = $my_macro + $macro_count) ### need some additional macros
#set($macro_count = $macro_count + 1)
#if (!${prevent_replace_labels})
set macro ${macroKs1H} name="${AccessoryName}_${my_accessory}_Ks1H"
#end
### macro operations
select macro ${macroKs1H}
config macro repeat=1 slowdown=1
### Signal dunkel
#set ($step_count = 0)
#foreach ($port in [$start_led..$end_led])
add step ptype=light action=down number=${port}
#set($step_count = $step_count + 1)
#end
### Ks1 setzten, $Ueberblenden Ticks / Ke prüfen
add step ptype=light action=up delay=${Ueberblenden} number=${led_Zs3}
#set($step_count = $step_count + 1)
#if (${existing_Ke})
add step ptype=light action=up delay=${Ueberblenden} number=${led_Ke}
#set($step_count = $step_count + 1)
#end
add step ptype=light action=up delay=${Ueberblenden} number=${led_Ks1}
#set($step_count = $step_count + 1)
#if (${step_count} > ${step_max})
#set ($step_max = $step_count)
#set ($macro_fail = $macro_count)
#end
#end
### Ende Macro Ks3H
########################################################################
### Mehrabschnittsignal
#if (${existing_Ks2})
### Macro Ks2 = led_ks2
#set($macroKs2 = $my_macro + $macro_count) ### need some additional macros
#set($macro_count = $macro_count + 1)
#if (!${prevent_replace_labels})
set macro ${macroKs2} name="${AccessoryName}_${my_accessory}_Ks2"
#end
### macro operations
select macro ${macroKs2}
config macro repeat=1 slowdown=1
### Signal dunkel
#set ($step_count = 0)
#foreach ($port in [$start_led..$end_led])
add step ptype=light action=down number=${port}
#set($step_count = $step_count + 1)
#end
### Ks2 setzten, $Ueberblenden Ticks / Ke prüfen
#if (${existing_Ke})
add step ptype=light action=up delay=${Ueberblenden} number=${led_Ke}
#set($step_count = $step_count + 1)
#end
add step ptype=light action=up delay=${Ueberblenden} number=${led_Ks2}
#set($step_count = $step_count + 1)
#if (${step_count} > ${step_max})
#set ($step_max = $step_count)
#set ($macro_fail = $macro_count)
#end
### Ende Macro Ks2
##################################
#if (${existing_Zs3} and ${existing_Zs3v})
### Macro Ks1bHV = Ks1b + Zs3 + Zs3v
#set($macroKs1bHV = $my_macro + $macro_count) ### need some additional macros
#set($macro_count = $macro_count + 1)
#if (!${prevent_replace_labels})
set macro ${macroKs1bHV} name="${AccessoryName}_${my_accessory}_Ks1bHV"
#end
### macro operations
select macro ${macroKs1bHV}
config macro repeat=1 slowdown=1
### Signal dunkel
#set ($step_count = 0)
#foreach ($port in [$start_led..$end_led])
add step ptype=light action=down number=${port}
#set($step_count = $step_count + 1)
#end
### Ks2 setzten, $Ueberblenden Ticks dunkel
add step ptype=light action=up delay=${Ueberblenden} number=${led_Zs3}
#set($step_count = $step_count + 1)
add step ptype=light action=up delay=${Ueberblenden} number=${led_Zs3v}
#set($step_count = $step_count + 1)
#if (${existing_Ke})
add step ptype=light action=up delay=${Ueberblenden} number=${led_Ke}
#set($step_count = $step_count + 1)
#end
add step ptype=light action=blinka delay=${Ueberblenden} number=${led_Ks1}
#set($step_count = $step_count + 1)
#if (${step_count} > ${step_max})
#set ($step_max = $step_count)
#set ($macro_fail = $macro_count)
#end
#end
### Ende Macro Ks1bHV
##############################
#if (${existing_Zs3v})
### Macro Ks1bV = led_Ks1b + led_Zs3v (? led_Ke)
#set($macroKs1bV = $my_macro + $macro_count) ### need some additional macros
#set($macro_count = $macro_count + 1)
#if (!${prevent_replace_labels})
set macro ${macroKs1bV} name="${AccessoryName}_${my_accessory}_Ks1bV"
#end
### macro operations
select macro ${macroKs1bV}
config macro repeat=1 slowdown=1
### Signal dunkel
#set ($step_count = 0)
#foreach ($port in [$start_led..$end_led])
add step ptype=light action=down number=${port}
#set($step_count = $step_count + 1)
#end
### Ks2 setzten, $Ueberblenden Ticks dunkel
add step ptype=light action=up delay=${Ueberblenden} number=${led_Zs3v}
#set($step_count = $step_count + 1)
#if (${existing_Ke})
add step ptype=light action=up delay=${Ueberblenden} number=${led_Ke}
#set($step_count = $step_count + 1)
#end
add step ptype=light action=blinka delay=${Ueberblenden} number=${led_Ks1}
#set($step_count = $step_count + 1)
#if (${step_count} > ${step_max})
#set ($step_max = $step_count)
#set ($macro_fail = $macro_count)
#end
#end
### Ende Macro Ks1bV
################################
#if (${existing_Zs3})
### Macro Ks2H = Ks2 + Zs3
#set($macroKs2H = $my_macro + $macro_count) ### need some additional macros
#set($macro_count = $macro_count + 1)
#if (!${prevent_replace_labels})
set macro ${macroKs2H} name="${AccessoryName}_${my_accessory}_Ks2H"
#end
### macro operations
select macro ${macroKs2H}
config macro repeat=1 slowdown=1
### Signal dunkel
#set ($step_count = 0)
#foreach ($port in [$start_led..$end_led])
add step ptype=light action=down number=${port}
#set($step_count = $step_count + 1)
#end
### Ks2 setzten, $Ueberblenden Ticks dunkel
add step ptype=light action=up delay=${Ueberblenden} number=${led_Zs3}
#set($step_count = $step_count + 1)
#if (${existing_Ke})
add step ptype=light action=up delay=${OnTime} number=${led_Ke}
#set($step_count = $step_count + 1)
#end
add step ptype=light action=up delay=${Ueberblenden} number=${led_Ks2}
#set($step_count = $step_count + 1)
#if (${step_count} > ${step_max})
#set ($step_max = $step_count)
#set ($macro_fail = $macro_count)
#end
#end
### Ende Macro Ks2H
################################
#end
### Ende Ks2 und Zs3,Zs3v
################################################################
#if (${existing_Sh1})
### für alle Anwendungen: macroSh1 = 2 * ws (LEDs RsZs1,Rs2)
#set($macroSh1 = $my_macro + $macro_count) ### need some additional macros
#set($macro_count = $macro_count + 1)
#if (!${prevent_replace_labels})
set macro ${macroSh1} name="${AccessoryName}_${my_accessory}_Sh1"
#end
### macro operations
select macro ${macroSh1}
config macro repeat=1 slowdown=1
### Signal dunkel
#set ($step_count = 0)
#foreach ($port in [$start_led..$end_led])
add step ptype=light action=down number=${port}
#set($step_count = $step_count + 1)
#end
### beide Rangierlichter zu Hp0 setzten, $Ueberblenden Ticks dunkel
add step ptype=light action=up delay=${Ueberblenden} number=${led_Hp0}
#set($step_count = $step_count + 1)
add step ptype=light action=up delay=${Ueberblenden} number=${led_Sh1_1Zs1}
#set($step_count = $step_count + 1)
add step ptype=light action=up delay=${OnTime} number=${led_Sh1_2}
#set($step_count = $step_count + 1)
#if (${step_count} > ${step_max})
#set ($step_max = $step_count)
#set ($macro_fail = $macro_count)
#end
### Ende Macro Sh1/Ra12 (Rangier)
#end
#################################################################################
### Ersatzsignal
#if (${existing_Zs1})
### Macro Zs17 = Ersatz-/Vorsichtsignal
#set($macroZs1 = $my_macro + $macro_count) ### need some additional macros
#set($macro_count = $macro_count + 1)
#if (!${prevent_replace_labels})
set macro ${macroZs1} name="${AccessoryName}_${my_accessory}_Zs1b"
#end
### macro operations
select macro ${macroZs1}
config macro repeat=1 slowdown=1
### Signal dunkel
#set ($step_count = 0)
#foreach ($port in [$start_led..$end_led])
add step ptype=light action=down number=${port}
#set($step_count = $step_count + 1)
#end
### Hp0 und Zs1 blink setzten, $Ueberblenden Ticks dunkel
add step ptype=light action=up delay=${Ueberblenden} number=${led_Hp0}
#set($step_count = $step_count + 1)
add step ptype=light action=blinka delay=${Ueberblenden} number=${led_Sh1_1Zs1}
#set($step_count = $step_count + 1)
#if (${step_count} > ${step_max})
#set ($step_max = $step_count)
#set ($macro_fail = $macro_count)
#end
#end
### Ende Macro Zs1
### Vorsichtsignal
#if (${existing_Zs7})
### Macro Zs7 = Vorsichtsignal
#set($macroZs7 = $my_macro + $macro_count) ### need some additional macros
#set($macro_count = $macro_count + 1)
#if (!${prevent_replace_labels})
set macro ${macroZs7} name="${AccessoryName}_${my_accessory}_Zs7"
#end
### macro operations
select macro ${macroZs7}
config macro repeat=1 slowdown=1
### Signal dunkel
#set ($step_count = 0)
#foreach ($port in [$start_led..$end_led])
add step ptype=light action=down number=${port}
#set($step_count = $step_count + 1)
#end
### Hp0 und Zs7 setzten, $Ueberblenden Ticks dunkel
add step ptype=light action=up delay=${Ueberblenden} number=${led_Hp0}
#set($step_count = $step_count + 1)
add step ptype=light action=up delay=${Ueberblenden} number=${led_Zs7}
#set($step_count = $step_count + 1)
#if (${step_count} > ${step_max})
#set ($step_max = $step_count)
#set ($macro_fail = $macro_count)
#end
#end
### Ende Macro Zs7
### Kennlicht für dunkles Signal
#if (${existing_Ked})
### Macro Ked: Kennlicht
#set($macroKeD = $my_macro + $macro_count) ### need some additional macros
#set($macro_count = $macro_count + 1)
#if (!${prevent_replace_labels})
set macro ${macroKeD} name="${AccessoryName}_${my_accessory}_KeD"
#end
### macro operations
select macro ${macroKeD}
config macro repeat=1 slowdown=1
### Signal dunkel
#set ($step_count = 0)
#foreach ($port in [$start_led..$end_led])
add step ptype=light action=down number=${port}
#end
### Ke setzten, $Ueberblenden Ticks dunkel
add step ptype=light action=up delay=${Ueberblenden} number=${led_Ke}
#set($step_count = $step_count + 1)
#if (${step_count} > ${step_max})
#set ($step_max = $step_count)
#set ($macro_fail = $macro_count)
#end
#end
### end macro Ked
### Ende aller Macro
####################################################################################################/
### Define Accessory
####################################################################################################/
#if (!${prevent_replace_labels})
### Set label of Accessories
set accessory ${my_accessory} name="${AccessoryName}_${my_accessory}"
#end
#if (${existing_Ke})
#set($kevka = "+ Ke")
#else
#set($kevka = "")
#end
select accessory ${my_accessory}
#set($aspect_count = 0)
add aspect 0 macroname="${AccessoryName}_${my_accessory}_Ks1" ## Ks1
set aspect 0 accessory=${my_accessory} name="Aspect 0 = Ks1" ### $kevka"
#set($aspect_count = $aspect_count + 1)
add aspect 1 macroname="${AccessoryName}_${my_accessory}_Hp0" ## Hp0 auch für Sperrsignal
set aspect 1 accessory=${my_accessory} name="Aspect 1 = Hp0"
#set($aspect_count = $aspect_count + 1)
#if (${existing_Zs3})
add aspect $aspect_count macroname="${AccessoryName}_${my_accessory}_Ks1H" ## Ks1 + Zs3 + (Ke?)
set aspect $aspect_count accessory=${my_accessory} name="Aspect ${aspect_count} = Ks1 + Zs3" ### $kevka"
#set($aspect_count = $aspect_count + 1)
#end
#### Mehrabschnittsignal
#if (${existing_Ks2})
add aspect $aspect_count macroname="${AccessoryName}_${my_accessory}_Ks2" ## Ks2 ( + Ke?)
set aspect $aspect_count accessory=${my_accessory} name="Aspect ${aspect_count} = Ks2 $kevka"
#set($aspect_count = $aspect_count + 1)
#if (${existing_Zs3v} and ${existing_Zs3})
add aspect $aspect_count macroname="${AccessoryName}_${my_accessory}_Ks1bHV" ## Ks1 Bl + Zs3 + Zs3v ( + Ke?)
set aspect $aspect_count accessory=${my_accessory} name="Aspect ${aspect_count} = Ks1bl + Zs3 + Zs3v $kevka"
#set($aspect_count = $aspect_count + 1)
#end
#if (${existing_Zs3v})
add aspect $aspect_count macroname="${AccessoryName}_${my_accessory}_Ks1bV" ## Ks1 Bl + Zs3v ( + Ke?)
set aspect $aspect_count accessory=${my_accessory} name="Aspect ${aspect_count} = Ks1bl + Zs3v $kevka"
#set($aspect_count = $aspect_count + 1)
#end
#if (${existing_Zs3})
add aspect $aspect_count macroname="${AccessoryName}_${my_accessory}_Ks2H" ## Ks2 Zs3 ( + Ke?)
set aspect $aspect_count accessory=${my_accessory} name="Aspect ${aspect_count} = Ks2 + Zs3 $kevka"
#set($aspect_count = $aspect_count + 1)
#end
#end
#if (${existing_Sh1})
add aspect $aspect_count macroname="${AccessoryName}_${my_accessory}_Sh1" ## Sh1/Ra12
set aspect $aspect_count accessory=${my_accessory} name="Aspect ${aspect_count} = Sh1/Ra12"
#set($aspect_count = $aspect_count + 1)
#end
#if (${existing_Zs1})
add aspect $aspect_count macroname="${AccessoryName}_${my_accessory}_Zs1b" ## Zs1/Zs11 ( + Ke?)
set aspect $aspect_count accessory=${my_accessory} name="Aspect ${aspect_count} = Hp0 + Zs1bl"
#set($aspect_count = $aspect_count + 1)
#end
#if (${existing_Zs7})
add aspect $aspect_count macroname="${AccessoryName}_${my_accessory}_Zs7" ## Zs7 ( + Ke?)
set aspect $aspect_count accessory=${my_accessory} name="Aspect ${aspect_count} = Hp0 + Zs7"
#set($aspect_count = $aspect_count + 1)
#end
#if (${existing_Ked})
add aspect $aspect_count macroname="${AccessoryName}_${my_accessory}_KeD" ## Ke bei dunkel
set aspect $aspect_count accessory=${my_accessory} name="Aspect ${aspect_count} = Ke (betr. dunkel)"
#set($aspect_count = $aspect_count + 1)
#end
config accessory startup aspect=1
############################################################################################/
### Test all data
############################################################################################/
### Test the inputs
### Test if Zs1 with Zs7 projected
#if (${existing_Zs1} and ${existing_Zs7})
#if ($user_lang == "de")
$exceptionThrower.throwUserDefined("Zs1 und Zs7 (Zs11 DR) sind nicht gleichzeitig erlaubt")
#else
$exceptionThrower.throwUserDefined("Zs1 und Zs7 (Zs11 DR) are not allowed at once")
#end
#end
### Test if Zs3v with Ks2 projected
#if (!(${existing_Ks2}) and ${existing_Zs3v})
#if ($user_lang == "de")
$exceptionThrower.throwUserDefined("Zs3v nur mit Ks2")
#else
$exceptionThrower.throwUserDefined("Zs3v only with Ks2")
#end
#end
### Test if Zs7 and Sh1 projected (Zs7 nur für Einfahrsignale)
### (and Ks2 and Zs3 and Zs3v and Ke(d) ) (more than 12 steps in macro)
#if (${existing_Zs7} and ${existing_Sh1})
### and ${existing_Zs3} and ${existing_Ks2} and ${existing_Zs3v} and (${existing_Ke} or ${existing_Ked})
#if ($user_lang == "de")
$exceptionThrower.throwUserDefined("Zs7 nicht erlaubt mit Sh1")
#else
$exceptionThrower.throwUserDefined("Zs7 not allowed with Sh1")
#end
#end
##########################
### Test on maximum
### Test on maximum aspects
#if (${aspect_count} > ${node_accessory_macro_mapped})
#if ($user_lang == "de")
$exceptionThrower.throwUserDefined("Maximal unterstützte Anzahl Aspecte auf diesem Knoten: $node_accessory_macro_mapped: benutzt $aspect_count")
#else
$exceptionThrower.throwUserDefined("Maximum supported number of aspects on this node: $node_accessory_macro_mapped: used $aspect_count")
#end
#end
### Test on maximum macros for the node
#if (${my_macro} + ${macro_count} > ${node_macro_count})
#set ($my_macro = $my_macro + 1)
#if ($user_lang == "de")
$exceptionThrower.throwUserDefined("Maximale Anzahl Macros auf diesem Knoten: $node_macro_count: benutzt $my_macro + neu $macro_count")
#else
$exceptionThrower.throwUserDefined("Maximum number of macros on this node: $node_macro_count: $my_macro + new $macro_count")
#end
#end
#if (${led_count} - 1 * ${led_gap} + ${start_led} > ${node_light_count})
#if ($user_lang == "de")
$exceptionThrower.throwUserDefined("Maximal unterstützte Anzahl Ligthports auf diesem Knoten: $node_light_count: benutzt $led_count")
#else
$exceptionThrower.throwUserDefined("Maximum supported number of Ligthports on this node: $node_light_count: used $led_count")
#end
#end
### Test on maximum macro-steps in all macros.
#if (${step_max} > ${node_macro_size})
#if ($user_lang == "de")
$exceptionThrower.throwUserDefined("Maximal unterstützte Macro-Schritte in Macro $macro_fail = $step_max erlaubt = $node_macro_size")
#else
$exceptionThrower.throwUserDefined("Maximum supported number macro-steps in macro $macro_fail = $step_max allowed = $node_macro_size")
#end
#end
### Test on maximum light-ports for the node