Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1493660
main.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Size
24 KB
Referenced Files
None
Subscribers
None
main.cpp
View Options
#include
"Agent.h"
#include
"Channel.h"
#include
"create_unit.h"
#include
"CSVreaderModule.h"
#include
"inAgentsRegistrations.h"
#include
"mount_nodes.h"
#include
"register_in_testbench.h"
#include
"Sensor.h"
#include
"setupNode.h"
#include
<iostream>
#include
<stdio.h>
#include
"Testbench.h"
#include
"setupModule.h"
//#include "mountModules.h"
//OLD STUFF
#include
"SetupOLD.h"
#include
"Lookuptable.h"
#include
"setup_lookuptable.h"
#include
"AbstractionModule.h"
#include
"ReliabilityModule.h"
//#include "DiscreteFunctionBlock.h"
#include
"CrossReliabilityProfileModule.h"
#include
"Setup.hpp"
#include
"test1.h"
#include
"csvparser.h"
int
main
(
int
argc
,
char
*
argv
[])
{
/*
DiscreteFunctionBlock test("relAbs:BTemp", "C:\\csv-data\\test.rff");
int x;
printf("loaded\n");
x = -1;
printf("x = %i -> y = %f\n", x, test.getY(x));
x = 0;
printf("x = %i -> y = %f\n", x, test.getY(x));
x = 1;
printf("x = %i -> y = %f\n", x, test.getY(x));
x = 2;
printf("x = %i -> y = %f\n", x, test.getY(x));
x = 3;
printf("x = %i -> y = %f\n", x, test.getY(x));
x = 4;
printf("x = %i -> y = %f\n", x, test.getY(x));
getchar();
*/
/*
CrossReliabilityProfileModule test("bla");
printf("name: %s\n", test.getName().c_str());
getchar();
*/
if
(
argc
>
18
)
{
//Read configurations
char
rootPath
[
300
];
char
datasetName
[
100
];
char
datasetPath
[
500
];
unsigned
int
datasetLength
;
sprintf_s
(
rootPath
,
"%s"
,
argv
[
1
]);
sprintf_s
(
datasetName
,
"%s"
,
argv
[
2
]);
sprintf_s
(
datasetPath
,
"%s
\\
Datasets
\\
%s"
,
rootPath
,
datasetName
);
#ifdef PRINT
printf
(
"datasetPath: %s
\n
"
,
datasetPath
);
#endif
// PRINT
datasetLength
=
(
unsigned
int
)
atoi
(
argv
[
3
]);
unsigned
int
HR
=
(
unsigned
int
)
atoi
(
argv
[
4
]);
unsigned
int
RR
=
(
unsigned
int
)
atoi
(
argv
[
5
]);
unsigned
int
SPO2
=
(
unsigned
int
)
atoi
(
argv
[
6
]);
unsigned
int
BTemp
=
(
unsigned
int
)
atoi
(
argv
[
7
]);
unsigned
int
BP
=
(
unsigned
int
)
atoi
(
argv
[
8
]);
char
destPath
[
600
];
//sprintf_s(destPath, "%s\\output.csv", argv[16]);
sprintf_s
(
destPath
,
"%s"
,
argv
[
9
]);
unsigned
int
HRconfig
=
(
unsigned
int
)
atoi
(
argv
[
10
]);
unsigned
int
RRconfig
=
(
unsigned
int
)
atoi
(
argv
[
11
]);
unsigned
int
BPconfig
=
(
unsigned
int
)
atoi
(
argv
[
12
]);
unsigned
int
SPO2config
=
(
unsigned
int
)
atoi
(
argv
[
13
]);
unsigned
int
BTempconfig
=
(
unsigned
int
)
atoi
(
argv
[
14
]);
unsigned
int
changeRightWrongDiffConfig
=
(
unsigned
int
)
atoi
(
argv
[
15
]);
unsigned
int
changeRightWrongTimeConfig
=
(
unsigned
int
)
atoi
(
argv
[
16
]);
unsigned
int
timeConfAndHistSize
=
(
unsigned
int
)
atoi
(
argv
[
17
]);
char
patientName
[
50
];
sprintf_s
(
patientName
,
"%s"
,
argv
[
18
]);
unsigned
int
crossParam
=
stof
(
argv
[
19
]);
//Configure RoSA so that it works as EWS system
unsigned
int
workingCycle
=
1
;
Setup
setup
;
Sensor
*
SensorHR
=
setup
.
createUnit
<
Sensor
>
(
"Sensor:HR"
);
setup
.
setWorkCycle
(
SensorHR
,
workingCycle
);
Sensor
*
SensorRR
=
setup
.
createUnit
<
Sensor
>
(
"Sensor:RR"
);
setup
.
setWorkCycle
(
SensorRR
,
workingCycle
);
Sensor
*
SensorBP
=
setup
.
createUnit
<
Sensor
>
(
"Sensor:BP"
);
setup
.
setWorkCycle
(
SensorBP
,
workingCycle
);
Sensor
*
SensorSPO2
=
setup
.
createUnit
<
Sensor
>
(
"Sensor:SPO2"
);
setup
.
setWorkCycle
(
SensorSPO2
,
workingCycle
);
Sensor
*
SensorBTemp
=
setup
.
createUnit
<
Sensor
>
(
"Sensor:BTemp"
);
setup
.
setWorkCycle
(
SensorBTemp
,
workingCycle
);
Agent
*
AgentHR
=
setup
.
createUnit
<
Agent
>
(
"Agent:HR"
);
setup
.
setWorkCycle
(
AgentHR
,
workingCycle
);
Agent
*
AgentRR
=
setup
.
createUnit
<
Agent
>
(
"Agent:RR"
);
setup
.
setWorkCycle
(
AgentRR
,
workingCycle
);
Agent
*
AgentBP
=
setup
.
createUnit
<
Agent
>
(
"Agent:BP"
);
setup
.
setWorkCycle
(
AgentBP
,
workingCycle
);
Agent
*
AgentSPO2
=
setup
.
createUnit
<
Agent
>
(
"Agent:SPO2"
);
setup
.
setWorkCycle
(
AgentSPO2
,
workingCycle
);
Agent
*
AgentBTemp
=
setup
.
createUnit
<
Agent
>
(
"Agent:BTemp"
);
setup
.
setWorkCycle
(
AgentBTemp
,
workingCycle
);
Agent
*
AgentSAEWS
=
setup
.
createUnit
<
Agent
>
(
"Agent:AgentSAEWS"
);
setup
.
setWorkCycle
(
AgentSAEWS
,
workingCycle
);
//getchar();
Channel
*
channel1HR
=
setup
.
createUnit
<
Channel
>
(
"HR"
);
setup
.
setTransferRate
(
channel1HR
,
0
);
Channel
*
channel1RR
=
setup
.
createUnit
<
Channel
>
(
"RR"
);
setup
.
setTransferRate
(
channel1RR
,
0
);
Channel
*
channel1BP
=
setup
.
createUnit
<
Channel
>
(
"BP"
);
setup
.
setTransferRate
(
channel1BP
,
0
);
Channel
*
channel1SPO2
=
setup
.
createUnit
<
Channel
>
(
"SPO2"
);
setup
.
setTransferRate
(
channel1SPO2
,
0
);
Channel
*
channel1BTemp
=
setup
.
createUnit
<
Channel
>
(
"BTemp"
);
setup
.
setTransferRate
(
channel1BTemp
,
0
);
Channel
*
channel2HR
=
setup
.
createUnit
<
Channel
>
(
"HR"
);
setup
.
setTransferRate
(
channel2HR
,
MAX_BUFFER_LENGTH
);
Channel
*
channel2RR
=
setup
.
createUnit
<
Channel
>
(
"RR"
);
setup
.
setTransferRate
(
channel2RR
,
MAX_BUFFER_LENGTH
);
Channel
*
channel2BP
=
setup
.
createUnit
<
Channel
>
(
"BP"
);
setup
.
setTransferRate
(
channel2BP
,
MAX_BUFFER_LENGTH
);
Channel
*
channel2SPO2
=
setup
.
createUnit
<
Channel
>
(
"SPO2"
);
setup
.
setTransferRate
(
channel2SPO2
,
MAX_BUFFER_LENGTH
);
Channel
*
channel2BTemp
=
setup
.
createUnit
<
Channel
>
(
"BTemp"
);
setup
.
setTransferRate
(
channel2BTemp
,
MAX_BUFFER_LENGTH
);
//printf("\nMount Sensors in Agents\n");
mount_sensorInAgent
(
AgentHR
,
SensorHR
,
channel1HR
);
mount_sensorInAgent
(
AgentRR
,
SensorRR
,
channel1RR
);
mount_sensorInAgent
(
AgentBP
,
SensorBP
,
channel1BP
);
mount_sensorInAgent
(
AgentSPO2
,
SensorSPO2
,
channel1SPO2
);
mount_sensorInAgent
(
AgentBTemp
,
SensorBTemp
,
channel1BTemp
);
//printf("\nMount Agents in Agents\n");
mount_agentInAgent
(
AgentSAEWS
,
AgentHR
,
channel2HR
);
mount_agentInAgent
(
AgentSAEWS
,
AgentRR
,
channel2RR
);
mount_agentInAgent
(
AgentSAEWS
,
AgentBP
,
channel2BP
);
mount_agentInAgent
(
AgentSAEWS
,
AgentSPO2
,
channel2SPO2
);
mount_agentInAgent
(
AgentSAEWS
,
AgentBTemp
,
channel2BTemp
);
//SHORTCUT/WORKAUROUND -> TODO: make this better!
//POLLAK ANGABEN:
//printf("\nCreate Reliability Modules\n");
char
ewsConfigFilepath
[
600
];
ReliabilityModule
reliabilityHR
(
"rm:HR"
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
rel
\\
reliabilityAbsoluteHR.rff"
,
rootPath
);
LinearFunctionBlock
relAbsHR
(
"relAbs:HR"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
rel
\\
reliabilitySlopeHR.rff"
,
rootPath
);
LinearFunctionBlock
relSloHR
(
"relSlo:HR"
,
ewsConfigFilepath
);
reliabilityHR
.
setFunctionBlocks
(
&
relAbsHR
,
&
relSloHR
);
ReliabilityModule
reliabilityRR
(
"rm:RR"
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
rel
\\
reliabilityAbsoluteRR.rff"
,
rootPath
);
LinearFunctionBlock
relAbsRR
(
"relAbs:RR"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
rel
\\
reliabilitySlopeRR.rff"
,
rootPath
);
LinearFunctionBlock
relSloRR
(
"relSlo:RR"
,
ewsConfigFilepath
);
reliabilityRR
.
setFunctionBlocks
(
&
relAbsRR
,
&
relSloRR
);
ReliabilityModule
reliabilityBP
(
"rm:BP"
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
rel
\\
reliabilityAbsoluteBP.rff"
,
rootPath
);
LinearFunctionBlock
relAbsBP
(
"relAbs:BP"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
rel
\\
reliabilitySlopeBP.rff"
,
rootPath
);
LinearFunctionBlock
relSloBP
(
"relSlo:BP"
,
ewsConfigFilepath
);
reliabilityBP
.
setFunctionBlocks
(
&
relAbsBP
,
&
relSloBP
);
ReliabilityModule
reliabilitySPO2
(
"rm:SPO2"
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
rel
\\
reliabilityAbsoluteSPO2.rff"
,
rootPath
);
LinearFunctionBlock
relAbsSPO2
(
"relAbs:SPO2"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
rel
\\
reliabilitySlopeSPO2.rff"
,
rootPath
);
LinearFunctionBlock
relSloSPO2
(
"relSlo:SPO2"
,
ewsConfigFilepath
);
reliabilitySPO2
.
setFunctionBlocks
(
&
relAbsSPO2
,
&
relSloSPO2
);
ReliabilityModule
reliabilityBTemp
(
"rm:BTemp"
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
rel
\\
reliabilityAbsoluteBTemp.rff"
,
rootPath
);
LinearFunctionBlock
relAbsBTemp
(
"relAbs:BTemp"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
rel
\\
reliabilitySlopeBTemp.rff"
,
rootPath
);
LinearFunctionBlock
relSloBTemp
(
"relSlo:BTemp"
,
ewsConfigFilepath
);
reliabilityBTemp
.
setFunctionBlocks
(
&
relAbsBTemp
,
&
relSloBTemp
);
//printf("\nMount Reliability Modules in Agents\n");
AgentHR
->
setReliabilityModule
(
&
reliabilityHR
);
AgentRR
->
setReliabilityModule
(
&
reliabilityRR
);
AgentBP
->
setReliabilityModule
(
&
reliabilityBP
);
AgentSPO2
->
setReliabilityModule
(
&
reliabilitySPO2
);
AgentBTemp
->
setReliabilityModule
(
&
reliabilityBTemp
);
//Confidence Module
ScoreConfidenceModule
scoreConfidencesHR
;
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
HR
\\
%u
\\
confHRis0.rff"
,
rootPath
,
HRconfig
);
LinearFunctionBlock
confHRis0
(
"conf:HR=0"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
HR
\\
%u
\\
confHRis1.rff"
,
rootPath
,
HRconfig
);
LinearFunctionBlock
confHRis1
(
"conf:HR=1"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
HR
\\
%u
\\
confHRis2.rff"
,
rootPath
,
HRconfig
);
LinearFunctionBlock
confHRis2
(
"conf:HR=2"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
HR
\\
%u
\\
confHRis3.rff"
,
rootPath
,
HRconfig
);
LinearFunctionBlock
confHRis3
(
"conf:HR=3"
,
ewsConfigFilepath
);
scoreConfidencesHR
.
addScoreConfidence
(
&
confHRis0
,
0
);
scoreConfidencesHR
.
addScoreConfidence
(
&
confHRis1
,
1
);
scoreConfidencesHR
.
addScoreConfidence
(
&
confHRis2
,
2
);
scoreConfidencesHR
.
addScoreConfidence
(
&
confHRis3
,
3
);
ScoreConfidenceModule
scoreConfidencesRR
;
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
RR
\\
%u
\\
confRRis0.rff"
,
rootPath
,
RRconfig
);
LinearFunctionBlock
confRRis0
(
"conf:RR=0"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
RR
\\
%u
\\
confRRis1.rff"
,
rootPath
,
RRconfig
);
LinearFunctionBlock
confRRis1
(
"conf:RR=1"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
RR
\\
%u
\\
confRRis2.rff"
,
rootPath
,
RRconfig
);
LinearFunctionBlock
confRRis2
(
"conf:RR=2"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
RR
\\
%u
\\
confRRis3.rff"
,
rootPath
,
RRconfig
);
LinearFunctionBlock
confRRis3
(
"conf:RR=3"
,
ewsConfigFilepath
);
scoreConfidencesRR
.
addScoreConfidence
(
&
confRRis0
,
0
);
scoreConfidencesRR
.
addScoreConfidence
(
&
confRRis1
,
1
);
scoreConfidencesRR
.
addScoreConfidence
(
&
confRRis2
,
2
);
scoreConfidencesRR
.
addScoreConfidence
(
&
confRRis3
,
3
);
ScoreConfidenceModule
scoreConfidencesBP
;
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
BP
\\
%u
\\
confBPis0.rff"
,
rootPath
,
BPconfig
);
LinearFunctionBlock
confBPis0
(
"conf:BP=0"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
BP
\\
%u
\\
confBPis1.rff"
,
rootPath
,
BPconfig
);
LinearFunctionBlock
confBPis1
(
"conf:BP=1"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
BP
\\
%u
\\
confBPis2.rff"
,
rootPath
,
BPconfig
);
LinearFunctionBlock
confBPis2
(
"conf:BP=2"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
BP
\\
%u
\\
confBPis3.rff"
,
rootPath
,
BPconfig
);
LinearFunctionBlock
confBPis3
(
"conf:BP=3"
,
ewsConfigFilepath
);
scoreConfidencesBP
.
addScoreConfidence
(
&
confBPis0
,
0
);
scoreConfidencesBP
.
addScoreConfidence
(
&
confBPis1
,
1
);
scoreConfidencesBP
.
addScoreConfidence
(
&
confBPis2
,
2
);
scoreConfidencesBP
.
addScoreConfidence
(
&
confBPis3
,
3
);
ScoreConfidenceModule
scoreConfidencesSPO2
;
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
SPO2
\\
%u
\\
confSPO2is0.rff"
,
rootPath
,
SPO2config
);
LinearFunctionBlock
confSPO2is0
(
"conf:SPO2=0"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
SPO2
\\
%u
\\
confSPO2is1.rff"
,
rootPath
,
SPO2config
);
LinearFunctionBlock
confSPO2is1
(
"conf:SPO2=1"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
SPO2
\\
%u
\\
confSPO2is2.rff"
,
rootPath
,
SPO2config
);
LinearFunctionBlock
confSPO2is2
(
"conf:SPO2=2"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
SPO2
\\
%u
\\
confSPO2is3.rff"
,
rootPath
,
SPO2config
);
LinearFunctionBlock
confSPO2is3
(
"conf:SPO2=3"
,
ewsConfigFilepath
);
scoreConfidencesSPO2
.
addScoreConfidence
(
&
confSPO2is0
,
0
);
scoreConfidencesSPO2
.
addScoreConfidence
(
&
confSPO2is1
,
1
);
scoreConfidencesSPO2
.
addScoreConfidence
(
&
confSPO2is2
,
2
);
scoreConfidencesSPO2
.
addScoreConfidence
(
&
confSPO2is3
,
3
);
ScoreConfidenceModule
scoreConfidencesBTemp
;
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
BTemp
\\
%u
\\
confBTempIs0.rff"
,
rootPath
,
BTempconfig
);
LinearFunctionBlock
confBTempIs0
(
"conf:BTemp=0"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
BTemp
\\
%u
\\
confBTempIs1.rff"
,
rootPath
,
BTempconfig
);
LinearFunctionBlock
confBTempIs1
(
"conf:BTemp=1"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
BTemp
\\
%u
\\
confBTempIs2.rff"
,
rootPath
,
BTempconfig
);
LinearFunctionBlock
confBTempIs2
(
"conf:BTemp=2"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
BTemp
\\
%u
\\
confBTempIs3.rff"
,
rootPath
,
BTempconfig
);
LinearFunctionBlock
confBTempIs3
(
"conf:BTemp=3"
,
ewsConfigFilepath
);
scoreConfidencesBTemp
.
addScoreConfidence
(
&
confBTempIs0
,
0
);
scoreConfidencesBTemp
.
addScoreConfidence
(
&
confBTempIs1
,
1
);
scoreConfidencesBTemp
.
addScoreConfidence
(
&
confBTempIs2
,
2
);
scoreConfidencesBTemp
.
addScoreConfidence
(
&
confBTempIs3
,
3
);
//printf("\nMount Score Confidence Modules in Agents\n");
AgentHR
->
setScoreConfidenceModule
(
&
scoreConfidencesHR
);
AgentRR
->
setScoreConfidenceModule
(
&
scoreConfidencesRR
);
AgentBP
->
setScoreConfidenceModule
(
&
scoreConfidencesBP
);
AgentSPO2
->
setScoreConfidenceModule
(
&
scoreConfidencesSPO2
);
AgentBTemp
->
setScoreConfidenceModule
(
&
scoreConfidencesBTemp
);
//CONF CHANGE
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
ChangeRightWrongDiff
\\
%u
\\
confidenceChangeRightDiff.rff"
,
rootPath
,
changeRightWrongDiffConfig
);
LinearFunctionBlock
confChangeRightDiff
(
"conf:ChangeRightDiff"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
ChangeRightWrongDiff
\\
%u
\\
confidenceChangeWrongDiff.rff"
,
rootPath
,
changeRightWrongDiffConfig
);
LinearFunctionBlock
confChangeWrongDiff
(
"conf:ChangeWrongDiff"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
ChangeRightWrongTime
\\
%u
\\
confidenceChangeRightTime.rff"
,
rootPath
,
changeRightWrongTimeConfig
);
LinearFunctionBlock
confChangeRightTime
(
"conf:ChangeRightTime"
,
ewsConfigFilepath
);
sprintf_s
(
ewsConfigFilepath
,
"%s
\\
EWSconfig
\\
ChangeRightWrongTime
\\
%u
\\
confidenceChangeWrongTime.rff"
,
rootPath
,
changeRightWrongTimeConfig
);
LinearFunctionBlock
confChangeWrongTime
(
"conf:ChangeWrongTime"
,
ewsConfigFilepath
);
AgentHR
->
setConfidenceChange
(
&
confChangeRightDiff
,
&
confChangeWrongDiff
,
&
confChangeRightTime
,
&
confChangeWrongTime
);
AgentRR
->
setConfidenceChange
(
&
confChangeRightDiff
,
&
confChangeWrongDiff
,
&
confChangeRightTime
,
&
confChangeWrongTime
);
AgentBP
->
setConfidenceChange
(
&
confChangeRightDiff
,
&
confChangeWrongDiff
,
&
confChangeRightTime
,
&
confChangeWrongTime
);
AgentSPO2
->
setConfidenceChange
(
&
confChangeRightDiff
,
&
confChangeWrongDiff
,
&
confChangeRightTime
,
&
confChangeWrongTime
);
AgentBTemp
->
setConfidenceChange
(
&
confChangeRightDiff
,
&
confChangeWrongDiff
,
&
confChangeRightTime
,
&
confChangeWrongTime
);
AgentSAEWS
->
setConfidenceChange
(
&
confChangeRightDiff
,
&
confChangeWrongDiff
,
&
confChangeRightTime
,
&
confChangeWrongTime
);
//NEW FOR Springer Journal //NOTE: at the moment timeConfAndHistSize is casted from unsigned int to float
LinearFunctionBlock
*
confTimeScoreHasBeen
=
new
LinearFunctionBlock
(
"funcBlock:confValidStateDev"
);
LinearFunction
*
confTimeScoreHasBeen1
=
new
LinearFunction
();
confTimeScoreHasBeen1
->
setDomain
(
false
,
true
,
(
float
)
0
);
confTimeScoreHasBeen1
->
setKandD
((
float
)
0
,
(
float
)
1
);
confTimeScoreHasBeen
->
addLinearFunction
(
confTimeScoreHasBeen1
);
LinearFunction
*
confTimeScoreHasBeen2
=
new
LinearFunction
();
confTimeScoreHasBeen2
->
setDomain
(
true
,
(
float
)
0
,
true
,
(
float
)
timeConfAndHistSize
);
confTimeScoreHasBeen2
->
setKandD
(
0
,
(
float
)
1
,
(
float
)
timeConfAndHistSize
,
(
float
)
0
);
confTimeScoreHasBeen
->
addLinearFunction
(
confTimeScoreHasBeen2
);
LinearFunction
*
confTimeScoreHasBeen3
=
new
LinearFunction
();
confTimeScoreHasBeen3
->
setDomain
(
true
,
(
float
)
timeConfAndHistSize
,
false
);
confTimeScoreHasBeen3
->
setKandD
((
float
)
0
,
(
float
)
0
);
confTimeScoreHasBeen
->
addLinearFunction
(
confTimeScoreHasBeen3
);
AgentHR
->
setConfTimeScoreHasBeen
(
confTimeScoreHasBeen
);
AgentRR
->
setConfTimeScoreHasBeen
(
confTimeScoreHasBeen
);
AgentBP
->
setConfTimeScoreHasBeen
(
confTimeScoreHasBeen
);
AgentSPO2
->
setConfTimeScoreHasBeen
(
confTimeScoreHasBeen
);
AgentBTemp
->
setConfTimeScoreHasBeen
(
confTimeScoreHasBeen
);
AgentSAEWS
->
setConfTimeScoreHasBeen
(
confTimeScoreHasBeen
);
AgentHR
->
setMaxHistSizePossScores
(
timeConfAndHistSize
);
AgentRR
->
setMaxHistSizePossScores
(
timeConfAndHistSize
);
AgentBP
->
setMaxHistSizePossScores
(
timeConfAndHistSize
);
AgentSPO2
->
setMaxHistSizePossScores
(
timeConfAndHistSize
);
AgentBTemp
->
setMaxHistSizePossScores
(
timeConfAndHistSize
);
AgentSAEWS
->
setMaxHistSizePossScores
(
timeConfAndHistSize
);
char
crossProfileFilePath
[
800
];
CrossReliabilityProfileModule
profile
(
"BP"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
BP-BTemp.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
BPBTempFunctionBlock
(
"BP-BTemp"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
BPBTempFunctionBlock
,
"BP"
,
"BTemp"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
BP-HR.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
BPHRFunctionBlock
(
"BP-HR"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
BPHRFunctionBlock
,
"BP"
,
"HR"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
BP-RR.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
BPRRFunctionBlock
(
"BP-RR"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
BPRRFunctionBlock
,
"BP"
,
"RR"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
BP-SPO2.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
BPSPO2FunctionBlock
(
"BP-SPO2"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
BPSPO2FunctionBlock
,
"BP"
,
"SPO2"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
BTemp-BP.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
BTempBPFunctionBlock
(
"BTemp-BP"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
BTempBPFunctionBlock
,
"BTemp"
,
"BP"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
BTemp-HR.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
BTempHRFunctionBlock
(
"BTemp-HR"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
BTempHRFunctionBlock
,
"BTemp"
,
"HR"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
BTemp-RR.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
BTempRRFunctionBlock
(
"BTemp-RR"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
BTempRRFunctionBlock
,
"BTemp"
,
"RR"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
BTemp-SPO2.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
BTempSPO2FunctionBlock
(
"BTemp-SPO2"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
BTempSPO2FunctionBlock
,
"BTemp"
,
"SPO2"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
HR-BP.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
HRBPFunctionBlock
(
"HR-BP"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
HRBPFunctionBlock
,
"HR"
,
"BP"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
HR-BTemp.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
HRBTempFunctionBlock
(
"HR-BTemp"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
HRBTempFunctionBlock
,
"HR"
,
"BTemp"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
HR-RR.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
HRRRFunctionBlock
(
"HR-RR"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
HRRRFunctionBlock
,
"HR"
,
"RR"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
HR-SPO2.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
HRSPO2FunctionBlock
(
"HR-SPO2"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
HRSPO2FunctionBlock
,
"HR"
,
"SPO2"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
RR-BP.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
RRBPFunctionBlock
(
"RR-BP"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
RRBPFunctionBlock
,
"RR"
,
"BP"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
RR-BTemp.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
RRBTempFunctionBlock
(
"RR-BTemp"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
RRBTempFunctionBlock
,
"RR"
,
"BTemp"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
RR-HR.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
RRHRFunctionBlock
(
"RR-HR"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
RRHRFunctionBlock
,
"RR"
,
"HR"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
RR-SPO2.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
RRSPO2FunctionBlock
(
"RR-SPO2"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
RRSPO2FunctionBlock
,
"RR"
,
"SPO2"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
SPO2-BP.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
SPO2BPFunctionBlock
(
"SPO2-BP"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
SPO2BPFunctionBlock
,
"SPO2"
,
"BP"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
SPO2-BTemp.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
SPO2BTempFunctionBlock
(
"SPO2-BTemp"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
SPO2BTempFunctionBlock
,
"SPO2"
,
"BTemp"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
SPO2-HR.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
SPO2HRFunctionBlock
(
"SPO2-HR"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
SPO2HRFunctionBlock
,
"SPO2"
,
"HR"
);
sprintf_s
(
crossProfileFilePath
,
"%s
\\
PatientProfiles
\\
%s
\\
SPO2-RR.rff"
,
rootPath
,
patientName
);
DiscreteFunctionBlock
SPO2RRFunctionBlock
(
"SPO2-RR"
,
crossProfileFilePath
);
profile
.
setFunctionBlock
(
&
SPO2RRFunctionBlock
,
"SPO2"
,
"RR"
);
AgentSAEWS
->
setCrossReliabilityProfileModule
(
&
profile
);
//Workaround
unsigned
int
scoreHistoryLength
=
30
*
changeRightWrongTimeConfig
;
AgentHR
->
setScoreHistorLength
(
scoreHistoryLength
);
AgentRR
->
setScoreHistorLength
(
scoreHistoryLength
);
AgentBP
->
setScoreHistorLength
(
scoreHistoryLength
);
AgentSPO2
->
setScoreHistorLength
(
scoreHistoryLength
);
AgentBTemp
->
setScoreHistorLength
(
scoreHistoryLength
);
AgentSAEWS
->
setScoreHistorLength
(
scoreHistoryLength
);
AgentSAEWS
->
setCrossReliabiabilityParameter
(
crossParam
);
/*
//TODO: basisklassen-pointer weitergeben, dann dynamic_cast machen
Unit *test = setup.createUnit<Agent>("test");
*/
//printf("\nCreate Testbench\n");
Testbench
tb1
=
create_testbench
(
"testbench1"
);
//TODO: load agents, sensors, channels, and csvreader from setup-object in testbench
//printf("\nLoad CSV-Files\n");
unsigned
int
row
=
2
;
CSVreaderModule
*
csvrHR
;
CSVreaderModule
*
csvrRR
;
CSVreaderModule
*
csvrSPO2
;
CSVreaderModule
*
csvrBTemp
;
CSVreaderModule
*
csvrBP
;
//printf("ja... %s\n", destPath);
//getchar();
AgentSAEWS
->
setCSVWRiter
(
destPath
);
char
destPath2
[
700
];
sprintf_s
(
destPath2
,
"%s-MoreData.csv"
,
destPath
);
AgentSAEWS
->
setSecondCSVWRiter
(
destPath2
);
sprintf_s
(
datasetPath
,
"%s"
,
datasetPath
);
csvrHR
=
create_CSVreaderModule
(
"csvr:HR"
,
datasetPath
,
HR
,
row
);
//HR
csvrRR
=
create_CSVreaderModule
(
"csvr:RR"
,
datasetPath
,
RR
,
row
);
//RR
csvrSPO2
=
create_CSVreaderModule
(
"csvr:SPO2"
,
datasetPath
,
SPO2
,
row
);
//SPO2
csvrBTemp
=
create_CSVreaderModule
(
"csvr:BTemp"
,
datasetPath
,
BTemp
,
row
);
//BTemp
csvrBP
=
create_CSVreaderModule
(
"csvr:BP"
,
datasetPath
,
BP
,
row
);
//BP
//printf("\nRegister all Sensors in Testbench\n");
register_sensorInTestbench
(
&
tb1
,
SensorHR
,
csvrHR
);
register_sensorInTestbench
(
&
tb1
,
SensorRR
,
csvrRR
);
register_sensorInTestbench
(
&
tb1
,
SensorBP
,
csvrBP
);
register_sensorInTestbench
(
&
tb1
,
SensorSPO2
,
csvrSPO2
);
register_sensorInTestbench
(
&
tb1
,
SensorBTemp
,
csvrBTemp
);
//printf("\nRegister all Agents in Testbench\n");
register_agentInTestbench
(
&
tb1
,
AgentHR
);
register_agentInTestbench
(
&
tb1
,
AgentRR
);
register_agentInTestbench
(
&
tb1
,
AgentBP
);
register_agentInTestbench
(
&
tb1
,
AgentSPO2
);
register_agentInTestbench
(
&
tb1
,
AgentBTemp
);
register_agentInTestbench
(
&
tb1
,
AgentSAEWS
);
//printf("\nRegister all Channels in Testbench\n");
register_channelInTestbench
(
&
tb1
,
channel1HR
);
register_channelInTestbench
(
&
tb1
,
channel1RR
);
register_channelInTestbench
(
&
tb1
,
channel1BP
);
register_channelInTestbench
(
&
tb1
,
channel1SPO2
);
register_channelInTestbench
(
&
tb1
,
channel1BTemp
);
register_channelInTestbench
(
&
tb1
,
channel2HR
);
register_channelInTestbench
(
&
tb1
,
channel2RR
);
register_channelInTestbench
(
&
tb1
,
channel2BP
);
register_channelInTestbench
(
&
tb1
,
channel2SPO2
);
register_channelInTestbench
(
&
tb1
,
channel2BTemp
);
//Start
tb1
.
simulate
(
datasetLength
);
//tb1.clearTestbench();
}
else
{
printf
(
"Arguments wrong!"
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sun, Mar 1, 5:51 PM (13 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
287694
Default Alt Text
main.cpp (24 KB)
Attached To
Mode
R20 SoC_Rosa_repo
Attached
Detach File
Event Timeline
Log In to Comment