X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.fmil.core%2Fnative%2FFMILibrary%2Fsrc%2FXML%2Finclude%2FFMI2%2Ffmi2_xml_unit.h;fp=org.simantics.fmil.core%2Fnative%2FFMILibrary%2Fsrc%2FXML%2Finclude%2FFMI2%2Ffmi2_xml_unit.h;h=1ef62b2bcbb26c9503057db9323505cbdb2c4dd2;hb=4bed8078f3f6d15b8539d7357b8815f8bfeec2c4;hp=0000000000000000000000000000000000000000;hpb=87cc423aefd98832c6c8d0979afc21551f8ceca3;p=simantics%2Ffmil.git diff --git a/org.simantics.fmil.core/native/FMILibrary/src/XML/include/FMI2/fmi2_xml_unit.h b/org.simantics.fmil.core/native/FMILibrary/src/XML/include/FMI2/fmi2_xml_unit.h new file mode 100644 index 0000000..1ef62b2 --- /dev/null +++ b/org.simantics.fmil.core/native/FMILibrary/src/XML/include/FMI2/fmi2_xml_unit.h @@ -0,0 +1,88 @@ +/* + Copyright (C) 2012 Modelon AB + + This program is free software: you can redistribute it and/or modify + it under the terms of the BSD style license. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + FMILIB_License.txt file for more details. + + You should have received a copy of the FMILIB_License.txt file + along with this program. If not, contact Modelon AB . +*/ + +/** \file fmi2_xml_unit.h +* \brief Public interface to the FMI XML C-library. Handling of variable units. +*/ + +#ifndef FMI2_XML_UNIT_H_ +#define FMI2_XML_UNIT_H_ + +#include "fmi2_xml_model_description.h" + +#ifdef __cplusplus +extern "C" { +#endif + + /** + \addtogroup fmi2_xml + @{ + \addtogroup fmi2_xml_units Functions for handling unit definitions. + @} + \addtogroup fmi2_xml_units Functions for handling unit definitions. + @{ + */ + +/** \brief Get a list of all the unit definitions */ +fmi2_xml_unit_definitions_t* fmi2_xml_get_unit_definitions(fmi2_xml_model_description_t* md); +unsigned int fmi2_xml_get_unit_definitions_number(fmi2_xml_unit_definitions_t*); +fmi2_xml_unit_t* fmi2_xml_get_unit(fmi2_xml_unit_definitions_t*, unsigned int index); + +const char* fmi2_xml_get_unit_name(fmi2_xml_unit_t*); +unsigned int fmi2_xml_get_unit_display_unit_number(fmi2_xml_unit_t*); +fmi2_xml_display_unit_t* fmi2_xml_get_unit_display_unit(fmi2_xml_unit_t*, size_t index); + +/** + \brief Get fmi2_SI_base_units_Num SI base units exponents associated with the unit. +*/ +const int* fmi2_xml_get_SI_unit_exponents(fmi2_xml_unit_t*); + +/** + \brief Get factor to the corresponding SI base units. +*/ +double fmi2_xml_get_SI_unit_factor(fmi2_xml_unit_t*); + +/** + \brief Get offset to the corresponding SI base units. +*/ +double fmi2_xml_get_SI_unit_offset(fmi2_xml_unit_t*); + +/** + \brief Convert a value with respect to the unit to the + value with respect to the SI base unit. +*/ +double fmi2_xml_convert_to_SI_base_unit(double, fmi2_xml_unit_t*); + +/** + \brief Convert a value with respect to the SI base unit to the + value with respect to the unit. +*/ +double fmi2_xml_convert_from_SI_base_unit(double, fmi2_xml_unit_t*); + +fmi2_xml_display_unit_t* fmi2_xml_get_type_display_unit(fmi2_xml_real_typedef_t*); +fmi2_xml_unit_t* fmi2_xml_get_base_unit(fmi2_xml_display_unit_t*); +const char* fmi2_xml_get_display_unit_name(fmi2_xml_display_unit_t*); +double fmi2_xml_get_display_unit_factor(fmi2_xml_display_unit_t*); +double fmi2_xml_get_display_unit_offset(fmi2_xml_display_unit_t*); + +double fmi2_xml_convert_to_display_unit(double, fmi2_xml_display_unit_t*, int isRelativeQuantity); +double fmi2_xml_convert_from_display_unit(double, fmi2_xml_display_unit_t*, int isRelativeQuantity); +/** +@} +*/ +#ifdef __cplusplus +} +#endif +#endif