-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOGS-Sim.cpp
More file actions
71 lines (67 loc) · 1.44 KB
/
Copy pathOGS-Sim.cpp
File metadata and controls
71 lines (67 loc) · 1.44 KB
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
// OGS-Sim.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.
//
#include "stdafx.h"
#include "Pipe.h"
#include <conio.h>
int _tmain(int argc, _TCHAR* argv[])
{
double austauschzeitschritt = 60.0;
long anzahlHaltungen = 0;
long anzahlSchaechte = 0;
COleDateTime zeitpunkt;
char buffer[255];
printf("Start\n");
CPipe *pipe = new CPipe();
printf("Verbinden\n");
if (!pipe->VerbindePipes("\\\\.\\pipe\\GW-Schreiben","\\\\.\\pipe\\GW-Lesen"))
{
printf("Nicht verbunden. Programm endet nach Tastendruck.\n");
_getch();
delete pipe;
return 1;
}
printf("Verbunden\n");
// Initialer Datenaustausch
pipe->PutD(austauschzeitschritt);
pipe->GetTime(zeitpunkt);
pipe->GetI(anzahlHaltungen);
printf("Anzahl Haltungen: %d\n", anzahlHaltungen);
for(long i= 0; i< anzahlHaltungen;i++)
{
pipe->GetS(buffer);
}
pipe->GetI(anzahlSchaechte);
printf("Anzahl Schächte: %d\n", anzahlSchaechte);
for(long i= 0; i< anzahlSchaechte;i++)
{
pipe->GetS(buffer);
}
bool Extran_ok = true;
while (Extran_ok)
{
double wasserstand;
printf("+");
pipe->GetTime(zeitpunkt);
for(long i= 0; i< anzahlSchaechte;i++)
{
pipe->GetD(wasserstand);
}
printf("-");
double zufluss = 0.1;
for(long i= 0; i< anzahlHaltungen;i++)
{
pipe->PutD(zufluss);
}
//long status = 0;
//if (current_time < end_time)
//{
// int couplingstatus = 0;
//}
//else{
// couplingstatus = 1;
//}
//pipe->PutI(status);
}
delete pipe;
return 0;
}