80 |
*/ |
*/ |
81 |
|
|
82 |
/* place to store symbols needed for accessing ASCEND's instance tree */ |
/* place to store symbols needed for accessing ASCEND's instance tree */ |
83 |
static symchar *fprops_symbols[2]; |
static symchar *fprops_symbols[3]; |
84 |
#define COMPONENT_SYM fprops_symbols[0] |
#define COMPONENT_SYM fprops_symbols[0] |
85 |
#define TYPE_SYM fprops_symbols[1] |
#define TYPE_SYM fprops_symbols[1] |
86 |
|
#define SOURCE_SYM fprops_symbols[2] |
87 |
|
|
88 |
static const char *fprops_p_help = "Calculate pressure from temperature and density, using FPROPS"; |
static const char *fprops_p_help = "Calculate pressure from temperature and density, using FPROPS"; |
89 |
static const char *fprops_u_help = "Calculate specific internal energy from temperature and density, using FPROPS"; |
static const char *fprops_u_help = "Calculate specific internal energy from temperature and density, using FPROPS"; |
166 |
struct Instance *data, |
struct Instance *data, |
167 |
struct gl_list_t *arglist |
struct gl_list_t *arglist |
168 |
){ |
){ |
169 |
struct Instance *compinst, *typeinst; |
struct Instance *compinst, *typeinst, *srcinst; |
170 |
const char *comp, *type = NULL; |
const char *comp, *type = NULL, *src = NULL; |
171 |
|
|
172 |
fprops_symbols[0] = AddSymbol("component"); |
fprops_symbols[0] = AddSymbol("component"); |
173 |
fprops_symbols[1] = AddSymbol("type"); |
fprops_symbols[1] = AddSymbol("type"); |
174 |
|
fprops_symbols[2] = AddSymbol("source"); |
175 |
|
|
176 |
/* get the component name */ |
/* get the component name */ |
177 |
compinst = ChildByChar(data,COMPONENT_SYM); |
compinst = ChildByChar(data,COMPONENT_SYM); |
203 |
if(type && strlen(type)==0)type = NULL; |
if(type && strlen(type)==0)type = NULL; |
204 |
} |
} |
205 |
|
|
206 |
bbox->user_data = (void *)fprops_fluid(comp,type); |
/* get the source data string (FPROPS doesn't mind if none given) */ |
207 |
|
srcinst = ChildByChar(data,SOURCE_SYM); |
208 |
|
if(srcinst){ |
209 |
|
if(InstanceKind(srcinst)!=SYMBOL_CONSTANT_INST){ |
210 |
|
ERROR_REPORTER_HERE(ASC_USER_ERROR,"DATA member 'source' must be a symbol_constant"); |
211 |
|
return 1; |
212 |
|
} |
213 |
|
src = SCP(SYMC_INST(srcinst)->value); |
214 |
|
CONSOLE_DEBUG("SOURCE: %s",src?src:"(null)"); |
215 |
|
if(src && strlen(src)==0)src = NULL; |
216 |
|
} |
217 |
|
|
218 |
|
bbox->user_data = (void *)fprops_fluid(comp,type,src); |
219 |
if(bbox->user_data == NULL){ |
if(bbox->user_data == NULL){ |
220 |
ERROR_REPORTER_HERE(ASC_USER_ERROR,"Component name/type was not recognised. Check the source-code for for the supported species."); |
ERROR_REPORTER_HERE(ASC_USER_ERROR,"Component name/type was not recognised. Check the source-code for for the supported species."); |
221 |
return 1; |
return 1; |