]> gerrit.simantics Code Review - simantics/fmil.git/blob - org.simantics.fmil.core/native/FMILibrary/src/Import/include/FMI1/fmi1_import.h
Add FMILibrary-2.0.3 to org.simantics.fmil.core\native.
[simantics/fmil.git] / org.simantics.fmil.core / native / FMILibrary / src / Import / include / FMI1 / fmi1_import.h
1 /*\r
2     Copyright (C) 2012 Modelon AB\r
3 \r
4     This program is free software: you can redistribute it and/or modify\r
5     it under the terms of the BSD style license.
6 \r
7     This program is distributed in the hope that it will be useful,\r
8     but WITHOUT ANY WARRANTY; without even the implied warranty of\r
9     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
10     FMILIB_License.txt file for more details.\r
11 \r
12     You should have received a copy of the FMILIB_License.txt file\r
13     along with this program. If not, contact Modelon AB <http://www.modelon.com>.\r
14 */\r
15 \r
16 /** \file fmi1_import.h\r
17 *  \brief Public interface to the FMI import C-library.\r
18 */\r
19 \r
20 #ifndef FMI1_IMPORT_H_\r
21 #define FMI1_IMPORT_H_\r
22 \r
23 #include <stddef.h>\r
24 #include <fmilib_config.h>\r
25 #include <JM/jm_callbacks.h>\r
26 #include <FMI/fmi_import_util.h>\r
27 #include <FMI/fmi_import_context.h>\r
28 /* #include <FMI1/fmi1_xml_model_description.h> */\r
29 \r
30 #include <FMI1/fmi1_types.h>
31 #include <FMI1/fmi1_functions.h>
32 #include <FMI1/fmi1_enums.h>\r
33 \r
34 #include "fmi1_import_type.h"\r
35 #include "fmi1_import_unit.h"\r
36 #include "fmi1_import_variable.h"\r
37 #include "fmi1_import_vendor_annotations.h"\r
38 #include "fmi1_import_capabilities.h"\r
39 #include "fmi1_import_variable_list.h"\r
40 \r
41 #include "fmi1_import_capi.h"\r
42 #include "fmi1_import_convenience.h"\r
43 #include "fmi1_import_cosim.h"\r
44 \r
45 #ifdef __cplusplus\r
46 extern "C" {\r
47 #endif\r
48 \r
49 /**\r
50  * \addtogroup  fmi1_import FMI 1.0 import interface\r
51  *  All the structures used in the interfaces are intended to\r
52  *  be treated as opaque objects by the client code.\r
53  @{ \r
54  */\r
55 \r
56 /**     \addtogroup fmi1_import_init Constuction, destruction and error handling\r
57  *      \addtogroup fmi1_import_gen General information retrieval\r
58  *      \addtogroup fmi1_import_capi Interface to the standard FMI 1.0 "C" API\r
59  *  \brief Convenient functions for calling the FMI functions. This interface wrappes the "C" API. \r
60  */\r
61  /** @} */\r
62  /** @} */\r
63 \r
64 /** \addtogroup fmi1_import_init Constuction, destruction and error handling\r
65 @{\r
66 */\r
67 /**\r
68    \brief Create ::fmi1_import_t structure and parse the XML file.\r
69 \r
70     @param context A context data strucutre is used to propagate the callbacks for memory handling and logging.\r
71     @param dirPath A directory name (full path) of a directory where the FMU was unzipped.\r
72     @return The new structure if parsing was successfull. 0-pointer is returned on error.\r
73 */\r
74 FMILIB_EXPORT fmi1_import_t* fmi1_import_parse_xml( fmi_import_context_t* context, const char* dirPath);\r
75 \r
76 /**\r
77 * \brief Retrieve the last error message.\r
78 *\r
79 * Error handling:\r
80 *\r
81 *  Many functions in the library return pointers to struct. An error is indicated by returning NULL/0-pointer.\r
82 *  If error is returned than fmi1_import_get_last_error() functions can be used to retrieve the error message.\r
83 *  If logging callbacks were specified then the same information is reported via logger.\r
84 *  Memory for the error string is allocated and deallocated in the module.\r
85 *  Client code should not store the pointer to the string since it can become invalid.\r
86 *    @param fmu An FMU object as returned by fmi1_import_parse_xml().\r
87 *    @return NULL-terminated string with an error message.\r
88 */\r
89 FMILIB_EXPORT const char* fmi1_import_get_last_error(fmi1_import_t* fmu);\r
90 \r
91 /**\r
92 \brief Clear the error message.\r
93 * @param fmu An FMU object as returned by fmi1_import_parse_xml().\r
94 * @return 0 if further processing is possible. If it returns 1 then the \r
95 *       error was not recoverable. The \p fmu object should then be freed and recreated.\r
96 */\r
97 FMILIB_EXPORT int fmi1_import_clear_last_error(fmi1_import_t* fmu);\r
98 \r
99 /**\r
100 \brief Release the memory allocated\r
101 @param fmu An fmu object as returned by fmi1_import_parse_xml().\r
102 */\r
103 FMILIB_EXPORT void fmi1_import_free(fmi1_import_t* fmu);\r
104 /** @}\r
105 \addtogroup fmi1_import_gen\r
106  * \brief Functions for retrieving general model information. Memory for the strings is allocated and deallocated in the module.\r
107  *   All the functions take an FMU object as returned by fmi1_import_parse_xml() as a parameter. \r
108  *   The information is retrieved from the XML file.\r
109  * @{\r
110 */\r
111 /** \r
112 \brief Get model name. \r
113 @param fmu An fmu object as returned by fmi1_import_parse_xml().\r
114 */\r
115 FMILIB_EXPORT const char* fmi1_import_get_model_name(fmi1_import_t* fmu);\r
116 \r
117 /** \r
118 \brief Get model identifier. \r
119 @param fmu An fmu object as returned by fmi1_import_parse_xml().\r
120 */\r
121 FMILIB_EXPORT const char* fmi1_import_get_model_identifier(fmi1_import_t* fmu);\r
122 \r
123 /** \r
124 \brief Get FMU GUID. \r
125 @param fmu An fmu object as returned by fmi1_import_parse_xml().\r
126 */\r
127 FMILIB_EXPORT const char* fmi1_import_get_GUID(fmi1_import_t* fmu);\r
128 \r
129 /** \r
130 \brief Get FMU description.\r
131 @param fmu An fmu object as returned by fmi1_import_parse_xml().\r
132 */\r
133 FMILIB_EXPORT const char* fmi1_import_get_description(fmi1_import_t* fmu);\r
134 \r
135 /** \r
136 \brief Get FMU author. \r
137 @param fmu An fmu object as returned by fmi1_import_parse_xml().\r
138 */\r
139 FMILIB_EXPORT const char* fmi1_import_get_author(fmi1_import_t* fmu);\r
140 \r
141 /** \brief Get FMU version.\r
142 @param fmu An fmu object as returned by fmi1_import_parse_xml().\r
143 */\r
144 FMILIB_EXPORT const char* fmi1_import_get_model_version(fmi1_import_t* fmu);\r
145 \r
146 /** \brief Get FMI standard version (always 1.0). \r
147 @param fmu An fmu object as returned by fmi1_import_parse_xml().\r
148 */\r
149 FMILIB_EXPORT const char* fmi1_import_get_model_standard_version(fmi1_import_t* fmu);\r
150 \r
151 /** \brief Get FMU generation tool. \r
152 @param fmu An fmu object as returned by fmi1_import_parse_xml().\r
153 */\r
154 FMILIB_EXPORT const char* fmi1_import_get_generation_tool(fmi1_import_t* fmu);\r
155 \r
156 /** \brief Get FMU generation date and time. \r
157 @param fmu An fmu object as returned by fmi1_import_parse_xml().\r
158 */\r
159 FMILIB_EXPORT const char* fmi1_import_get_generation_date_and_time(fmi1_import_t* fmu);\r
160 \r
161 /** \brief Get variable naming convention used. \r
162 @param fmu An fmu object as returned by fmi1_import_parse_xml().\r
163 */\r
164 FMILIB_EXPORT fmi1_variable_naming_convension_enu_t fmi1_import_get_naming_convention(fmi1_import_t* fmu);\r
165 \r
166 /** \brief Get the number of contnuous states. */\r
167 FMILIB_EXPORT unsigned int fmi1_import_get_number_of_continuous_states(fmi1_import_t* fmu);\r
168 \r
169 /** \brief Get the number of event indicators. */\r
170 FMILIB_EXPORT unsigned int fmi1_import_get_number_of_event_indicators(fmi1_import_t* fmu);\r
171 \r
172 /** \brief Get the start time for default experiment  as specified in the XML file. */\r
173 FMILIB_EXPORT double fmi1_import_get_default_experiment_start(fmi1_import_t* fmu);\r
174 \r
175 /** \brief Get the stop time for default experiment  as specified in the XML file. */\r
176 FMILIB_EXPORT double fmi1_import_get_default_experiment_stop(fmi1_import_t* fmu);\r
177 \r
178 /** \brief Get the tolerance default experiment as specified in the XML file. */\r
179 FMILIB_EXPORT double fmi1_import_get_default_experiment_tolerance(fmi1_import_t* fmu);\r
180 \r
181 /** \brief Get the type of the FMU (model exchange or co-simulation) */\r
182 FMILIB_EXPORT fmi1_fmu_kind_enu_t fmi1_import_get_fmu_kind(fmi1_import_t* fmu);\r
183 \r
184 /** \brief Get the structure with capability flags.\r
185         @return A pointer to the fmi1_import_capabilities_t allocated within the library. \r
186                         Note that for model exchange FMUs the values of all the flags are always default.\r
187 */\r
188 FMILIB_EXPORT fmi1_import_capabilities_t* fmi1_import_get_capabilities(fmi1_import_t* fmu);\r
189 \r
190 /** \brief Get the list of all the type definitions in the model*/
191 FMILIB_EXPORT fmi1_import_type_definitions_t* fmi1_import_get_type_definitions(fmi1_import_t* );
192 \r
193 /** \brief Get a list of all the unit definitions in the model. */
194 FMILIB_EXPORT fmi1_import_unit_definitions_t* fmi1_import_get_unit_definitions(fmi1_import_t* fmu);
195 \r
196 /** 
197         \brief Get the direct dependency information
198
199         @return A variable list is returned for variables with causality Output. Null pointer for others. */
200 FMILIB_EXPORT fmi1_import_variable_list_t* fmi1_import_get_direct_dependency(fmi1_import_t* fmu, fmi1_import_variable_t*);
201 \r
202 /** \brief Get the variable with the same value reference that is not an alias*/
203 FMILIB_EXPORT fmi1_import_variable_t* fmi1_import_get_variable_alias_base(fmi1_import_t* fmu,fmi1_import_variable_t*);
204
205 /**
206     Get the list of all the variables aliased to the given one (including the base one).
207
208     Note that the list is ordered: base variable, aliases, negated aliases.
209 */
210 FMILIB_EXPORT fmi1_import_variable_list_t* fmi1_import_get_variable_aliases(fmi1_import_t* fmu,fmi1_import_variable_t*);
211 \r
212 /** \brief Get the list of all the variables in the model.\r
213 * @param fmu An FMU object as returned by fmi1_import_parse_xml().\r
214 * @return a variable list with all the variables in the model.\r
215 *\r
216 * Note that variable lists are allocated dynamically and must be freed when not needed any longer.\r
217 */\r
218 FMILIB_EXPORT fmi1_import_variable_list_t* fmi1_import_get_variable_list(fmi1_import_t* fmu);\r
219 \r
220 /** \brief Get the list of all the variables in the model in alphabetical order.\r
221 * @param fmu An FMU object as returned by fmi1_import_parse_xml().\r
222 * @return a variable list with all the variables in the model sorted in alphabetical order.\r
223 *\r
224 * Note that variable lists are allocated dynamically and must be freed when not needed any longer.\r
225 */\r
226 FMILIB_EXPORT fmi1_import_variable_list_t* fmi1_import_get_variable_list_alphabetical_order(fmi1_import_t* fmu);\r
227 \r
228 /** \brief Create a variable list with a single variable.\r
229   \r
230 \param fmu An FMU object that this variable list will reference.\r
231 \param v A variable.\r
232 */\r
233 FMILIB_EXPORT fmi1_import_variable_list_t* fmi1_import_create_var_list(fmi1_import_t* fmu,fmi1_import_variable_t* v);\r
234 \r
235 /**@} */\r
236 \r
237 #ifdef __cplusplus\r
238 }\r
239 #endif\r
240 \r
241 #endif\r