Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="___Reseting_signal__off_false___" xml:space="preserve">
<value>Reseting signal (off/false)</value>
</data>
<data name="___Setting_signal__on_true___" xml:space="preserve">
<value>Setting signal (on/true)</value>
</data>
</root>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net48</TargetFramework>
<TargetFrameworks>net48;net5.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net48</TargetFramework>
<TargetFrameworks>net48;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="TcoDigitalActuator" Id="{a94c677a-ea37-0c4d-2eda-a26d576606a9}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK TcoDigitalActuator EXTENDS TcoCore.TcoComponent
VAR_IN_OUT
inoSignal : BOOL;
END_VAR

VAR
_signal : BOOL;
_adr : ULINT;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[IF(__ISVALIDREF(inoSignal)) THEN
inoSignal := _signal;
_adr := ADR(inoSignal);
END_IF;
]]></ST>
</Implementation>
<Method Name="FB_init" Id="{3d495706-c76b-095e-389f-7ba6c1dae3a7}">
<Declaration><![CDATA[METHOD FB_init : BOOL
VAR_INPUT
bInitRetains : BOOL; // if TRUE, the retain variables are initialized (warm start / cold start)
bInCopyCode : BOOL; // if TRUE, the instance afterwards gets moved into the copy code (online change)
Parent : ITcoObject;
END_VAR

]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<Property Name="IsFalse" Id="{d6d0da98-c1ac-0a37-21f7-b9013b7a9347}">
<Declaration><![CDATA[{attribute 'monitoring' := 'variable'}
PROPERTY IsFalse : BOOL]]></Declaration>
<Get Name="Get" Id="{efc004b0-702d-0b7b-3249-c46f50548bad}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IsFalse := NOT _signal;
Messenger.Info('Expecting `negative` signal');]]></ST>
</Implementation>
</Get>
</Property>
<Property Name="IsTrue" Id="{bfef7889-549c-0855-3e52-92d7219d024a}">
<Declaration><![CDATA[{attribute 'monitoring' := 'variable'}
PROPERTY IsTrue : BOOL]]></Declaration>
<Get Name="Get" Id="{97720d5a-b86c-0dbf-0b94-b72b60d909a7}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IsTrue := _signal;
Messenger.Info('Expecting `positive` signal');]]></ST>
</Implementation>
</Get>
</Property>
<Method Name="Reset" Id="{8d9a1541-7fde-0939-1d52-c21f46132ca4}">
<Declaration><![CDATA[METHOD Reset : BOOL
]]></Declaration>
<Implementation>
<ST><![CDATA[Messenger.Trace('<#Reseting signal (off/false)#>');
_signal := FALSE;
Reset := TRUE;]]></ST>
</Implementation>
</Method>
<Method Name="Restore" Id="{28f0fb71-aa8a-0f79-0fa8-867a06c586ce}">
<Declaration><![CDATA[(*~
<docu>
<summary>
Restores this instance to the Ready state. Can be called explicitly or from within one of the restore mechanisms.
</summary>
</docu>
~*)
METHOD Restore : ITcoRestorable


]]></Declaration>
<Implementation>
<ST><![CDATA[// No implementation needed for this componet.]]></ST>
</Implementation>
</Method>
<Method Name="ServiceMode" Id="{370c3428-cc83-04b9-0717-e7260a4027a0}">
<Declaration><![CDATA[(*~
<docu>
<summary>
Custom service (manual, maintenance) logic.
This method must be implemented in derived class.
</summary>
</docu>
~*)
METHOD PROTECTED ServiceMode
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<Method Name="Set" Id="{83e12c95-7ea1-0597-1f2a-882d3fad52b0}">
<Declaration><![CDATA[METHOD PUBLIC Set : BOOL

]]></Declaration>
<Implementation>
<ST><![CDATA[Messenger.Trace('<#Setting signal (on/true)#>');
_signal := TRUE;
Set := TRUE;]]></ST>
</Implementation>
</Method>
</POU>
</TcPlcObject>
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="TcoDigitalSensor" Id="{940ec0d0-0377-0ad5-2841-be1fc78a02da}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK TcoDigitalSensor EXTENDS TcoCore.TcoComponent
VAR_INPUT
Signal : BOOL;
VAR_IN_OUT
inoSignal : BOOL;
END_VAR

]]></Declaration>
VAR
_signal : BOOL;
_adr : ULINT;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
<ST><![CDATA[IF(__ISVALIDREF(inoSignal)) THEN
_signal := inoSignal;
_adr := ADR(inoSignal);
END_IF; ]]></ST>
</Implementation>
<Method Name="FB_init" Id="{ab66c675-5325-0f32-2184-6fc98948f748}">
<Declaration><![CDATA[METHOD FB_init : BOOL
Expand All @@ -24,25 +30,27 @@ END_VAR
</Implementation>
</Method>
<Property Name="IsFalse" Id="{48e6cf82-019c-09fc-0b62-4318a8025ee4}">
<Declaration><![CDATA[PROPERTY IsFalse : BOOL]]></Declaration>
<Declaration><![CDATA[{attribute 'monitoring' := 'variable'}
PROPERTY IsFalse : BOOL]]></Declaration>
<Get Name="Get" Id="{c23c2e72-5cf6-0203-23ee-9d8001c6afd4}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IsFalse := NOT Signal;
<ST><![CDATA[IsFalse := NOT _signal;
Messenger.Info('Expecting `negative` signal');]]></ST>
</Implementation>
</Get>
</Property>
<Property Name="IsTrue" Id="{c588e641-6ea7-04c2-2aae-c7227089c8ae}">
<Declaration><![CDATA[PROPERTY IsTrue : BOOL]]></Declaration>
<Declaration><![CDATA[{attribute 'monitoring' := 'variable'}
PROPERTY IsTrue : BOOL]]></Declaration>
<Get Name="Get" Id="{2089a10e-bba5-06e8-1e33-1a25b4fcfa09}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IsTrue := Signal;
<ST><![CDATA[IsTrue := _signal;
Messenger.Info('Expecting `positive` signal');]]></ST>
</Implementation>
</Get>
Expand All @@ -60,7 +68,7 @@ METHOD Restore : ITcoRestorable

]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
<ST><![CDATA[// No implementation needed for this componet.]]></ST>
</Implementation>
</Method>
<Method Name="ServiceMode" Id="{27fb8047-ad11-0e35-19c9-b36842b34792}">
Expand Down
3 changes: 3 additions & 0 deletions src/TcoElements/src/XAE/XAE/TcoElements/TcoElements.plcproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
<Compile Include="Digital\TcoDigitalSensor.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="Digital\TcoDigitalActuator.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="PlcTask.TcTTO">
<SubType>Code</SubType>
</Compile>
Expand Down
4 changes: 3 additions & 1 deletion src/TcoElements/src/XAE/XAE/TcoElementsTests/POUs/MAIN.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
<Declaration><![CDATA[PROGRAM MAIN
VAR
_tcoDigitalSensorTests : TcoDigitalSensorTests;
_tcoDigitalActuatorTests : TcoDigitalActuatorTests;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[_tcoDigitalSensorTests.ProbeRun();]]></ST>
<ST><![CDATA[_tcoDigitalSensorTests.ProbeRun();
_tcoDigitalActuatorTests.ProbeRun();]]></ST>
</Implementation>
</POU>
</TcPlcObject>
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
<Compile Include="Tests\TcoDigitalSensorTests.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="Tests\TcoDigitalActuatorTests.TcPOU">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="Tests" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="TcoDigitalActuatorTests" Id="{0e553b88-9244-02c7-04d0-b9980a3fe668}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK TcoDigitalActuatorTests EXTENDS TcoCore._internals_TcoContext
VAR
_signal : BOOL;
_sut : TcoElements.TcoDigitalActuator(THIS^);
_sutNotInitialized : TcoElements.TcoDigitalActuator(THIS^);
END_VAR

VAR
_IsTrue_result : BOOL;
_IsFalse_result : BOOL;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
<Method Name="Main" Id="{f853b0f5-a78b-003c-10a9-f8d4054c8c5b}">
<Declaration><![CDATA[METHOD PROTECTED Main

]]></Declaration>
<Implementation>
<ST><![CDATA[CASE _testId OF
50:
_sutNotInitialized.Reset();
_sutNotInitialized.Set();
_sutNotInitialized.IsTrue;
_sutNotInitialized.IsFalse;
_sutNotInitialized.Service();
_sutNotInitialized.Restore();
100:
_signal := FALSE;
_sut.Set();
_sut(inoSignal := _signal);
150:
_IsTrue_result :=_sut.IsTrue;
_IsFalse_result := _sut.IsFalse;
200:
_signal := TRUE;
_sut.Reset();
_sut(inoSignal := _signal);
250:
_IsTrue_result :=_sut.IsTrue;
_IsFalse_result := _sut.IsFalse;
END_CASE
]]></ST>
</Implementation>
</Method>
</POU>
</TcPlcObject>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
VAR
_signal : BOOL;
_sut : TcoElements.TcoDigitalSensor(THIS^);
_sutNotInitialized : TcoElements.TcoDigitalSensor(THIS^);
END_VAR

VAR
Expand All @@ -21,11 +22,16 @@ END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[CASE _testId OF
50:
_sutNotInitialized.IsTrue;
_sutNotInitialized.IsFalse;
_sutNotInitialized.Service();
_sutNotInitialized.Restore();
100:
_sut(Signal := _signal);
_sut(inoSignal := _signal);
_IsTrue_result :=_sut.IsTrue;
200:
_sut(Signal := _signal);
_sut(inoSignal := _signal);
_IsFalse_result := _sut.IsFalse;
END_CASE
]]></ST>
Expand Down
2 changes: 1 addition & 1 deletion src/TcoElements/src/XAE/XAE/XAETcoElements.tsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<TcSmProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.beckhoff.com/schemas/2012/07/TcSmProject" TcSmVersion="1.0" TcVersion="3.1.4024.12">
<Project ProjectGUID="{F9E8CB0C-87A9-4377-9234-E2ACBFE1E5FE}" TargetNetId="172.20.10.2.1.1" ShowHideConfigurations="#x106">
<Project ProjectGUID="{F9E8CB0C-87A9-4377-9234-E2ACBFE1E5FE}" 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