refactor: 将Framework库和RT、UI放在同一个解决方案中。
This commit is contained in:
@@ -0,0 +1,210 @@
|
||||
using MECF.Framework.Simulator.Core.Driver;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
|
||||
namespace MECF.Framework.Simulator.Core.Breakers
|
||||
{
|
||||
class NSXBreaker : SerialPortDeviceSimulator
|
||||
{
|
||||
Stopwatch _timer = new Stopwatch();
|
||||
|
||||
private System.Timers.Timer _tick;
|
||||
Random _rd = new Random();
|
||||
|
||||
public event Action<string> receiveMsg;
|
||||
|
||||
public bool IsACurrent { get; set; }
|
||||
public bool IsBCurrent { get; set; }
|
||||
public bool IsCCurrent { get; set; }
|
||||
public bool IsAActive{ get; set; }
|
||||
public bool IsBActive { get; set; }
|
||||
public bool IsCActive { get; set; }
|
||||
|
||||
public bool IsAReactive { get; set; }
|
||||
public bool IsBReactive { get; set; }
|
||||
public bool IsCReactive { get; set; }
|
||||
public int APhaseCurrent { get; set; }
|
||||
public int BPhaseCurrent { get; set; }
|
||||
public int CPhaseCurrent { get; set; }
|
||||
public int AActivePower { get; set; }
|
||||
public int BActivePower { get; set; }
|
||||
public int CActivePower { get; set; }
|
||||
public int AReactivePower { get; set; }
|
||||
public int BReactivePower { get; set; }
|
||||
public int CReactivePower { get; set; }
|
||||
|
||||
private object _locker = new object();
|
||||
|
||||
public NSXBreaker(string port)
|
||||
: base(port, -1, "\r", ' ', false,"")
|
||||
{
|
||||
// ResultValue = "";
|
||||
|
||||
_tick = new System.Timers.Timer();
|
||||
_tick.Interval = 200;
|
||||
|
||||
_tick.Elapsed += _tick_Elapsed;
|
||||
_tick.Start();
|
||||
|
||||
IsACurrent = false;
|
||||
IsBCurrent = false;
|
||||
IsCCurrent = false;
|
||||
|
||||
IsAActive = false;
|
||||
IsBActive = false;
|
||||
IsCActive = false;
|
||||
|
||||
IsAReactive = false;
|
||||
IsBReactive = false;
|
||||
IsCReactive = false;
|
||||
|
||||
APhaseCurrent = 500;
|
||||
BPhaseCurrent = 600;
|
||||
CPhaseCurrent = 555;
|
||||
AActivePower = 700;
|
||||
BActivePower = 650;
|
||||
CActivePower = 680;
|
||||
AReactivePower = 680;
|
||||
BReactivePower = 660;
|
||||
CReactivePower = 540;
|
||||
|
||||
}
|
||||
private byte GetRandomValue()
|
||||
{
|
||||
Thread.Sleep(30);
|
||||
Random random = new Random();
|
||||
return (byte)random.Next(0, 10000);
|
||||
}
|
||||
|
||||
|
||||
private void _tick_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
|
||||
lock (_locker)
|
||||
{
|
||||
if (_timer.IsRunning && _timer.Elapsed > TimeSpan.FromSeconds(10))
|
||||
{
|
||||
_timer.Stop();
|
||||
|
||||
//IsAtSpeed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void ProcessUnsplitMessage(byte[] message)
|
||||
{
|
||||
if (message.Length != 8)
|
||||
{ return; }
|
||||
var arry = ModRTU_CRC(message.Take(6).ToArray()).Skip(2).ToArray();
|
||||
if (CheckModRTU_CRC(arry) != CheckModRTU_CRC(message.Skip(2).ToArray()))
|
||||
{ return; }
|
||||
base.ProcessUnsplitMessage(message);
|
||||
byte prefix = message[0];
|
||||
byte command = (byte)message[1];
|
||||
byte AddressHigh = (byte)(message[2]);
|
||||
byte AddressLow = message[3];
|
||||
switch (command)
|
||||
{
|
||||
case 0x03:
|
||||
{
|
||||
byte[] speedmsg = new byte[53];
|
||||
speedmsg[0] = 0x01;
|
||||
speedmsg[1] = 0x03;
|
||||
speedmsg[2] = 0x30;
|
||||
if (IsACurrent)
|
||||
APhaseCurrent = GetRandomValue();
|
||||
speedmsg[3] = (byte)(APhaseCurrent >> 8 & 0xff);
|
||||
speedmsg[4] = (byte)(APhaseCurrent & 0xff);
|
||||
|
||||
if (IsBCurrent)
|
||||
BPhaseCurrent = GetRandomValue();
|
||||
speedmsg[5] = (byte)(BPhaseCurrent >> 8 & 0xff);
|
||||
speedmsg[6] = (byte)(BPhaseCurrent & 0xff);
|
||||
|
||||
if (IsCCurrent)
|
||||
CPhaseCurrent = GetRandomValue()+50;
|
||||
speedmsg[7] = (byte)(CPhaseCurrent >> 8 & 0xff);
|
||||
speedmsg[8] = (byte)(CPhaseCurrent & 0xff);
|
||||
|
||||
if (IsAActive)
|
||||
AActivePower = GetRandomValue()+80;
|
||||
speedmsg[39] = (byte)(AActivePower >> 8 & 0xff);
|
||||
speedmsg[40] = (byte)(AActivePower & 0xff);
|
||||
|
||||
if (IsBActive)
|
||||
BActivePower = GetRandomValue();
|
||||
speedmsg[41] = (byte)(BActivePower >> 8 & 0xff);
|
||||
speedmsg[42] = (byte)(BActivePower & 0xff);
|
||||
|
||||
if (IsCActive)
|
||||
CActivePower = GetRandomValue();
|
||||
speedmsg[43] = (byte)(CActivePower >> 8 & 0xff);
|
||||
speedmsg[44] = (byte)(CActivePower & 0xff);
|
||||
|
||||
if (IsAReactive)
|
||||
AReactivePower = GetRandomValue();
|
||||
speedmsg[45] = (byte)(AReactivePower >> 8 & 0xff);
|
||||
speedmsg[46] = (byte)(AReactivePower & 0xff);
|
||||
|
||||
if (IsBReactive)
|
||||
BReactivePower = GetRandomValue();
|
||||
speedmsg[47] = (byte)(BReactivePower >> 8 & 0xff);
|
||||
speedmsg[48] = (byte)(BReactivePower & 0xff);
|
||||
|
||||
if (IsCReactive)
|
||||
CReactivePower = GetRandomValue();
|
||||
speedmsg[49] = (byte)(CReactivePower >> 8 & 0xff);
|
||||
speedmsg[50] = (byte)(CReactivePower & 0xff);
|
||||
|
||||
|
||||
speedmsg = ModRTU_CRC(speedmsg);
|
||||
OnWriteMessage(speedmsg);
|
||||
//ProcessWriteMessage(speedmsg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
public byte[] ModRTU_CRC(byte[] value)
|
||||
{
|
||||
var val = 0xFFFF;
|
||||
|
||||
for (int i = 0; i < value.Length; i++)
|
||||
{
|
||||
val ^= value[i];
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
var xdabit = (int)(val & 0x01);
|
||||
val >>= 1;
|
||||
if (xdabit == 1)
|
||||
val ^= 0xA001;
|
||||
}
|
||||
}
|
||||
|
||||
if (val == 0x0000)
|
||||
return value;
|
||||
var arg = value.ToList();
|
||||
arg.Add((byte)(val & 0xFF));
|
||||
arg.Add((byte)(val >> 8));
|
||||
return arg.ToArray();
|
||||
}
|
||||
private static byte CheckModRTU_CRC(byte[] buffer)
|
||||
{
|
||||
//ushort crc = 0xFFFF;
|
||||
// var buf = System.Text.Encoding.UTF8.GetBytes(String.Join(Environment.NewLine, buffer));
|
||||
var buf = buffer;
|
||||
var len = buffer.Length;
|
||||
byte temp = buffer[0];
|
||||
|
||||
for (int i = 1; i < buffer.Length; i++)
|
||||
{
|
||||
temp = (byte)(temp ^ buffer[i]);
|
||||
}
|
||||
return (byte)temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
<UserControl x:Class="MECF.Framework.Simulator.Core.Breakers.NSXBreakerView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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:local="clr-namespace:MECF.Framework.Simulator.Core.FFUs"
|
||||
mc:Ignorable="d"
|
||||
xmlns:commons="clr-namespace:MECF.Framework.Simulator.Core.Commons"
|
||||
Height="900" Width="900" Background="LightBlue" Initialized="UserControl_Initialized">
|
||||
<UserControl.Resources>
|
||||
<commons:ConnectionStatusBackgroundConverter x:Key="connectionStatusBackgroundConverter"/>
|
||||
|
||||
<Style TargetType="Label">
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
<Setter Property="Padding" Value="10,0,10,0" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="100"></RowDefinition>
|
||||
<RowDefinition Height="150"></RowDefinition>
|
||||
<RowDefinition Height="50"></RowDefinition>
|
||||
<RowDefinition Height="400"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Grid.Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50"></RowDefinition>
|
||||
<RowDefinition Height="50"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Content="{Binding Title}" FontSize="20" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Height="50" Background="{Binding IsConnected, Converter={StaticResource connectionStatusBackgroundConverter}}" ></Label>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<ComboBox Name="PortName" Text="{Binding PortSetPoint}" VerticalContentAlignment="Center" Width="120" Margin="20,0,0,0" Height="35" />
|
||||
<Label Content="Listen port:"></Label>
|
||||
<Label Content="{Binding LocalPort}"></Label>
|
||||
|
||||
<Label Content="{Binding ConnectionStatus}"></Label>
|
||||
|
||||
<Button Width="100" Height="35" Content="Enable" Command="{Binding EnableCommand}" IsEnabled="{Binding IsEnableEnable}"></Button>
|
||||
<Button Width="100" Height="35" Content="Disable" Command="{Binding DisableCommand}" IsEnabled="{Binding IsEnableDisable}"></Button>
|
||||
|
||||
<Label Content="Connection:"></Label>
|
||||
<Label Content="{Binding RemoteConnection}"></Label>
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Canvas Width="900" Margin="0,100,0,1" Grid.RowSpan="2">
|
||||
|
||||
|
||||
<!--<CheckBox Content="Fail" IsChecked="{Binding IsFailed}" Canvas.Left="36" Canvas.Top="31"></CheckBox>
|
||||
|
||||
<CheckBox Content="Pump on" IsChecked="{Binding IsPumpOn}" Canvas.Left="36" Canvas.Top="86"></CheckBox>
|
||||
|
||||
<CheckBox Content="OverTemp" IsChecked="{Binding IsOverTemp}" Canvas.Left="172" Canvas.Top="86"></CheckBox>
|
||||
|
||||
<CheckBox Content="At Speed" IsChecked="{Binding IsAtSpeed}" Canvas.Left="324" Canvas.Top="90"></CheckBox>-->
|
||||
|
||||
|
||||
<!-- <TextBlock Text="ActualTemp:" Canvas.Left="155" Canvas.Top="28" ></TextBlock>-->
|
||||
<TextBox Text="{Binding APhaseCurrent, UpdateSourceTrigger=PropertyChanged }" Canvas.Left="187" Canvas.Top="9" Margin="0" Width="94"></TextBox>
|
||||
<CheckBox Content="APhaseCurrent" IsChecked="{Binding IsACurrent}" Canvas.Left="48" Canvas.Top="20" RenderTransformOrigin="1.288,-4.39"></CheckBox>
|
||||
|
||||
<!--<TextBlock Text="SettingTemp:" Canvas.Left="151" Canvas.Top="88" ></TextBlock>-->
|
||||
<TextBox Text="{Binding BPhaseCurrent, UpdateSourceTrigger=PropertyChanged }" Canvas.Left="187" Canvas.Top="56" Margin="0" Width="94"></TextBox>
|
||||
<CheckBox Content="BPhaseCurrent" IsChecked="{Binding IsBCurrent}" Canvas.Left="47" Canvas.Top="69" RenderTransformOrigin="1.288,-4.39"></CheckBox>
|
||||
|
||||
<TextBox Text="{Binding CPhaseCurrent, UpdateSourceTrigger=PropertyChanged }" Canvas.Left="187" Canvas.Top="104" Margin="0" Width="94"></TextBox>
|
||||
<CheckBox Content="CPhaseCurrent" IsChecked="{Binding IsCCurrent}" Canvas.Left="52" Canvas.Top="116" RenderTransformOrigin="1.288,-4.39"></CheckBox>
|
||||
|
||||
<!-- <TextBlock Text="ActualTemp:" Canvas.Left="155" Canvas.Top="28" ></TextBlock>-->
|
||||
<TextBox Text="{Binding AActivePower, UpdateSourceTrigger=PropertyChanged }" Canvas.Left="454" Canvas.Top="10" Margin="0" Width="94"></TextBox>
|
||||
<CheckBox Content="AActivePower" IsChecked="{Binding IsAActive}" Canvas.Left="320" Canvas.Top="22" RenderTransformOrigin="1.288,-4.39"></CheckBox>
|
||||
|
||||
<!--<TextBlock Text="SettingTemp:" Canvas.Left="151" Canvas.Top="88" ></TextBlock>-->
|
||||
<TextBox Text="{Binding BActivePower, UpdateSourceTrigger=PropertyChanged }" Canvas.Left="455" Canvas.Top="56" Margin="0" Width="94"></TextBox>
|
||||
<CheckBox Content="BActivePower" IsChecked="{Binding IsBActive}" Canvas.Left="319" Canvas.Top="67" RenderTransformOrigin="1.288,-4.39"></CheckBox>
|
||||
|
||||
<TextBox Text="{Binding CActivePower, UpdateSourceTrigger=PropertyChanged }" Canvas.Left="455" Canvas.Top="104" Margin="0" Width="94"></TextBox>
|
||||
<CheckBox Content="CActivePower" IsChecked="{Binding IsCActive}" Canvas.Left="320" Canvas.Top="116" RenderTransformOrigin="1.288,-4.39"></CheckBox>
|
||||
|
||||
<!-- <TextBlock Text="ActualTemp:" Canvas.Left="155" Canvas.Top="28" ></TextBlock>-->
|
||||
<TextBox Text="{Binding AReactivePower, UpdateSourceTrigger=PropertyChanged }" Canvas.Left="722" Canvas.Top="10" Margin="0" Width="94" RenderTransformOrigin="0.552,0.109"></TextBox>
|
||||
<CheckBox Content="AReactivePower" IsChecked="{Binding IsAReactive}" Canvas.Left="578" Canvas.Top="20" RenderTransformOrigin="1.288,-4.39"></CheckBox>
|
||||
|
||||
<!--<TextBlock Text="SettingTemp:" Canvas.Left="151" Canvas.Top="88" ></TextBlock>-->
|
||||
<TextBox Text="{Binding BReactivePower, UpdateSourceTrigger=PropertyChanged }" Canvas.Left="722" Canvas.Top="56" Margin="0" Width="94"></TextBox>
|
||||
<CheckBox Content="BReactivePower" IsChecked="{Binding IsBReactive}" Canvas.Left="578" Canvas.Top="67" RenderTransformOrigin="1.288,-4.39"></CheckBox>
|
||||
|
||||
<TextBox Text="{Binding CReactivePower, UpdateSourceTrigger=PropertyChanged }" Canvas.Left="722" Canvas.Top="104" Margin="0" Width="94"></TextBox>
|
||||
<CheckBox Content="CReactivePower" IsChecked="{Binding IsCReactive}" Canvas.Left="580" Canvas.Top="117" RenderTransformOrigin="1.288,-4.39"></CheckBox>
|
||||
|
||||
</Canvas>
|
||||
|
||||
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" Width="900">
|
||||
<Button Content="Clear Log" Width="100" Height="35" Command="{Binding ClearLogCommand}"></Button>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<DataGrid Grid.Row="3" FontSize="16" AutoGenerateColumns="False" CanUserAddRows="False" CanUserResizeRows="False" CanUserSortColumns="False" ItemsSource="{Binding TransactionLogItems}"
|
||||
ScrollViewer.CanContentScroll="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
Width="900" Height="380" VerticalAlignment="Top">
|
||||
<DataGrid.Columns>
|
||||
|
||||
<DataGridTextColumn Header="Time" Width="160" IsReadOnly="True" Binding="{Binding OccurTime, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<DataGridTextColumn Header="Incoming" Width="350" IsReadOnly="True" Binding="{Binding Incoming, UpdateSourceTrigger=PropertyChanged}">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="TextWrapping" Value="Wrap"/>
|
||||
<Setter Property="Height" Value="auto"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
|
||||
<DataGridTextColumn Header="Outgoing" Width="350" IsReadOnly="True" Binding="{Binding Outgoing, UpdateSourceTrigger=PropertyChanged}">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="TextWrapping" Value="Wrap"/>
|
||||
<Setter Property="Height" Value="auto"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,58 @@
|
||||
using Aitex.Core.UI.MVVM;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace MECF.Framework.Simulator.Core.Breakers
|
||||
{
|
||||
/// <summary>
|
||||
/// NSXBreakerView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class NSXBreakerView : UserControl
|
||||
{
|
||||
public static int CurrentTick = 0;
|
||||
public NSXBreakerView()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = new NSXBreakerViewModel((CurrentTick++ == 0) ? "COM36" : "COM38");
|
||||
|
||||
(DataContext as TimerViewModelBase).Start();
|
||||
|
||||
this.Loaded += OnViewLoaded;
|
||||
}
|
||||
private void OnViewLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext == null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void UserControl_Initialized(object sender, EventArgs e)
|
||||
{
|
||||
InitSerialPort();
|
||||
}
|
||||
//GetPortNames()方法:获取当前计算机的串行端口名的数组
|
||||
private void InitSerialPort()
|
||||
{
|
||||
PortName.Items.Clear();
|
||||
foreach (string com in System.IO.Ports.SerialPort.GetPortNames())
|
||||
{
|
||||
PortName.Items.Add(com);
|
||||
}
|
||||
PortName.SelectedIndex = 0;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
using MECF.Framework.Simulator.Core.Commons;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MECF.Framework.Simulator.Core.Breakers
|
||||
{
|
||||
class NSXBreakerViewModel : SerialPortDeviceViewModel
|
||||
{
|
||||
private NSXBreaker _reader;
|
||||
|
||||
public string ResultValue { get; set; }
|
||||
public bool IsACurrent
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.IsACurrent;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.IsACurrent = value;
|
||||
}
|
||||
}
|
||||
public bool IsBCurrent
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.IsBCurrent;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.IsBCurrent = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsCCurrent
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.IsCCurrent;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.IsCCurrent = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsAActive
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.IsAActive;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.IsAActive = value;
|
||||
}
|
||||
}
|
||||
public bool IsBActive
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.IsBActive;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.IsBActive = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsCActive
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.IsCActive;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.IsCActive = value;
|
||||
}
|
||||
|
||||
}
|
||||
public bool IsAReactive
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.IsAReactive;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.IsAReactive = value;
|
||||
}
|
||||
}
|
||||
public bool IsBReactive
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.IsBReactive;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.IsBReactive = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsCReactive
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.IsCReactive;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.IsCReactive = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int APhaseCurrent
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.APhaseCurrent;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.APhaseCurrent = value;
|
||||
}
|
||||
}
|
||||
public int BPhaseCurrent
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.BPhaseCurrent;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.BPhaseCurrent = value;
|
||||
}
|
||||
}
|
||||
public int CPhaseCurrent
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.CPhaseCurrent;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.CPhaseCurrent = value;
|
||||
}
|
||||
}
|
||||
public int AActivePower
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.AActivePower;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.AActivePower = value;
|
||||
}
|
||||
}
|
||||
public int BActivePower
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.BActivePower;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.BActivePower = value;
|
||||
}
|
||||
}
|
||||
public int CActivePower
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.CActivePower;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.CActivePower = value;
|
||||
}
|
||||
}
|
||||
public int AReactivePower
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.AReactivePower;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.AReactivePower = value;
|
||||
}
|
||||
}
|
||||
public int BReactivePower
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.BReactivePower;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.BReactivePower = value;
|
||||
}
|
||||
}
|
||||
public int CReactivePower
|
||||
{
|
||||
get
|
||||
{
|
||||
return _reader.CReactivePower;
|
||||
}
|
||||
set
|
||||
{
|
||||
_reader.CReactivePower = value;
|
||||
}
|
||||
}
|
||||
public NSXBreakerViewModel(string port) : base("NSXBreakerViewModel")
|
||||
{
|
||||
_reader = new NSXBreaker(port);
|
||||
Init(_reader, true);
|
||||
_reader.receiveMsg += _reader_receiveMsg;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void _reader_receiveMsg(string obj)
|
||||
{
|
||||
ResultValue = obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user