Skip to content

Commit

Permalink
Scripts allignement with AXOPEN (#49)
Browse files Browse the repository at this point in the history
* plcsim

* Create draft PR for #46

* Create draft PR for #48

* wip

* missing variables in all_first.sh

---------

Co-authored-by: TK <61820360+TomKovac@users.noreply.github.com>
  • Loading branch information
IX-BOT and TomKovac authored Dec 9, 2024
1 parent b5f3237 commit 252769a
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 32 deletions.
9 changes: 4 additions & 5 deletions axopen.template.simple/ax/apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,18 @@ 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: dotnet run --project ..\\tools\\AXOpen.Simple.Tools\\AXOpen.Simple.Tools\\AXOpen.Simple.Tools.csproj -- startplcsim -x $APAX_YML_NAME -n $PLC_NAME -t $AXTARGET
plcsim: ..\\scripts\\plcsimadvanced.sh $APAX_YML_NAME $PLC_NAME $AXTARGET
r: ..\\scripts\\restart_PLC.sh $AXTARGET $PLC_NAME
ixc: | # run ix builder
dotnet tool restore
dotnet ixc
postbuild: apax run ixc # run after build
dcpli: | # list all interfaces, used to discover MAC address of the adapter connected to PLC
..\\..\\scripts\\dcp_utility_list_interfaces.sh
..\\scripts\\dcp_utility_list_interfaces.sh
dcpd: | # discover all accesible devices connected to adapter with MAC address equal to entered MAC, used to discover MAC-addresses of the slaves
..\\..\\scripts\\dcp_utility_discover.sh $PNIO_MAC
..\\scripts\\dcp_utility_discover.sh $PNIO_MAC
hdl: | #List configured harware and its state
..\\..\\scripts\\hw_diag_list.sh $AXTARGET $PLC_NAME
..\\scripts\\hw_diag_list.sh $AXTARGET $PLC_NAME
ci: | #clean and install dependencies
apax clean
apax install
Expand Down
5 changes: 2 additions & 3 deletions axopen.template.simple/scripts/all_first.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ if ! $check_requisites_nuget_script ; then
fi

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
plcsim_script=$( dirname ${BASH_SOURCE[0]})"\\plcsimadvanced.sh"
$plcsim_script $NAMESPACE $PLC_NAME $PLC_IP_ADDRESS
fi

#apax run ci # clean and install dependencies
Expand Down
23 changes: 0 additions & 23 deletions axopen.template.simple/scripts/plcsim.sh

This file was deleted.

30 changes: 30 additions & 0 deletions axopen.template.simple/scripts/plcsimadvanced.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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 3 ]; then
printf "${RED}Usage: $0 <INSTANCE_NAME> <PLC_NAME> <PLC_IP_ADDRESS>\r\n${NC}"
exit 1
fi

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

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

PLC_IP_ADDRESS=$3
validate_script=$( dirname ${BASH_SOURCE[0]})"\\validate_ip.sh"
if ! $validate_script "$PLC_IP_ADDRESS"; then
printf "${RED}The PLC_IP_ADDRESS '$PLC_IP_ADDRESS' is not a valid IP address.\r\n${NC}"
exit 1
fi

dotnet run --project ..\\tools\\AXOpen.Simple.Tools\\AXOpen.Simple.Tools\\AXOpen.Simple.Tools.csproj -- startplcsim -x $INSTANCE_NAME -n $PLC_NAME -t $PLC_IP_ADDRESS
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
<PackageReference Include="AXSharp.Compiler" Version="0.20.1-alpha.270" />
<PackageReference Include="AXSharp.Compiler.Cs" Version="0.20.1-alpha.270" />
<PackageReference Include="Cocona" Version="2.2.0" />
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>

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

<ItemGroup>
Expand Down

0 comments on commit 252769a

Please sign in to comment.