Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1494047
main.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Size
4 KB
Referenced Files
None
Subscribers
None
main.cpp
View Options
#include
<stdio.h>
#include
<stdlib.h>
#include
<string>
#include
"configCAMforNewMotor.h"
#include
"configCAMforFluid.h"
#include
"configCAMforOldMotor.h"
#define CAM_FOR_FLUID 1
#define CAM_FOR_NEWMOTOR 2
#define CAM_FOR_OLDMOTOR 3
//#define PRINT
#define STOP_AFTER_SUMMARY
int
main
(
int
argc
,
char
*
argv
[])
{
// paths config
// TODO: maybe change char[] to String
char
datasetPath
[
700
];
char
destinationPath
[
700
];
// dataset config
char
datasetName
[
200
];
unsigned
int
datasetLength
;
// CAM System config
int
camConfigOption
;
// CAM Values config (fuzzy functions etc.)
float
innerBoundSimDif
;
float
outerBoundSimDif
;
int
boundTimeInSamples
;
unsigned
int
discreteAveragePartitionSize
;
float
innerBoundDrift
;
float
outerBoundDrift
;
int
boundBrokenTime
;
int
downSamplingFactor
;
// if the only argument is the name of the executable itself.
if
(
argc
<=
1
)
{
// configure here everything out of the C++ code.
printf
(
"Got no (or to less) arguments. Pass arguements to the executeable "
"or setup CAM in the C++ project!"
);
/*
//Only for Debugging
char destPath[] = "C:\\csv-data\\IJOCI_Journal\\Motor\\Results\\Step1_"
"experimentResults\\20190102_someLoadChanges14s10kHz";
char dataPath[] =
"C:\\csv-data\\IJOCI_Journal\\Motor\\datasets\\20190102_someLoadChanges14s10kHz.csv";
char namePath[] = "someLoadChanges14s10kHz";
configAndStartNewMotorExperiment(
destPath, dataPath, namePath, 140001, (float)0.01, (float)0.14, (unsigned int)10, (float)0.12, (float)0.42, (unsigned int)10, (unsigned int)50);
*/
}
else
if
(
argc
>
13
)
{
//Read all arguments that were passed to the exe
//NOTE: they have to be in the right order. There is no Error Handling.
//TODO: make error handling
// paths config
#ifdef _WIN32
sprintf_s
(
destinationPath
,
"%s"
,
argv
[
1
]);
sprintf_s
(
datasetPath
,
"%s"
,
argv
[
2
]);
#else
sprintf
(
destinationPath
,
"%s"
,
argv
[
1
]);
sprintf
(
datasetPath
,
"%s"
,
argv
[
2
]);
#endif
// dataset config
#ifdef _WIN32
sprintf_s
(
datasetName
,
"%s"
,
argv
[
3
]);
#else
sprintf
(
datasetName
,
"%s"
,
argv
[
3
]);
#endif
datasetLength
=
(
unsigned
int
)
atoi
(
argv
[
4
]);
// CAM System config
camConfigOption
=
atoi
(
argv
[
5
]);
// CAM Values config (fuzzy functions etc.)
innerBoundSimDif
=
std
::
stof
(
argv
[
6
]);
outerBoundSimDif
=
std
::
stof
(
argv
[
7
]);
boundTimeInSamples
=
std
::
stoi
(
argv
[
8
]);
discreteAveragePartitionSize
=
(
unsigned
int
)
atoi
(
argv
[
9
]);
innerBoundDrift
=
std
::
stof
(
argv
[
10
]);
outerBoundDrift
=
std
::
stof
(
argv
[
11
]);
boundBrokenTime
=
std
::
stoi
(
argv
[
12
]);
downSamplingFactor
=
std
::
stoi
(
argv
[
13
]);
#ifdef PRINT
printf
(
"destinationPath: %s
\n\n
"
,
destinationPath
);
printf
(
"datasetPath: %s
\n
"
,
datasetPath
);
printf
(
"datasetName: %s
\n
"
,
datasetName
);
printf
(
"datasetLength: %u
\n
"
,
datasetLength
);
printf
(
"innerBoundSimDif: %f
\n
"
,
innerBoundSimDif
);
printf
(
"outerBoundSimDif: %f
\n
"
,
outerBoundSimDif
);
printf
(
"boundTimeInSamples: %i
\n
"
,
boundTimeInSamples
);
printf
(
"innerBoundDrift: %f
\n
"
,
innerBoundDrift
);
printf
(
"outerBoundDrift: %f
\n
"
,
outerBoundDrift
);
printf
(
"boundBrokenTime: %i
\n
"
,
boundBrokenTime
);
printf
(
"downSamplingFactor: %i
\n
"
,
downSamplingFactor
);
#ifdef STOP_AFTER_SUMMARY
getchar
();
#endif
// STOP_AFTER_SUMMARY
#endif
if
(
camConfigOption
==
CAM_FOR_FLUID
)
{
// start Fluid CAM config
configAndStartFluidExperiment
(
destinationPath
,
datasetPath
,
datasetName
,
datasetLength
,
innerBoundSimDif
,
outerBoundSimDif
,
boundTimeInSamples
,
discreteAveragePartitionSize
,
innerBoundDrift
,
outerBoundDrift
,
boundBrokenTime
,
downSamplingFactor
);
}
else
if
(
camConfigOption
==
CAM_FOR_NEWMOTOR
)
{
// start newMotor CAM config
configAndStartNewMotorExperiment
(
destinationPath
,
datasetPath
,
datasetName
,
datasetLength
,
innerBoundSimDif
,
outerBoundSimDif
,
boundTimeInSamples
,
discreteAveragePartitionSize
,
innerBoundDrift
,
outerBoundDrift
,
boundBrokenTime
,
downSamplingFactor
);
}
else
if
(
camConfigOption
==
CAM_FOR_OLDMOTOR
)
{
// start oldMotor CAM config
configAndStartOldMotorExperiment
(
destinationPath
,
datasetPath
,
datasetName
,
datasetLength
,
innerBoundSimDif
,
outerBoundSimDif
,
boundTimeInSamples
,
discreteAveragePartitionSize
,
innerBoundDrift
,
outerBoundDrift
,
boundBrokenTime
,
downSamplingFactor
);
}
else
{
printf
(
"Chosen config does not exist. Check Arguments that were passed!
\n
"
);
}
}
return
0
;
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sun, Mar 1, 6:30 PM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
287285
Default Alt Text
main.cpp (4 KB)
Attached To
Mode
R20 SoC_Rosa_repo
Attached
Detach File
Event Timeline
Log In to Comment