Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
steam-material-library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STEAM
steam-material-library
Commits
4c8fe610
Commit
4c8fe610
authored
9 months ago
by
Erik Schnaubelt
Browse files
Options
Downloads
Patches
Plain Diff
added kG10_v2 and kKapton_v2: introduce minimum temperature
parent
97c7a4a1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#7589729
passed with warnings
9 months ago
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
models/c/general/CFUN_kG10_v2.c
+90
-0
90 additions, 0 deletions
models/c/general/CFUN_kG10_v2.c
models/c/general/CFUN_kKapton_v2.c
+98
-0
98 additions, 0 deletions
models/c/general/CFUN_kKapton_v2.c
with
188 additions
and
0 deletions
models/c/general/CFUN_kG10_v2.c
0 → 100644
+
90
−
0
View file @
4c8fe610
#include
<math.h>
#include
<float.h>
#include
<stdlib.h>
#include
<string.h>
#ifdef _MSC_VER
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif
static
const
char
*
error
=
NULL
;
EXPORT
int
init
(
const
char
*
str
)
{
return
1
;
}
EXPORT
const
char
*
getLastError
()
{
return
error
;
}
EXPORT
int
eval
(
const
char
*
func
,
int
nArgs
,
const
double
**
inReal
,
const
double
**
inImag
,
int
blockSize
,
double
*
outReal
,
double
*
outImag
)
{
int
i
;
double
a0
=
-
4
.
1236
;
double
a1
=
13
.
788
;
double
a2
=
-
26
.
06
8
;
double
a3
=
26
.
272
;
double
a4
=
-
14
.
663
;
double
a5
=
4
.
4954
;
double
a6
=
-
0
.
6905
;
double
a7
=
0
.
03
97
;
//linear approximation parameters
double
m
=
0
.
0017
;
double
n
=
0
.
097983
;
double
log_T
;
double
f_exp
;
if
(
strcmp
(
"CFUN_kG10_v1"
,
func
)
==
0
)
{
if
(
nArgs
!=
1
)
{
error
=
"One argument expected"
;
return
0
;
}
for
(
i
=
0
;
i
<
blockSize
;
i
++
)
{
double
T
=
inReal
[
0
][
i
];
// Enforce minimum temperature of 1.9 K
// The value of kG10 is not computed in this case but can be directly returned
// for increased performance.
// BEWARE: the value of outReal needs to be changed if the function is changed
if
(
T
<
1
.
9
)
{
outReal
[
i
]
=
0
.
01520715036
820004
;
return
1
;
}
if
(
T
<
300
){
log_T
=
log10
(
T
);
f_exp
=
(
a0
+
a1
*
log_T
+
a2
*
pow
(
log_T
,
2
)
+
a3
*
pow
(
log_T
,
3
)
+
a4
*
pow
(
log_T
,
4
)
+
a5
*
pow
(
log_T
,
5
)
+
a6
*
pow
(
log_T
,
6
)
+
a7
*
pow
(
log_T
,
7
));
outReal
[
i
]
=
pow
(
10
,
f_exp
);
}
if
(
T
>=
300
){
//linear approximation
outReal
[
i
]
=
m
*
T
+
n
;
}
/*Output consistency check*/
if
(
outReal
[
i
]
!=
outReal
[
i
]){
error
=
"Output is nan"
;
return
0
;
}
if
(
fabs
(
outReal
[
i
])
>
DBL_MAX
){
error
=
"Output is inf"
;
return
0
;
}
}
return
1
;
}
else
{
error
=
"Unknown function"
;
return
0
;
}
}
This diff is collapsed.
Click to expand it.
models/c/general/CFUN_kKapton_v2.c
0 → 100644
+
98
−
0
View file @
4c8fe610
#include
<math.h>
#include
<float.h>
#include
<stdlib.h>
#include
<string.h>
#ifdef _MSC_VER
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif
static
const
char
*
error
=
NULL
;
EXPORT
int
init
(
const
char
*
str
)
{
return
1
;
}
EXPORT
const
char
*
getLastError
()
{
return
error
;
}
EXPORT
int
eval
(
const
char
*
func
,
int
nArgs
,
const
double
**
inReal
,
const
double
**
inImag
,
int
blockSize
,
double
*
outReal
,
double
*
outImag
)
{
int
i
;
double
a
=
5
.
73101
;
double
b
=
-
39
.
5199
;
double
c
=
79
.
9313
;
double
d
=
-
83
.
8572
;
double
e
=
50
.
9157
;
double
f
=
-
17
.
9835
;
double
g
=
3
.
42413
;
double
h
=
-
0
.
27133
;
double
m
=
1.6367e-04
;
double
log_500
=
log10
(
500
);
double
f_exp_500
=
(
a
+
b
*
log_500
+
c
*
pow
(
log_500
,
2
)
+
d
*
pow
(
log_500
,
3
)
+
e
*
pow
(
log_500
,
4
)
+
f
*
pow
(
log_500
,
5
)
+
g
*
pow
(
log_500
,
6
)
+
h
*
pow
(
log_500
,
7
));
double
n
=
pow
(
10
,
f_exp_500
)
-
m
*
500
;
//0.142771;
double
log_T
;
double
f_exp
;
if
(
strcmp
(
"CFUN_kKapton_v1"
,
func
)
==
0
)
{
if
(
nArgs
!=
1
)
{
error
=
"One argument expected"
;
return
0
;
}
for
(
i
=
0
;
i
<
blockSize
;
i
++
)
{
double
T
=
inReal
[
0
][
i
];
// Enforce minimum temperature of 1.9 K
// The value of kKapton is not computed in this case but can be directly returned
// for increased performance.
// BEWARE: the value of outReal needs to be changed if the function is changed
if
(
T
<
1
.
9
)
{
outReal
[
i
]
=
0
.
006
839
;
return
1
;
}
if
(
T
<=
4
.
3
)
{
outReal
[
i
]
=
1
.
0703
*
1e-2
-
1
.
61
*
1e-3
*
(
4
.
3
-
T
);
}
else
if
(
T
>
4
.
3
&&
T
<=
500
)
{
if
(
T
==
0
){
T
=
0
.
001
;
}
log_T
=
log10
(
T
);
f_exp
=
(
a
+
b
*
log_T
+
c
*
pow
(
log_T
,
2
)
+
d
*
pow
(
log_T
,
3
)
+
e
*
pow
(
log_T
,
4
)
+
f
*
pow
(
log_T
,
5
)
+
g
*
pow
(
log_T
,
6
)
+
h
*
pow
(
log_T
,
7
));
outReal
[
i
]
=
pow
(
10
,
f_exp
);
}
if
(
T
>
500
){
//linear approximation
outReal
[
i
]
=
m
*
T
+
n
;
}
/*Output consistency check*/
if
(
outReal
[
i
]
!=
outReal
[
i
]){
error
=
"Output is nan"
;
return
0
;
}
if
(
fabs
(
outReal
[
i
])
>
DBL_MAX
){
error
=
"Output is inf"
;
return
0
;
}
}
return
1
;
}
else
{
error
=
"Unknown function"
;
return
0
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment