.BusinessSimulation.Functions.stringToTimeBase

Information

This information is part of the Business Simulation Library (BSL). Please support this work and ► donate.

The function will return the element of the enumeration Types.TimeBases that corresponds to a given unit of time given as a string. The string should be given in lower case letters and should be given either as a word or the unit symbol. If there is no match, the function will default to TimeBases.second.

Syntax


Functions.stringToTimeBase( timeBaseString );   // the string is to be given as lower case

Examples


stringToTimeBase( "month" );   // TimesBases.months
stringToTimeBase( "yrCal" ); // TimeBases.years

Interface

function stringToTimeBase
  extends BusinessSimulation.Icons.Function;
  import BusinessSimulation.Types.TimeBases;
  import Modelica.Utilities.Strings.isEqual;
  input String timeBaseString "String for a time base given in lower case";
  output TimeBases timeBase "Element in the enumeration corresponding to the string given";
end stringToTimeBase;

Revisions


Generated at 2024-11-20T19:25:51Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos