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
7 changes: 3 additions & 4 deletions pipelines/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,13 @@ task Tests -depends CloseVs -precondition { return $isTestingEnabled } {
}

$testProjects = @(
[System.Tuple]::Create(".\src\TcoCore\TcoCore.slnf", "\src\TcoCore\src\XaeTcoCore\", -1, "TcoCore"),
# [System.Tuple]::Create(".\src\TcoDrivesBeckhoff\TcoDrivesBeckhoff.slnf", "\src\TcoDrivesBeckhoff\src\XaeTcoDrivesBeckhoff\", -1, "TcoDrivesBeckhoff"),
[System.Tuple]::Create(".\src\TcoCore\TcoCore.slnf", "\src\TcoCore\src\XaeTcoCore\", -1, "TcoCore"),
[System.Tuple]::Create(".\src\TcoElements\TcoElements.slnf", ".\src\TcoElements\src\XAE\XAE\", -1, "TcoElements"),
[System.Tuple]::Create(".\src\TcoIoBeckhoff\TcoIoBeckhoff.slnf", "\src\TcoIoBeckhoff\src\XaeTcoIoBeckhoff\", -1, "TcoIoBeckhoff"),
[System.Tuple]::Create(".\src\TcoPneumatics\TcoPneumatics.slnf", "src\TcoPneumatics\src\XaeTcoPneumatics\", -1, "TcoPneumatics")
)


# removed due to missing hardware
# [System.Tuple]::Create(".\src\TcoDrivesBeckhoff\TcoDrivesBeckhoff.slnf", "\src\TcoDrivesBeckhoff\src\XaeTcoDrivesBeckhoff\", -1, "TcoDrivesBeckhoff"),

Write-Host "Running tests up to strength $testingStrength"

Expand Down
38 changes: 38 additions & 0 deletions src/TcoCore/src/TcoCore.Wpf/Converters/SignalToBrushConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Media;
using Vortex.Presentation.Wpf.Converters;

namespace TcoCore
{
/// <summary>
/// Will convert boolean values to Brusheh which represent wheter signal is on, or off
/// Using the MaterialDesignXaml toolkit http://materialdesigninxaml.net/ and it's color palette
///
/// Signal On is the Accent color from the palette, signal off si Dark color.
/// https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/MainDemo.Wpf/Palette.xaml
/// </summary>
public class SignalToBrushConverter : BaseConverter
{
public override object ToConvert(object value, Type targetType, object parameter, CultureInfo culture)
{
try
{
var signal = (bool)value;
if (signal)
{
return Application.Current.TryFindResource("SecondaryHueMidBrush") ?? Brushes.GreenYellow;
}
else
{
return Application.Current.TryFindResource("PrimaryHueDarkBrush") ?? Brushes.DimGray;
}
}
catch (Exception e)
{
return Brushes.DarkGray;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,7 @@ External Setpoint Generation:
</System>
<Motion>
<NC>
<SafTask Priority="4" CycleTime="20000" AmsPort="501" IoAtBegin="true">
<SafTask Disabled="true" Priority="4" CycleTime="20000" AmsPort="501" IoAtBegin="true">
<Name>NC-Task 1 SAF</Name>
<Vars VarGrpType="1" InsertType="1">
<Name>Inputs</Name>
Expand Down Expand Up @@ -1883,7 +1883,7 @@ External Setpoint Generation:
</Project>
</Plc>
<Io>
<Device Id="4" DevType="111" DevFlags="#x0003" AmsPort="28676" AmsNetId="172.20.10.104.5.1" RemoteName="Device 4 (EtherCAT)">
<Device Id="4" Disabled="true" DevType="111" DevFlags="#x0003" AmsPort="28676" AmsNetId="172.20.10.104.5.1" RemoteName="Device 4 (EtherCAT)">
<Name>Device 4 (EtherCAT)</Name>
<AddressInfo>
<Pnp>
Expand Down Expand Up @@ -3894,9 +3894,6 @@ Bit 8 - 15 : reserved]]></Comment>
</Io>
</Project>
<Mappings>
<MappingInfo Identifier="{00000000-0020-0304-1000-040321000403}" Id="#x02030020"/>
<MappingInfo Identifier="{00000000-0040-0304-1000-040340000403}" Id="#x02030010"/>
<MappingInfo Identifier="{08502041-0010-0500-4020-500810000403}" Id="#x02030030" Watchdog="04000000140000000400000004000000"/>
<OwnerA Name="TINC^NC-Task 1 SAF^Axes^Axis 1">
<OwnerB Name="TIID^Device 4 (EtherCAT)^Term 1 (EK1100)^Term 6 (EL7211-0010)">
<Link VarA="Drive^Inputs^In^nDataIn1" VarB="DRV Following error actual value^Following error actual value"/>
Expand Down
5 changes: 0 additions & 5 deletions src/TcoElements/TcoElements.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
"src\\TcoCore\\src\\TcoCore.Wpf\\TcoCore.Wpf.csproj",
"src\\TcoCore\\src\\TcoCoreConnector\\TcoCoreConnector.csproj",
"src\\TcoCore\\src\\XaeTcoCore\\XaeTcoCore.tsproj",
"src\\TcoCore\\tests\\TcoCore.Sandbox.Wpf\\TcoCore.Sandbox.Wpf.csproj",
"src\\TcoCore\\tests\\TcoCoreExamplesConnector\\TcoCoreExamplesConnector.csproj",
"src\\TcoCore\\tests\\TcoCoreTestsConnector\\TcoCoreTestsConnector.csproj",
"src\\TcoCore\\tests\\TcoCoreUnitTests\\TcoCoreUnitTests.csproj",
"src\\TcoCore\\tests\\TcoTestRunners\\TcoTestRunners.csproj",
"src\\TcoElements\\src\\TcoElementsConnector\\TcoElementsConnector.csproj",
"src\\TcoElements\\src\\Wpf\\TcoElements.Wpf\\TcoElements.Wpf.csproj",
"src\\TcoElements\\src\\XAE\\XAE\\XAETcoElements.tsproj",
Expand Down
4 changes: 2 additions & 2 deletions src/TcoElements/src/TcoElementsConnector/Entry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace TcoElements
{
public static class Entry
{
const string AmdId = "172.20.10.2.1.1";
readonly static string AmdId = Environment.GetEnvironmentVariable("Tc3Target");

public static TcoElements.TcoElementsTwinController TcoElementsPlc
public static TcoElementsTwinController TcoElementsPlc
= new TcoElementsTwinController(Tc3ConnectorAdapter.Create(AmdId, 851, true));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<UserControl
x:Class="TcoElements.TcoDiServiceView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:TcoElements="clr-namespace:TcoElements;assembly=TcoElementsConnector"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:TcoElements"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:tcoCore="clr-namespace:TcoCore;assembly=TcoCore.Wpf"
d:DesignWidth="800"
mc:Ignorable="d">
<d:UserControl.DataContext>
<TcoElements:TcoDi/>
</d:UserControl.DataContext>
<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.6*" SharedSizeGroup="Name" />
<ColumnDefinition Width="0.4*" />
</Grid.ColumnDefinitions>
<TextBlock Style="{DynamicResource MaterialDesignBody2TextBlock}" Text="{Binding ., Converter={tcoCore:NameOrSymbolConverter}}" />
<Border
Grid.Column="1"
Margin="5,0,5,0"
Background="{Binding Signal.Cyclic, Converter={tcoCore:SignalToBrushConverter}}"
CornerRadius="2" />
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.ComponentModel;
using System.Windows.Controls;

namespace TcoElements
{
/// <summary>
/// Interaction logic for TcoDiServiceView.xaml
/// </summary>
public partial class TcoDiServiceView : UserControl
{
public TcoDiServiceView()
{
if (DesignerProperties.GetIsInDesignMode(this))
{
this.DataContext = new TcoDi();
}

InitializeComponent();

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@
<ProjectReference Include="..\..\TcoElementsConnector\TcoElementsConnector.csproj" />
</ItemGroup>

<ItemGroup>
<Page Update="Digital\TcoDiServiceView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
</Page>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@
x:Class="TcoElements.SampleComponentManualView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:TcoElements="clr-namespace:TcoElements;assembly=TcoElementsConnector"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:TcoElements"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:TcoElements="clr-namespace:TcoElements;assembly=TcoElementsConnector"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<!--<UserControl.DataContext>
<TcoElements:SampleComponent />
</UserControl.DataContext>-->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
Expand All @@ -36,8 +33,14 @@
Minimum="{Binding InstanceMinValue}"
Value="{Binding Cyclic}" />
</GroupBox>
<GroupBox Grid.Row="2" Header="{Binding AttributeName}" DataContext="{Binding _addResult}">
<TextBlock Text="{Binding Cyclic}" HorizontalAlignment="Center" FontSize="20" />
<GroupBox
Grid.Row="2"
DataContext="{Binding _addResult}"
Header="{Binding AttributeName}">
<TextBlock
HorizontalAlignment="Center"
FontSize="20"
Text="{Binding Cyclic}" />
</GroupBox>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
@@ -1,19 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<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
<POU Name="TcoDi" Id="{940ec0d0-0377-0ad5-2841-be1fc78a02da}" SpecialFunc="None">
<Declaration><![CDATA[(*~
<docu>
<summary>
Generic component for monitoring of an input. (e.g. DigitalSensor).
</summary>
</docu>
~*)
FUNCTION_BLOCK TcoDi EXTENDS TcoCore.TcoComponent
VAR_IN_OUT
(*~
<docu>
<summary>
Input signal. Typically an `%I*` variable.
</summary>
</docu>
~*)
inoSignal : BOOL;
END_VAR

VAR
_signal : BOOL;
_adr : ULINT;
(*~
<docu>
<summary>
Backing variable for signal; this variable is used directly by the component. It updates `inoSingal` in FB body call.
</summary>
</docu>
~*)
_signal : BOOL;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[IF(__ISVALIDREF(inoSignal)) THEN
_signal := inoSignal;
_adr := ADR(inoSignal);
_signal := inoSignal;
END_IF; ]]></ST>
</Implementation>
<Method Name="FB_init" Id="{ab66c675-5325-0f32-2184-6fc98948f748}">
Expand All @@ -29,29 +48,46 @@ END_VAR
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<Property Name="IsFalse" Id="{48e6cf82-019c-09fc-0b62-4318a8025ee4}">
<Declaration><![CDATA[{attribute 'monitoring' := 'variable'}
<Property Name="IsFalse" Id="{ec2f8868-7b72-099e-3c52-ecac20627405}">
<Declaration><![CDATA[(*~
<docu>
<summary>
Gets 'true' when monitor signal is 'off/false/logical 0'.
Generates message when the returning 'false'.
</summary>
</docu>
~*)
{attribute 'monitoring' := 'variable'}
PROPERTY IsFalse : BOOL]]></Declaration>
<Get Name="Get" Id="{c23c2e72-5cf6-0203-23ee-9d8001c6afd4}">
<Get Name="Get" Id="{5dc82cbc-c761-07b9-164e-01989022f16b}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IsFalse := NOT _signal;
Messenger.Info('Expecting `negative` signal');]]></ST>
IF(NOT IsFalse) THEN Messenger.Info('<#Expecting `negative` signal#>'); END_IF;]]></ST>
</Implementation>
</Get>
</Property>
<Property Name="IsTrue" Id="{c588e641-6ea7-04c2-2aae-c7227089c8ae}">
<Declaration><![CDATA[{attribute 'monitoring' := 'variable'}
<Property Name="IsTrue" Id="{ab525802-f6c2-0477-297c-4b1c69c11f23}">
<Declaration><![CDATA[(*~
<docu>
<summary>
Gets 'true' when monitor signal is 'on/true/logical 1'.
Generates message when the returning 'false'.
</summary>
</docu>
~*)
{attribute 'monitoring' := 'variable'}
PROPERTY IsTrue : BOOL]]></Declaration>
<Get Name="Get" Id="{2089a10e-bba5-06e8-1e33-1a25b4fcfa09}">
<Get Name="Get" Id="{260c107a-8454-0d57-3f95-b0c3b180f288}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IsTrue := _signal;
Messenger.Info('Expecting `positive` signal');]]></ST>
IF(NOT IsTrue) THEN Messenger.Info('<#Expecting `positive` signal#>'); END_IF;
]]></ST>
</Implementation>
</Get>
</Property>
Expand Down
Loading