aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Software/DB/Tango.mdfbin75497472 -> 75497472 bytes
-rw-r--r--Software/DB/Tango_log.ldfbin15400960 -> 15400960 bytes
-rw-r--r--Software/Graphics/temperature.pngbin0 -> 1827 bytes
-rw-r--r--Software/PMR/Messages/Common/MessageType.proto2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml148
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs8
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/temperature.pngbin0 -> 1827 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj3
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs22
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs42
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml2
-rw-r--r--Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs55
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs8
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs31
-rw-r--r--Software/Visual_Studio/Tango.PMR/Common/MessageType.cs42
15 files changed, 339 insertions, 24 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf
index 799dc0f37..5237d8b2b 100644
--- a/Software/DB/Tango.mdf
+++ b/Software/DB/Tango.mdf
Binary files differ
diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf
index ab520a1f0..52eafd2f1 100644
--- a/Software/DB/Tango_log.ldf
+++ b/Software/DB/Tango_log.ldf
Binary files differ
diff --git a/Software/Graphics/temperature.png b/Software/Graphics/temperature.png
new file mode 100644
index 000000000..0bd30c002
--- /dev/null
+++ b/Software/Graphics/temperature.png
Binary files differ
diff --git a/Software/PMR/Messages/Common/MessageType.proto b/Software/PMR/Messages/Common/MessageType.proto
index 6ff10ab6c..595a167ad 100644
--- a/Software/PMR/Messages/Common/MessageType.proto
+++ b/Software/PMR/Messages/Common/MessageType.proto
@@ -160,6 +160,8 @@ enum MessageType
StartEventsNotificationResponse = 2031;
StopEventsNotificationRequest = 2032;
StopEventsNotificationResponse = 2033;
+ SetHeaterStateRequest = 2034;
+ SetHeaterStateResponse = 2035;
//Printing
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml
index f72c5ad08..ca9f6140c 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml
@@ -3,12 +3,13 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems"
xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors"
xmlns:visuals="clr-namespace:Tango.Visuals;assembly=Tango.Visuals"
xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors"
- mc:Ignorable="d" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:HeaterItem, IsDesignTimeCreatable=False}" Height="99.188" Width="163.459">
+ mc:Ignorable="d" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:HeaterItem, IsDesignTimeCreatable=False}" Height="284.188" Width="243.459">
<UserControl.Resources>
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter>
@@ -29,10 +30,151 @@
<!--Content-->
<Grid>
- <Image Source="../Images/blower-big.png"></Image>
+ <Viewbox>
+ <Border CornerRadius="5" Background="#151515" BorderBrush="#3B3B3B" BorderThickness="1" Padding="15">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="16"/>
+ <RowDefinition Height="74"/>
+ <RowDefinition Height="63"/>
+ <RowDefinition Height="37"/>
+ <RowDefinition/>
+ </Grid.RowDefinitions>
+
+ <Grid>
+ <TextBlock FontFamily="digital-7" Text="Heater Controller" FontSize="16" Foreground="#7CC924" HorizontalAlignment="Left" Width="123"></TextBlock>
+ <TextBlock HorizontalAlignment="Right" Text="TEMPERATURE" FontSize="9" VerticalAlignment="Bottom" Foreground="Gainsboro" Height="12" Width="58"></TextBlock>
+ </Grid>
+
+ <Grid Grid.Row="1">
+ <Border Background="#202020" Margin="0 3 0 0" CornerRadius="3" Padding="5">
+ <Grid>
+ <TextBlock Text="{Binding HeaterState.CurrentValue,StringFormat=0.0,FallbackValue='0.0'}" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="80" FontFamily="digital-7" Margin="0 0 12 0">
+ <TextBlock.Style>
+ <Style TargetType="TextBlock">
+ <Setter Property="Foreground" Value="#FF6F78"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding HeaterState.IsInSetPoint}" Value="True">
+ <Setter Property="Foreground" Value="#7CC924"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </TextBlock.Style>
+ </TextBlock>
+ <TextBlock HorizontalAlignment="Right" VerticalAlignment="Bottom" FontSize="9" Foreground="Gainsboro">PV</TextBlock>
+ </Grid>
+ </Border>
+ </Grid>
+
+ <Grid Grid.Row="2" Margin="0 5 0 0">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="49"/>
+ <ColumnDefinition Width="162"/>
+ </Grid.ColumnDefinitions>
+
+ <Image Source="../Images/temperature.png" Margin="0 10 20 10" RenderOptions.BitmapScalingMode="Fant"></Image>
+
+ <Border Background="#202020" Margin="0 3 0 0" CornerRadius="3" Padding="5" Grid.Column="1">
+ <Grid>
+ <mahapps:NumericUpDown Style="{x:Null}" InterceptMouseWheel="True" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Right" HideUpDownButtons="True" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled" HasDecimals="True" Minimum="0" Maximum="400" Padding="0" Value="{Binding SetPoint,FallbackValue='0.0',Mode=TwoWay}" VerticalAlignment="Center" FontSize="44" FontFamily="digital-7" Foreground="#FFD400" Margin="0 0 12 0">
+ <mahapps:NumericUpDown.Resources>
+ <Style TargetType="TextBox">
+
+ </Style>
+ </mahapps:NumericUpDown.Resources>
+ </mahapps:NumericUpDown>
+ <TextBlock HorizontalAlignment="Right" VerticalAlignment="Bottom" FontSize="9" Foreground="Gainsboro">SV</TextBlock>
+ </Grid>
+ </Border>
+ </Grid>
+
+ <Grid Grid.Row="3" Margin="0 5 0 0">
+ <StackPanel Orientation="Horizontal" TextElement.Foreground="Gray" TextElement.FontSize="9">
+ <StackPanel>
+ <TextBlock>ACTIVE</TextBlock>
+ <Ellipse Width="12" Height="12" Margin="0 4 0 0" Fill="#FF6262" Stroke="#526744">
+ <Ellipse.Style>
+ <Style TargetType="Ellipse">
+ <Setter Property="Opacity" Value="0.2"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding HeaterState.IsActive}" Value="True">
+ <Setter Property="Opacity" Value="1"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Ellipse.Style>
+ </Ellipse>
+ </StackPanel>
+
+ <StackPanel Margin="10 0 0 0">
+ <TextBlock>RAMP UP</TextBlock>
+ <Ellipse Width="12" Height="12" Margin="0 4 0 0" Fill="#FF8608" Stroke="#526744">
+ <Ellipse.Style>
+ <Style TargetType="Ellipse">
+ <Setter Property="Opacity" Value="0.2"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding HeaterState.IsRampingUp}" Value="True">
+ <Setter Property="Opacity" Value="1"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Ellipse.Style>
+ </Ellipse>
+ </StackPanel>
+
+ <StackPanel Margin="10 0 0 0">
+ <TextBlock>IN POINT</TextBlock>
+ <Ellipse Width="12" Height="12" Margin="0 4 0 0" Fill="#00C600" Stroke="#526744">
+ <Ellipse.Style>
+ <Style TargetType="Ellipse">
+ <Setter Property="Opacity" Value="0.2"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding HeaterState.IsInSetPoint}" Value="True">
+ <Setter Property="Opacity" Value="1"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Ellipse.Style>
+ </Ellipse>
+ </StackPanel>
+ </StackPanel>
+ </Grid>
+
+ <Grid Grid.Row="4">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="36"/>
+ <ColumnDefinition Width="175"/>
+ </Grid.ColumnDefinitions>
+
+ <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray" FontSize="16" FontWeight="SemiBold">ITC</TextBlock>
+
+ <Grid Grid.Column="1">
+ <Button Style="{x:Null}" Width="60" Height="60" HorizontalAlignment="Right" Cursor="Hand" Command="{Binding SetCommand}">
+ <Button.Template>
+ <ControlTemplate TargetType="Button">
+ <Grid>
+ <Ellipse Stroke="#7C7C7C" Fill="#383838"></Ellipse>
+ <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Gainsboro" FontSize="16" FontWeight="SemiBold">SET</TextBlock>
+ </Grid>
+ <ControlTemplate.Triggers>
+ <Trigger Property="IsPressed" Value="True">
+ <Setter Property="Opacity" Value="0.7"></Setter>
+ </Trigger>
+ <Trigger Property="IsEnabled" Value="False">
+ <Setter Property="Opacity" Value="0.5"></Setter>
+ </Trigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Button.Template>
+ </Button>
+ </Grid>
+ </Grid>
+ </Grid>
+ </Border>
+ </Viewbox>
<Border Margin="0 0 0 -23" VerticalAlignment="Bottom">
- <TextBlock Text="{Binding HardwareBlowerType.Description}" FontSize="14" Foreground="DimGray" HorizontalAlignment="Center"></TextBlock>
+ <TextBlock Text="{Binding TechHeater.Description}" FontSize="14" Foreground="DimGray" HorizontalAlignment="Center"></TextBlock>
</Border>
</Grid>
<!--Content-->
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs
index b0b28454a..37d0defe5 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs
@@ -60,6 +60,9 @@ namespace Tango.MachineStudio.Technician.Editors
}
private HeaterItem _heaterItem;
+ /// <summary>
+ /// Gets or sets the heater item.
+ /// </summary>
public HeaterItem HeaterItem
{
get { return _heaterItem; }
@@ -98,5 +101,10 @@ namespace Tango.MachineStudio.Technician.Editors
{
get { return HeaterItem; }
}
+
+ private void Ellipse_GiveFeedback(object sender, GiveFeedbackEventArgs e)
+ {
+
+ }
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/temperature.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/temperature.png
new file mode 100644
index 000000000..0bd30c002
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/temperature.png
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj
index 21fcf3e24..2a1660bcc 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj
@@ -645,6 +645,9 @@
<ItemGroup>
<Resource Include="Images\heater-controller.png" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\temperature.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs
index e1221e1f2..c1b876e9b 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using System.Windows.Media;
using System.Xml.Serialization;
using Tango.BL.Entities;
+using Tango.Core.Commands;
using Tango.PMR.Diagnostics;
using Tango.SharedUI.Helpers;
@@ -18,6 +19,8 @@ namespace Tango.MachineStudio.Technician.TechItems
[TechItem(10)]
public class HeaterItem : TechItem
{
+ public event Action SetCommandClicked;
+
private TechHeater _techHeater;
/// <summary>
/// Gets or sets the db tech monitor.
@@ -28,6 +31,12 @@ namespace Tango.MachineStudio.Technician.TechItems
get { return _techHeater; }
set { _techHeater = value; RaisePropertyChangedAuto(); TechName = _techHeater != null ? _techHeater.Description : null; ItemGuid = value != null ? value.Guid : null; }
}
+
+ /// <summary>
+ /// Gets or sets the set command.
+ /// </summary>
+ public RelayCommand SetCommand { get; set; }
+
/// <summary>
/// Initializes a new instance of the <see cref="HeaterItem"/> class.
/// </summary>
@@ -37,6 +46,8 @@ namespace Tango.MachineStudio.Technician.TechItems
Color = Colors.White;
Description = "Heater Controller";
Image = ResourceHelper.GetImageFromResources("Images/heater-controller.png");
+ SetCommand = new RelayCommand(() => { SetCommandClicked?.Invoke(); }, (x) => HeaterState.CurrentValue != SetPoint);
+ HeaterState = new HeaterState();
}
/// <summary>
@@ -55,7 +66,16 @@ namespace Tango.MachineStudio.Technician.TechItems
public HeaterState HeaterState
{
get { return _heaterState; }
- set { _heaterState = value; RaisePropertyChangedAuto(); }
+ set
+ {
+ _heaterState = value;
+ RaisePropertyChangedAuto();
+
+ InvokeUI(() =>
+ {
+ SetCommand.RaiseCanExecuteChanged();
+ });
+ }
}
private double _setPoint;
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
index 6575bd53c..5f439e1ca 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
@@ -444,6 +444,17 @@ namespace Tango.MachineStudio.Technician.ViewModels
digitalInItem.Value = digitalPin.Value;
}
}
+ else if (item.GetType() == typeof(HeaterItem))
+ {
+ HeaterItem heaterItem = item as HeaterItem;
+
+ var heaterState = data.HeatersStates.SingleOrDefault(x => x.HeaterType == (HeaterType)heaterItem.TechHeater.Code);
+
+ if (heaterState != null)
+ {
+ heaterItem.HeaterState = heaterState;
+ }
+ }
else if (item.GetType() == typeof(ControllerItem))
{
ControllerItem controllerItem = item as ControllerItem;
@@ -557,6 +568,11 @@ namespace Tango.MachineStudio.Technician.ViewModels
{
CreateElement<MeterElementEditor, MeterItem, TechMonitor>(bounds, Adapter.TechMonitors.Where(x => !x.MultiChannel).FirstOrDefault());
}
+ else if (item is HeaterItem)
+ {
+ var editor = CreateElement<HeaterElementEditor, HeaterItem, TechHeater>(bounds, Adapter.TechHeaters.FirstOrDefault());
+ InitTechHeater(editor.HeaterItem);
+ }
else if (item is SingleGraphItem)
{
var editor = CreateElement<SingleGraphElementEditor, SingleGraphItem, TechMonitor>(bounds, Adapter.TechMonitors.Where(x => !x.MultiChannel).FirstOrDefault());
@@ -682,6 +698,11 @@ namespace Tango.MachineStudio.Technician.ViewModels
(item as MonitorItem).TechMonitor = Adapter.TechMonitors.Where(x => !x.MultiChannel).FirstOrDefault(x => x.Guid == item.ItemGuid);
CreateElement<MonitorElementEditor>(item);
}
+ else if (item is HeaterItem)
+ {
+ (item as HeaterItem).TechHeater = Adapter.TechHeaters.FirstOrDefault(x => x.Guid == item.ItemGuid);
+ CreateElement<HeaterElementEditor>(item);
+ }
else if (item is MeterItem)
{
(item as MeterItem).TechMonitor = Adapter.TechMonitors.Where(x => !x.MultiChannel).FirstOrDefault(x => x.Guid == item.ItemGuid);
@@ -895,6 +916,27 @@ namespace Tango.MachineStudio.Technician.ViewModels
#region Init Tech Items
/// <summary>
+ /// Initializes the tech heater.
+ /// </summary>
+ /// <param name="item">The item.</param>
+ private void InitTechHeater(HeaterItem item)
+ {
+ item.SetCommandClicked += async () =>
+ {
+ try
+ {
+ CheckMachineOperator();
+ await MachineOperator.SetHeaterState((HeaterType)item.TechHeater.Code, item.SetPoint);
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"Error executing SetHeaterState command for heater {item.TechHeater.Name}.");
+ _eventLogger.Log(ex, $"Error executing SetHeaterState command for heater {item.TechHeater.Name}.");
+ }
+ };
+ }
+
+ /// <summary>
/// Initializes the motor item.
/// </summary>
/// <param name="item">The item.</param>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml
index 3fe82944c..cbc296e32 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml
@@ -202,7 +202,7 @@
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type techItems:TechItem}">
- <Border Cursor="Hand" ToolTip="{Binding Description}" RenderTransformOrigin="0.5,0.5" Width="60" Height="60" Padding="10" Margin="5" BorderThickness="1" CornerRadius="100">
+ <Border Cursor="Hand" ToolTip="{Binding Description}" RenderTransformOrigin="0.5,0.5" Width="55" Height="55" Padding="10" Margin="5" BorderThickness="1" CornerRadius="100">
<Border.Style>
<Style TargetType="Border">
<Setter Property="RenderTransform">
diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
index bac8ceb90..abeb1238b 100644
--- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
+++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
@@ -53,6 +53,7 @@ namespace Tango.Emulations.Emulators
private List<DigitalInterfaceState> _digitalOutputPinsStates;
private List<DigitalInterfaceState> _digitalInputPinsStates;
private List<ValueComponentState> _componentsStates;
+ private List<HeaterState> _heater_states;
private List<ContinousResponseToken> _continousResponseTokens;
public List<MachineEventState> EventsStates { get; set; }
private bool _diagnostics_enabled;
@@ -108,6 +109,7 @@ namespace Tango.Emulations.Emulators
{
EventsStates = MachineEventState.GetAllEventsStates();
+ _heater_states = new List<HeaterState>();
_continousResponseTokens = new List<ContinousResponseToken>();
_motorJoggingRequestTypes = new List<PMR.Hardware.HardwareMotorType>();
_motorHomingRequestCodes = new List<PMR.Hardware.HardwareMotorType>();
@@ -138,6 +140,14 @@ namespace Tango.Emulations.Emulators
});
}
+ foreach (var item in adapter.TechHeaters)
+ {
+ _heater_states.Add(new HeaterState()
+ {
+ HeaterType = (HeaterType)item.Code,
+ });
+ }
+
ResetGraphFactors();
}
@@ -261,6 +271,9 @@ namespace Tango.Emulations.Emulators
case MessageType.StubFpgaWriteRegRequest:
HandleResetRequest(MessageFactory.ParseTangoMessageFromContainer<StubFpgaWriteRegRequest>(container));
break;
+ case MessageType.SetHeaterStateRequest:
+ HandleSetHeaterStateRequest(MessageFactory.ParseTangoMessageFromContainer<SetHeaterStateRequest>(container));
+ break;
}
}
@@ -353,6 +366,7 @@ namespace Tango.Emulations.Emulators
res.DigitalInterfaceStates.AddRange(_digitalOutputPinsStates.Concat(_digitalInputPinsStates));
res.ComponentsStates.AddRange(_componentsStates);
+ res.HeatersStates.AddRange(_heater_states);
Transporter.SendResponse<StartDiagnosticsResponse>(res, request.Container.Token);
@@ -761,6 +775,47 @@ namespace Tango.Emulations.Emulators
Transporter.SendResponse<StubFpgaWriteRegResponse>(new StubFpgaWriteRegResponse(), request.Container.Token);
}
+ private void HandleSetHeaterStateRequest(TangoMessage<SetHeaterStateRequest> request)
+ {
+ var heater = _heater_states.SingleOrDefault(x => x.HeaterType == request.Message.HeaterType);
+
+ if (heater != null)
+ {
+ double startValue = heater.CurrentValue;
+ double targetValue = request.Message.SetPoint;
+
+ Task.Factory.StartNew(() =>
+ {
+ heater.IsRampingUp = true;
+ heater.IsActive = true;
+ heater.IsInSetPoint = false;
+
+ if (targetValue > startValue)
+ {
+ while (heater.CurrentValue < targetValue)
+ {
+ heater.CurrentValue++;
+ Thread.Sleep(30);
+ }
+ }
+ else
+ {
+ while (heater.CurrentValue > targetValue)
+ {
+ heater.CurrentValue--;
+ Thread.Sleep(30);
+ }
+ }
+
+ heater.IsRampingUp = false;
+ heater.IsActive = false;
+ heater.IsInSetPoint = true;
+ });
+ }
+
+ Transporter.SendResponse<SetHeaterStateResponse>(new SetHeaterStateResponse(), request.Container.Token);
+ }
+
#endregion
#region Public Methods
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
index 11b57fcc8..ba8d0e085 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
@@ -266,6 +266,14 @@ namespace Tango.Integration.Operation
Task<SetComponentValueResponse> SetComponentValue(SetComponentValueRequest request);
/// <summary>
+ /// Sets the state of the specified heater type.
+ /// </summary>
+ /// <param name="heater">The heater.</param>
+ /// <param name="setPoint">Set point temperature.</param>
+ /// <returns></returns>
+ Task<SetHeaterStateResponse> SetHeaterState(HeaterType heater, double setPoint);
+
+ /// <summary>
/// Resolves the specified event type.
/// </summary>
/// <param name="eventType">Type of the event.</param>
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
index 332a2696c..ac264a8a4 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
@@ -1187,6 +1187,37 @@ namespace Tango.Integration.Operation
}
/// <summary>
+ /// Sets the state of the specified heater type.
+ /// </summary>
+ /// <param name="heater">The heater.</param>
+ /// <param name="setPoint">Set point temperature.</param>
+ /// <returns></returns>
+ public async Task<SetHeaterStateResponse> SetHeaterState(HeaterType heater, double setPoint)
+ {
+ SetHeaterStateResponse response = null;
+ SetHeaterStateRequest request = new SetHeaterStateRequest()
+ {
+ HeaterType = heater,
+ SetPoint = setPoint,
+ IsActive = true,
+ };
+
+ try
+ {
+ LogRequestSent(request);
+ response = await SendRequest<SetHeaterStateRequest, SetHeaterStateResponse>(request);
+ LogResponseReceived(response);
+ }
+ catch (Exception ex)
+ {
+ LogRequestFailed(request, ex);
+ throw ex;
+ }
+
+ return response;
+ }
+
+ /// <summary>
/// Resolves the specified event type.
/// </summary>
/// <param name="eventType">Type of the event.</param>
diff --git a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs
index 33d17c82d..fbf6299d1 100644
--- a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs
+++ b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs
@@ -22,7 +22,7 @@ namespace Tango.PMR.Common {
static MessageTypeReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbiq0JgoLTWVz",
+ "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbirtJgoLTWVz",
"c2FnZVR5cGUSCAoETm9uZRAAEhEKDUVycm9yUmVzcG9uc2UQARIUChBDYWxj",
"dWxhdGVSZXF1ZXN0EAMSFQoRQ2FsY3VsYXRlUmVzcG9uc2UQBBITCg9Qcm9n",
"cmVzc1JlcXVlc3QQBRIUChBQcm9ncmVzc1Jlc3BvbnNlEAYSHAoYU3R1YkNh",
@@ -115,24 +115,26 @@ namespace Tango.PMR.Common {
"bnNlEO0PEiMKHlN0YXJ0RXZlbnRzTm90aWZpY2F0aW9uUmVxdWVzdBDuDxIk",
"Ch9TdGFydEV2ZW50c05vdGlmaWNhdGlvblJlc3BvbnNlEO8PEiIKHVN0b3BF",
"dmVudHNOb3RpZmljYXRpb25SZXF1ZXN0EPAPEiMKHlN0b3BFdmVudHNOb3Rp",
- "ZmljYXRpb25SZXNwb25zZRDxDxIPCgpKb2JSZXF1ZXN0ELgXEhAKC0pvYlJl",
- "c3BvbnNlELkXEhQKD0Fib3J0Sm9iUmVxdWVzdBC6FxIVChBBYm9ydEpvY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
+ "EhoKFUV4ZWN1dGVQcm9jZXNzUmVxdWVzdBDcNhIbChZFeGVjdXRlUHJvY2Vz",
+ "c1Jlc3BvbnNlEN02EhcKEktpbGxQcm9jZXNzUmVxdWVzdBDeNhIYChNLaWxs",
+ "UHJvY2Vzc1Jlc3BvbnNlEN82QhwKGmNvbS50d2luZS50YW5nby5wbXIuY29t",
+ "bW9uYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Common.MessageType), }, null));
@@ -298,6 +300,8 @@ namespace Tango.PMR.Common {
[pbr::OriginalName("StartEventsNotificationResponse")] StartEventsNotificationResponse = 2031,
[pbr::OriginalName("StopEventsNotificationRequest")] StopEventsNotificationRequest = 2032,
[pbr::OriginalName("StopEventsNotificationResponse")] StopEventsNotificationResponse = 2033,
+ [pbr::OriginalName("SetHeaterStateRequest")] SetHeaterStateRequest = 2034,
+ [pbr::OriginalName("SetHeaterStateResponse")] SetHeaterStateResponse = 2035,
/// <summary>
///Printing
/// </summary>