Skip to content

Commit

Permalink
- Merge branch 'dev' into feature/addition_to_tcopneumatics'
Browse files Browse the repository at this point in the history
- Closes #98 removed Rtc synchronization that produced failed tests.
- Additions to pneumatic cylinder relates to #75
  • Loading branch information
PTKu committed May 18, 2021
2 parents e7b2b8d + 1eae08c commit b1115a3
Show file tree
Hide file tree
Showing 31 changed files with 409 additions and 431 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![TcOpen logo](assets/logo/TcOpenWide.png)
![TcOpen logo](assets/logov2/ReadmeTop.png)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/TcOpenGroup/TcOpen/graphs/commit-activity)
[![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/TcOpenGroup/TcOpen/blob/dev/LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/TcOpenGroup/TcOpen/pulls)
Expand Down Expand Up @@ -130,6 +130,7 @@ There is a separate documentation repository for this project [here](https://git
1. [TwinCAT 3.1 eXtended Automation Engineering (XAE)](https://www.beckhoff.com/english.asp?download/tc3-downloads.htm) TwinCAT 3.1 4024.4+
1. [.NET Framework 4.8 developer pack](https://dotnet.microsoft.com/download/dotnet-framework/thank-you/net48-developer-pack-offline-installer)
1. [.NET5 developer pack](https://dotnet.microsoft.com/download/dotnet/5.0)
1. [Get free inxton developer licence](https://inxton.com/register)
1. [Inxton Vortex Builder extension](https://marketplace.visualstudio.com/items?itemName=Inxton.InxtonVortexBuilderExtensionPre)

**Clone this repository**
Expand Down
491 changes: 94 additions & 397 deletions TcOpen.sln

Large diffs are not rendered by default.

Binary file added assets/logov2/ProfileImage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logov2/ReadmeTop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions assets/logov2/ReadmeTop.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logov2/SocialPreview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logov2/TcOpenFigma.fig
Binary file not shown.
21 changes: 16 additions & 5 deletions pipelines/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@



task default -depends CloseVs, Tests, CreatePackages, Finish
task default -depends Init, CopyInxton, CloseVs, Build, Tests, CreatePackages, Finish


FormatTaskName (("="*25) + " [ {0} ] " + ("="*25))
Expand Down Expand Up @@ -67,12 +67,17 @@ task NugetRestore -depends Clean {
task CopyInxton -depends NugetRestore -continueOnError {
exec {
& $dotnet build `
.\src\TcoApplicationExamples\PlcAppExamplesConnector\PlcAppExamplesConnector.csproj `
.\src\TcoCore\tests\TcoDummyTest\TcoDummyTest.csproj `
-v:$msbuildVerbosity `
--nologo `
/p:SolutionDir=$solutionDir
}
}

task GitVersion -depends CopyInxton {
task GitVersion `
-precondition { $updateAssemblyInfo } `
-depends CopyInxton `
{
EnsureGitVersion -pathToGitVersion ".\_toolz\gitversion.exe"
$updateAssemblyInfoFlag = if( $updateAssemblyInfo) {"/updateassemblyinfo"} else {""}
$gitVersionOutput = & ".\_toolz\gitversion.exe" "$updateAssemblyInfoFlag" "/config" "$baseDir/GitVersion.yml"
Expand Down Expand Up @@ -235,13 +240,19 @@ task Tests -depends CloseVs -precondition { return $isTestingEnabled } {
}


task ClearPackages -depends Tests {
task ClearPackages `
-precondition { $publishNugets } `
-depends Tests `
{
mkdir nugets -ErrorAction SilentlyContinue
mkdir nugets\dependants -ErrorAction SilentlyContinue
Get-ChildItem -Path .\nugets\ -Include *.* -File -Recurse | ForEach-Object { $_.Delete()}
}

task CreatePackages -depends ClearPackages {
task CreatePackages `
-precondition { $publishNugets } `
-depends ClearPackages `
{
$semVer = $script:gitVersion.SemVer
$projects = @(
#Packaging
Expand Down
1 change: 1 addition & 0 deletions src/TcoCore/TcoCore.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"src\\TcoCore\\tests\\TcoCoreExamplesConnector\\TcoCoreExamplesConnector.csproj",
"src\\TcoCore\\tests\\TcoCoreTestsConnector\\TcoCoreTestsConnector.csproj",
"src\\TcoCore\\tests\\TcoCoreUnitTests\\TcoCoreUnitTests.csproj",
"src\\TcoCore\\tests\\TcoDummyTest\\TcoDummyTest.csproj",
"src\\TcoCore\\tests\\TcoTestRunners\\TcoTestRunners.csproj"
]
}
Expand Down
4 changes: 2 additions & 2 deletions src/TcoCore/src/TcoCore.Wpf/TcoTask/VisibleOnTaskState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
namespace TcoCore
{
/// <summary>
/// Will set Visibility to Visible if the value exisst in ConverterParameter
/// Converter paramater values are dash (-) separated and should contain only eTaskState states. ie Requested-Busy-Error or Ready-Done
/// Will set Visibility to Visible if the value exist in ConverterParameter
/// Converter parameter values are dash (-) separated and should contain only eTaskState states. ie Requested-Busy-Error or Ready-Done
/// </summary>
public class VisibleOnTaskState : BaseConverter
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@
<data name="___Invoke_request__" xml:space="preserve">
<value>Invoke request</value>
</data>
<data name="___Abort_request__" xml:space="preserve">
<value>Abort request</value>
</data>
<data name="___Enabled__" xml:space="preserve">
<value>Enabled</value>
</data>
Expand Down
10 changes: 8 additions & 2 deletions src/TcoCore/src/TcoCoreConnector/pex/TcoObject/TcoObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@ public IEnumerable<PlainTcoMessage> GetActiveMessages()
refreshTags.AddRange(GetObjectMessages().Select(p => p.Cycle));
}

this.GetConnector().ReadBatch(refreshTags);

// We must check that the connector did start R/W operations loop, due to possible dead lock at start-up
// Reported to Inxton team as FOXTROTH #564

if (this.GetConnector().RwCycleCount > 1)
{
this.GetConnector().ReadBatch(refreshTags);
}

return GetObjectMessages().Where(p => p.IsActive).Select(p => p.PlainMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,25 @@ public void ExecuteProbeRun(ulong counts, ulong testId)
_probeRunRequiredCycles.Synchron = counts;
_probeCurrentCycleCount.Synchron = 0;

Task.Run(() => { while (_probeCurrentCycleCount.Synchron < _probeRunRequiredCycles.Synchron) ; }).Wait();
Task.Run(() => { while (_probeCurrentCycleCount.Synchron < _probeRunRequiredCycles.Synchron) System.Threading.Thread.Sleep(5); }).Wait();
}

/// <summary>
/// Executes context cycle until end condition is met. Optionally can provide <see cref="_testId"/> for test code isolation.
/// In the plc you must ensure cyclical call of <see cref="TcoCore.TcoContext.PlcTcoContext.ProbeRun"/> method.
/// </summary>
/// <param name="testId">Test Id</param>
/// <param name="endCondition">Evaluates end condition for the test.</param>
public void ExecuteProbeRun(ulong testId, Func<bool> endCondition)
{
_probeCurrentCycleCount.Synchron = ulong.MaxValue;
_testId.Synchron = testId;
_probeRunRequiredCycles.Synchron = ulong.MaxValue;
_probeCurrentCycleCount.Synchron = 0;

Task.Run(() => { while (!endCondition()); System.Threading.Thread.Sleep(5); }).Wait();

_testId.Synchron = 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,31 @@ END_VAR
<ST><![CDATA[THIS^.Post(Message, eMessageCategory.Catastrophic);]]></ST>
</Implementation>
</Method>
<Method Name="Clear" Id="{640fefd4-a9aa-0de1-3f5c-cce4bd50449f}">
<Declaration><![CDATA[(*~
<docu>
<summary>
Clears the message content.
<remarks>
<note type="important">
This method is exposed for Rpc calls, for testing purposes. Rpc calls of this method must not be used in production code
</note>
</remarks>
</summary>
</docu>
~*)
{attribute 'TcRpcEnable'}
METHOD Clear
]]></Declaration>
<Implementation>
<ST><![CDATA[_mime.TimeStamp := DT#1970-01-01-00:00;
_mime.Text := '';
_mime.Identity := 0;
_mime.Category := eMessageCategory.None;
_mime.Cycle := 0;
_mime.PerCycleCount := 0; ]]></ST>
</Implementation>
</Method>
<Method Name="Compose" Id="{3447ad14-6768-48d6-b294-87e00174ef1e}">
<Declaration><![CDATA[METHOD PROTECTED FINAL Compose
VAR_INPUT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ VAR
{attribute addProperty Name "<#Enabled#>"}
{attribute clr [ReadOnly()]}
_enabled : BOOL := TRUE;
END_VAR
VAR
{attribute 'hide'}
_executionTimer : Tc2_Standard.TON;
{attribute clr [ReadOnly()]}
_elapsedTime : TIME;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
Expand Down Expand Up @@ -322,6 +329,29 @@ END_IF;
]]></ST>
</Implementation>
</Method>
<Property Name="ElapsedTime" Id="{78278734-9469-0240-24bb-e24bb2258532}">
<Declaration><![CDATA[(*~
<docu>
<summary>
Gets the elapsed time of the execution of this task.
<remarks>
<note type="important">
Uses `TIME` type. It might be not sutable for tasks running longer than 49 days.
</note>
</remarks>
</summary>
</docu>
~*)
PROPERTY PUBLIC ElapsedTime : TIME]]></Declaration>
<Get Name="Get" Id="{37071e73-80b0-05b2-2967-dfec5fd00ceb}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[ElapsedTime := _elapsedTime;]]></ST>
</Implementation>
</Get>
</Property>
<Property Name="Enabled" Id="{c98a96a1-7e51-07e4-301f-9d561b604bea}">
<Declaration><![CDATA[(*~
<docu>
Expand Down Expand Up @@ -375,6 +405,10 @@ PROPERTY Error : BOOL]]></Declaration>
METHOD Execute : BOOL
VAR
_serviceableParent : ITcoServiceable;
END_VAR
VAR
tmpTimeDiff : TIME;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[// Detects if parent is in serviceable state to enable manual invoke of the task from the HMI/SCADA system.
Expand Down Expand Up @@ -405,7 +439,7 @@ IF( THIS^._restoreRequest) THEN
END_IF;
IF NOT _enabled THEN
IF THIS^._taskState = eTaskState.Requested THEN
IF THIS^._taskState = eTaskState.Requested THEN
THIS^.Messenger.Post('Task cannot start; Enabled property is FALSE.',eMessageCategory.Info);
THIS^.Restore();
END_IF
Expand All @@ -418,7 +452,8 @@ END_IF;
CheckIfCalledCyclically();
AutoRestore();
IF(THIS^._taskState = eTaskState.Requested) THEN
IF(THIS^._taskState = eTaskState.Requested) THEN
_executionTimer(IN := FALSE);
THIS^._taskState := eTaskState.Busy;
END_IF;
Expand All @@ -427,6 +462,14 @@ IF(THIS^._taskState = eTaskState.Error) THEN
END_IF;
Execute := (THIS^._taskState = eTaskState.Busy);
IF(Execute) THEN
_executionTimer(IN := Execute, PT := T#49D);
_elapsedTime := _executionTimer.ET;
END_IF;
]]></ST>
</Implementation>
</Method>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ _moveWorkTask(PositionSensor := iWorkPositionSensor, MoveToPositionSignal := qWo
<ST><![CDATA[Close := MoveToHome();]]></ST>
</Implementation>
</Method>
<Method Name="Manual" Id="{d42ee7ad-0112-04b6-26d8-2fd1dcc9e3b0}">
<Declaration><![CDATA[METHOD PROTECTED Manual
VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<Method Name="MoveDown" Id="{71c646dc-aa10-0aa2-1ab2-9ffcfb10c4a3}" FolderPath="Vertical\">
<Declaration><![CDATA[METHOD MoveDown : TcoCore.ITcoTaskStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ END_VAR
THIS^.Messenger.Debug('|[[1]AttributeName]| |[AttributeActivity]|, extremity sensor not reached yet.');
InverseSignal := FALSE;
MoveToPositionSignal := TRUE;
ThrowWhen(THIS^.ElapsedTime > T#5S);
THIS^.DoneWhen(PositionSensor);
END_IF]]></ST>
</Implementation>
Expand Down
5 changes: 4 additions & 1 deletion src/TcoCore/src/XaeTcoCore/TcoCoreTests/POUs/MAIN.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ VAR
_tcoContextMessagingPerf : TcoContextMessagingPerf;
_tcoComponentTest : TcoComponentTest;
_stringBuilderTest : StringBuilderTests;
_tcoTaskTestContext : TcoTaskTestContext;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[_tcoRtcTest_A();
Expand All @@ -33,7 +34,9 @@ _tcoContextMessagingPerf();
_tcoComponentTest();
_stringBuilderTest();]]></ST>
_stringBuilderTest();
_tcoTaskTestContext.ProbeRun();]]></ST>
</Implementation>
</POU>
</TcPlcObject>
7 changes: 7 additions & 0 deletions src/TcoCore/src/XaeTcoCore/TcoCoreTests/TcoCoreTests.plcproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,19 @@
<Compile Include="Tests\TcoTask\TcoTaskTest.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="Tests\TcoTask\PlcExecuted\eTcoTaskTests.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="Tests\TcoTask\PlcExecuted\TcoTaskTestContext.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="Tests\Utilities\StringBuilderTests.TcPOU">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="Tests" />
<Folder Include="Tests\TcoTask\PlcExecuted" />
<Folder Include="Tests\Utilities" />
<Folder Include="Tests\TcoComponent" />
<Folder Include="Tests\TcoObject\EqualsOverride" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="TcoTaskTestContext" Id="{da10e4d9-b59b-03b6-048b-8b4e8d7fd81e}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK TcoTaskTestContext EXTENDS TcoCore._internals_TcoContext
VAR
_sut : TcoCore.TcoTask(THIS^);
_elapsedTimeETA : TIME;
_elapsedTime : TIME;
_runElapsedTimer : BOOL;
_elapsedTimeTimer : Tc2_Standard.TON;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[
]]></ST>
</Implementation>
<Method Name="Main" Id="{ba13ae7b-16e9-04e3-2a3d-62a7bdca7899}">
<Declaration><![CDATA[METHOD PROTECTED Main
]]></Declaration>
<Implementation>
<ST><![CDATA[_elapsedTimeTimer(IN := _runElapsedTimer, PT := _elapsedTimeETA);
CASE _testId OF
eTcoTaskTests.ElapsedTypeMeasurement:
_sut.Invoke();
IF(_sut.Execute()) THEN
_runElapsedTimer := TRUE;
IF(_elapsedTimeTimer.Q) THEN
_sut.DoneWhen(_elapsedTimeTimer.Q);
END_IF;
END_IF
_elapsedTime := _sut.ElapsedTime;
END_CASE
]]></ST>
</Implementation>
</Method>
</POU>
</TcPlcObject>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<DUT Name="eTcoTaskTests" Id="{5b7723bf-5703-0a65-15dc-43889553ed66}">
<Declaration><![CDATA[{attribute 'qualified_only'}
{attribute 'strict'}
TYPE eTcoTaskTests :
(
ElapsedTypeMeasurement := 100
);
END_TYPE
]]></Declaration>
</DUT>
</TcPlcObject>
4 changes: 2 additions & 2 deletions src/TcoCore/src/XaeTcoCore/XaeTcoCore.tsproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<Elements>8</Elements>
</ArrayInfo>
</DataType>
</DataTypes>
<Project ProjectGUID="{39D84538-69DF-46F4-9E2F-272A81B72C66}" TargetNetId="172.20.10.104.1.1" Target64Bit="true" ShowHideConfigurations="#x106">
</DataTypes>
<Project ProjectGUID="{39D84538-69DF-46F4-9E2F-272A81B72C66}" TargetNetId="172.20.10.2.1.1" Target64Bit="true" ShowHideConfigurations="#x106">
<System>
<Tasks>
<Task Id="3" Priority="20" CycleTime="100000" AmsPort="350" AdtTasks="true">
Expand Down
Loading

0 comments on commit b1115a3

Please sign in to comment.