2 Copyright (C) 2012 Modelon AB
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the BSD style license.
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.
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>.
16 /** \file fmi2_xml_unit.h
17 * \brief Public interface to the FMI XML C-library. Handling of variable units.
20 #ifndef FMI2_XML_UNIT_H_
21 #define FMI2_XML_UNIT_H_
23 #include "fmi2_xml_model_description.h"
32 \addtogroup fmi2_xml_units Functions for handling unit definitions.
34 \addtogroup fmi2_xml_units Functions for handling unit definitions.
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);
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);
48 \brief Get fmi2_SI_base_units_Num SI base units exponents associated with the unit.
50 const int* fmi2_xml_get_SI_unit_exponents(fmi2_xml_unit_t*);
53 \brief Get factor to the corresponding SI base units.
55 double fmi2_xml_get_SI_unit_factor(fmi2_xml_unit_t*);
58 \brief Get offset to the corresponding SI base units.
60 double fmi2_xml_get_SI_unit_offset(fmi2_xml_unit_t*);
63 \brief Convert a value with respect to the unit to the
64 value with respect to the SI base unit.
66 double fmi2_xml_convert_to_SI_base_unit(double, fmi2_xml_unit_t*);
69 \brief Convert a value with respect to the SI base unit to the
70 value with respect to the unit.
72 double fmi2_xml_convert_from_SI_base_unit(double, fmi2_xml_unit_t*);
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*);
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);