Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1493700
relationChecker.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Size
1 KB
Referenced Files
None
Subscribers
None
relationChecker.cpp
View Options
#include
"relationChecker.h"
#include
<stdio.h>
//DATE18
float
deviationValueReferenceValue
(
float
sampleValue
,
float
historyValue
)
{
//printf("hier\n");
float
diff
;
if
(
sampleValue
<
0
)
{
sampleValue
=
sampleValue
*
(
-1
);
}
if
(
historyValue
<
0
)
{
historyValue
=
historyValue
*
(
-1
);
}
if
(
sampleValue
>
historyValue
)
diff
=
sampleValue
-
historyValue
;
else
diff
=
historyValue
-
sampleValue
;
//printf("sample %f, reference %f, diff %f, ", sampleValue, historyValue, diff);
if
(
diff
==
0
)
{
//printf("deviation %f\n", 0);
return
0
;
}
else
{
//printf("deviation %f\n", (diff / sampleValue));
return
(
diff
/
sampleValue
);
}
}
bool
valueIsRelatedToReferenceValue
(
float
referenceValue
,
float
value
,
float
threshold
)
{
float
diff
;
if
(
referenceValue
>
value
)
diff
=
referenceValue
-
value
;
else
diff
=
value
-
referenceValue
;
//printf("referenceValue %f, value %f, diff %f, threshold %f\n", referenceValue, value, diff, threshold);
if
(
diff
==
0
||
(
diff
/
referenceValue
<=
threshold
))
{
return
true
;
}
printf
(
"
\n
Related Calculation:
\n
Average: %f
\n
ActualValue: %f
\n
Diff: %f
\n
deviation: %f
\n
threshold: %f
\n
"
,
referenceValue
,
value
,
diff
,
diff
/
referenceValue
,
threshold
);
return
false
;
}
bool
valueIsRelatedToReferenceValueOrBetweenMinAndMax
(
float
referenceValue
,
float
minimumValue
,
float
maximumValue
,
float
value
,
float
threshold
)
{
if
(
value
>=
minimumValue
&&
value
<=
maximumValue
)
{
return
true
;
}
return
valueIsRelatedToReferenceValue
(
referenceValue
,
value
,
threshold
);
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sun, Mar 1, 5:53 PM (8 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
287635
Default Alt Text
relationChecker.cpp (1 KB)
Attached To
Mode
R20 SoC_Rosa_repo
Attached
Detach File
Event Timeline
Log In to Comment