]> gerrit.simantics Code Review - simantics/fmil.git/blob - org.simantics.fmil.core/native/FMILibrary/src/Import/include/FMI1/fmi1_import_unit.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_unit.h
1 /*
2     Copyright (C) 2012 Modelon AB
3
4     This program is free software: you can redistribute it and/or modify
5     it under the terms of the BSD style license.
6
7      This program is distributed in the hope that it will be useful,
8     but WITHOUT ANY WARRANTY; without even the implied warranty of
9     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10     FMILIB_License.txt file for more details.
11
12     You should have received a copy of the FMILIB_License.txt file
13     along with this program. If not, contact Modelon AB <http://www.modelon.com>.
14 */
15
16 /** \file fmi1_import_unit.h
17 *  \brief Public interface to the FMI import C-library. Handling of variable units.
18 */
19
20 #ifndef FMI1_IMPORT_UNIT_H_
21 #define FMI1_IMPORT_UNIT_H_
22 \r
23 #include <fmilib_config.h>\r
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29                 /**
30         \addtogroup fmi1_import
31         @{
32         \addtogroup fmi1_import_units Functions for handling unit definitions.
33         @}
34         \addtogroup fmi1_import_units Functions for handling unit definitions.
35         @{
36         */
37
38 /**\name Structures encapsulating unit information */\r
39 /**@{ */\r
40 /** \brief A variable unit defined with a unit defition */\r
41 typedef struct fmi1_xml_unit_t fmi1_import_unit_t;\r
42 /** \brief A display unit. */\r
43 typedef struct fmi1_xml_display_unit_t fmi1_import_display_unit_t;\r
44 /** \brief The list of all the unit definitions in the model */\r
45 typedef struct fmi1_xml_unit_definitions_t fmi1_import_unit_definitions_t;\r
46 /**@} */\r
47
48 /** \brief Get the number of unit definitions. */
49 FMILIB_EXPORT unsigned int  fmi1_import_get_unit_definitions_number(fmi1_import_unit_definitions_t*);
50
51 /** \brief Get a unit definition */
52 FMILIB_EXPORT fmi1_import_unit_t* fmi1_import_get_unit(fmi1_import_unit_definitions_t*, unsigned int  index);
53
54 /** \brief Get a unit name */
55 FMILIB_EXPORT const char* fmi1_import_get_unit_name(fmi1_import_unit_t*);
56
57 /** \brief Get the number of display units associated with this unit */
58 FMILIB_EXPORT unsigned int fmi1_import_get_unit_display_unit_number(fmi1_import_unit_t*);
59
60 /** \brief Get a display unit object by index.
61         @param index The index of display unit to be returned. Must be less than the number returned by fmi1_import_get_unit_display_unit_number()
62 */
63 FMILIB_EXPORT fmi1_import_display_unit_t* fmi1_import_get_unit_display_unit(fmi1_import_unit_t*, size_t index);
64
65 /**
66         \brief Get unit defition for a display unit.
67 */
68 FMILIB_EXPORT fmi1_import_unit_t* fmi1_import_get_base_unit(fmi1_import_display_unit_t*);
69 /**
70         \brief Get display unit name
71 */
72 FMILIB_EXPORT const char* fmi1_import_get_display_unit_name(fmi1_import_display_unit_t*);
73
74 /**
75         \brief Get the "gain" associated with the display unit.
76 */
77 FMILIB_EXPORT fmi1_real_t fmi1_import_get_display_unit_gain(fmi1_import_display_unit_t*);
78 /**
79         \brief Get the "offset" associated with the display unit.
80 */
81 FMILIB_EXPORT fmi1_real_t fmi1_import_get_display_unit_offset(fmi1_import_display_unit_t*);
82
83 /**
84         \brief Convert a value measured in "units" to a value measured with "display units"
85         @param value The value to be converted.
86         @param du The display unit object
87         @param isRelativeQuantity specifies if "offset" should be incorporated into conversion
88 */
89 FMILIB_EXPORT fmi1_real_t fmi1_import_convert_to_display_unit(fmi1_real_t value , fmi1_import_display_unit_t* du, int isRelativeQuantity);
90
91
92 /**
93         \brief Convert a value measured in "display units" to a value measured with "units"
94         @param value The value to be converted.
95         @param du The display unit object
96         @param isRelativeQuantity specifies if "offset" should be incorporated into conversion
97 */
98 FMILIB_EXPORT fmi1_real_t fmi1_import_convert_from_display_unit(fmi1_real_t value, fmi1_import_display_unit_t* du, int isRelativeQuantity);
99 /** @} */
100 #ifdef __cplusplus
101 }
102 #endif
103 #endif