Repository navigation
Expand file tree
/
Copy pathSimulator.cpp
More file actions
102 lines (82 loc) · 2.7 KB
/
Copy pathSimulator.cpp
File metadata and controls
102 lines (82 loc) · 2.7 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include "Simulator.h"
Simulator::Simulator(QObject *parent) :
QObject(parent)
{
pump = new Pump();
presure_sensors = new PressureSensors();
sample_parameters = new SampleParameters();
fluid_parameters = new FluidParameters();
}
Simulator::~Simulator()
{
delete pump;
delete presure_sensors;
delete sample_parameters;
delete fluid_parameters;
}
void Simulator::run()
{
while (m_running)
{
if(m_simulator_start){
m_simulator_start = false;
qDebug()<<"Симулятор запущен";
double current_preasure = 0;
double current_flowRate = 0;
double D1minD2_pressure = 0;
current_preasure = pump->GetCurrent_pressure();
if(pump->getFlowRate_mode()){
current_flowRate = pump->GetSet_value_flowRate();
}
if(pump->getPressure_mode()){
current_flowRate = pump->GetCurrent_flowRate();
}
if(pump->getStop_mode()){
current_flowRate = 0;
}
D1minD2_pressure = presure_sensors->getCurrent_D1minD2_pressure();
double nu = fluid_parameters->getCurrentNu();
double length = sample_parameters->getLength();
double area = sample_parameters->GetArea();
double permability = calculatePermability(nu, current_flowRate, length, D1minD2_pressure, area);
emit signal_CurrentPreassure(current_preasure);
emit signal_CurrentFlowRate(current_flowRate);
emit signal_CurrentD1minD2(D1minD2_pressure);
emit signal_Permability(permability);
qDebug()<<"current_preasure: " <<current_preasure;
qDebug()<<"current_flowRate: " <<current_flowRate;
qDebug()<<"nu: " <<nu;
qDebug()<<"length: " <<length;
qDebug()<<"D1minD2_pressure: " <<D1minD2_pressure;
qDebug()<<"area: " <<area;
qDebug()<<"Проницаемость: " << permability;
}
}
emit finished();
}
double Simulator::calculatePermability(double nu, double flowRate, double length, double dPreassure, double area)
{
return koeff_si*nu*flowRate*length/dPreassure/area;
}
bool Simulator::simulator_start() const
{
return m_simulator_start;
}
void Simulator::setSimulator_start(bool newSimulator_start)
{
if (m_simulator_start == newSimulator_start)
return;
m_simulator_start = newSimulator_start;
emit simulator_startChanged();
}
bool Simulator::running() const
{
return m_running;
}
void Simulator::setRunning(bool newRunning)
{
if (m_running == newRunning)
return;
m_running = newRunning;
emit runningChanged();
}