Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script to start PlcSimAdvanced and set the instance IP according to AXTARGET value #47

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
292 changes: 169 additions & 123 deletions axopen.template.simple/ax/apax-lock.json

Large diffs are not rendered by default.

62 changes: 17 additions & 45 deletions axopen.template.simple/ax/apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ variables:
APAX_BUILD_ARGS: [ -d ]
PLC_NAME: "plc_line"
DEFAULT_NAMESPACE: "axosimple"
HWCONFIG: "HWC"
AXTARGET: 10.222.6.1
AXTARGETPLATFORMINPUT: .\bin\1500\
AX_USERNAME: "adm"
AX_TARGET_PWD: "123ABCDabcd$#!"
MY_VERY_STRONG_PASSWORD: $AX_TARGET_PWD
USE_PLC_SIM_ADVANCED: "true"
HWCONFIG: "HWC"
COM_CERT_PATH: .\certs\Communication.cer
scripts:
push:
Expand Down Expand Up @@ -171,7 +171,8 @@ scripts:
if [[ "$HWCONFIG" == "TIA-NON-SECURE" ]]; then
apax sld load --accept-security-disclaimer -t $AXTARGET -i $AXTARGETPLATFORMINPUT --mode delta
fi
plcsim: ..\\scripts\\StartPlcSimAdvCli.exe #start PLCSIM
# plcsim: ..\\scripts\\StartPlcSimAdvCli.exe #start PLCSIM
plcsim: dotnet run --project ..\\tools\\AXOpen.Simple.Tools\\AXOpen.Simple.Tools\\AXOpen.Simple.Tools.csproj -- startplcsim -x $APAX_YML_NAME -n $PLC_NAME -t $AXTARGET
r: ..\\scripts\\restart_PLC.sh $AXTARGET $PLC_NAME
ixc: | # run ix builder
dotnet tool restore
Expand All @@ -187,65 +188,36 @@ scripts:
apax clean
apax install
reset_plc: | #total reset of the PLC including IP and name
if [[ "$HWCONFIG" == "HWC" ]]; then
..\\scripts\\reset_plc.sh $AXTARGET
fi
..\\scripts\\reset_plc.sh $AXTARGET
clean_plc: | #total reset of the PLC excluding IP and name
if [[ "$HWCONFIG" == "HWC" ]]; then
..\\scripts\\clean_plc.sh $AXTARGET
fi
..\\scripts\\clean_plc.sh $AXTARGET
ssc: | # setup secure communication, create and import certificates, setup password for AX_USERNAME
if
[[ "$HWCONFIG" == "HWC" ]]; then ..\\scripts\\setup_secure_communication.sh $PLC_NAME $AX_USERNAME $AX_TARGET_PWD
fi
..\\scripts\\setup_secure_communication.sh $PLC_NAME $AX_USERNAME $AX_TARGET_PWD
gsd: | # copy and install all gsdml files from libraries
if
[[ "$HWCONFIG" == "HWC" ]]; then
..\\scripts\\copy_and_install_gsd.sh
fi
..\\scripts\\copy_and_install_gsd.sh
hwl: | # copy all templates from libraries
if [[ "$HWCONFIG" == "HWC" ]]; then
..\\scripts\\copy_hwl_templates.sh
fi
..\\scripts\\copy_hwl_templates.sh
hwcc: | # compile hardware configuration
if [[ "$HWCONFIG" == "HWC" ]]; then
..\\scripts\\hw_compile.sh
fi
hwid: | # copy the generated HwIds from global constants into the type definition, matching the format as the TIA2AX tool creates
if [[ "$HWCONFIG" == "HWC" ]]; then
..\\scripts\\copy_hardware_ids.sh $DEFAULT_NAMESPACE $PLC_NAME
fi
..\\scripts\\copy_hardware_ids.sh $DEFAULT_NAMESPACE $PLC_NAME
hwadr: | # copy the generated IoAddresses
if [[ "$HWCONFIG" == "HWC" ]]; then
..\\scripts\\copy_io_addresses.sh $DEFAULT_NAMESPACE $PLC_NAME
fi
..\\scripts\\copy_io_addresses.sh $DEFAULT_NAMESPACE $PLC_NAME
hwfd: | # copy and install gsd, copy templates,compile, copy the HwIds, copy the IoAddresses, first download HW using password and upload certificate
if [[ "$HWCONFIG" == "HWC" ]]; then
..\\scripts\\hw_first_download.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AX_TARGET_PWD
fi
..\\scripts\\hw_first_download.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AX_TARGET_PWD
hwu: | # copy and install gsd, copy templates, compile, copy the HwIds, copy the IoAddresses, download HW using certificate
if [[ "$HWCONFIG" == "HWC" ]]; then
..\\scripts\\hw_update.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET
fi
..\\scripts\\hw_update.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET
swfd: | # software build and full download
if [[ "$HWCONFIG" == "HWC" ]]; then
..\\scripts\\sw_build_and_download_full.sh $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT
fi
..\\scripts\\sw_build_and_download_full.sh $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT
swdd: | # software build and delta download
if [[ "$HWCONFIG" == "HWC" ]]; then
..\\scripts\\sw_build_and_download_delta.sh $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT
fi
..\\scripts\\sw_build_and_download_delta.sh $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT
alf: | #clear plc except ip and name and provide all actions for install all, build and initial download hw so as sw
START=$(date +%s)
if [[ "$HWCONFIG" == "HWC" ]]; then
..\\scripts\\all_first.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT $AX_USERNAME $AX_TARGET_PWD
fi
..\\scripts\\all_first.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT $AX_USERNAME $AX_TARGET_PWD $USE_PLC_SIM_ADVANCED
echo $(date +%D)"-"$(date +%H)":"$(date +%M)":"$(date +%S) " - Finished in :" $(expr $(date +%s) - $START) "s"
all: | #build and download hardware and software
START=$(date +%s)
if [[ "$HWCONFIG" == "HWC" ]]; then
..\\scripts\\all.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT $AX_USERNAME $AX_TARGET_PWD
fi
..\\scripts\\all.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT $AX_USERNAME $AX_TARGET_PWD $USE_PLC_SIM_ADVANCED
echo $(date +%D)"-"$(date +%H)":"$(date +%M)":"$(date +%S) " - Finished in :" $(expr $(date +%s) - $START) "s"
publicKeys:
"@ix-ax": 30c06ef7830b4dfd8f16e003508da1ac2d187714d0e1f38279a9332cbe4e4e17
Binary file not shown.
40 changes: 0 additions & 40 deletions axopen.template.simple/scripts/StartPlcSimAdvCli.deps.json

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

31 changes: 27 additions & 4 deletions axopen.template.simple/scripts/all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ export GREEN='\033[0;32m'
export RED='\033[0;31m'
export YELLOW='\033[0;33m'
export NC='\033[0m\r\n' # No Color+CRLF
if [ "$#" -ne 6 ]; then
printf "${RED}Usage: $0 <NAMESPACE> <PLC_NAME> <PLC_IP_ADDRESS> <PLATFORM> <USERNAME> <PASSWORD>\r\n${NC}"
if [ "$#" -ne 7 ]; then
printf "${RED}Usage: $0 <NAMESPACE> <PLC_NAME> <PLC_IP_ADDRESS> <PLATFORM> <USERNAME> <PASSWORD> <USE_PLC_SIM_ADVANCED>\r\n${NC}"
exit 1
fi

Expand Down Expand Up @@ -44,6 +44,27 @@ if [ -z $PASSWORD ]; then
exit 1
fi

USE_PLC_SIM_ADVANCED=$7
if [ -z $USE_PLC_SIM_ADVANCED ]; then
printf "${RED}The USE_PLC_SIM_ADVANCED could not be an empty string.\r\n${NC}"
exit 1
fi

PLCSIM=0
case "$(echo "$USE_PLC_SIM_ADVANCED" | tr '[:upper:]' '[:lower:]')" in
"true")
PLCSIM=1
printf "${YELLOW} USE_PLC_SIM_ADVANCED is true. ${NC}"
;;
"false")
PLCSIM=0
printf "${YELLOW} USE_PLC_SIM_ADVANCED is false. ${NC}"
;;
*)
printf "${RED}USE_PLC_SIM_ADVANCED has an invalid or undefined value: '$USE_PLC_SIM_ADVANCED'.${NC}"
;;
esac

certfile="./certs/$PLC_NAME/$PLC_NAME.cer"
if ! [[ -e "$certfile" ]]; then
printf "${RED}Certification file $certfile does not exist.\r\n${NC}"
Expand All @@ -61,8 +82,10 @@ else
exit 1
fi

plcsim_script=$( dirname ${BASH_SOURCE[0]})"\\plcsim.sh"
$plcsim_script
if [ "$PLCSIM" -eq 1 ]; then
plcsim_script=$( dirname ${BASH_SOURCE[0]})"\\plcsimadvanced.sh"
$plcsim_script $NAMESPACE $PLC_NAME $PLC_IP_ADDRESS
fi

#apax run ci # clean and install dependencies
apax clean
Expand Down
32 changes: 28 additions & 4 deletions axopen.template.simple/scripts/all_first.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ export GREEN='\033[0;32m'
export RED='\033[0;31m'
export YELLOW='\033[0;33m'
export NC='\033[0m\r\n' # No Color+CRLF
if [ "$#" -ne 6 ]; then
printf "${RED}Usage: $0 <NAMESPACE> <PLC_NAME> <PLC_IP_ADDRESS> <PLATFORM> <USERNAME> <PASSWORD>\r\n${NC}"
if [ "$#" -ne 7 ]; then
printf "${RED}Usage: $0 <NAMESPACE> <PLC_NAME> <PLC_IP_ADDRESS> <PLATFORM> <USERNAME> <PASSWORD> <USE_PLC_SIM_ADVANCED>\r\n${NC}"
exit 1
fi

Expand Down Expand Up @@ -44,6 +44,27 @@ if [ -z $PASSWORD ]; then
exit 1
fi

USE_PLC_SIM_ADVANCED=$7
if [ -z $USE_PLC_SIM_ADVANCED ]; then
printf "${RED}The USE_PLC_SIM_ADVANCED could not be an empty string.\r\n${NC}"
exit 1
fi

PLCSIM=0
case "$(echo "$USE_PLC_SIM_ADVANCED" | tr '[:upper:]' '[:lower:]')" in
"true")
PLCSIM=1
printf "${YELLOW} USE_PLC_SIM_ADVANCED is true. ${NC}"
;;
"false")
PLCSIM=0
printf "${YELLOW} USE_PLC_SIM_ADVANCED is false. ${NC}"
;;
*)
printf "${RED}USE_PLC_SIM_ADVANCED has an invalid or undefined value: '$USE_PLC_SIM_ADVANCED'.${NC}"
;;
esac

printf "${RED}This command will prompt during execution, so do not leave your PC. You can enjoy your coffee afterward.\r\n${NC}"

check_requisites_apax_script=$( dirname ${BASH_SOURCE[0]})"\\check_requisites_apax.sh"
Expand All @@ -56,8 +77,11 @@ if ! $check_requisites_nuget_script ; then
exit 1
fi

plcsim_script=$( dirname ${BASH_SOURCE[0]})"\\plcsim.sh"
$plcsim_script
if [ "$PLCSIM" -eq 1 ]; then
dotnet run --project ..\\tools\\AXOpen.Simple.Tools\\AXOpen.Simple.Tools\\AXOpen.Simple.Tools.csproj -- startplcsim -x $NAMESPACE -n $PLC_NAME -t $PLC_IP_ADDRESS
# plcsim_script=$( dirname ${BASH_SOURCE[0]})"\\plcsimadvanced.sh"
# $plcsim_script $NAMESPACE $PLC_NAME $PLC_IP_ADDRESS
fi

#apax run ci # clean and install dependencies
apax clean
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35521.163
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AXOpen.Simple.Tools", "AXOpen.Simple.Tools\AXOpen.Simple.Tools.csproj", "{2085A8F9-6645-4BF6-AAC5-18D7DA651689}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlcSimAdvancedStarter", "PlcSimAdvancedStarter\PlcSimAdvancedStarter.csproj", "{24B14AC4-4623-41FB-94C7-5E0E67576940}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2085A8F9-6645-4BF6-AAC5-18D7DA651689}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2085A8F9-6645-4BF6-AAC5-18D7DA651689}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2085A8F9-6645-4BF6-AAC5-18D7DA651689}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2085A8F9-6645-4BF6-AAC5-18D7DA651689}.Release|Any CPU.Build.0 = Release|Any CPU
{24B14AC4-4623-41FB-94C7-5E0E67576940}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{24B14AC4-4623-41FB-94C7-5E0E67576940}.Debug|Any CPU.Build.0 = Debug|Any CPU
{24B14AC4-4623-41FB-94C7-5E0E67576940}.Release|Any CPU.ActiveCfg = Release|Any CPU
{24B14AC4-4623-41FB-94C7-5E0E67576940}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,6 @@
"docs/1_language/02_oop/2_interfaces.md",
"docs/1_language/02_oop/3_copyfunctions.md",
"docs/1_language/02_oop/index.md",
"docs/1_language/images/directive-syntax-highlighting.png",
"docs/1_language/images/partial-access-width.png",
"docs/1_language/images/stringstructure.jpg",
"docs/1_language/diagrams/accessModifier.svg",
"docs/1_language/diagrams/arrayTypeDeclaration.svg",
"docs/1_language/diagrams/calls.svg",
Expand Down Expand Up @@ -226,6 +223,9 @@
"docs/1_language/diagrams/taskConfig.svg",
"docs/1_language/diagrams/varDeclarationSection.svg",
"docs/1_language/diagrams/whileStatement.svg",
"docs/1_language/images/directive-syntax-highlighting.png",
"docs/1_language/images/partial-access-width.png",
"docs/1_language/images/stringstructure.jpg",
"docs/1_language/_types/conversion-table.md",
"docs/1_language/_types/conversion-table.png",
"docs/1_language/_types/fullTable.png",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\PlcSimAdvancedStarter\PlcSimAdvancedStarter.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="AX.ST.Compiler.PluginAbstractions">
<HintPath>.apax\.apax\packages\@ax\stc-win-x64\bin\AX.ST.Compiler.PluginAbstractions.dll</HintPath>
Expand Down

This file was deleted.

Loading
Loading