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.turnouts.Doubleswitch_turnout_Roco_doublecoil_oncontrol.nodescript Maven / Gradle / Ivy
### Dieses Script definiert ein Asseccory,
### um eine Doppelkreuzungsweiche von Roco (HO) mit Doppelspulen
### anzusteuern.
###
### Hardware: 3 Switchport mit Poweroutput f?r Spulenantrieb
### Port 0 = Antrieb A - abzweig
### Port 1 = Antrieb A - gerade
### Port 2 = Antrieb B - abzweig
### Port 3 = Antrieb B - gerade
### Software: 1 accessory
### 4 macros, 0 = Gerade AC, 1 = Gerade BD, 2 = Rund BC, 3 = Rund AD
###
### history: 2017-11-07 A.Tillner, erste Version
###
### how to use:
### A) configure
### In section 1, define your ports and the desired accessory number
### In section 2, define your settings (like brightness and speed)
### B) load and run this script
### what will happen?
### 1. the ports will be configured with the given parameters
### 2. three new macros for the aspects will be defined
### 3. these macros will be assigned to the accessory
### C) have fun
###
##require(vid="13", pid="117,140,141,142,122,143,144,145")
##requireVersion(min=1.0.0, max=3.0.0)
###
### -------------- 1. Select Target
##application(text:de="Doppelkreuzungsweiche, Roco H0 (Doppelspule) an OneControl", text:en="Double-Switch turnout, Roco H0 (double coil) at OneControl", text:nl="Kruiswissel (Dubbele Engelsman) van Roco H0 met twee spoelen op de OneControl")
##instruction(text:de="Doppelkreuzungsweiche, Roco H0 (Doppelspule) an OneControl: Powerports: Antrieb A - abzweig (gr?n), Antrieb A - gerade (rot), Antrieb B - abzweig (gr?n), Antrieb B - gerade (rot) Macros = Gerade AC, Gerade BD, Rund BC, Rund AD", text:en="Three-Way turnout, Roco H0 (double coil) at OneControl: Powerports: Track switch A - turn (green), Track switch A - straight (red), Track switch B - turn (green), Track switch B - straight (red) Macros = Straight AC, Straight BD, Branch BC, Branch AD")
###
##input($AccessoryName:string, text:de="Name der Weiche: ", text:en="Name of the trunout: ", default="Doppelkreuzungsweiche")
##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 (rechts): ", text:en="Number of the first macro (right): ", default=0)
##input($start_powerport:switch, text:de="Nummer des ersten Powerport: ", text:en="Number of the first Powerport: ", default=0)
##input($prevent_replace_labels:boolean, text:de="Keine Namen fuer Accessory, Makros, Ports ersetzen", text:en="Prevent replace labels for accessory, macro and ports", default=false)
### -- prepare some variables --
#set($switch_gap = 1) ### die anderen Spulen sind an den folgenden Powerports angeschlossen
#set($CVs_perPort = 3)
#set($CVoffset = 389)
#set($Antrieb_A_gn = $start_powerport) ### Spule an erstem Powerport, der eingegeben wurde
#set($Antrieb_A_rt = 1 * $switch_gap + $start_powerport) ### Spule an naechstem Powerport
#set($Antrieb_B_gn = 2 * $switch_gap + $start_powerport) ### Spule an naechstem Powerport
#set($Antrieb_B_rt = 3 * $switch_gap + $start_powerport) ### Spule an naechstem Powerport
#set($pairAntrieb_A_gn = $Antrieb_A_gn - $node_servo_count)
#set($pairAntrieb_A_rt = $Antrieb_A_rt - $node_servo_count)
#set($pairAntrieb_B_gn = $Antrieb_B_gn - $node_servo_count)
#set($pairAntrieb_B_rt = $Antrieb_B_rt - $node_servo_count)
#set($CV_Antrieb_A_gn_config = $CVoffset + $CVs_perPort * $pairAntrieb_A_gn)
#set($CV_Antrieb_A_gn_pulse = $CV_Antrieb_A_gn_config + 1)
#set($CV_Antrieb_A_gn_paire = $CV_Antrieb_A_gn_pulse + 1)
#set($CV_Antrieb_A_rt_config = $CVoffset + $CVs_perPort * $pairAntrieb_A_rt)
#set($CV_Antrieb_A_rt_pulse = $CV_Antrieb_A_rt_config + 1)
#set($CV_Antrieb_A_rt_paire = $CV_Antrieb_A_rt_pulse + 1)
#set($CV_Antrieb_B_gn_config = $CVoffset + $CVs_perPort * $pairAntrieb_B_gn)
#set($CV_Antrieb_B_gn_pulse = $CV_Antrieb_B_gn_config + 1)
#set($CV_Antrieb_B_gn_paire = $CV_Antrieb_B_gn_pulse + 1)
#set($CV_Antrieb_B_rt_config = $CVoffset + $CVs_perPort * $pairAntrieb_B_rt)
#set($CV_Antrieb_B_rt_pulse = $CV_Antrieb_B_rt_config + 1)
#set($CV_Antrieb_B_rt_paire = $CV_Antrieb_B_rt_pulse + 1)
###
### -------------- set Parameters for Ports
#set($switchDelay = 5)
#set($portPulse = 100)
#set($portConfig = 11)
#set($Delay = $portPulse + 1)
###
### -------------- Set CV values
###
set CV $CV_Antrieb_A_gn_config $portConfig
set CV $CV_Antrieb_A_gn_pulse $portPulse
set CV $CV_Antrieb_A_gn_paire $pairAntrieb_A_rt
set CV $CV_Antrieb_A_rt_config $portConfig
set CV $CV_Antrieb_A_rt_pulse $portPulse
set CV $CV_Antrieb_A_rt_paire $pairAntrieb_A_gn
set CV $CV_Antrieb_B_gn_config $portConfig
set CV $CV_Antrieb_B_gn_pulse $portPulse
set CV $CV_Antrieb_B_gn_paire $pairAntrieb_B_rt
set CV $CV_Antrieb_B_rt_config $portConfig
set CV $CV_Antrieb_B_rt_pulse $portPulse
set CV $CV_Antrieb_B_rt_paire $pairAntrieb_B_gn
###
### -------------- 3. execute part of the script
###
#set($macro0 = $my_macro) ### need some additional macros
#set($macro1 = $macro0 + 1) ### need some additional macros
#set($macro2 = $macro0 + 2) ### need some additional macros
#set($macro3 = $macro0 + 3) ### need some additional macros
########################################
### Setzt label, wenn ${prevent_replace_labels} NICHT true
#if (!${prevent_replace_labels})
###
### Set label of Ports
set switch ${Antrieb_A_gn} name="${AccessoryName}_${my_accessory}_${Antrieb_A_gn}_A_green"
set switch ${Antrieb_A_rt} name="${AccessoryName}_${my_accessory}_${Antrieb_A_rt}_A_red"
set switch ${Antrieb_B_gn} name="${AccessoryName}_${my_accessory}_${Antrieb_B_gn}_B_green"
set switch ${Antrieb_B_rt} name="${AccessoryName}_${my_accessory}_${Antrieb_B_rt}_B_red"
### Set label of Macro
set macro ${macro0} name="${AccessoryName}_${my_accessory}_Gerade_AC"
set macro ${macro1} name="${AccessoryName}_${my_accessory}_Gerade_BD"
set macro ${macro2} name="${AccessoryName}_${my_accessory}_Rund_BC"
set macro ${macro3} name="${AccessoryName}_${my_accessory}_Rund_AD"
### Set label of Accessories
set accessory ${my_accessory} name="${AccessoryName}_${my_accessory}"
#end
########################################
################################################/
### Macro straight AC
###
select macro ${macro0}
config macro repeat=1 slowdown=1
### stop the other macros
add step ptype=macro action=stop number=${macro1}
add step ptype=macro action=stop number=${macro2}
add step ptype=macro action=stop number=${macro3}
### All powerports off
add step ptype=switch action=off number=${Antrieb_A_gn}
add step ptype=switch action=off number=${Antrieb_A_rt}
add step ptype=switch action=off number=${Antrieb_B_gn}
add step ptype=switch action=off number=${Antrieb_B_rt}
###
### straight AC
add step ptype=switch action=on number=${Antrieb_A_rt}
add step delay=${switchDelay} ptype=switch action=on number=${Antrieb_B_rt}
add step delay=${Delay} ptype=delay
###
### End Macro straight AC
###
################################################/
################################################/
### Macro straight BD
###
select macro ${macro1}
config macro repeat=1 slowdown=1
### stop the other macros
add step ptype=macro action=stop number=${macro0}
add step ptype=macro action=stop number=${macro2}
add step ptype=macro action=stop number=${macro3}
### All powerports off
add step ptype=switch action=off number=${Antrieb_A_gn}
add step ptype=switch action=off number=${Antrieb_A_rt}
add step ptype=switch action=off number=${Antrieb_B_gn}
add step ptype=switch action=off number=${Antrieb_B_rt}
###
### straight BD
add step ptype=switch action=on number=${Antrieb_A_gn}
add step delay=${switchDelay} ptype=switch action=on number=${Antrieb_B_gn}
add step delay=${Delay} ptype=delay
###
### End Macro straight BD
###
################################################/
################################################/
### Macro turn branch BC
###
select macro ${macro2}
config macro repeat=1 slowdown=1
### stop the other macros
add step ptype=macro action=stop number=${macro0}
add step ptype=macro action=stop number=${macro1}
add step ptype=macro action=stop number=${macro3}
### All powerports off
add step ptype=switch action=off number=${Antrieb_A_gn}
add step ptype=switch action=off number=${Antrieb_A_rt}
add step ptype=switch action=off number=${Antrieb_B_gn}
add step ptype=switch action=off number=${Antrieb_B_rt}
###
### branch BC
add step ptype=switch action=on number=${Antrieb_A_gn}
add step delay=${switchDelay} ptype=switch action=on number=${Antrieb_B_rt}
add step delay=${Delay} ptype=delay
###
### End Macro branch BC
###
################################################/
################################################/
### Macro turn branch AD
###
select macro ${macro3}
config macro repeat=1 slowdown=1
### stop the other macros
add step ptype=macro action=stop number=${macro0}
add step ptype=macro action=stop number=${macro1}
add step ptype=macro action=stop number=${macro2}
### All powerports off
add step ptype=switch action=off number=${Antrieb_A_gn}
add step ptype=switch action=off number=${Antrieb_A_rt}
add step ptype=switch action=off number=${Antrieb_B_gn}
add step ptype=switch action=off number=${Antrieb_B_rt}
###
### branch AD
add step ptype=switch action=on number=${Antrieb_A_rt}
add step delay=${switchDelay} ptype=switch action=on number=${Antrieb_B_gn}
add step delay=${Delay} ptype=delay
###
### End Macro branch AD
###
################################################/
### Define Accessory
select accessory ${my_accessory}
config accessory startup aspect=1
add aspect 0 macroname="${AccessoryName}_${my_accessory}_Gerade_AC"
add aspect 1 macroname="${AccessoryName}_${my_accessory}_Gerade_BD"
add aspect 2 macroname="${AccessoryName}_${my_accessory}_Rund_BC"
add aspect 3 macroname="${AccessoryName}_${my_accessory}_Rund_AD"