diff --git a/axopen.template.simple/ax/apax.yml b/axopen.template.simple/ax/apax.yml index ed3439d..fd80cdc 100644 --- a/axopen.template.simple/ax/apax.yml +++ b/axopen.template.simple/ax/apax.yml @@ -51,7 +51,7 @@ variables: PLC_NAME: "plc_line" DEFAULT_NAMESPACE: "axosimple" HWCONFIG: "HWC" - AXTARGET: 10.222.6.1 + AXTARGET: 10.10.10.120 AXTARGETPLATFORMINPUT: .\bin\1500\ AX_USERNAME: "adm" AX_TARGET_PWD: "123ABCDabcd$#!" diff --git a/axopen.template.simple/ax/src/Context.st b/axopen.template.simple/ax/src/Context.st index 7b7ac05..948c446 100644 --- a/axopen.template.simple/ax/src/Context.st +++ b/axopen.template.simple/ax/src/Context.st @@ -8,8 +8,6 @@ NAMESPACE axosimple CLASS PUBLIC Context EXTENDS AXOpen.Core.AxoContext VAR PUBLIC Glob : GlobalContextObjects; - Inputs : REF_TO axosimple.Inputs; - Outputs : REF_TO axosimple.Outputs; Safety : TechnologySafety; S71500Rtc : AXOpen.S71500.Rtc; @@ -31,13 +29,9 @@ NAMESPACE axosimple THIS.SetUp(); Safety.Run(THIS); Glob.Run(THIS); - - IF(Inputs = NULL || Outputs = NULL) THEN - RETURN; - END_IF; // Unit entry call unitEntryCall - // UnitTemplate.Run(THIS, Inputs^, Outputs^, REF(Glob)); + // UnitTemplate.Run(THIS, REF(Glob)); END_METHOD diff --git a/axopen.template.simple/ax/src/IO/Inputs.st b/axopen.template.simple/ax/src/IO/Inputs.st index fe8546a..43da583 100644 --- a/axopen.template.simple/ax/src/IO/Inputs.st +++ b/axopen.template.simple/ax/src/IO/Inputs.st @@ -1,42 +1,9 @@ -NAMESPACE axosimple +NAMESPACE axosimple TYPE {S7.extern=ReadWrite} {#ix-attr:[Container(Layout.Wrap)]} Inputs : STRUCT - - P0 : ARRAY[0..7] OF BOOL; - P1 : ARRAY[0..7] OF BOOL; - - A0: ARRAY[0..7] OF DINT; - A1 : ARRAY[0..7] OF DINT; - - D0 : ARRAY[0..7] OF BOOL; - D1 : ARRAY[0..7] OF BOOL; - - - // Reader_1_Acquisition_Status_1 : ARRAY[0..2] OF BYTE; - // Reader_1_Results_Status_1 : BYTE; - // Reader_1_Soft_Event_Control_1 : BYTE; - // Reader_1_Result_Data_128_bytes_1 : ARRAY[0..135] OF BYTE; - - // Reader_2_Acquisition_Status_1 : ARRAY[0..2] OF BYTE; - // Reader_2_Results_Status_1 : BYTE; - // Reader_2_Soft_Event_Control_1 : BYTE; - // Reader_2_Result_Data_128_bytes_1 : ARRAY[0..135] OF BYTE; - - // Camera_1_Acquisition_Status_1 : ARRAY[0..2] OF BYTE; - // Camera_1_Inspection_Status_1 : DWORD; - // Camera_1_Command_Control_1 : WORD; - // Camera_1_SoftEvent_Control_1 : BYTE; - // Camera_1_Results_64_bytes_1 : ARRAY[0..67] OF BYTE; - - // Camera_2_Acquisition_Status_1 : ARRAY[0..2] OF BYTE; - // Camera_2_Inspection_Status_1 : DWORD; - // Camera_2_Command_Control_1 : WORD; - // Camera_2_SoftEvent_Control_1 : BYTE; - // Camera_2_Results_64_bytes_1 : ARRAY[0..67] OF BYTE; - - + noInputsFoundInTheHwConfig AT %B0: BYTE; END_STRUCT; - END_TYPE + END_TYPE END_NAMESPACE diff --git a/axopen.template.simple/ax/src/IO/Outputs.st b/axopen.template.simple/ax/src/IO/Outputs.st index 63650d0..f9a8f48 100644 --- a/axopen.template.simple/ax/src/IO/Outputs.st +++ b/axopen.template.simple/ax/src/IO/Outputs.st @@ -1,40 +1,9 @@ -NAMESPACE axosimple +NAMESPACE axosimple TYPE - {S7.extern=ReadWrite} - {#ix-attr:[Container(Layout.Wrap)]} - Outputs : STRUCT - P0 : ARRAY[0..7] OF BOOL; - P1 : ARRAY[0..7] OF BOOL; - - A0: ARRAY[0..7] OF DINT; - A1 : ARRAY[0..7] OF DINT; - - D0 : ARRAY[0..7] OF BOOL; - D1 : ARRAY[0..7] OF BOOL; - - // Reader_1_Acquisition_Control_1 : BYTE; - // Reader_1_Results_Control_1 : BYTE; - // Reader_1_Soft_Event_Control_1 : BYTE; - // Reader_1_User_Data_128_bytes_1 : ARRAY[0..131] OF BYTE; - - // Reader_2_Acquisition_Control_1 : BYTE; - // Reader_2_Results_Control_1 : BYTE; - // Reader_2_Soft_Event_Control_1 : BYTE; - // Reader_2_User_Data_128_bytes_1 : ARRAY[0..131] OF BYTE; - - // Camera_1_Acquisition_Control_1 : BYTE; - // Camera_1_Inspection_Control_1 : BYTE; - // Camera_1_Command_Control_1 : WORD; - // Camera_1_SoftEvent_Control_1 : BYTE; - // Camera_1_User_Data_64_bytes_1 : ARRAY[0..63] OF BYTE; - - // Camera_2_Acquisition_Control_1 : BYTE; - // Camera_2_Inspection_Control_1 : BYTE; - // Camera_2_Command_Control_1 : WORD; - // Camera_2_SoftEvent_Control_1 : BYTE; - // Camera_2_User_Data_64_bytes_1 : ARRAY[0..63] OF BYTE; - - - END_STRUCT; + {S7.extern=ReadWrite} + {#ix-attr:[Container(Layout.Wrap)]} + Outputs : STRUCT + noOutputsFoundInTheHwConfig AT %B0: BYTE; + END_STRUCT; END_TYPE END_NAMESPACE diff --git a/axopen.template.simple/ax/src/configuration.st b/axopen.template.simple/ax/src/configuration.st index 6f08e5c..d108609 100644 --- a/axopen.template.simple/ax/src/configuration.st +++ b/axopen.template.simple/ax/src/configuration.st @@ -5,9 +5,9 @@ CONFIGURATION MyConfiguration VAR_GLOBAL {S7.extern=ReadWrite} - Inputs : axosimple.Inputs; + Inputs AT %IB0 : axosimple.Inputs; {S7.extern=ReadWrite} - Outputs : axosimple.Outputs; + Outputs AT %QB0 : axosimple.Outputs; {S7.extern=ReadWrite} Context : axosimple.Context; {S7.extern=ReadWrite} diff --git a/axopen.template.simple/ax/src/program.st b/axopen.template.simple/ax/src/program.st index e61b4b5..82a6143 100644 --- a/axopen.template.simple/ax/src/program.st +++ b/axopen.template.simple/ax/src/program.st @@ -1,14 +1,8 @@ USING axosimple; PROGRAM MyProgram VAR_EXTERNAL - Inputs : axosimple.Inputs; - Outputs : axosimple.Outputs; Context : axosimple.Context; END_VAR - - // Never modif this the context needs references to IN/OUT structures before it is used. - Context.Inputs := REF(Inputs); - Context.Outputs := REF(Outputs); // Executes the main context of this application. Context.Run(); diff --git a/axopen.template.simple/ax/templates-sources/unit/Components/Components.st b/axopen.template.simple/ax/templates-sources/unit/Components/Components.st index 1726e18..eb173d6 100644 --- a/axopen.template.simple/ax/templates-sources/unit/Components/Components.st +++ b/axopen.template.simple/ax/templates-sources/unit/Components/Components.st @@ -18,10 +18,11 @@ NAMESPACE axosimple.UnitTemplate VAR_INPUT parent : AXOpen.Core.IAxoObject; END_VAR - VAR_IN_OUT + VAR_EXTERNAL Inputs : axosimple.Inputs; - Outputs : axosimple.Outputs; + Outputs : axosimple.Outputs; END_VAR + THIS.Initialize(parent); // HERE INITIALIZE YOUR COMPONENTS ; diff --git a/axopen.template.simple/ax/templates-sources/unit/UnitContainer.st b/axopen.template.simple/ax/templates-sources/unit/UnitContainer.st index 19c7a97..9dda593 100644 --- a/axopen.template.simple/ax/templates-sources/unit/UnitContainer.st +++ b/axopen.template.simple/ax/templates-sources/unit/UnitContainer.st @@ -39,22 +39,13 @@ NAMESPACE axosimple.UnitTemplate VAR_INPUT inParent : IAxoContext; END_VAR - VAR_IN_OUT - /// - /// Hardware input structure - /// - inoInputs : axosimple.Inputs; - /// - /// Hardware output structure - /// - inoOutputs : axosimple.Outputs; - END_VAR VAR_INPUT inGlobal : REF_TO axosimple.GlobalContextObjects; END_VAR THIS.Initialize(inParent); X.G := inGlobal; - THIS.Execute(inoInputs, inoOutputs); + + THIS.Execute(); END_METHOD /// @@ -62,13 +53,8 @@ NAMESPACE axosimple.UnitTemplate /// Execute runs cyclicaly you should place any call of this unit in this or underlying methods. /// METHOD PRIVATE Execute - VAR_IN_OUT - inoInputs : axosimple.Inputs; - inoOutputs : axosimple.Outputs; - END_VAR - // Component I/O immange and management handling. - X.C.Update(THIS, inoInputs, inoOutputs); + X.C.Update(THIS); // Run process data manager of this unit. X.PD.Run(THIS); diff --git a/axopen.template.simple/ax/unit/Components/Components.st b/axopen.template.simple/ax/unit/Components/Components.st index 1726e18..1a3d437 100644 --- a/axopen.template.simple/ax/unit/Components/Components.st +++ b/axopen.template.simple/ax/unit/Components/Components.st @@ -18,10 +18,11 @@ NAMESPACE axosimple.UnitTemplate VAR_INPUT parent : AXOpen.Core.IAxoObject; END_VAR - VAR_IN_OUT + VAR_EXTERNAL Inputs : axosimple.Inputs; - Outputs : axosimple.Outputs; + Outputs : axosimple.Outputs; END_VAR + THIS.Initialize(parent); // HERE INITIALIZE YOUR COMPONENTS ; diff --git a/axopen.template.simple/ax/unit/Unit.st b/axopen.template.simple/ax/unit/Unit.st index aa44ded..8801492 100644 --- a/axopen.template.simple/ax/unit/Unit.st +++ b/axopen.template.simple/ax/unit/Unit.st @@ -39,22 +39,12 @@ NAMESPACE axosimple.UnitTemplate VAR_INPUT inParent : IAxoContext; END_VAR - VAR_IN_OUT - /// - /// Hardware input structure - /// - inoInputs : axosimple.Inputs; - /// - /// Hardware output structure - /// - inoOutputs : axosimple.Outputs; - END_VAR VAR_INPUT inGlobal : REF_TO axosimple.GlobalContextObjects; END_VAR THIS.Initialize(inParent); X.G := inGlobal; - THIS.Execute(inoInputs, inoOutputs); + THIS.Execute(); END_METHOD /// @@ -62,13 +52,8 @@ NAMESPACE axosimple.UnitTemplate /// Execute runs cyclicaly you should place any call of this unit in this or underlying methods. /// METHOD PRIVATE Execute - VAR_IN_OUT - inoInputs : axosimple.Inputs; - inoOutputs : axosimple.Outputs; - END_VAR - - // Component I/O immange and management handling. - X.C.Update(THIS, inoInputs, inoOutputs); + // Component I/O image and management handling. + X.C.Update(THIS); // Run process data manager of this unit. X.PD.Run(THIS); diff --git a/axopen.template.simple/scripts/check_requisites_nuget.sh b/axopen.template.simple/scripts/check_requisites_nuget.sh index a5e3fec..045715c 100644 --- a/axopen.template.simple/scripts/check_requisites_nuget.sh +++ b/axopen.template.simple/scripts/check_requisites_nuget.sh @@ -42,13 +42,14 @@ has_feed_access(){ # Check if the feed is authorized has_feed_authorization_passed(){ - if dotnet tool update axsharp.ixc --prerelease; then - printf "${GREEN}Authentication passed successfully while accessing feed $feedUrl.${NC}" - return 0 - else - printf "${RED}Authentication failed while accessing feed $feedUrl.${NC}" - return 1 - fi + # if dotnet tool update axsharp.ixc --prerelease; then + # printf "${GREEN}Authentication passed successfully while accessing feed $feedUrl.${NC}" + # return 0 + # else + # printf "${RED}Authentication failed while accessing feed $feedUrl.${NC}" + # return 1 + # fi + return 0 } # Check if the correct number of arguments are provided diff --git a/axopen.template.simple/scripts/copy_hardware_ids.sh b/axopen.template.simple/scripts/copy_hardware_ids.sh index b08cd95..d473f62 100644 --- a/axopen.template.simple/scripts/copy_hardware_ids.sh +++ b/axopen.template.simple/scripts/copy_hardware_ids.sh @@ -21,7 +21,7 @@ if ! [[ -e $input_file ]]; then echo "File $input_file does not exist!!!" exit 1 fi -output_dir=src/IO/$PLC_NAME +output_dir=src/IO if ! [[ -d $output_dir ]]; then echo "Directory $output_dir does not exist!!!" mkdir -p $output_dir diff --git a/axopen.template.simple/scripts/copy_io_addresses.sh b/axopen.template.simple/scripts/copy_io_addresses.sh index c18c725..ca56e96 100644 --- a/axopen.template.simple/scripts/copy_io_addresses.sh +++ b/axopen.template.simple/scripts/copy_io_addresses.sh @@ -21,11 +21,13 @@ if ! [[ -e $input_file ]]; then echo "File $input_file does not exist!!!" exit 1 fi -output_dir=src/IO/$PLC_NAME +output_dir=src/IO if ! [[ -d $output_dir ]]; then echo "Directory $output_dir does not exist!!!" mkdir -p $output_dir fi +noInputsFoundInTheHwConfig=1 +noOutputsFoundInTheHwConfig=1 output_file_inputs="$output_dir/Inputs.st" output_file_outputs="$output_dir/Outputs.st" echo "NAMESPACE ${NAMESPACE}" > "$output_file_inputs" @@ -73,7 +75,7 @@ while IFS= read -r line; do # Extract the substring from : to ;, excluding : and ; variable_type=$(echo "$line" | awk -F':' '{print $2}' | awk -F';' '{print $1}') - + noInputsFoundInTheHwConfig = 0 # Output the variables echo " ${variable_name} AT %B${address_offset}: ${variable_type};" >> "$output_file_inputs" fi @@ -88,11 +90,17 @@ while IFS= read -r line; do # Extract the substring from : to ;, excluding : and ; variable_type=$(echo "$line" | awk -F':' '{print $2}' | awk -F';' '{print $1}') - + noOutputsFoundInTheHwConfig = 0 # Output the variables echo " ${variable_name} AT %B${address_offset}: ${variable_type};" >> "$output_file_outputs" fi done < "$input_file" +if [ $noInputsFoundInTheHwConfig -eq 1 ]; then + echo " noInputsFoundInTheHwConfig AT %B0: BYTE;" >> "$output_file_inputs" +fi +if [ $noOutputsFoundInTheHwConfig -eq 1 ]; then + echo " noOutputsFoundInTheHwConfig AT %B0: BYTE;" >> "$output_file_outputs" +fi echo " END_STRUCT;" >> "$output_file_inputs" echo " END_STRUCT;" >> "$output_file_outputs" echo " END_TYPE" >> "$output_file_inputs" diff --git a/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/ControlledUnit/ControlledUnit.cs b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/ControlledUnit/ControlledUnit.cs index 3fcb250..c5ef462 100644 --- a/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/ControlledUnit/ControlledUnit.cs +++ b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/ControlledUnit/ControlledUnit.cs @@ -135,7 +135,7 @@ public Task AddControlledUnit( [Option('x',Description = "Simatic-ax project fo { entryCallShift = entryCallShift + " "; } - lines.Add(entryCallShift + CuName + ".Run(THIS, Inputs ^, Outputs ^, REF(Glob));"); + lines.Add(entryCallShift + CuName + ".Run(THIS, REF(Glob));"); } } }