functionreadStringParameter

Read the value of a String parameter from file

Extends from Modelica.Icons.Function (Icon for functions).

Information

Hypothesis and equations

Syntax :

result = readStringParameter(fileName, name);

This function demonstrates how a function can be implemented that reads the value of a String parameter from file. The function performs the following actions:

  1. It opens file "fileName" and reads the lines of the file.
  2. When the name of the parameter is found, the whole String after "=" is returned.

Bibliography

none

Instructions for use

On file "test.txt" the following lines might be present:

// Building data

S=100
G=3
V=250
Meteo=trappes.txt

The function returns the value "trappes.txt" when called as:

readRealParameter("test.txt", "Meteo")

Known limits / Use precautions

Be careful, each character after "=" will be returned, included space characters at the beginning.

Validations

Model validated - Hassan Bouia 09/2015

--------------------------------------------------------------
Licensed by EDF under a 3-clause BSD-license
Copyright © EDF 2009 - 2023
BuildSysPro version 3.6.0
Author : Hassan BOUIA, EDF (2015)
--------------------------------------------------------------

Inputs

TypeNameDefaultDescription
StringfileNameName of file
StringnameName of parameter

Outputs

TypeNameDefaultDescription
StringresultActual value of parameter on file