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

data.nodescript.turnouts.ServoTurnout_Switches_ExtInput.nodescript Maven / Gradle / Ivy

## Dieses Script erstellt Accessory, Makro um einen ServoPort mit 2 Schaltern zu steuern.
## Dabei wird das Feature FEATURE_CTRL_MAC_START_MAN benötigt um mit Eingang 0 das Makro 0 zu starten.
##  
## history: 2019-03-15 A.Kuhtz, erste Version
##
##
## -------------- 1. Select Target
##application(text:de="Weichenantrieb mit Servo mit 2 Eingängen und Accessory steuern, Feature FEATURE_CTRL_MAC_START_MAN notwendig.", text:en="Turnout (servo) controlled with 2 inputs and accessory. The feature FEATURE_CTRL_MAC_START_MAN is required.", text:nl="Wisselaandrijving met Servo met twee ingangen en aansturen van Accessoires, Feature_CTRL_MAC_START_MAN")
##instruction(text:de="Konfiguration von Servo für Weichensteuerung mittels 2 Eingängen (Schalter) und Accessory.
Dabei wird das Feature FEATURE_CTRL_MAC_START_MAN benötigt um mit Eingang 0 -> Makro 0, Eingang 1 -> Makro 1, etc. zu starten.") ##instruction(text:en="Configuration of servo for turnouts with 2 inputs (switches) and accessory.
The feature FEATURE_CTRL_MAC_START_MAN is required to start the macros with the input. Input 0 -> macro 0, Input 1 -> macro 1 ...") ## ##input($AccessoryName:string, text:de="Name des Accessory: ", text:en="Name of the Accessory: ", default="Schalter-Servo") ##input($selectedAccessory:accessory, text:de="Nummer des verwendeten Accessory", text:en="Number of the used Accessory", default=0) ##input($MacroNumber:macro, text:de="Nummer des ersten Macros (Total: 2)", text:en="Number of the first macro (total: 2)", default=0) ##input($ServoPortNumber:servo, text:de="Nummer des ServoPort", text:en="Number of the servo port", default=0) ##input($ServoName:string, text:de="Name des Servo: ", text:en="Name of the servo: ", default="Schalter-Servo") ##input($InputPortNumber:input, text:de="Nummer des Eingang (Total: 2)", text:en="Number of the input port (total: 2)", default=0) ##input($InputName:string, text:de="Name des Eingang: ", text:en="Name of the iput port: ", default="Schalter-Servo") ### -------------- 2. configure variables #set($targetPosition0 = 0) #set($targetPosition1 = 100) #set($macroCount = 2) #set($macroNumber0 = $MacroNumber) #set($macroNumber1 = $MacroNumber + 1) #set($inputPortNumber0 = $InputPortNumber) #set($inputPortNumber1 = $InputPortNumber + 1) ### ----- make sure we have the input ports available ------- assert port number=${inputPortNumber0} ptype=input assert port number=${inputPortNumber1} ptype=input ### ----- restart the node if restart is pending ---- restart pendingonly=true delay=3000 ### -------------- 3. execute part of the script ### Set label of Accessories set accessory ${selectedAccessory} name="${AccessoryName}" ### Set label of Macro set macro ${macroNumber0} name="${AccessoryName}_gerade" set macro ${macroNumber1} name="${AccessoryName}_abzweig" ### Set label of ServoPort set servo ${ServoPortNumber} name="${ServoName}" ### Set label of InputPort set input ${inputPortNumber0} name="${InputName}_gerade" set input ${inputPortNumber1} name="${InputName}_abzweig" ### Set label of aspect set aspect 0 accessory=${selectedAccessory} name="${InputName}_gerade" set aspect 1 accessory=${selectedAccessory} name="${InputName}_abzweig" ################################################ ### configure macro ### ### macro straight ### select macro ${macroNumber0} wait 30 config macro repeat=1 slowdown=1 add step ptype=macro action=stop number=${macroNumber1} add step ptype=servo action=start target=$targetPosition0 number=$ServoPortNumber add step ptype=moveServoQuery number=$ServoPortNumber wait 50 ### macro round ### select macro ${macroNumber1} wait 30 config macro repeat=1 slowdown=1 add step ptype=macro action=stop number=${macroNumber0} add step ptype=servo action=start target=$targetPosition1 number=$ServoPortNumber add step ptype=moveServoQuery number=$ServoPortNumber wait 50 ### Define Accessory select accessory ${selectedAccessory} config accessory startup restore add aspect 0 macronumber=${macroNumber0} add aspect 1 macronumber=${macroNumber1}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy