refactor: 将Framework库和RT、UI放在同一个解决方案中。
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
using Aitex.Core.RT.IOCore;
|
||||
using MECF.Framework.Common.IOCore;
|
||||
using MECF.Framework.Common.PLC;
|
||||
|
||||
namespace SicSimulator.Instances
|
||||
{
|
||||
public class SimulatorAdsPlcService : IWcfPlcService
|
||||
{
|
||||
|
||||
//diVariable="" doVariable="" aiVariable="" aoVariable=""
|
||||
public bool CheckIsConnected()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Read(string variable, out object data, string type, int length, out string reason)
|
||||
{
|
||||
reason = string.Empty;
|
||||
data = null;
|
||||
|
||||
switch (variable)
|
||||
{
|
||||
case "GVL_IO.PM1_DI_G":
|
||||
data = IoManager.Instance.GetDiBuffer("PM1.PLC")[0];
|
||||
break;
|
||||
case "GVL_IO.PM1_DO_G":
|
||||
data = IoManager.Instance.GetDoBuffer("PM1.PLC")[0];
|
||||
break;
|
||||
case "GVL_IO.PM1_AI_G":
|
||||
data = IoManager.Instance.GetAiBuffer("PM1.PLC")[0];
|
||||
break;
|
||||
case "GVL_IO.PM1_AI_G_2":
|
||||
data = IoManager.Instance.GetAiBuffer("PM1.PLC")[1];
|
||||
break;
|
||||
case "GVL_IO.PM1_AI_G_3":
|
||||
data = IoManager.Instance.GetAiBuffer("PM1.PLC")[2];
|
||||
break;
|
||||
case "GVL_IO.PM1_AO_G":
|
||||
data = IoManager.Instance.GetAoBuffer("PM1.PLC")[0];
|
||||
break;
|
||||
case "GVL_IO.PM1_AO_G_2":
|
||||
data = IoManager.Instance.GetAoBuffer("PM1.PLC")[1];
|
||||
break;
|
||||
case "GVL_IO.PM1_AO_G_3":
|
||||
data = IoManager.Instance.GetAoBuffer("PM1.PLC")[2];
|
||||
break;
|
||||
|
||||
case "GVL_IO.PM2_DI_G":
|
||||
data = IoManager.Instance.GetDiBuffer("PM2.PLC")[0];
|
||||
break;
|
||||
case "GVL_IO.PM2_DO_G":
|
||||
data = IoManager.Instance.GetDoBuffer("PM2.PLC")[0];
|
||||
break;
|
||||
case "GVL_IO.PM2_AI_G":
|
||||
data = IoManager.Instance.GetAiBuffer("PM2.PLC")[0];
|
||||
break;
|
||||
case "GVL_IO.PM2_AI_G_2":
|
||||
data = IoManager.Instance.GetAiBuffer("PM2.PLC")[1];
|
||||
break;
|
||||
case "GVL_IO.PM2_AI_G_3":
|
||||
data = IoManager.Instance.GetAiBuffer("PM2.PLC")[2];
|
||||
break;
|
||||
case "GVL_IO.PM2_AO_G":
|
||||
data = IoManager.Instance.GetAoBuffer("PM2.PLC")[0];
|
||||
break;
|
||||
case "GVL_IO.PM2_AO_G_2":
|
||||
data = IoManager.Instance.GetAoBuffer("PM2.PLC")[1];
|
||||
break;
|
||||
case "GVL_IO.PM2_AO_G_3":
|
||||
data = IoManager.Instance.GetAoBuffer("PM2.PLC")[2];
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool WriteArrayElement(string variable, int index, object value, out string reason)
|
||||
{
|
||||
reason = string.Empty;
|
||||
switch (variable)
|
||||
{
|
||||
case "GVL_IO.PM1_DI_G":
|
||||
break;
|
||||
case "GVL_IO.PM1_DO_G":
|
||||
IoManager.Instance.GetDoBuffer("PM1.PLC")[0][index] = (bool)value;
|
||||
break;
|
||||
case "GVL_IO.PM1_AI_G":
|
||||
IoManager.Instance.GetAiBuffer("PM1.PLC")[0][index] = (float)value;
|
||||
break;
|
||||
case "GVL_IO.PM1_AI_G_2":
|
||||
IoManager.Instance.GetAiBuffer("PM1.PLC")[1][index] = (float)value;
|
||||
break;
|
||||
case "GVL_IO.PM1_AI_G_3":
|
||||
IoManager.Instance.GetAiBuffer("PM1.PLC")[2][index] = (float)value;
|
||||
break;
|
||||
case "GVL_IO.PM1_AO_G":
|
||||
IoManager.Instance.GetAoBuffer("PM1.PLC")[0][index] = (float)value;
|
||||
break;
|
||||
case "GVL_IO.PM1_AO_G_2":
|
||||
IoManager.Instance.GetAoBuffer("PM1.PLC")[1][index] = (float)value;
|
||||
break;
|
||||
case "GVL_IO.PM1_AO_G_3":
|
||||
IoManager.Instance.GetAoBuffer("PM1.PLC")[2][index] = (float)value;
|
||||
break;
|
||||
|
||||
case "GVL_IO.PM2_DI_G":
|
||||
break;
|
||||
case "GVL_IO.PM2_DO_G":
|
||||
IoManager.Instance.GetDoBuffer("PM2.PLC")[0][index] = (bool)value;
|
||||
break;
|
||||
|
||||
case "GVL_IO.PM2_AI_G":
|
||||
IoManager.Instance.GetAiBuffer("PM2.PLC")[0][index] = (float)value;
|
||||
break;
|
||||
case "GVL_IO.PM2_AI_G_2":
|
||||
IoManager.Instance.GetAiBuffer("PM2.PLC")[1][index] = (float)value;
|
||||
break;
|
||||
case "GVL_IO.PM2_AI_G_3":
|
||||
IoManager.Instance.GetAiBuffer("PM2.PLC")[2][index] = (float)value;
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case "GVL_IO.PM2_AO_G":
|
||||
IoManager.Instance.GetAoBuffer("PM2.PLC")[0][index] = (float)value;
|
||||
break;
|
||||
case "GVL_IO.PM2_AO_G_2":
|
||||
IoManager.Instance.GetAoBuffer("PM2.PLC")[1][index] = (float)value;
|
||||
break;
|
||||
case "GVL_IO.PM2_AO_G_3":
|
||||
IoManager.Instance.GetAoBuffer("PM2.PLC")[2][index] = (float)value;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool[] ReadDi(int offset, int size, out string reason)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public float[] ReadAiFloat(int offset, int size, out string reason)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public int[] ReadAiInt(int offset, int size, out string reason)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool WriteDo(int offset, bool[] buffer, out string reason)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool WriteAoFloat(int offset, float[] buffer, out string reason)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool WriteAoInt(int offset, int[] buffer, out string reason)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public int Heartbeat(int counter)
|
||||
{
|
||||
return counter;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user