]> gerrit.simantics Code Review - simantics/fmil.git/blob - org.simantics.fmil.core/native/FMILibrary/src/XML/include/FMI2/fmi2_xml_unit.h
1ef62b2bcbb26c9503057db9323505cbdb2c4dd2
[simantics/fmil.git] / org.simantics.fmil.core / native / FMILibrary / src / XML / include / FMI2 / fmi2_xml_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 fmi2_xml_unit.h
17 *  \brief Public interface to the FMI XML C-library. Handling of variable units.
18 */
19
20 #ifndef FMI2_XML_UNIT_H_
21 #define FMI2_XML_UNIT_H_
22
23 #include "fmi2_xml_model_description.h"
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28                 
29         /**
30         \addtogroup fmi2_xml
31         @{
32         \addtogroup fmi2_xml_units Functions for handling unit definitions.
33         @}
34         \addtogroup fmi2_xml_units Functions for handling unit definitions.
35         @{
36         */
37
38 /** \brief Get a list of all the unit definitions */
39 fmi2_xml_unit_definitions_t* fmi2_xml_get_unit_definitions(fmi2_xml_model_description_t* md);
40 unsigned int  fmi2_xml_get_unit_definitions_number(fmi2_xml_unit_definitions_t*);
41 fmi2_xml_unit_t* fmi2_xml_get_unit(fmi2_xml_unit_definitions_t*, unsigned int  index);
42
43 const char* fmi2_xml_get_unit_name(fmi2_xml_unit_t*);
44 unsigned int fmi2_xml_get_unit_display_unit_number(fmi2_xml_unit_t*);
45 fmi2_xml_display_unit_t* fmi2_xml_get_unit_display_unit(fmi2_xml_unit_t*, size_t index);
46
47 /**
48         \brief Get fmi2_SI_base_units_Num SI base units exponents associated with the unit.
49 */
50 const int* fmi2_xml_get_SI_unit_exponents(fmi2_xml_unit_t*);
51
52 /**
53         \brief Get factor to the corresponding SI base units.
54 */
55 double fmi2_xml_get_SI_unit_factor(fmi2_xml_unit_t*);
56
57 /**
58         \brief Get offset to the corresponding SI base units.
59 */
60 double fmi2_xml_get_SI_unit_offset(fmi2_xml_unit_t*);
61
62 /**
63         \brief Convert a value with respect to the unit to the
64         value with respect to the SI base unit.
65 */
66 double fmi2_xml_convert_to_SI_base_unit(double, fmi2_xml_unit_t*);
67
68 /**
69         \brief Convert a value with respect to the SI base unit to the
70         value with respect to the unit.
71 */
72 double fmi2_xml_convert_from_SI_base_unit(double, fmi2_xml_unit_t*);
73
74 fmi2_xml_display_unit_t* fmi2_xml_get_type_display_unit(fmi2_xml_real_typedef_t*);
75 fmi2_xml_unit_t* fmi2_xml_get_base_unit(fmi2_xml_display_unit_t*);
76 const char* fmi2_xml_get_display_unit_name(fmi2_xml_display_unit_t*);
77 double fmi2_xml_get_display_unit_factor(fmi2_xml_display_unit_t*);
78 double fmi2_xml_get_display_unit_offset(fmi2_xml_display_unit_t*);
79
80 double fmi2_xml_convert_to_display_unit(double, fmi2_xml_display_unit_t*, int isRelativeQuantity);
81 double fmi2_xml_convert_from_display_unit(double, fmi2_xml_display_unit_t*, int isRelativeQuantity);
82 /**
83 @}
84 */
85 #ifdef __cplusplus
86 }
87 #endif
88 #endif