Skip to content
Snippets Groups Projects
Commit a47e125d authored by Julian Grothoff's avatar Julian Grothoff
Browse files

Added autostart system and fixed directions and flaws in control.

parent 1ee9fc23
No related branches found
No related tags found
No related merge requests found
Showing
with 327 additions and 1370 deletions
# ACPLT/RTE - Runtime Environment for realtime PTS Simulation (SMS Model 4) # ACPLT/RTE - Runtime Environment for realtime PTS Simulation (SMS Model 4)
This folder contains an [ACPLT/RTE](https://github.com/acplt/rte) runtime environment system for the more realistic realtime simulation of the palette transport system, which is currently not hosted here due to IP reasons. This folder contains an [ACPLT/RTE](https://github.com/acplt/rte) runtime environment system for the more realistic realtime simulation of the palette transport system, which is currently not hosted here due to IP reasons.
## Start Demo
* execute `autostart.bat`
### Test Demo
* Check logfiles for errors:
* `acplt\servers\<<Servername>>\logfiles\log_autostart_server.txt`
* Start the simulation
...
* Simple HMI for control components:
* http://localhost:7509/ese/
* http://localhost:7509/gse/
## Infos on the Demo
* autostart.bat starts up 3 ACPLT/RTE server with ACPLT/KS protocol:
* **MANAGER**: Port 7509
* HMI: Loads a simple online engineering HMI, which can be used in the browser to inspect and change the control logic
* Browserendpoint: http://localhost:7509/hmi/
* **ESE**: Port 7510
* Loads and executes the single control components for conveyors with their control logic
* SHM: connection to simulation
* The signal adresses for IOs are loaded from `acplt/IO_Configuration.xml`
* **GSE**: Port 7511
* Loads and executes the group control components for palettes with their control logic
* The ACPLT/RTE system can be found in acplt folder with following relevant folders:
* servers: each ACPLT/RTE server has its own folder with:
* Configuration files
* Database
* Autostart script
* Logfiles
* system:
* sysbin: RTE, database and loading tool executables
* addonlibs and syslibs: libraries that can be dynamically loaded by the server
* systools: tcl scripts to load and configure databases
* templates:
* Serialized engineering files of the control components
* Serialized files for HMI and OPC UA Server
### Specification
* The control component OPC UA specification can be found in the [BaSyx Wiki Control Component Page](https://wiki.eclipse.org/BaSyx_/_Documentation_/_API_/_ControlComponent#OPC-UA)
* Other examples for OPC UA control components can be found in the [CCProfilesUA project](https://git.rwth-aachen.de/acplt/basys4.2/ccProfilesUA).
* Variations of control components are described via facets and profiles in the [BaSyx Wiki Control Component Profiles Page](https://wiki.eclipse.org/BaSyx_/_Documentation_/_API_/_ControlComponentProfiles).
\ No newline at end of file
@echo off @echo off
rem ******************************************************************* rem *******************************************************************
rem Dient nur als Windows-Aufrufschell fr das Skript start_server.tcl rem Dient nur als Windows-Aufrufschell fr das Skript system\systools\autostart.tcl
rem rem
rem Muss direkt im Verzeichnis des zu startenden Servers liegen rem Muss im acplt system Verzeichnis liegen.
rem rem
rem ******************************************************************** rem ********************************************************************
rem rem
"%~dp0..\..\system\sysbin\tclsh" "%~dp0..\..\system\systools\start_server.tcl" cd system\systools && ..\sysbin\tclsh.exe "autostart.tcl"
pause pause
#!/bin/sh
# Resets all ESEs by PRIO --> ABORT --> CLEAR --> RESET --> FREE
# Emergency-Stop has to be off (No ESE in ABORTING state)
##### Custom paths #####
SERVERPORT="7510"
SERVERIP="localhost"
##### Functions ######
sendCMDs()
{
# argument 1 = command
echo -e "Sending cmd to all ESEs: $1"
for name in $NAMESArray
do
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$name".CMD&newvalue="$1
done
echo -e "\n"
}
##### Start of Main script ######
# Get all ESE names
NAMES=$(curl -s "http://"$SERVERIP":"$SERVERPORT"/getEP?format=plain&requestType=OT_DOMAIN&requestOutput=OP_NAME&path=/TechUnits/ESE")
NAMESArray=$(echo $NAMES | tr "; " "\n")
echo -e "Found ESEs:"
echo $NAMESArray
echo ""
### Send cmds ###
sendCMDs "INIT;PRIO;"
sendCMDs "INIT;ABORT;"
sendCMDs "INIT;CLEAR;"
sendCMDs "INIT;RESET;"
# Shift and Turn once
echo "Shift and Turn ESEs once"
sendCMDs "INIT;DSHIFT;"
sendCMDs "INIT;TURN;"
sendCMDs "INIT;START;"
echo "Wait for 60 seconds to complete Shift and Turn"
sleep 60
sendCMDs "INIT;STOP;"
sendCMDs "INIT;RESET;"
sendCMDs "INIT;FREE;"
echo -e "\n\033[1;32mDone\033[m"
exit
#!/bin/bash
# no parameter: start server and load fbds
##### Custom paths #####
THISACPLTSYSTEM=$(pwd)/..
SERVERNAME="ESE"
SERVERPORT="7510"
SERVERIP="localhost"
##### Functions ######
configESESHM(){
CurrentESE=$1
UseSHM=$2
[[ $UseSHM = "FALSE" ]] && UseRFM="TRUE" || UseRFM="FALSE"
echo -e "Switching $CurrentESE to SHM ($UseSHM)"
echo -e "- Switch RFM Outputs in Interlock: "
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PE.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PE.MountDir&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PU.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PN.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PL.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/Furnace.useSHM&newvalue="$UseSHM
echo -e "\n- Switch RFM Inputs in Skills: "
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Move/PE.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Move/Furnace.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift/PU.useSHM&newvalue="$UseSHM
#curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift2/PU.useSHM&newvalue="$UseSHM
#TODO: Replace Shift2 P3STOP and P3SLOW
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Turn/PL.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Heat/Furnace.useSHM&newvalue="$UseSHM
echo -e "\n- Switch HandPanel Inputs in ExMode: "
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/HandPanel.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/HandPanel.iexreq&newvalue="$UseRFM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/hcon916.on&newvalue="$UseRFM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/hcon2428.on&newvalue="$UseRFM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/NoESTOP.IN&newvalue="$UseRFM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/AbortOrESTOP.IN1&newvalue="$UseRFM
echo -e "\n- Rename IDs for PU,PN,PL Outputs in Interlock: "
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PUID.value&newvalue="$CurrentESE
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PLID.value&newvalue="$CurrentESE
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PNID.value&newvalue="$CurrentESE
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/PUID.value&newvalue="$CurrentESE
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/PLID.value&newvalue="$CurrentESE
#acitvate Shift
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift.actimode&newvalue=1"
echo -e "\n"
}
##### Start of Main script ######
NAMES=$(curl -s "http://"$SERVERIP":"$SERVERPORT"/getEP?format=plain&requestType=OT_DOMAIN&requestOutput=OP_NAME&path=/TechUnits/ESE")
NAMESArray=$(echo $NAMES | tr "; " "\n")
for name in $NAMESArray
do
configESESHM "$name" "TRUE"
done
echo -e "\n\033[1;32mDone\033[m"
exit
#!/bin/bash
# no parameter: start server and load fbds
##### Custom paths #####
THISACPLTSYSTEM=$(pwd)/..
SERVERNAME="ESE"
SERVERPORT="7510"
SERVERIP="localhost"
##### Functions ######
configESESHM(){
CurrentESE=$1
UseSHM=$2
[[ $UseSHM = "FALSE" ]] && UseRFM="TRUE" || UseRFM="FALSE"
echo -e "Switching $CurrentESE to SHM ($UseSHM)"
echo -e "- Switch RFM Outputs in Interlock: "
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PE.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PE.MountDir&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PU.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PN.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PL.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/Furnace.useSHM&newvalue="$UseSHM
echo -e "\n- Switch RFM Inputs in Skills: "
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Move/PE.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Move/Furnace.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift/PU.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift2/PU.useSHM&newvalue="$UseSHM
#TODO: Replace Shift2 P3STOP and P3SLOW
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Turn/PL.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Heat/Furnace.useSHM&newvalue="$UseSHM
echo -e "\n- Switch HandPanel Inputs in ExMode: "
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/HandPanel.useSHM&newvalue="$UseSHM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/HandPanel.iexreq&newvalue="$UseRFM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/hcon916.on&newvalue="$UseRFM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/hcon2428.on&newvalue="$UseRFM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/NoESTOP.IN&newvalue="$UseRFM
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/AbortOrESTOP.IN1&newvalue="$UseRFM
echo -e "\n- Rename IDs for PU,PN,PL Outputs in Interlock: "
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PUID.value&newvalue="$CurrentESE
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PLID.value&newvalue="$CurrentESE
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PNID.value&newvalue="$CurrentESE
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/PUID.value&newvalue="$CurrentESE
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/PLID.value&newvalue="$CurrentESE
echo -e "\n"
}
##### Start of Main script ######
NAMES=$(curl -s "http://"$SERVERIP":"$SERVERPORT"/getEP?format=plain&requestType=OT_DOMAIN&requestOutput=OP_NAME&path=/TechUnits/ESE")
NAMESArray=$(echo $NAMES | tr "; " "\n")
for name in $NAMESArray
do
configESESHM "$name" "TRUE"
done
echo -e "\n\033[1;32mDone\033[m"
exit
#!/bin/sh
# no parameter: start server and load fbds
# parameter 1: -r --> restarts server
# -l --> only load and configure fbds
##### Custom paths #####
THISACPLTSYSTEM=$(pwd)/..
SERVERNAME="ESE"
SERVERPORT="7510"
SERVERIP="localhost"
##### Functions ######
configESE(){
CurrentESE=$1
echo -e "Configuring "$CurrentESE
#disable actimode
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift.actimode&newvalue=0"
#rename Shift and Shift2
curl "http://"$SERVERIP":"$SERVERPORT"/renameObject?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift&newname=/TechUnits/ESE/"$CurrentESE"/Skills/ShiftTemp"
curl "http://"$SERVERIP":"$SERVERPORT"/renameObject?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift2&newname=/TechUnits/ESE/"$CurrentESE"/Skills/Shift"
curl "http://"$SERVERIP":"$SERVERPORT"/renameObject?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/ShiftTemp&newname=/TechUnits/ESE/"$CurrentESE"/Skills/Shift2"
#rename ShiftToWORKST and Shift2ToWORKST
curl "http://"$SERVERIP":"$SERVERPORT"/renameObject?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/ShiftToWORKST&newname=/TechUnits/ESE/"$CurrentESE"/Skills/ShiftToWORKSTTemp"
curl "http://"$SERVERIP":"$SERVERPORT"/renameObject?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift2ToWORKST&newname=/TechUnits/ESE/"$CurrentESE"/Skills/ShiftToWORKST"
curl "http://"$SERVERIP":"$SERVERPORT"/renameObject?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/ShiftToWORKSTTemp&newname=/TechUnits/ESE/"$CurrentESE"/Skills/Shift2ToWORKST"
#change SHIFTPOS connection link
curl "http://"$SERVERIP":"$SERVERPORT"/unlink?format=plain&path=/TechUnits/ESE/"$CurrentESE"/c_SHIFTPOS.sourcefb&element=/TechUnits/ESE/"$CurrentESE"/Skills/Shift2/SHIFTPOS"
curl "http://"$SERVERIP":"$SERVERPORT"/link?format=plain&path=/TechUnits/ESE/"$CurrentESE"/c_SHIFTPOS.sourcefb&element=/TechUnits/ESE/"$CurrentESE"/Skills/Shift/SHIFTPOS"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/c_SHIFTPOS.on&newvalue=TRUE"
#enable actimode
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift.actimode&newvalue=1"
echo -e "\n"
}
##### Start of Main script ######
# shift conveyor
configESE "PE034"
configESE "PE033"
#configESE "PX"
echo -e "\n\033[1;32mDone\033[m"
exit
#!/bin/bash
echo -e "Starting Demo from "$(pwd)": "
date
(./manager.sh -l)
(./hmi.sh -l)
(./ese.sh -l -e)# -r -e) # only model 2, else: -e)
(./gse.sh -l)
(./proc.sh -l)
echo -e "\n\033[1;32mDemo ready.\033[m"
exit
#!/bin/sh
# no parameter: start server and load fbds
# parameter 1: -r --> restarts server
# -l --> only load and configure fbds
##### Custom paths #####
THISACPLTSYSTEM=$(pwd)/..
SERVERNAME="DEV1"
SERVERPORT="7520"
SERVERIP="localhost"
##### Functions ######
. ./functions.sh
##### Start of Main script ######
startServer $1
if [ "$1" != "-l" ]; then
echo -e "Waiting 5sec for Server to register at MANAGER."
sleep 5
fi
#### Load and configure the fbds ####
# Set cycletime to 0.02 sec
echo -e "Setting cyctime to 0.02"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/Tasks/UrTask.cyctime&newvalue=0.02"
echo -e "\n"
### Load DiscoveryTask ###
loadFBD "basys/Tasks_DiscoveryTask"
echo ""
### Load OPC UA interface ###
loadFBD "basys/communication_opcua"
echo -e ""
### Load ESEs ###
#load development ESE
loadESE "PX" 1 1 1 0 500
loadESEProxy "PXAlternative" 0 0 0 360 400
### Load GSEs ###
loadFBD "basys/TechUnits_Topology-erweitert"
#loadPaletts
loadGSE "PX" "PE031" 0 300
echo -e "\n\033[1;32mDone\033[m"
exit
#!/bin/bash
# no parameter: start server and load fbds
# parameter 1: -r --> restarts server
# -l --> only load and configure fbds
# -e --> Expanded Example with third row
##### Custom paths #####
THISACPLTSYSTEM=$(pwd)/..
SERVERNAME="ESE"
SERVERPORT="7510"
SERVERIP="localhost"
TIME="1"
##### Functions ######
. ./functions.sh
configPE033()
{
#configure shift conveyer Adress and directions
echo -e "Configure shift conveyer PE033 adress and directions"
FOLDER33="http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/PE033/"
curl ""$FOLDER33"Skills/Move/InvertMountDir.IN2&newvalue=TRUE"
curl ""$FOLDER33"Skills/PUID.value&newvalue=PU010"
curl ""$FOLDER33"Interlock/PUID.value&newvalue=PU010"
#curl ""$FOLDER33"Skills/Shift2/P3SLOW.address&newvalue=212"
#curl ""$FOLDER33"Skills/Shift2/P3STOP.address&newvalue=213"
curl ""$FOLDER33"Skills/Shift/Direction.IN0&newvalue=1"
curl ""$FOLDER33"Skills/Shift/Direction.IN1&newvalue=-1"
#curl ""$FOLDER33"Skills/Shift2/Direction.IN0&newvalue=1"
#curl ""$FOLDER33"Skills/Shift2/Direction.IN1&newvalue=-1"
curl ""$FOLDER33"Interlock/PU.MountDir&newvalue=FALSE"
curl ""$FOLDER33"Skills/Shift/PU.MountDir&newvalue=TRUE"
#curl ""$FOLDER33"Skills/Shift2/InvertMountDir.IN2&newvalue=TRUE"
#curl ""$FOLDER33"Skills/Shift2/actualPosition.u1&newvalue=3"
#curl ""$FOLDER33"Skills/Shift2/actualPosition.u3&newvalue=1"
#curl ""$FOLDER33"Skills/Shift2/MapDestination.u1&newvalue=3"
#curl ""$FOLDER33"Skills/Shift2/MapDestination.u3&newvalue=1"
#curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift2/SHIFTPOS.value&newvalue=3"
#echo ""
}
configPE034()
{
#configure shift conveyer Adresss and directions
FOLDER34="http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/PE034/"
#curl ""$FOLDER34"Skills/Shift2/actualPosition.u1&newvalue=3"
#curl ""$FOLDER34"Skills/Shift2/actualPosition.u3&newvalue=1"
#curl ""$FOLDER34"Skills/Shift2/MapDestination.u1&newvalue=3"
#curl ""$FOLDER34"Skills/Shift2/MapDestination.u3&newvalue=1"
#curl ""$FOLDER34"Skills/Shift2/Direction.IN0&newvalue=-1"
#curl ""$FOLDER34"Skills/Shift2/Direction.IN1&newvalue=1"
}
##### Start of Main script ######
#startServer $1
#if [ "$1" != "-l" ]; then
# echo -e "Waiting 5sec for Server to register at MANAGER."
# sleep $TIME
#fi
# Set cycletime to 1 sec
echo -e "Setting cyctime to 1"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/Tasks/UrTask.cyctime&newvalue=1"
echo -e "\n\033[1;32mDone\033[m\n"
#### Load and configure the fbds ####
### Load DiscoveryTask ###
#loadFBD "basys/Tasks_DiscoveryTask"
#echo ""
### Load OPC UA interface ###
#loadFBD "basys/communication_opcua"
#echo -e ""
### Load ESEs ###
#load development ESE
#loadESE "PX" 1 1 1 0 500
# first row
loadESE "PE004" 1 0 0 0 0 100
loadESE "PE005" 1 0 0 0 360 100
loadESE "PE008" 1 0 0 0 540 100
loadESE "PE009" 1 0 0 1 720 100
loadESE "PE010" 1 0 0 0 900 100
loadESE "PE011" 1 0 0 0 1080 100
loadESE "PE018" 1 0 0 0 1440 100
# second row
loadESE "PE031" 1 0 0 0 360 300
loadESE "PE030" 1 0 0 0 540 300
loadESE "PE025" 1 0 1 0 720 300
loadESE "PE028" 1 0 0 0 900 300
loadESE "PE027" 1 0 0 0 1080 300
# shift conveyor
loadESE "PE034" 1 1 0 0 180 200
loadESE "PE033" 1 1 0 0 1260 200
#configure shift conveyer Adress and directions
configPE033
configPE034
# load Proxy ESEs
#./forte.sh
#loadESEProxy "PE005Alternative" 0 0 0 360 400
if [ "$1" == "-e" ] || [ "$2" == "-e" ]; then
./ese2.sh
fi
# Set cycletime to 0.02 sec
echo -e "\nSetting cyctime to 0.02"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/Tasks/UrTask.cyctime&newvalue=0.02"
echo -e "\n"
echo -e "\n\033[1;32mDone\033[m"
exit
\ No newline at end of file
#!/bin/bash
# no parameter: start server and load fbds
# parameter 1: -r --> restarts server
# -l --> only load and configure fbds
# -e --> Expanded Example with third row
##### Custom paths #####
THISACPLTSYSTEM=$(pwd)/..
SERVERNAME="ESE"
SERVERPORT="7510"
SERVERIP="localhost"
##### Functions ######
. ./functions.sh
configPE033()
{
#configure shift conveyer Adress and directions
echo -e "Configure shift conveyer PE033 adress and directions"
FOLDER33="http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/PE033/"
curl ""$FOLDER33"Skills/Move/InvertMountDir.IN2&newvalue=TRUE"
curl ""$FOLDER33"Skills/PUID.value&newvalue=PU010"
curl ""$FOLDER33"Interlock/PUID.value&newvalue=PU010"
curl ""$FOLDER33"Skills/Shift2/P3SLOW.address&newvalue=212"
curl ""$FOLDER33"Skills/Shift2/P3STOP.address&newvalue=213"
curl ""$FOLDER33"Skills/Shift/Direction.IN0&newvalue=1"
curl ""$FOLDER33"Skills/Shift/Direction.IN1&newvalue=-1"
curl ""$FOLDER33"Skills/Shift2/Direction.IN0&newvalue=1"
curl ""$FOLDER33"Skills/Shift2/Direction.IN1&newvalue=-1"
curl ""$FOLDER33"Interlock/PU.MountDir&newvalue=FALSE"
curl ""$FOLDER33"Skills/Shift/PU.MountDir&newvalue=TRUE"
curl ""$FOLDER33"Skills/Shift2/InvertMountDir.IN2&newvalue=TRUE"
curl ""$FOLDER33"Skills/Shift2/actualPosition.u1&newvalue=3"
curl ""$FOLDER33"Skills/Shift2/actualPosition.u3&newvalue=1"
curl ""$FOLDER33"Skills/Shift2/MapDestination.u1&newvalue=3"
curl ""$FOLDER33"Skills/Shift2/MapDestination.u3&newvalue=1"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift2/SHIFTPOS.value&newvalue=3"
echo ""
}
configPE034()
{
#configure shift conveyer Adresss and directions
FOLDER34="http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/PE034/"
curl ""$FOLDER34"Skills/Shift2/actualPosition.u1&newvalue=3"
curl ""$FOLDER34"Skills/Shift2/actualPosition.u3&newvalue=1"
#curl ""$FOLDER34"Skills/Shift2/MapDestination.u1&newvalue=3"
#curl ""$FOLDER34"Skills/Shift2/MapDestination.u3&newvalue=1"
#curl ""$FOLDER34"Skills/Shift2/Direction.IN0&newvalue=-1"
#curl ""$FOLDER34"Skills/Shift2/Direction.IN1&newvalue=1"
}
##### Start of Main script ######
startServer $1
if [ "$1" != "-l" ]; then
echo -e "Waiting 5sec for Server to register at MANAGER."
sleep 5
fi
# Set cycletime to 1 sec
echo -e "Setting cyctime to 1"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/Tasks/UrTask.cyctime&newvalue=1"
echo -e "\n"
echo -e "\n\033[1;32mDone\033[m"
#### Load and configure the fbds ####
### Load DiscoveryTask ###
#loadFBD "basys/Tasks_DiscoveryTask"
#echo ""
### Load OPC UA interface ###
#loadFBD "basys/communication_opcua"
#echo -e ""
### Load ESEs ###
#load development ESE
#loadESE "PX" 1 1 1 0 500
# first row
loadESE "PE004" 0 0 0 0 100
loadESE "PE005" 0 0 0 360 100
loadESE "PE008" 0 0 0 540 100
loadESE "PE009" 0 0 1 720 100
loadESE "PE010" 0 0 0 900 100
loadESE "PE011" 0 0 0 1080 100
loadESE "PE018" 0 0 0 1440 100
# second row
#loadESE "PE031" 0 0 0 360 300
#loadESE "PE030" 0 0 0 540 300
#loadESE "PE025" 0 1 0 720 300
#loadESE "PE028" 0 0 0 900 300
#loadESE "PE027" 0 0 0 1080 300
# shift conveyor
loadESE "PE034" 1 0 0 180 200
loadESE "PE033" 1 0 0 1260 200
#configure shift conveyer Adress and directions
configPE033
configPE034
# load Proxy ESEs
#./forte.sh
#loadESEProxy "PE005Alternative" 0 0 0 360 400
if [ "$1" == "-e" ] || [ "$2" == "-e" ]; then
./ese2.sh
fi
# Set cycletime to 0.02 sec
echo -e "Setting cyctime to 0.02"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/Tasks/UrTask.cyctime&newvalue=0.02"
echo -e "\n"
echo -e "\n\033[1;32mDone\033[m"
exit
\ No newline at end of file
#!/bin/bash
# no parameter: start server and load fbds
# parameter 1: -r --> restarts server
# -l --> only load and configure fbds
# -e --> Expanded Example with third row
##### Custom paths #####
THISACPLTSYSTEM=$(pwd)/..
SERVERNAME="ESE"
SERVERPORT="7510"
SERVERIP="localhost"
##### Functions ######
. ./functions.sh
configPE033()
{
#configure shift conveyer Adress and directions
echo -e "Configure shift conveyer PE033 adress and directions"
FOLDER33="http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/PE033/"
curl ""$FOLDER33"Skills/Move/InvertMountDir.IN2&newvalue=TRUE"
curl ""$FOLDER33"Skills/PUID.value&newvalue=PU010"
curl ""$FOLDER33"Interlock/PUID.value&newvalue=PU010"
curl ""$FOLDER33"Skills/Shift2/P3SLOW.address&newvalue=212"
curl ""$FOLDER33"Skills/Shift2/P3STOP.address&newvalue=213"
curl ""$FOLDER33"Skills/Shift/Direction.IN0&newvalue=1"
curl ""$FOLDER33"Skills/Shift/Direction.IN1&newvalue=-1"
curl ""$FOLDER33"Skills/Shift2/Direction.IN0&newvalue=1"
curl ""$FOLDER33"Skills/Shift2/Direction.IN1&newvalue=-1"
curl ""$FOLDER33"Interlock/PU.MountDir&newvalue=FALSE"
curl ""$FOLDER33"Skills/Shift/PU.MountDir&newvalue=TRUE"
curl ""$FOLDER33"Skills/Shift2/InvertMountDir.IN2&newvalue=TRUE"
curl ""$FOLDER33"Skills/Shift2/actualPosition.u1&newvalue=3"
curl ""$FOLDER33"Skills/Shift2/actualPosition.u3&newvalue=1"
curl ""$FOLDER33"Skills/Shift2/MapDestination.u1&newvalue=3"
curl ""$FOLDER33"Skills/Shift2/MapDestination.u3&newvalue=1"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift2/SHIFTPOS.value&newvalue=3"
echo ""
}
configPE034()
{
#configure shift conveyer Adresss and directions
FOLDER34="http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/PE034/"
curl ""$FOLDER34"Skills/Shift2/actualPosition.u1&newvalue=3"
curl ""$FOLDER34"Skills/Shift2/actualPosition.u3&newvalue=1"
#curl ""$FOLDER34"Skills/Shift2/MapDestination.u1&newvalue=3"
#curl ""$FOLDER34"Skills/Shift2/MapDestination.u3&newvalue=1"
#curl ""$FOLDER34"Skills/Shift2/Direction.IN0&newvalue=-1"
#curl ""$FOLDER34"Skills/Shift2/Direction.IN1&newvalue=1"
}
##### Start of Main script ######
startServer $1
if [ "$1" != "-l" ]; then
echo -e "Waiting 5sec for Server to register at MANAGER."
sleep 5
fi
# Set cycletime to 1 sec
echo -e "Setting cyctime to 1"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/Tasks/UrTask.cyctime&newvalue=1"
echo -e "\n"
echo -e "\n\033[1;32mDone\033[m"
#### Load and configure the fbds ####
### Load DiscoveryTask ###
#loadFBD "basys/Tasks_DiscoveryTask"
#echo ""
### Load OPC UA interface ###
#loadFBD "basys/communication_opcua"
#echo -e ""
### Load ESEs ###
#load development ESE
#loadESE "PX" 1 1 1 0 500
# first row
loadESE "PE004" 0 0 0 0 100
loadESE "PE005" 0 0 0 360 100
#loadESE "PE008" 0 0 0 540 100
#loadESE "PE009" 0 0 1 720 100
#loadESE "PE010" 0 0 0 900 100
#loadESE "PE011" 0 0 0 1080 100
#loadESE "PE018" 0 0 0 1440 100
# second row
#loadESE "PE031" 0 0 0 360 300
#loadESE "PE030" 0 0 0 540 300
#loadESE "PE025" 0 1 0 720 300
#loadESE "PE028" 0 0 0 900 300
#loadESE "PE027" 0 0 0 1080 300
# shift conveyor
loadESE "PE034" 1 0 0 180 200
#loadESE "PE033" 1 0 0 1260 200
#configure shift conveyer Adress and directions
#configPE033
configPE034
# load Proxy ESEs
#./forte.sh
#loadESEProxy "PE005Alternative" 0 0 0 360 400
if [ "$1" == "-e" ] || [ "$2" == "-e" ]; then
./ese2.sh
fi
# Set cycletime to 0.02 sec
echo -e "Setting cyctime to 0.02"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/Tasks/UrTask.cyctime&newvalue=0.02"
echo -e "\n"
echo -e "\n\033[1;32mDone\033[m"
exit
\ No newline at end of file
#!/bin/bash
#
##### Custom paths #####
THISACPLTSYSTEM=$(pwd)/..
SERVERNAME="ESE"
SERVERPORT="7510"
SERVERIP="localhost"
##### Functions ######
. ./functions.sh
#### Load and configure the fbds ####
# Set cycletime to 1 sec
echo -e "Setting cyctime to 1"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/Tasks/UrTask.cyctime&newvalue=1"
echo -e "\n"
echo -e "\n\033[1;32mDone\033[m"
echo -e "Setting up expanded example with third row:"
# second row
loadESE "PE013" 0 0 0 360 500
loadESE "PE016" 0 0 0 540 500
loadESE "PE019" 0 0 0 720 500
loadESE "PE021" 0 0 0 900 500
loadESE "PE026" 0 0 0 1080 500
#Change Shift to Shift2 skill to use third row
#./configShift2.sh
# Set cycletime to 1 sec
echo -e "Setting cyctime to 0.02"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/Tasks/UrTask.cyctime&newvalue=0.02"
echo -e "\n"
echo -e "\n\033[1;32mDone\033[m"
#echo -e "\n\033[1;32mDone\033[m"
exit
#!/bin/bash
##### needed global vars #####
#THISACPLTSYSTEM
#SERVERNAME
#SERVERPORT
#SERVERIP
##### Functions ######
loadFBD()
{
FBD=$1
echo -e "- Loading $FBD."
rm -f $THISACPLTSYSTEM/templates/${FBD}.log
RESULT=$($THISACPLTSYSTEM/system/sysbin/fb_dbcommands -s ${SERVERIP}:7509/${SERVERNAME} -load -f $THISACPLTSYSTEM/templates/${FBD}.fbd 2>&1)
if [[ "$RESULT" == *"' geladen." ]]; then
:
else
echo -e "\033[1;31m- Failed!\033[m See log file for more information:"
echo "$THISACPLTSYSTEM/templates/${FBD}.log"
echo $RESULT
fi
}
replaceNameAndLoad(){
FBD=$1
OLDNAME=$2
NEWNAME=$3
echo -e "- Replacing $OLDNAME with $NEWNAME in $FBD"
rm -f $THISACPLTSYSTEM/templates/${FBD}.temp.log
cp -f $THISACPLTSYSTEM/templates/${FBD}.fbd $THISACPLTSYSTEM/templates/${FBD}.temp.fbd
sed -i 's/'$OLDNAME'/'$NEWNAME'/g' $THISACPLTSYSTEM/templates/${FBD}.temp.fbd
loadFBD $FBD".temp"
rm -f $THISACPLTSYSTEM/templates/${FBD}.temp.fbd
}
loadESE(){
CurrentESE=$1
IsMove=$2
IsShift=$3
IsTurn=$4
IsHeat=$5
Xpos=$6
Ypos=$7
#Check if already exists
RESULT=$(curl -s "http://"$SERVERIP":"$SERVERPORT"/getVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".actimode")
regex="1|0;"
if [[ "$RESULT" =~ $regex ]]; then
echo -e "\n\033[1;32m- OK\033[m ESE $CurrentESE already exists in server."
else
### Set Frame ###
echo -e "\nLoading Frame for $CurrentESE"
replaceNameAndLoad "basys/TechUnits_ESE_Frame" "PX" $CurrentESE
echo -e "\033[1;32m- Frame loaded" $CurrentESE "\033[m"
fi
### Set Skills ###
#Move
RESULT=$(curl -s "http://"$SERVERIP":"$SERVERPORT"/getVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Move.actimode")
regex="1|0;"
if [[ "$RESULT" =~ $regex ]]; then
echo -e "\033[1;32m- OK\033[m Skill Move $CurrentESE already exists in server."
elif [ "$IsMove" == "1" ]; then
echo -e "\nLoading Skill Move for $CurrentESE"
replaceNameAndLoad "basys/TechUnits_ESE_Move" "PX" $CurrentESE
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Move/Direction.IN0&newvalue=-1"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Move/Direction.IN1&newvalue=1"
echo -e "\n\033[1;32m- Skill Move loaded" $CurrentESE "\033[m"
fi
#Shift
RESULT=$(curl -s "http://"$SERVERIP":"$SERVERPORT"/getVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift.actimode")
regex="1|0;"
if [[ "$RESULT" =~ $regex ]]; then
echo -e "\033[1;32m- OK\033[m Skill Shift $CurrentESE already exists in server."
elif [ "$IsShift" == "1" ]; then
echo -e "\nLoading Skill Shift for $CurrentESE"
replaceNameAndLoad "basys/TechUnits_ESE_Shift" "PX" $CurrentESE
echo -e "\n\033[1;32m- Skill Shift loaded" $CurrentESE "\033[m"
#specific Output
#curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift2/SHIFTPOS.value&newvalue=1"
fi
#Turn
RESULT=$(curl -s "http://"$SERVERIP":"$SERVERPORT"/getVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Turn.actimode")
regex="1|0;"
if [[ "$RESULT" =~ $regex ]]; then
echo -e "\033[1;32m- OK\033[m Skill Turn $CurrentESE already exists in server."
elif [ "$IsTurn" == "1" ]; then
echo -e "\nLoading Skill Turn for $CurrentESE"
replaceNameAndLoad "basys/TechUnits_ESE_Turn" "PX" $CurrentESE
echo -e "\033[1;32m- Skill Turn loaded" $CurrentESE "\033[m"
fi
#Heat
RESULT=$(curl -s "http://"$SERVERIP":"$SERVERPORT"/getVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Heat.actimode")
regex="1|0;"
if [[ "$RESULT" =~ $regex ]]; then
echo -e "\033[1;32m- OK\033[m Skill Heat $CurrentESE already exists in server."
elif [ "$IsHeat" == "1" ]; then
echo -e "\nLoading Skill Heat for $CurrentESE"
replaceNameAndLoad "basys/TechUnits_ESE_Heat" "PX" $CurrentESE
echo -e "\033[1;32m- Skill Heat loaded" $CurrentESE "\033[m"
#Configure Doors of Furnace ###
echo -e "\n- Configure Move for doors of furnace: "
[[ $IsFurnace = 1 ]] && Furnace="TRUE" || Furnace="FALSE"
[[ $IsFurnace = 1 ]] && NFurnace="FALSE" || NFurnace="TRUE"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Move/hcon1391.on&newvalue="$Furnace
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Move/hcon6458.on&newvalue="$Furnace
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Move/ready.result&newvalue="$NFurnace
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Move/end.result&newvalue="$NFurnace
fi
### Set SSC States ###
echo -e "\nResetting SSC States: "
# Resetting SSCs
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/OrIn/Occ.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/Mode.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/Clearing.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/Clear.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/Abort.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Stop.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Reset.EN&newvalue=3"
#Enable SSCs after reset
sleep $(($TIME+1))
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/OrIn/Occ.EN&newvalue=1"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/Mode.EN&newvalue=1"
#curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/Clearing.EN&newvalue=1"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode.EN&newvalue=1"
# Disalbe OpMode changes from pass to take
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/OpMode/hcon3877.on&newvalue=FALSE"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/OpMode/hcon5704.on&newvalue=FALSE"
### Set orderlist and executor ###
echo -e "\nSet orderlist and delete services: "
#ORDERLIST=$(curl -s "http://"$SERVERIP":"$SERVERPORT"/getVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".ORDERLIST")
ORDERLIST="\{JOG\}%20\{ABORT\}%20\{CLEAR\}%20\{RESET\}%20\{START\}%20\{HOLD\}%20\{UNHOLD\}%20\{SUSPEND\}%20\{UNSUSPEND\}%20\{STOP\}%20\{FREE\}%20\{OCCUPY\}%20\{PRIO\}%20\{AUTO\}%20\{MANUAL\}"
ORDEREXECUTOR="\{cmMode\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmOcc\}%20\{cmOcc\}%20\{cmOcc\}%20\{cmExe\}%20\{cmExe\}"
if [ "$IsMove" == "1" ]; then
ORDERLIST="\{BTAKE\}%20\{FTAKE\}%20\{BPASS\}%20\{FPASS\}%20"$ORDERLIST
ORDEREXECUTOR="\{cmMode\}%20\{cmMode\}%20\{cmMode\}%20\{cmMode\}%20"$ORDEREXECUTOR
fi
if [ "$IsShift" == "1" ]; then
ORDERLIST="\{USHIFT\}%20\{DSHIFT\}%20"$ORDERLIST
ORDEREXECUTOR="\{cmMode\}%20\{cmMode\}%20"$ORDEREXECUTOR
fi
if [ "$IsTurn" == "1" ]; then
ORDERLIST="\{TURN\}%20"$ORDERLIST
ORDEREXECUTOR="\{cmMode\}%20"$ORDEREXECUTOR
fi
if [ "$IsFurnace" == "1" ]; then
ORDERLIST="\{HEAT\}%20"$ORDERLIST
ORDEREXECUTOR="\{cmMode\}%20"$ORDEREXECUTOR
else
#TODO add Service for Heat in ESE
:
#curl "http://"$SERVERIP":"$SERVERPORT"/deleteObject?format=plain&path=/TechUnits/ESE/"$CurrentESE"/SERVICES/TURN"
fi
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".ORDERLIST&newvalue="$ORDERLIST
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".ORDEREXECUTOR&newvalue="$ORDEREXECUTOR
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".Xpos&newvalue="$Xpos
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".Ypos&newvalue="$Ypos
echo -e "\n"
}
loadESEProxy(){
CurrentESE=$1
IsShift=$2
IsTurn=$3
IsFurnace=$4
Xpos=$5
Ypos=$6
replaceNameAndLoad "basys/TechUnits_ESE_PXProxy" "PXProxy" $CurrentESE
echo "Configuring "$CurrentESE
### Set SSC States ###
echo -e "- Resetting SSC States: "
# Resetting SSCs
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/OrIn/Occ.EN&newvalue=3"
#Enable SSCs after reset
sleep $TIME
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/OrIn/Occ.EN&newvalue=1"
### Set orderlist and executor ###
echo -e "\n- Set orderlist and delete services: "
ORDERLIST="\{BTAKE\}%20\{FTAKE\}%20\{BPASS\}%20\{FPASS\}%20\{JOG\}%20\{RESET\}%20\{START\}%20\{STOP\}%20\{FREE\}%20\{OCCUPY\}%20\{PRIO\}"
ORDEREXECUTOR="\{cmMode\}%20\{cmMode\}%20\{cmMode\}%20\{cmMode\}%20\{cmMode\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmOcc\}%20\{cmOcc\}%20\{cmOcc\}"
if [ "$IsShift" == "1" ]; then
ORDERLIST="\{USHIFT\}%20\{DSHIFT\}%20"$ORDERLIST
ORDEREXECUTOR="\{cmMode\}%20\{cmMode\}%20"$ORDEREXECUTOR
else
:
fi
if [ "$IsTurn" == "1" ]; then
ORDERLIST="\{TURN\}%20"$ORDERLIST
ORDEREXECUTOR="\{cmMode\}%20"$ORDEREXECUTOR
else
:
fi
if [ "$IsFurnace" == "1" ]; then
ORDERLIST="\{HEAT\}%20"$ORDERLIST
ORDEREXECUTOR="\{cmMode\}%20"$ORDEREXECUTOR
else
:
fi
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".ORDERLIST&newvalue="$ORDERLIST
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".ORDEREXECUTOR&newvalue="$ORDEREXECUTOR
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".Xpos&newvalue="$Xpos
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".Ypos&newvalue="$Ypos
echo -e "\n"
}
loadGSE(){
CurrentESE=$1
CurrentPos=$2
Xpos=$3
Ypos=$4
FBD="basys/TechUnits_GSE_PX"$5
replaceNameAndLoad $FBD "PX" $CurrentESE
echo "Configuring "$CurrentESE
###
#reset
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/OrIn/Occ.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/ExMode/Mode.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/Skills/PImage/CStatusExt.doReset&newvalue=TRUE"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/Skills/PImage/NStatusExt.doReset&newvalue=TRUE"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/Interlock/SetCCMDext.doReset&newvalue=TRUE"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/Interlock/SetNCMDext.doReset&newvalue=TRUE"
sleep $TIME
#set
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/OrIn/Occ.EN&newvalue=1"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/ExMode/Mode.EN&newvalue=1"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/Skills/PImage/CStatusExt.doCyclic&newvalue=TRUE"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/Skills/PImage/NStatusExt.doCyclic&newvalue=TRUE"
### Set X/Y Pos and Current position
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/Current.value&newvalue="$CurrentPos
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE".Xpos&newvalue="$Xpos
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE".Ypos&newvalue="$Ypos
echo -e "\n"
}
#!/bin/bash
##### needed global vars #####
#THISACPLTSYSTEM
#SERVERNAME
#SERVERPORT
#SERVERIP
##### Functions ######
startServer(){
#check if only load and not start server
if [ "$1" == "-l" ]; then
return 0
fi
##### Check that no server is running #####
SERVERPID=$(lsof -i:${SERVERPORT} -t)
if [[ {"$(pidof ov_runtimeserver.exe)" != ""} && {"$SERVERPID" != ""} ]]; then
if [ "$SERVERPID" != "" ]; then
if [ "$1" == "-r" ]; then
echo -e "\033[1;33mAn ov server process is already running and listening on port ${SERVERPORT}.\033[m It will be killed."
kill -TERM $SERVERPID
sleep 1
else
echo -e "\033[1;31mAn ov server process is already running and listening on port ${SERVERPORT}.\033[m Try with parameter -r to kill and restart the server."
exit 1
fi
fi
fi
##### ACPLT shell variables #####
export LD_LIBRARY_PATH=$THISACPLTSYSTEM/system/addonlibs:$THISACPLTSYSTEM/system/syslibs:$LD_LIBRARY_PATH
SERVERDOMAIN="$THISACPLTSYSTEM/servers/$SERVERNAME"
##### Build Database and start the ov server #####
#FIXME use absolute path (concat from variables) and delete "cd $OLDPWD"
cd $SERVERDOMAIN
### Database ###
echo "Creating new database for $SERVERNAME."
RESULT=$(tclsh ../../system/systools/build_database.tcl | tail -1)
if [ "$RESULT" = "Database created!" ]; then
echo -e "\033[1;32m- OK\033[m"
else
echo -e "\033[1;31mDatabase clean up failed!\033[m"
echo "View log file for more information:"
echo "$SERVERDOMAIN/logfiles/log_builddb.txt"
cd $OLDPWD
exit 1 #Terminate indicating an error
fi
### Server ###
echo -e "Starting OV server $SERVERNAME."
$THISACPLTSYSTEM/system/sysbin/ov_runtimeserver.exe -c $SERVERDOMAIN/ov_server.conf -l $SERVERDOMAIN/logfiles/log_start_server.txt & 2>&1
SERVERPID=$!
sleep 0.5
if [ -e /proc/$SERVERPID ]; then
echo -e "\033[1;32m- OK. (Could not check PID to port assignment)\033[m"
# if [ "$(lsof -i:$SERVERPORT -t)" == "$SERVERPID" ]; then
# echo -e "\033[1;32m- OK\033[m"
# else
# echo -e "\033[1;31mServer start failed!\033[m"
# echo "Server process is running, but not listening on port ${SERVERPORT}. Killing Server."
# kill -TERM $SERVERPID
# cd $OLDPWD
# exit 1 #Terminate indicating an error
# fi
else
echo -e "\n\033[1;31mServer start failed!\033[m"
echo "View log file for more information:"
echo "$SERVERDOMAIN/logfiles/log_start_server.txt"
cd $OLDPWD
exit 1 #Terminate indicating an error
fi
cd $OLDPWD
}
loadFBD()
{
FBD=$1
echo -e "Loading $FBD."
rm -f $THISACPLTSYSTEM/templates/${FBD}.log
RESULT=$($THISACPLTSYSTEM/system/sysbin/fb_dbcommands -s ${SERVERIP}:7509/${SERVERNAME} -load -f $THISACPLTSYSTEM/templates/${FBD}.fbd 2>&1)
if [[ "$RESULT" == *"' geladen." ]]; then
echo -e "\033[1;32m- OK\033[m"
else
echo -e "\033[1;31m- Failed!\033[m See log file for more information:"
echo "$THISACPLTSYSTEM/templates/${FBD}.log"
echo $RESULT
fi
}
replaceNameAndLoad(){
FBD=$1
OLDNAME=$2
NEWNAME=$3
echo -e "Replacing $OLDNAME with $NEWNAME in $FBD"
rm -f $THISACPLTSYSTEM/templates/${FBD}.temp.log
cp -f $THISACPLTSYSTEM/templates/${FBD}.fbd $THISACPLTSYSTEM/templates/${FBD}.temp.fbd
sed -i 's/'$OLDNAME'/'$NEWNAME'/g' $THISACPLTSYSTEM/templates/${FBD}.temp.fbd
loadFBD $FBD".temp"
rm -f $THISACPLTSYSTEM/templates/${FBD}.temp.fbd
}
loadESE(){
CurrentESE=$1
IsShift=$2
IsTurn=$3
IsFurnace=$4
Xpos=$5
Ypos=$6
#Check if already exists
RESULT=$(curl -s "http://"$SERVERIP":"$SERVERPORT"/getVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".actimode")
regex="1|0;"
if [[ "$RESULT" =~ $regex ]]; then
echo -e "\033[1;32m- OK\033[m ESE $CurrentESE already exists in server."
return 0
fi
replaceNameAndLoad "basys/TechUnits_ESE_PX" "PX" $CurrentESE
echo "Configuring "$CurrentESE
### Set SSC States ###
echo -e "- Resetting SSC States: "
# Resetting SSCs
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/OrIn/Occ.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/Mode.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/Clearing.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/Clear.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/Abort.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Stop.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Reset.EN&newvalue=3"
#Enable SSCs after reset
sleep 0.1
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/OrIn/Occ.EN&newvalue=1"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/Mode.EN&newvalue=1"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode/Clearing.EN&newvalue=1"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/ExMode.EN&newvalue=1"
#Disalbe unused RFM Outputs (No interference with oder blocks)
echo -e "\n- Disable unused RFM Outputs: "
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PU.actimode&newvalue="$IsShift
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PN.actimode&newvalue="$IsTurn
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/PL.actimode&newvalue="$IsTurn
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Interlock/Furnace.actimode&newvalue="$IsFurnace
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Move/Furnace.actimode&newvalue="$IsFurnace
# Disalbe unused Skills (for performance)
echo -e "\n- Disable unused Skills: "
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift.actimode&newvalue="$IsShift
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Turn.actimode&newvalue="$IsTurn
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Heat.actimode&newvalue="$IsFurnace
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift2.actimode&newvalue=0"
# Disalbe OpMode changes from pass to take
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/OpMode/hcon3877.on&newvalue=FALSE"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/OpMode/hcon5704.on&newvalue=FALSE"
### Configure Doors of Furnace ###
echo -e "\n- Configure Move for doors of furnace: "
[[ $IsFurnace = 1 ]] && Furnace="TRUE" || Furnace="FALSE"
[[ $IsFurnace = 1 ]] && NFurnace="FALSE" || NFurnace="TRUE"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Move/hcon1391.on&newvalue="$Furnace
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Move/hcon6458.on&newvalue="$Furnace
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Move/ready.result&newvalue="$NFurnace
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Move/end.result&newvalue="$NFurnace
### Set orderlist and executor ###
echo -e "\n- Set orderlist and delete services: "
ORDERLIST="\{BTAKE\}%20\{FTAKE\}%20\{BPASS\}%20\{FPASS\}%20\{JOG\}%20\{ABORT\}%20\{CLEAR\}%20\{RESET\}%20\{START\}%20\{HOLD\}%20\{UNHOLD\}%20\{SUSPEND\}%20\{UNSUSPEND\}%20\{STOP\}%20\{FREE\}%20\{OCCUPY\}%20\{PRIO\}%20\{AUTO\}%20\{MANUAL\}"
ORDEREXECUTOR="\{cmMode\}%20\{cmMode\}%20\{cmMode\}%20\{cmMode\}%20\{cmMode\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmOcc\}%20\{cmOcc\}%20\{cmOcc\}%20\{cmExe\}%20\{cmExe\}"
if [ "$IsShift" == "1" ]; then
ORDERLIST="\{USHIFT\}%20\{DSHIFT\}%20"$ORDERLIST
ORDEREXECUTOR="\{cmMode\}%20\{cmMode\}%20"$ORDEREXECUTOR
else
curl "http://"$SERVERIP":"$SERVERPORT"/deleteObject?format=plain&path=/TechUnits/ESE/"$CurrentESE"/SERVICES/USHIFT"
curl "http://"$SERVERIP":"$SERVERPORT"/deleteObject?format=plain&path=/TechUnits/ESE/"$CurrentESE"/SERVICES/DSHIFT"
fi
if [ "$IsTurn" == "1" ]; then
ORDERLIST="\{TURN\}%20"$ORDERLIST
ORDEREXECUTOR="\{cmMode\}%20"$ORDEREXECUTOR
else
curl "http://"$SERVERIP":"$SERVERPORT"/deleteObject?format=plain&path=/TechUnits/ESE/"$CurrentESE"/SERVICES/TURN"
fi
if [ "$IsFurnace" == "1" ]; then
ORDERLIST="\{HEAT\}%20"$ORDERLIST
ORDEREXECUTOR="\{cmMode\}%20"$ORDEREXECUTOR
else
#TODO add Service for Heat in ESE
:
#curl "http://"$SERVERIP":"$SERVERPORT"/deleteObject?format=plain&path=/TechUnits/ESE/"$CurrentESE"/SERVICES/TURN"
fi
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".ORDERLIST&newvalue="$ORDERLIST
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".ORDEREXECUTOR&newvalue="$ORDEREXECUTOR
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".Xpos&newvalue="$Xpos
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".Ypos&newvalue="$Ypos
### Delete type specific Outputs ###
echo -e "\n- Delete type specific Outputs: "
if [ "$IsShift" == "1" ]; then
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/Skills/Shift2/SHIFTPOS.value&newvalue=1"
else
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/c_SHIFTPOS.on&newvalue=FALSE"
curl "http://"$SERVERIP":"$SERVERPORT"/deleteObject?format=plain&path=/TechUnits/ESE/"$CurrentESE"/c_SHIFTPOS"
curl "http://"$SERVERIP":"$SERVERPORT"/unlink?format=plain&path=/TechUnits/ESE/"$CurrentESE".ports&element=/TechUnits/ESE/"$CurrentESE"/SHIFTPOS"
curl "http://"$SERVERIP":"$SERVERPORT"/deleteObject?format=plain&path=/TechUnits/ESE/"$CurrentESE"/SHIFTPOS"
fi
if [ "$IsFurnace" == "1" ]; then
:
else
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/c_TEMPFURN.on&newvalue=FALSE"
curl "http://"$SERVERIP":"$SERVERPORT"/deleteObject?format=plain&path=/TechUnits/ESE/"$CurrentESE"/c_TEMPFURN"
curl "http://"$SERVERIP":"$SERVERPORT"/unlink?format=plain&path=/TechUnits/ESE/"$CurrentESE".ports&element=/TechUnits/ESE/"$CurrentESE"/TEMPFURN"
curl "http://"$SERVERIP":"$SERVERPORT"/deleteObject?format=plain&path=/TechUnits/ESE/"$CurrentESE"/TEMPFURN"
fi
echo -e "\n"
}
loadESEProxy(){
CurrentESE=$1
IsShift=$2
IsTurn=$3
IsFurnace=$4
Xpos=$5
Ypos=$6
replaceNameAndLoad "basys/TechUnits_ESE_PXProxy" "PXProxy" $CurrentESE
echo "Configuring "$CurrentESE
### Set SSC States ###
echo -e "- Resetting SSC States: "
# Resetting SSCs
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/OrIn/Occ.EN&newvalue=3"
#Enable SSCs after reset
sleep 0.1
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE"/OrIn/Occ.EN&newvalue=1"
### Set orderlist and executor ###
echo -e "\n- Set orderlist and delete services: "
ORDERLIST="\{BTAKE\}%20\{FTAKE\}%20\{BPASS\}%20\{FPASS\}%20\{JOG\}%20\{RESET\}%20\{START\}%20\{STOP\}%20\{FREE\}%20\{OCCUPY\}%20\{PRIO\}"
ORDEREXECUTOR="\{cmMode\}%20\{cmMode\}%20\{cmMode\}%20\{cmMode\}%20\{cmMode\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmOcc\}%20\{cmOcc\}%20\{cmOcc\}"
if [ "$IsShift" == "1" ]; then
ORDERLIST="\{USHIFT\}%20\{DSHIFT\}%20"$ORDERLIST
ORDEREXECUTOR="\{cmMode\}%20\{cmMode\}%20"$ORDEREXECUTOR
else
:
fi
if [ "$IsTurn" == "1" ]; then
ORDERLIST="\{TURN\}%20"$ORDERLIST
ORDEREXECUTOR="\{cmMode\}%20"$ORDEREXECUTOR
else
:
fi
if [ "$IsFurnace" == "1" ]; then
ORDERLIST="\{HEAT\}%20"$ORDERLIST
ORDEREXECUTOR="\{cmMode\}%20"$ORDEREXECUTOR
else
:
fi
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".ORDERLIST&newvalue="$ORDERLIST
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".ORDEREXECUTOR&newvalue="$ORDEREXECUTOR
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".Xpos&newvalue="$Xpos
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/ESE/"$CurrentESE".Ypos&newvalue="$Ypos
echo -e "\n"
}
loadGSE(){
CurrentESE=$1
CurrentPos=$2
Xpos=$3
Ypos=$4
FBD="basys/TechUnits_GSE_PX"$5
replaceNameAndLoad $FBD "PX" $CurrentESE
echo "Configuring "$CurrentESE
###
#reset
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/OrIn/Occ.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/ExMode/Mode.EN&newvalue=3"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/Skills/PImage/CStatusExt.doReset&newvalue=TRUE"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/Skills/PImage/NStatusExt.doReset&newvalue=TRUE"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/Interlock/SetCCMDext.doReset&newvalue=TRUE"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/Interlock/SetNCMDext.doReset&newvalue=TRUE"
sleep 0.5
#set
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/OrIn/Occ.EN&newvalue=1"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/ExMode/Mode.EN&newvalue=1"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/Skills/PImage/CStatusExt.doCyclic&newvalue=TRUE"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/Skills/PImage/NStatusExt.doCyclic&newvalue=TRUE"
### Set X/Y Pos and Current position
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE"/Current.value&newvalue="$CurrentPos
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE".Xpos&newvalue="$Xpos
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/"$CurrentESE".Ypos&newvalue="$Ypos
echo -e "\n"
}
#!/bin/bash
# no parameter: start server and load fbds
# parameter 1: -r --> restarts server
# -l --> only load and configure fbds
##### Custom paths #####
THISACPLTSYSTEM=$(pwd)/..
SERVERNAME="GSE"
SERVERPORT="7511"
SERVERIP="localhost"
##### Functions ######
. ./functions.sh
##### start Server #####
startServer $1
echo -e "Waiting 5sec for Server to register at MANAGER."
sleep 5
##### Configure server ######
# Set cycletime
echo -e "Setting cyctime to 0.05"
curl "http://$SERVERIP:"$SERVERPORT"/setVar?format=plain&path=/Tasks/UrTask.cyctime&newvalue=0.05"
echo -e "\n"
##### Load the fbds #####
#loadFBD "basys/TechUnits_Topology-erweitert"
loadFBD "basys/TechUnits_Topology"
#loadPaletts
loadGSE "PA001" "PE0025" 0 100
#loadGSE "PA002" "PE031" 360 100
#loadGSE "PA003" "PE027" 540 100
#config Topologyagent #TODO write function for config
#PALETTELIST="\{/TechUnits/GSE/PA001\}"
PALETTELIST="\{/TechUnits/GSE/PA001\}%20\{/TechUnits/GSE/PA002\}%20\{/TechUnits/GSE/PA003\}"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/TopologyAgent.PalettePaths&newvalue="$PALETTELIST
# Set shift direction
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/PA001/Skills/Move/Execute/UorD.IN1&newvalue=DSHIFT"
curl "http://"$SERVERIP":"$SERVERPORT"/setVar?format=plain&path=/TechUnits/GSE/PA001/Skills/Move/Execute/UorD.IN2&newvalue=USHIFT"
echo -e "\n\033[1;32mDone\033[m"
exit
#!/bin/bash
# no parameter: start server and load fbds
# parameter 1: -r --> restarts server
# -l --> only load and configure fbds
##### Custom paths #####
THISACPLTSYSTEM=$(pwd)/..
SERVERNAME="HMI"
SERVERPORT="7508"
SERVERIP="localhost"
##### Functions ######
. ./functions.sh
##### start Server #####
#startServer $1
echo -e "Waiting 5sec for Server to register at MANAGER."
sleep 5
##### Load the fbds #####
loadFBD "basys/StaticDisplayComponent"
loadFBD "basys/Templates_Engineering"
loadFBD "basys/Sheet_EngineeringFB"
loadFBD "basys/data_kshttp_ese"
loadFBD "basys/data_kshttp_gse"
echo -e "\033[1;32mDone\033[m"
exit
#!/bin/bash
# no parameter: start server and load fbds
# parameter 1: -r --> restarts server
# -l --> only load and configure fbds
##### Custom paths #####
THISACPLTSYSTEM=$(pwd)/..
SERVERNAME="MANAGER"
SERVERPORT="7509"
SERVERIP="localhost"
##### Functions ######
. ./functions.sh
##### start Server #####
startServer $1
echo -e "\n\033[1;32mDone\033[m"
exit
#!/bin/bash
# no parameter: start server and load fbds
# parameter 1: -r --> restarts server
# -l --> only load and configure fbds
##### Custom paths #####
THISACPLTSYSTEM=$(pwd)/..
SERVERNAME="PROC"
SERVERPORT="7512"
SERVERIP="localhost"
##### Functions ######
. ./functions.sh
##### start Server #####
startServer $1
echo -e "Waiting 5sec for Server to register at MANAGER."
sleep 5
##### Load the fbds #####
loadFBD "basys/TechUnits_PROC_M1"
replaceNameAndLoad "basys/TechUnits_PROC_M1" "M1" "M2"
replaceNameAndLoad "basys/TechUnits_PROC_M1" "M1" "M3"
replaceNameAndLoad "basys/TechUnits_PROC_M1" "M1" "M4"
replaceNameAndLoad "basys/TechUnits_PROC_M1" "M1" "M5"
##### Configure server ######
# Set cycletime to 0.1 sec
echo -e "Setting cyctime to 0.5"
curl "http://localhost:"$SERVERPORT"/setVar?format=plain&path=/Tasks/UrTask.cyctime&newvalue=0.05"
echo -e "\n"
echo -e "\n\033[1;32mDone\033[m"
exit
File moved
#!/bin/tclsh
# No parameters.
# Starts the server in this directory, loads fbds and configures via ksHTTP
# Has to be inside the acplt/servers/SERVERNAME/ dir
##### load requried libs #####
#source ../../system/systools/acplt.tcl ;#already sourced by basys.tcl #TODO create acplt package instead
source ../../system/systools/basys.tcl
#namespace import acplt::* ;#TODO imports don't work the way they should --> startServer instead of acplt::startServer e.g.
##### set global vars #####
#set acplt::logger::LOGLEVEL 0 ;# Set loglevel to trace
# server variables #TODO read from ov_server.conf
set acplt::SERVERNAME ESE
set acplt::SERVERPORT 7510
set acplt::SERVERIP localhost
### Server specific variables ###
variable CYCLETIME 100
# mark the start of the sript
acplt::logger::info "Script autostart_server for $acplt::SERVERNAME started on: [clock format [clock seconds] -format %d.%m.%y]"
##### start server #####
set started [acplt::startServer]
if {$started == 1} {
acplt::logger::info "Script autostart_server for $acplt::SERVERNAME finished early, as server is already running."
exit 0
}
##### Custom Functions for ESE server #####
proc configureConveyorSHM {UseSHM UseRFM} {
basys::setVarList "Switch RFM Outputs in Interlock" [subst {
"/Interlock/PE.useSHM" $UseSHM
"/Interlock/PU.useSHM" $UseSHM
"/Interlock/PN.useSHM" $UseSHM
"/Interlock/PL.useSHM" $UseSHM
"/Interlock/Furnace.useSHM" $UseSHM
}]
basys::setVarList "Switch RFM Inputs in Skills" [subst {
"/Skills/Move/PE.useSHM" $UseSHM
"/Skills/Move/Furnace.useSHM" $UseSHM
"/Skills/Shift/PU.useSHM" $UseSHM
"/Skills/Shift2/PU.useSHM" $UseSHM
"/Skills/Turn/PL.useSHM" $UseSHM
"/Skills/Heat/Furnace.useSHM" $UseSHM
}]
#TODO: Replace Shift2 P3STOP and P3SLOW
basys::setVarList "Switch HandPanel Inputs in ExMode" [subst {
"/ExMode/HandPanel.useSHM" $UseSHM
"/ExMode/HandPanel.iexreq" $UseRFM
"/ExMode/hcon916.on" $UseRFM
"/ExMode/hcon2428.on" $UseRFM
"/ExMode/NoESTOP.IN" $UseRFM
"/ExMode/AbortOrESTOP.IN1" $UseRFM
}]
#TODO only works for change to SHM
basys::setVarList "Rename IDs for PU,PN,PL Outputs in Interlock" [subst {
"/Interlock/PUID.value" $basys::COMPONENT
"/Interlock/PLID.value" $basys::COMPONENT
"/Interlock/PNID.value" $basys::COMPONENT
"/Skills/PUID.value" $basys::COMPONENT
"/Skills/PLID.value" $basys::COMPONENT
}]
}
proc loadConveyorCC {Name IsShift IsTurn IsFurnace Xpos Ypos {MoveDirection 0}} {
acplt::logger::separator
set basys::COMPONENT $Name
basys::loadComponent PX
# Configure conveyor specific settings:
basys::setVarList "Disalbe unused RFM outputs" [subst {
"/Interlock/PU.actimode" $IsShift
"/Interlock/PN.actimode" $IsTurn
"/Interlock/PL.actimode" $IsTurn
"/Interlock/Furnace.actimode" "$IsFurnace"
"/Skills/Move/Furnace.actimode" "$IsFurnace"
}]
basys::setVarList "Disalbe unused Skills (for performance)" [subst {
"/Skills/Shift.actimode" $IsShift
"/Skills/Turn.actimode" $IsTurn
"/Skills/Heat.actimode" $IsFurnace
"/Skills/Shift2.actimode" 0
}]
basys::setVarList "Disalbe OpMode changes from pass to take" {
"/OpMode/hcon3877.on" FALSE
"/OpMode/hcon5704.on" FALSE
}
#Configure move direction
basys::setVar "/Interlock/PE.MountDir" $MoveDirection
if {$IsFurnace == 1} {
basys::setVarList "Configure Move for doors of furnace" {
"/Skills/Move/hcon1391.on" TRUE
"/Skills/Move/hcon6458.on" TRUE
"/Skills/Move/ready.result" FALSE
"/Skills/Move/end.result" FALSE
}
} else {
basys::setVarList "Configure Move for doors of furnace" {
"/Skills/Move/hcon1391.on" FALSE
"/Skills/Move/hcon6458.on" FALSE
"/Skills/Move/ready.result" TRUE
"/Skills/Move/end.result" TRUE
}
}
acplt::logger::info "Set orderlist and executor"
set OrderList "\{BTAKE\}%20\{FTAKE\}%20\{BPASS\}%20\{FPASS\}%20\{JOG\}%20\{ABORT\}%20\{CLEAR\}%20\{RESET\}%20\{START\}%20\{HOLD\}%20\{UNHOLD\}%20\{SUSPEND\}%20\{UNSUSPEND\}%20\{STOP\}%20\{FREE\}%20\{OCCUPY\}%20\{PRIO\}%20\{AUTO\}%20\{MANUAL\}"
set OrderExecutor "\{cmMode\}%20\{cmMode\}%20\{cmMode\}%20\{cmMode\}%20\{cmMode\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmExe\}%20\{cmOcc\}%20\{cmOcc\}%20\{cmOcc\}%20\{cmExe\}%20\{cmExe\}"
if {$IsShift == 1} {
set OrderList "\{USHIFT\}%20\{DSHIFT\}%20$OrderList"
set OrderExecutor "\{cmMode\}%20\{cmMode\}%20$OrderExecutor"
}
if {$IsTurn == 1} {
set OrderList "\{TURN\}%20$OrderList"
set OrderExecutor "\{cmMode\}%20$OrderExecutor"
}
if {$IsFurnace == 1} {
set OrderList "\{HEAT\}%20$OrderList"
set OrderExecutor "\{cmMode\}%20$OrderExecutor"
}
basys::setVar ".ORDERLIST" $OrderList
basys::setVar ".ORDEREXECUTOR" $OrderExecutor
acplt::logger::info "Delete type specific signal outputs"
if {$IsShift == 1} {
basys::setVar "/Skills/Shift2/SHIFTPOS.value" 1
} else {
basys::setVar "/c_SHIFTPOS.on" FALSE
basys::deleteObject "/c_SHIFTPOS"
basys::unlink ".ports" "/TechUnits/$basys::FOLDERNAME/$basys::COMPONENT/SHIFTPOS"
basys::deleteObject "/SHIFTPOS"
}
if {$IsFurnace == 0} {
basys::setVar "/c_TEMPFURN.on" FALSE
basys::deleteObject "/c_TEMPFURN"
basys::unlink ".ports" "/TechUnits/$basys::FOLDERNAME/$basys::COMPONENT/TEMPFURN"
basys::deleteObject "/TEMPFURN"
}
basys::setVarList "Set engineering x and y position" [subst {
".Xpos" $Xpos
".Ypos" $Ypos
}]
configureConveyorSHM TRUE FALSE
acplt::logger::info "Done for $basys::COMPONENT"
}
proc configureShift2 {Name} {
acplt::logger::info "Configure extended shift to 3rd row for $Name"
set basys::COMPONENT $Name
#disable actimode
basys::setVar "/Skills/Shift.actimode" 0
#rename Shift and Shift2
basys::renameObject "/Skills/Shift" "/TechUnits/$basys::FOLDERNAME/$basys::COMPONENT/Skills/ShiftTemp"
basys::renameObject "/Skills/Shift2" "/TechUnits/$basys::FOLDERNAME/$basys::COMPONENT/Skills/Shift"
basys::renameObject "/Skills/ShiftTemp" "/TechUnits/$basys::FOLDERNAME/$basys::COMPONENT/Skills/Shift2"
#rename ShiftToWORKST and Shift2ToWORKST
basys::setVar "/Skills/ShiftToWORKST.on" FALSE
basys::renameObject "/Skills/ShiftToWORKST" "/TechUnits/$basys::FOLDERNAME/$basys::COMPONENT/Skills/ShiftToWORKSTTemp"
basys::renameObject "/Skills/Shift2ToWORKST" "/TechUnits/$basys::FOLDERNAME/$basys::COMPONENT/Skills/ShiftToWORKST"
basys::renameObject "/Skills/ShiftToWORKSTTemp" "/TechUnits/$basys::FOLDERNAME/$basys::COMPONENT/Skills/Shift2ToWORKST"
#change SHIFTPOS connection link
basys::unlink "/c_SHIFTPOS.sourcefb" "/TechUnits/$basys::FOLDERNAME/$basys::COMPONENT/Skills/Shift2/SHIFTPOS"
basys::link "/c_SHIFTPOS.sourcefb" "/TechUnits/$basys::FOLDERNAME/$basys::COMPONENT/Skills/Shift/SHIFTPOS"
basys::setVar "/c_SHIFTPOS.on" TRUE
#enable actimode
basys::setVar "/Skills/Shift.actimode" 1
if {$Name == "PE033"} {
basys::setVarList "Configure shift conveyer shm adresses" {
"/Skills/Shift/P3SLOW.address" 212
"/Skills/Shift/P3STOP.address" 213
}
}
}
##### load fbds and configure server #####
# set cycletime
basys::setCycletime $CYCLETIME
acplt::ks::setVar /Tasks/UrTask.actimode 0
### Load ESEs ###
set basys::FOLDERNAME ESE
# create ESE domain
acplt::ks::createObject "/acplt/ov/domain" "/TechUnits/ESE"
## Load conveyors of firt row PE004 - PE018 ##
loadConveyorCC PE004 0 0 0 0 100
loadConveyorCC PE005 0 0 0 360 100
loadConveyorCC PE008 0 0 0 540 100
loadConveyorCC PE009 0 0 1 720 100
loadConveyorCC PE010 0 0 0 900 100
loadConveyorCC PE011 0 0 0 1080 100
loadConveyorCC PE018 0 0 0 1440 100
## Load conveyors of second row PE031 - PE028 ##
loadConveyorCC PE031 0 0 0 360 300
loadConveyorCC PE030 0 0 0 540 300
loadConveyorCC PE025 0 1 0 720 300
loadConveyorCC PE028 0 0 0 900 300
loadConveyorCC PE027 0 0 0 1080 300
## Load shift conveyors ##
loadConveyorCC PE034 1 0 0 180 200
loadConveyorCC PE033 1 0 0 1260 200
# The lightbarriers of PE033 in move direction are reversed
basys::setVar "/Skills/Move/InvertMountDir.IN2" TRUE
## Load conveyors of third row PE013 - PE026 ##
# The motors of the
loadConveyorCC PE013 0 0 0 360 500 1
loadConveyorCC PE016 0 0 0 540 500 1
loadConveyorCC PE019 0 0 0 720 500 1
loadConveyorCC PE021 0 0 0 900 500 1
loadConveyorCC PE026 0 0 0 1080 500 1
configureShift2 PE034
configureShift2 PE033
### reset all ###
acplt::logger::separator
acplt::ks::setVar /Tasks/UrTask.actimode 1
set ESElist [basys::getCCList]
acplt::logger::info "Reset all ESEs: $ESElist"
basys::sendCMDToAll $ESElist OCCUPY AUTOSTART 3
basys::sendCMDToAll $ESElist ABORT AUTOSTART 3
basys::sendCMDToAll $ESElist CLEAR AUTOSTART 3
basys::sendCMDToAll $ESElist RESET AUTOSTART 3
acplt::logger::info "Select UHIFT and TURN. START"
basys::sendCMDToAll $ESElist USHIFT AUTOSTART 3
basys::sendCMDToAll $ESElist TURN AUTOSTART 3
basys::sendCMDToAll $ESElist START AUTOSTART 3
acplt::logger::info "Wait for 60 seconds to complete DHIFT and TURN"
#TODO read EXSTs instead
after 45000
acplt::logger::info "Stop Reset and free"
basys::sendCMDToAll $ESElist STOP AUTOSTART 3
basys::sendCMDToAll $ESElist RESET AUTOSTART 3
basys::sendCMDToAll $ESElist FREE AUTOSTART 3
### Book physical palettes ###
#TODO: Book with shm library and DO blocks instead:
# <ioelement name="PalletBooking.PalletBooking.BookIn" direction="FromSHM" type="bool" size="4" unit="none" signal="36" />
# <ioelement name="PalletBooking.PalletBooking.BookOut" direction="FromSHM" type="bool" size="4" unit="none" signal="37" />
# <ioelement name="PalletBooking.PalletBooking.PalletID" direction="FromSHM" type="string" size="16" unit="none" signal="38" />
# <ioelement name="PalletBooking.PalletBooking.PalletNumber" direction="FromSHM" type="int" size="4" unit="none" signal="42" />
# <ioelement name="PalletBooking.PalletBooking.Position" direction="FromSHM" type="string" size="16" unit="none" signal="43" />
# <ioelement name="PalletBooking.PalletBooking.PositionIndex" direction="FromSHM" type="int" size="4" unit="none" signal="47" />
proc bookPalette {name pos} {
acplt::logger::info "Booking in physical palette $name at $pos"
acplt::ks::createObject "/acplt/smscrm/BookPallet" "/TechUnits/Booking$name"
acplt::ks::setVar "/TechUnits/Booking$name.cyctime" 1.0
acplt::ks::setVar "/TechUnits/Booking$name.actimode" 1
acplt::ks::link "/TechUnits/Booking$name.taskparent" /Tasks/UrTask
acplt::ks::setVar "/TechUnits/Booking$name.useSHM" TRUE
acplt::ks::setVar "/TechUnits/Booking$name.ID" $name
acplt::ks::setVar "/TechUnits/Booking$name.Location" $pos
after 1000
acplt::ks::setVar "/TechUnits/Booking$name.Book" TRUE
after 1000
acplt::ks::setVar "/TechUnits/Booking$name.Book" FALSE
}
acplt::logger::separator
bookPalette PA001 PE004
bookPalette PA002 PE018
##### finish script #####
acplt::logger::separator
acplt::logger::info "Script autostart_server for $acplt::SERVERNAME finished."
exit 0
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment