From 7d61c30b400b62069d1e69893ebe196412b2df2b Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 27 Feb 2018 14:25:58 +0200 Subject: Added PID Control. --- .../Images/balance.png | Bin 0 -> 1844 bytes .../Tango.MachineStudio.HardwareDesigner.csproj | 3 + .../ViewModels/MainViewVM.cs | 43 ++++- .../Views/MainView.xaml | 184 ++++++++++++++++++--- .../Views/MainView.xaml.cs | 12 ++ 5 files changed, 215 insertions(+), 27 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Images/balance.png (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Images/balance.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Images/balance.png new file mode 100644 index 000000000..46255b3ed Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Images/balance.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj index 15186d65b..12c32df08 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj @@ -155,5 +155,8 @@ + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs index 4becc0b04..0da894aba 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs @@ -4,6 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core.Commands; using Tango.Integration.Observables; using Tango.SharedUI; @@ -46,10 +47,20 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels set { _currentVersionDancerTypes = value; RaisePropertyChangedAuto(); } } + private ObservableCollection _currentVersionPidControls; + public ObservableCollection CurrentVersionPidControls + { + get { return _currentVersionPidControls; } + set { _currentVersionPidControls = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand SaveCommand { get; set; } public MainViewVM() { Adapter = ObservablesEntitiesAdapter.Instance; + + SaveCommand = new RelayCommand(Save); } private void OnSelectedVersionChanged() @@ -57,6 +68,7 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels CurrentVersion = SelectedVersion.Clone(); CurrentVersionDancerTypes = CurrentVersion.HardwareVersionsDancerTypes.Select(x => x.DancerType).ToObservableCollection(); CurrentVersionMotorTypes = CurrentVersion.HardwareVersionsMotorTypes.Select(x => x.MotorType).ToObservableCollection(); + CurrentVersionPidControls = CurrentVersion.HardwareVersionsPidControls.Select(x => x.PidControl).ToObservableCollection(); } public void OnRemoveDancer(DancerType dancerType) @@ -69,14 +81,41 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels CurrentVersionMotorTypes.Remove(motorType); } + public void OnRemovePidControl(PidControl pidControl) + { + CurrentVersionPidControls.Remove(pidControl); + } + public void OnMotorDrop(MotorType motorType) { - CurrentVersionMotorTypes.Add(motorType); + if (!CurrentVersionMotorTypes.Contains(motorType)) + { + CurrentVersionMotorTypes.Add(motorType); + } } public void OnDropDancer(DancerType dancerType) { - CurrentVersionDancerTypes.Add(dancerType); + if (!CurrentVersionDancerTypes.Contains(dancerType)) + { + CurrentVersionDancerTypes.Add(dancerType); + } + } + + public void OnDropPidControl(PidControl pidControl) + { + if (!CurrentVersionPidControls.Contains(pidControl)) + { + CurrentVersionPidControls.Add(pidControl); + } + } + + private void Save() + { + if (CurrentVersion != null) + { + + } } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml index 77ace3e63..e73ba2a1f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml @@ -60,10 +60,10 @@ - + DRAG & DROP DANCERS - + @@ -72,22 +72,23 @@ - - - - - - - - : - - - - - - - - + + + + + + + + + + @@ -102,10 +103,10 @@ - + DRAG & DROP MOTORS - + @@ -129,7 +130,23 @@ - + + + + + + + + + + @@ -143,6 +160,49 @@ + + + + DRAG & DROP PID CONTROLS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -209,7 +269,11 @@ - + + + + + @@ -238,10 +302,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -281,7 +375,7 @@ - + @@ -317,11 +411,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - +