All Downloads are FREE. Search and download functionalities are using the official Maven repository.

data.nodescript.application.ReadyServoTurn.ReadyServoTurn-DoubleSlip_Servo_Frog_iTrain.nodescript Maven / Gradle / Ivy

## Dieses Script erstellt Asseccory, Macro und ServoPort für Weichen
## es kann die Anzahl der Servos ausgewählt werden
##
## Es wurde nur für die LightControl geschrieben
##
##  
## history: 2020-03-05 A.Kuhtz, V 1.0, nach Vorlage Ludwig (exsachse)
##          2020-03-05 A.Kuhtz, V 1.1, fix wrong variable name $ServoPortNumber
##
## -------------- 1. Select Target
##application(text:de="Doppelkreuzungsweiche mit Servo an LightControl (iTrain)", text:en="Double slip (servo) at LightControl (iTrain)", text:nl="Kruiswissel (Dubbele Engelsman) met Servo op de LightControl (iTrain)")
##instruction(text:de="Konfiguration für Doppelkreuzungsweiche mit 4 Aspekten für 2 Servo und Herzstückpolarisierung.", link="https://forum.opendcc.de/wiki/doku.php?id=konfigvorlagen:turnouts#doppelkreuzungsweiche_mit_servo_an_lightcontrol_itrain")
##instruction(text:en="Configuration of double slip with 4 aspects for 2 servo and frog polarization.", link="https://forum.opendcc.de/wiki/doku.php?id=konfigvorlagen:turnouts#doppelkreuzungsweiche_mit_servo_an_lightcontrol_itrain")
##author(A. Kuhtz, Ludwig)
##
##input($AccessoryName:string, text:de="Name des Accessory: ", text:en="Name of the Accessory: ", default="DKW")
##input($AccessoryNumber:accessory, text:de="Nummer des verwendeten Accessory", text:en="Number of the accessory to use", default=0)
##input($MacroNumber:macro, text:de="Nummer des ersten Macros (total 4)", text:en="Number of the first macro (total 4)", default=0)
##input($ServoPortNumber:servo, text:de="Nummer des ersten Servo", text:en="Number of the first servo port", default=0)
##input($SwitchPortNumber:switch, text:de="Nummer des ersten Schaltausgang", text:en="Number of the first switch port", default=0)

## -------------- 2. set Parameters for Ports

## Makro
#if ($node_macro_count - 4 - $MacroNumber  < 0)
 $exceptionThrower.throwUserDefined("zu wenig Makros frei (benötigt: 4)")
#end

## Servo
#if ($node_servo_count - ($ServoPortNumber + 1) < 1)
 $exceptionThrower.throwUserDefined("zu wenig ServoPorts frei (benötigt: 2)")
#end

## Switch
#if ($node_first_switchport_number + $node_switch_count - ($SwitchPortNumber + 1) < 1)
 $exceptionThrower.throwUserDefined("zu wenig Schaltausgänge frei (benötigt: 2)")
#end


## -------------- 3. execute part of the script

#set($servo0 = $ServoPortNumber)
#set($servo1 = $ServoPortNumber + 1)

#set($switch0 = $SwitchPortNumber)
#set($switch1 = $SwitchPortNumber + 1)

#set($macro0 = $MacroNumber)               ## need some additional macros
#set($macro1 = $macro0 + 1)                ## need some additional macros
#set($macro2 = $macro1 + 1)                ## need some additional macros
#set($macro3 = $macro2 + 1)                ## need some additional macros

## Set label of the accessory
set accessory ${AccessoryNumber} name="${AccessoryName}"

set aspect 0 accessory=${AccessoryNumber} name="A - C"
set aspect 1 accessory=${AccessoryNumber} name="A - D"
set aspect 2 accessory=${AccessoryNumber} name="B - D"
set aspect 3 accessory=${AccessoryNumber} name="B - C"

## Set label of the macro
set macro ${macro0} name="A - C"
set macro ${macro1} name="A - D"
set macro ${macro2} name="B - D"
set macro ${macro3} name="B - C"

### Set label of ServoPort
set servo ${servo0} name="Servo1 A/B"
set servo ${servo1} name="Servo2 C/D"

### Set label of SwitchPort
set switch ${switch0} name="Herzstück AB"
set switch ${switch1} name="Herzstück CD"

################################################
### configure macro
###


### macro A-C
select macro ${macro0}

config macro repeat=1 slowdown=1

add step ptype=macro action=stop number=${macro1}
add step ptype=macro action=stop number=${macro2}
add step ptype=macro action=stop number=${macro3}

add step ptype=servo action=start number=${servo0} target=0
add step delay=5 ptype=switch action=off number=${switch1}
add step ptype=moveServoQuery number=${servo0}

add step ptype=servo action=start number=${servo1} target=0
add step delay=5 ptype=switch action=off number=${switch0}
add step ptype=moveServoQuery number=${servo1}


### macro A-D
select macro ${macro1}

config macro repeat=1 slowdown=1

add step ptype=macro action=stop number=${macro0}
add step ptype=macro action=stop number=${macro2}
add step ptype=macro action=stop number=${macro3}

add step ptype=servo action=start number=${servo0} target=0
add step delay=5 ptype=switch action=on number=${switch1}
add step ptype=moveServoQuery number=${servo0}

add step ptype=servo action=start number=${servo1} target=100
add step delay=5 ptype=switch action=off number=${switch0}
add step ptype=moveServoQuery number=${servo1}


### macro B-D
select macro ${macro2}

config macro repeat=1 slowdown=1

add step ptype=macro action=stop number=${macro0}
add step ptype=macro action=stop number=${macro1}
add step ptype=macro action=stop number=${macro3}

add step ptype=servo action=start number=${servo0} target=100
add step delay=5 ptype=switch action=on number=${switch1}
add step ptype=moveServoQuery number=${servo0}

add step ptype=servo action=start number=${servo1} target=100
add step delay=5 ptype=switch action=on number=${switch0}
add step ptype=moveServoQuery number=${servo1}

### macro B-C
select macro ${macro3}

config macro repeat=1 slowdown=1

add step ptype=macro action=stop number=${macro0}
add step ptype=macro action=stop number=${macro1}
add step ptype=macro action=stop number=${macro2}

add step ptype=servo action=start number=${servo0} target=100
add step delay=5 ptype=switch action=off number=${switch1}
add step ptype=moveServoQuery number=${servo0}

add step ptype=servo action=start number=${servo1} target=0
add step delay=5 ptype=switch action=off number=${switch0}
add step ptype=moveServoQuery number=${servo1}


## Define Accessory

select accessory ${AccessoryNumber}
add aspect 0 macronumber=$macro0
add aspect 1 macronumber=$macro1
add aspect 2 macronumber=$macro2
add aspect 3 macronumber=$macro3
config accessory startup restore ## restore; none; aspect=1




© 2015 - 2024 Weber Informatics LLC | Privacy Policy