From b8bebe7669e3a4e0f0441662a213e08c8c460ead Mon Sep 17 00:00:00 2001 From: David Koenigs Date: Mon, 23 Oct 2023 15:21:20 +0200 Subject: [PATCH 1/7] Change Readme --- README.md | 127 +++++++++++++++++- .../Drives/classWriteDriveSingleParams.st | 5 - 2 files changed, 126 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 58f6463..9d77d46 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,132 @@ Simatic.Ax.LAcycCom; ## Example - +PROGRAM MyProgram + VAR + Resourcemanager : OOPLAcycCom_ResourceManager; + WriteParameterSingle : LAcycCom_classWriteDriveSingleParams; + ReadParameterSingle : LAcycCom_classReadDriveSingleParams; + WriteParameter : LAcycCom_classWriteDriveParams; + ReadParameter : LAcycCom_classReadDriveParams; + + diagnostic : LAcycCom_ooptypeDrivediagnostics; + + RVALUEp304 : real; + RVALUEp305 : real; + RVALUEp310 : real; + FirstCycle : Bool := TRUE; + datasetitemread : LAcycCom_typeDriveDataset; + datasetitemwrite : LAcycCom_typeDriveDataset; + elements : int; + END_VAR + + Resourcemanager.execute(); + + ReadParameter.execute(); + ReadParameterSingle.execute(); + WriteParameter.execute(); + WriteParameterSingle.execute(); + + + If FirstCycle Then + + ReadParameter.Config(requestBuffer := Resourcemanager); + ReadParameterSingle.Config(requestBuffer := Resourcemanager); + WriteParameter.Config(requestBuffer := Resourcemanager); + WriteParameterSingle.Config(requestBuffer := Resourcemanager); + + end_IF; + + CASE ReadParameter.Status() OF + LAcycComstate_def#BUSY : + ; + + LAcycComstate_def#IDLE : + datasetitemread.parameterNumber := uint#304; + elements := ReadParameter.AddatasetItem(datasetItem := datasetitemread, + element_no := -1); + + datasetitemread.parameterNumber := uint#305; + elements := ReadParameter.AddatasetItem(datasetItem := datasetitemread, + element_no := -1); + + ReadParameter.Start(driveObjectId := uint#5, + hardwareId := word#269); + + LAcycComstate_def#DONE : + datasetitemread := ReadParameter.ReaddatasetItem(element_no := 0); + RVALUEp304 := datasetitemread.value; + datasetitemread := ReadParameter.ReaddatasetItem(element_no := 1); + RVALUEp305 := datasetitemread.value; + + LAcycComstate_def#ERROR : + diagnostic := ReadParameter.errordiagnostics(); + END_CASE; + + + CASE ReadParameterSingle.Status() OF + LAcycComstate_def#BUSY : + ; + + LAcycComstate_def#IDLE : + ReadParameterSingle.Start( driveObjectId := uint#5, + hardwareId := word#269, + parameterNumber := uint#310, + index := uint#0); + + LAcycComstate_def#DONE : + RVALUEp310 := ReadParameterSingle.GetValueREAL(); + + LAcycComstate_def#ERROR : + diagnostic := ReadParameterSingle.errordiagnostics(); + END_CASE; + + CASE WriteParameter.Status() OF + LAcycComstate_def#BUSY : + ; + + LAcycComstate_def#IDLE : + + datasetitemwrite.parameterNumber := uint#2900; + datasetitemwrite.value := real#12.3; + elements := WriteParameter.AddatasetItem(datasetItem := datasetitemwrite, + element_no := -1); + + datasetitemwrite.parameterNumber := uint#2901; + datasetitemwrite.value := real#45.6; + elements := WriteParameter.AddatasetItem(datasetItem := datasetitemwrite, + element_no := -1); + + WriteParameter.Start(driveObjectId := uint#5, + hardwareId := word#269); + + LAcycComstate_def#DONE : + ; + + LAcycComstate_def#ERROR : + diagnostic := WriteParameter.errordiagnostics(); + END_CASE; + + CASE WriteParameterSingle.Status() OF + LAcycComstate_def#BUSY : + ; + + LAcycComstate_def#IDLE : + WriteParameterSingle.Start( driveObjectId := uint#5, + hardwareId := word#269, + parameterNumber := uint#2930, + value := REAL#78.9, + index := uint#0); + + LAcycComstate_def#DONE : + ; + + LAcycComstate_def#ERROR : + diagnostic := WriteParameterSingle.errordiagnostics(); + END_CASE; + + FirstCycle := False; +END_PROGRAM ## Contribution diff --git a/src/Blocks/Drives/classWriteDriveSingleParams.st b/src/Blocks/Drives/classWriteDriveSingleParams.st index 780d25c..fe1673a 100644 --- a/src/Blocks/Drives/classWriteDriveSingleParams.st +++ b/src/Blocks/Drives/classWriteDriveSingleParams.st @@ -528,10 +528,5 @@ NAMESPACE Simatic.Ax.LAcycCom END_IF; END_METHOD - METHOD PUBLIC ReqReadParameter : LAcycCom_TypestatstatReqParameter - - ReqReadParameter := statReqReadParameter; - END_METHOD - END_CLASS END_NAMESPACE \ No newline at end of file From 6e4bbbb51f7f1407e013f675bb68c47eb3a3199c Mon Sep 17 00:00:00 2001 From: David Koenigs Date: Mon, 23 Oct 2023 15:26:49 +0200 Subject: [PATCH 2/7] delete spaces --- README.md | 76 +++++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 9d77d46..a8fc346 100644 --- a/README.md +++ b/README.md @@ -55,102 +55,100 @@ PROGRAM MyProgram WriteParameter.execute(); WriteParameterSingle.execute(); - If FirstCycle Then - ReadParameter.Config(requestBuffer := Resourcemanager); - ReadParameterSingle.Config(requestBuffer := Resourcemanager); + ReadParameter.Config(requestBuffer := Resourcemanager); + ReadParameterSingle.Config(requestBuffer := Resourcemanager); WriteParameter.Config(requestBuffer := Resourcemanager); WriteParameterSingle.Config(requestBuffer := Resourcemanager); end_IF; CASE ReadParameter.Status() OF - LAcycComstate_def#BUSY : + LAcycComstate_def#BUSY : ; - LAcycComstate_def#IDLE : - datasetitemread.parameterNumber := uint#304; + LAcycComstate_def#IDLE : + datasetitemread.parameterNumber := uint#304; elements := ReadParameter.AddatasetItem(datasetItem := datasetitemread, - element_no := -1); + element_no := -1); - datasetitemread.parameterNumber := uint#305; + datasetitemread.parameterNumber := uint#305; elements := ReadParameter.AddatasetItem(datasetItem := datasetitemread, - element_no := -1); + element_no := -1); - ReadParameter.Start(driveObjectId := uint#5, - hardwareId := word#269); + ReadParameter.Start(driveObjectId := uint#5, + hardwareId := word#269); - LAcycComstate_def#DONE : + LAcycComstate_def#DONE : datasetitemread := ReadParameter.ReaddatasetItem(element_no := 0); RVALUEp304 := datasetitemread.value; datasetitemread := ReadParameter.ReaddatasetItem(element_no := 1); RVALUEp305 := datasetitemread.value; - LAcycComstate_def#ERROR : - diagnostic := ReadParameter.errordiagnostics(); + LAcycComstate_def#ERROR : + diagnostic := ReadParameter.errordiagnostics(); END_CASE; - CASE ReadParameterSingle.Status() OF - LAcycComstate_def#BUSY : + LAcycComstate_def#BUSY : ; - LAcycComstate_def#IDLE : - ReadParameterSingle.Start( driveObjectId := uint#5, - hardwareId := word#269, - parameterNumber := uint#310, + LAcycComstate_def#IDLE : + ReadParameterSingle.Start( driveObjectId := uint#5, + hardwareId := word#269, + parameterNumber := uint#310, index := uint#0); - LAcycComstate_def#DONE : + LAcycComstate_def#DONE : RVALUEp310 := ReadParameterSingle.GetValueREAL(); - LAcycComstate_def#ERROR : - diagnostic := ReadParameterSingle.errordiagnostics(); + LAcycComstate_def#ERROR : + diagnostic := ReadParameterSingle.errordiagnostics(); END_CASE; CASE WriteParameter.Status() OF - LAcycComstate_def#BUSY : + LAcycComstate_def#BUSY : ; LAcycComstate_def#IDLE : datasetitemwrite.parameterNumber := uint#2900; datasetitemwrite.value := real#12.3; - elements := WriteParameter.AddatasetItem(datasetItem := datasetitemwrite, + elements := WriteParameter.AddatasetItem(datasetItem := datasetitemwrite, element_no := -1); datasetitemwrite.parameterNumber := uint#2901; datasetitemwrite.value := real#45.6; - elements := WriteParameter.AddatasetItem(datasetItem := datasetitemwrite, + elements := WriteParameter.AddatasetItem(datasetItem := datasetitemwrite, element_no := -1); - WriteParameter.Start(driveObjectId := uint#5, + WriteParameter.Start(driveObjectId := uint#5, hardwareId := word#269); - LAcycComstate_def#DONE : + LAcycComstate_def#DONE : ; - LAcycComstate_def#ERROR : - diagnostic := WriteParameter.errordiagnostics(); - END_CASE; + LAcycComstate_def#ERROR : + diagnostic := WriteParameter.errordiagnostics(); + END_CASE; CASE WriteParameterSingle.Status() OF - LAcycComstate_def#BUSY : + LAcycComstate_def#BUSY : ; - LAcycComstate_def#IDLE : - WriteParameterSingle.Start( driveObjectId := uint#5, - hardwareId := word#269, - parameterNumber := uint#2930, + LAcycComstate_def#IDLE : + WriteParameterSingle.Start( driveObjectId := uint#5, + hardwareId := word#269, + parameterNumber := uint#2930, value := REAL#78.9, index := uint#0); - LAcycComstate_def#DONE : + LAcycComstate_def#DONE : ; - LAcycComstate_def#ERROR : - diagnostic := WriteParameterSingle.errordiagnostics(); + LAcycComstate_def#ERROR : + diagnostic := WriteParameterSingle.errordiagnostics(); END_CASE; FirstCycle := False; From 9a4f8cf409db58a64fe3b8a3cd00ad3069ef3a9e Mon Sep 17 00:00:00 2001 From: David Koenigs Date: Mon, 23 Oct 2023 15:29:59 +0200 Subject: [PATCH 3/7] delete spaces --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index a8fc346..30a7503 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ PROGRAM MyProgram ReadParameterSingle : LAcycCom_classReadDriveSingleParams; WriteParameter : LAcycCom_classWriteDriveParams; ReadParameter : LAcycCom_classReadDriveParams; - + diagnostic : LAcycCom_ooptypeDrivediagnostics; RVALUEp304 : real; @@ -56,12 +56,10 @@ PROGRAM MyProgram WriteParameterSingle.execute(); If FirstCycle Then - ReadParameter.Config(requestBuffer := Resourcemanager); ReadParameterSingle.Config(requestBuffer := Resourcemanager); WriteParameter.Config(requestBuffer := Resourcemanager); WriteParameterSingle.Config(requestBuffer := Resourcemanager); - end_IF; CASE ReadParameter.Status() OF From 04cedf88bf0ead431867de8c70ebc3472aa904eb Mon Sep 17 00:00:00 2001 From: David Koenigs Date: Fri, 27 Oct 2023 14:49:57 +0200 Subject: [PATCH 4/7] Add Method ReaddatasetValue --- src/Blocks/Drives/classReadDriveParams.st | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/Blocks/Drives/classReadDriveParams.st b/src/Blocks/Drives/classReadDriveParams.st index 1622a83..078446a 100644 --- a/src/Blocks/Drives/classReadDriveParams.st +++ b/src/Blocks/Drives/classReadDriveParams.st @@ -468,5 +468,33 @@ NAMESPACE Simatic.Ax.LAcycCom End_Method + Method public ReaddatasetValue : real + VAR_INPUT + element_no : int := int#0; + end_VAR + VAR_TEMP + tempLoopIndex : Int; + end_VAR + + If element_no >= 0 and element_no <= typeconstantsint#LACYCCOM_READ_PARAMETERS_UPPER_LIM Then + ReaddatasetValue := dataset[element_no].value; + end_if; + + End_Method + + Method public ReaddatasetDWValue : DWORD + VAR_INPUT + element_no : int := int#0; + end_VAR + VAR_TEMP + tempLoopIndex : Int; + end_VAR + + If element_no >= 0 and element_no <= typeconstantsint#LACYCCOM_READ_PARAMETERS_UPPER_LIM Then + ReaddatasetDWValue := dataset[element_no].DWvalue; + end_if; + + End_Method + END_CLASS END_NAMESPACE \ No newline at end of file From d078f14720d2add1a084f5cae19c48d067d21f55 Mon Sep 17 00:00:00 2001 From: DavidDKo <142005913+DavidDKo@users.noreply.github.com> Date: Fri, 27 Oct 2023 15:35:42 +0200 Subject: [PATCH 5/7] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 30a7503..2dcf29e 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,7 @@ PROGRAM MyProgram ReadParameterSingle : LAcycCom_classReadDriveSingleParams; WriteParameter : LAcycCom_classWriteDriveParams; ReadParameter : LAcycCom_classReadDriveParams; - diagnostic : LAcycCom_ooptypeDrivediagnostics; - RVALUEp304 : real; RVALUEp305 : real; RVALUEp310 : real; From 0256b159303d84fa2482e12eb800b9cdae903fc0 Mon Sep 17 00:00:00 2001 From: DavidDKo <142005913+DavidDKo@users.noreply.github.com> Date: Fri, 27 Oct 2023 15:36:43 +0200 Subject: [PATCH 6/7] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2dcf29e..7b74575 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Simatic.Ax.LAcycCom; ## Example + PROGRAM MyProgram VAR Resourcemanager : OOPLAcycCom_ResourceManager; From 735cceb99e011d6684142550debc42fe731f95a8 Mon Sep 17 00:00:00 2001 From: DavidDKo <142005913+DavidDKo@users.noreply.github.com> Date: Fri, 27 Oct 2023 15:39:56 +0200 Subject: [PATCH 7/7] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b74575..8c129e4 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Simatic.Ax.LAcycCom; ## Example - +```cli PROGRAM MyProgram VAR Resourcemanager : OOPLAcycCom_ResourceManager; @@ -150,6 +150,7 @@ PROGRAM MyProgram FirstCycle := False; END_PROGRAM +``` ## Contribution