-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.cs
86 lines (70 loc) · 2.58 KB
/
Main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Threading;
using System.ServiceProcess;
using Unitronics.ComDriver.Messages.DataRequest;
namespace Unitronics.ComDriver
{
class Main
{
public static void main()
{
//Haussteuerung
{
Channel ch = new Ethernet("192.168.47.6", 20257, EthProtocol.TCP);
PLC plc = PLCFactory.GetPLC(ch, 0);
Console.WriteLine(plc.PlcName);
plc.SetExecuter(OperandsExecuterType.ExecuterPartialBinaryMix);
Console.WriteLine(plc.Version + "\t");
Console.WriteLine(plc.RTC + "\tPLC Timer \n" + System.DateTime.Now + "\tUTC Time");
//Until here
plc_haussterung plcHaussterung = new plc_haussterung(ch);
ReadWriteRequest[] rw = plcHaussterung.init();
while (true)
{
plcHaussterung.readData();
Thread.Sleep(60000);
}
}
//Kompressor
/* {
Channel ch = new Ethernet("192.168.47.12", 20256, EthProtocol.TCP);
PLC plc = PLCFactory.GetPLC(ch, 0);
Console.WriteLine(plc.PlcName);
plc.SetExecuter(OperandsExecuterType.ExecuterPartialBinaryMix);
Console.WriteLine(plc.Version);
Console.WriteLine(plc.PLCChannel);
Console.WriteLine(plc.RTC + " \t" + System.DateTime.Now);
object[] values = new object[2048];
for (int i = 0; i < values.Length; i++)
{
values[i] = (object) i;
}
ReadWriteRequest[] rw = new ReadWriteRequest[1];
ReadWriteRequest getCurr = new ReadOperands
{
NumberOfOperands = 1,
OperandType = OperandTypes.TimerPreset,
StartAddress = 0,
TimerValueFormat = TimerValueFormat.TimeFormat,
};
rw[0] = getCurr;
try
{
plc.ReadWrite(ref rw);
Console.WriteLine(rw[0].ResponseValues);
}
catch (Exception e)
{
Console.WriteLine(e.Message + ":" + e.StackTrace);
throw;
}
}*/
}
}
}