packageFilesUtilities

File input/output/test

Extends from Types.Utilities (Value input/output/test support), Modelica.Icons.VariantsPackage (Icon for package containing variants).

Information

During the creation and debugging of huge integrated models it is necessary to easily define consistent input, output and test sets of all output variables for some subsystems. Let's imagine that we have a model composed only of subsystems that converge from some constant inputs to constant outputs. It should be possible to substitute each main subsystem for its chosen constant output values as parameters. Comparing the model with these parametric values and the original subsystem can show the wrong part of the simulation.

For example in the huge HumMod model it is necessary to debug smaller parts separately. These tools could be use, because HumMod is the type of constant-converged model. Each subsystem in the first level has the constant input values set for its output variables. Simulating, for example, the cardiovascular subsystem is possible by creating the high-level system with the original cardiovascular subsystem, but with a constant metabolic, constant thermoregulation, constant hormonal, constant water, constant proteins, constant gases, constant electrolytes and constant status subsystem.

Because the number of output variables for each subsytem changes during development, it is a good idea to have only one list for each subsystem. And generating consistent sets to store, restore, compare initial and final values is possible by the same pattern as presented in the package Types.Example. In this package it is also possible to define a customized  way to save and load the variables that connect subsystems together. For this purpose, one has to redeclare the package Types.Utilities with simple functions for reading and writing values, such as is done in the default package FileUtilities.

Parameters

TypeNameDefaultDescription
StringdirectoryName"io"
StringinputFileName"input.txt"File to load values with (non-)SI units
StringoutputFileName"output.txt"File to save values with (non-)SI units
StringcomparisonFileName"comparison.txt"File to save comparison from loaded values and simulation results with (non-)SI units
StringinputSIFileName"input_SI.txt"File to load values in SI units
StringoutputSIFileName"output_SI.txt"File to save values in SI units
StringcomparisonSIFileName"comparison_SI.txt"File to save comparison in SI units from loaded values and simulation results

Contents

NameDescription
readReal
readReal_SI
readBoolean
writeRealWrite the value to file
writeReal_SIWrite the value to file using SI unit
writeBoolean
writeComparisonCompare and write the result and the value to file
writeComparison_SICompare and write the result and the value to file using SI units
writeBooleanComparisonCompare and write the result and the value to file

Revisions

Licensed by Marek Matejak under the Modelica License 2

Copyright © 2008-2013, Marek Matejak, Charles University in Prague.


This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see UsersGuide.ModelicaLicense2 or visit http://www.modelica.org/licenses/ModelicaLicense2.