BuildingSystems icon indicating copy to clipboard operation
BuildingSystems copied to clipboard

clean up SmoothFunctions

Open thorade opened this issue 9 years ago • 5 comments

We should check the subpackge BS/Utilities/SmoothFunctions. https://github.com/UdK-VPT/BuildingSystems/tree/master/BuildingSystems/Utilities/SmoothFunctions

All functions that are usefull should get a documentation, a corresponding block and a runnable example with reference results. Then they can be added to Annex60/Utilities/Math: https://github.com/iea-annex60/modelica-annex60/tree/master/Annex60/Utilities/Math

All other functions should be deleted or replaced with their MSL or Annex60 equivalent.

thorade avatar Nov 13 '15 14:11 thorade

Statistics for concerend functions:


  • softcut: 16 function calls in 11 files Buildings\Airvolumes\AirvolumeCompressible0D Buildings\Constructions\Windows\RadiationTransmission Climate\SolarRadiationTransformers\SolarRadiationTransformerGeneral Climate\SolarRadiationTransformers\SolarRadiationTransformerIsotropicSky Technologies\Chillers\CompressionChiller Technologies\ElectricalStorages\BatterySimple.mo Technologies\Photovoltaics\BaseClasses\ElectricalModels\ElectricalModelOneDiode Technologies\Photovoltaics\BaseClasses\ElectricalModels\ElectricalModelOneDiodeMPP Technologies\SolarThermal\ThermalCollector Utilities\MoistAirFunctions\T_sat Utilities\NcDataReader2\NcDataReader

  • softcut_lower: 6 function calls in 5 files Buildings\Constructions\Windows\RadiationTransmission Technologies\Chillers\CompressionChiller Technologies\Photovoltaics\BaseClasses\ElectricalModels\ElectricalModelOneDiode Technologies\Photovoltaics\BaseClasses\ElectricalModels\ElectricalModelOneDiodeMPP Technologies\SolarThermal\ThermalCollector

  • softswitch: 12 function calls in 4 files Buildings\Data\AirpathCharacteristics\AirpathCharacteristicWindow HAM\ConvectiveHeatTransfer\Gaps\alphaGap HAM\ConvectiveHeatTransfer\Surfaces\alphaPlateFree Utilities\MoistAirFunctions\enthalpy

  • softcut_upper: 4 function calls in 3 files Climate\SolarRadiationTransformers\SolarRadiationTransformerIsotropicSky Technologies\Chillers\CompressionChiller Technologies\ElectricalStorages\BatterySimple


  • safetanh: 2 function calls in 2 files Utilities\SmoothFunctions\softswitch Utilities\SmoothFunctions\softfabs

  • softfabs: 2 function calls in 2 files Buildings\Airpathes\AirpathPrescribedPressure Buildings\BaseClasses\AirpathGeneral

  • savepow: 2 function calls in 2 files: Buildings\Airpathes\AirpathPrescribedPressure Buildings\BaseClasses\AirpathGeneral

  • softpow: 12 function calls in 1 file HAM\ConvectiveHeatTransfer\Surfaces\alphaPlateFree


    No function calls within the entire library

  • powerLinearized

  • safereciprocal

Note, that safetanh is not used correctly, as it is not called with absolute path.

jmoeckel avatar Nov 16 '15 12:11 jmoeckel

Actually I realized that these statistics are only lower boundaries, as several functions use relative paths.

I especially checked for powerLinearized and safereciprocal and it seems, that these really are not used within the library.

jmoeckel avatar Nov 17 '15 09:11 jmoeckel

@jraedler : Do you still have the old documentation about the SmootFunctions (old SMILE context) and can you send it to @thorade

nytschgeusen avatar Mar 09 '17 11:03 nytschgeusen

https://www.j-raedler.de/2010/10/smooth-transition-between-functions-with-tanh/

thorade avatar Mar 09 '17 12:03 thorade

Here is my opinion on each function (alphabetically):

  • powerLinearized is not used, not documented, and it does not have a test, so I think we should just remove it
  • safepow should be deleted, just use normal power, and where that fails, explicitly use sign(x)
  • safereciprocal is not used and does not have a test, so I think we should remove it
  • safetanh can be replaced by normal tanh
  • softcut_lower and softcut_upper do the same as IBPSA softMin and softMax. We should do testing which one is better (faster, more stable, higher continuity) and then use that function everywhere, and remove the other one.
  • softcut uses softcut_upper or softcut_lower. After fixing the above point, we should possibly rename it, then add a block and example, and move it to IBPSA.
  • softabs: not sure yet
  • softpow: not sure yet
  • softswitch: not sure yet

thorade avatar Nov 16 '17 09:11 thorade