OMCompiler/SimulationRuntime/cpp/Core/SimulationSettings/IGlobalSettings.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * This file belongs to the OpenModelica Run-Time System | ||
| 3 | * | ||
| 4 | * Copyright (c) 1998-2026, Open Source Modelica Consortium (OSMC), c/o Linköpings | ||
| 5 | * universitet, Department of Computer and Information Science, SE-58183 Linköping, Sweden. All rights | ||
| 6 | * reserved. | ||
| 7 | * | ||
| 8 | * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE BSD NEW LICENSE OR THE | ||
| 9 | * AGPL VERSION 3 LICENSE OR THE OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8. ANY | ||
| 10 | * USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S | ||
| 11 | * ACCEPTANCE OF THE BSD NEW LICENSE OR THE OSMC PUBLIC LICENSE OR THE AGPL | ||
| 12 | * VERSION 3, ACCORDING TO RECIPIENTS CHOICE. | ||
| 13 | * | ||
| 14 | * The OpenModelica software and the OSMC (Open Source Modelica Consortium) Public License | ||
| 15 | * (OSMC-PL) are obtained from OSMC, either from the above address, from the URLs: | ||
| 16 | * http://www.openmodelica.org or https://github.com/OpenModelica/ or | ||
| 17 | * http://www.ida.liu.se/projects/OpenModelica, and in the OpenModelica distribution. GNU | ||
| 18 | * AGPL version 3 is obtained from: https://www.gnu.org/licenses/licenses.html#GPL. The BSD NEW | ||
| 19 | * License is obtained from: http://www.opensource.org/licenses/BSD-3-Clause. | ||
| 20 | * | ||
| 21 | * This program is distributed WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY | ||
| 23 | * SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF | ||
| 24 | * OSMC-PL. | ||
| 25 | * | ||
| 26 | */ | ||
| 27 | |||
| 28 | #pragma once | ||
| 29 | /** @addtogroup coreSimulationSettings | ||
| 30 | * | ||
| 31 | * @{ | ||
| 32 | */ | ||
| 33 | |||
| 34 | /*****************************************************************************/ | ||
| 35 | /** | ||
| 36 | |||
| 37 | Encapsulation of global simulation settings. | ||
| 38 | |||
| 39 | \date October, 1st, 2008 | ||
| 40 | \author | ||
| 41 | |||
| 42 | */ | ||
| 43 | |||
| 44 | /*includes removed for static linking not needed any more | ||
| 45 | #ifdef RUNTIME_STATIC_LINKING | ||
| 46 | #include <string.h> | ||
| 47 | using std::string; | ||
| 48 | #endif | ||
| 49 | */ | ||
| 50 | |||
| 51 | #include <vector> | ||
| 52 | |||
| 53 | enum LogCategory {LC_INIT = 0, LC_NLS = 1, LC_LS = 2, LC_SOLVER = 3, LC_OUTPUT = 4, LC_EVENTS = 5, LC_OTHER = 6, LC_MODEL = 7}; | ||
| 54 | enum LogLevel {LL_ERROR = 0, LL_WARNING = 1, LL_INFO = 2, LL_DEBUG = 3}; | ||
| 55 | enum LogFormat {LF_TXT = 0, LF_FMI = 1, LF_FMI2 = 2, LF_XML = 3, LF_XMLTCP = 4}; | ||
| 56 | enum OutputPointType {OPT_ALL, OPT_STEP, OPT_NONE}; | ||
| 57 | enum OutputFormat {CSV, MAT, BUFFER, EMPTY}; | ||
| 58 | enum EmitResults {EMIT_ALL, EMIT_HIDDEN, EMIT_PROTECTED, EMIT_PUBLIC, EMIT_NONE}; | ||
| 59 | |||
| 60 |
10/15✓ Branch 1 taken 80 times.
✓ Branch 2 taken 1 time.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 3 taken 40 times.
✓ Branch 4 taken 80 times.
✓ Branch 6 taken 80 times.
✓ Branch 8 taken 40 times.
✓ Branch 10 taken 1 time.
✗ Branch 11 not taken.
✓ Branch 11 taken 40 times.
✓ Branch 12 taken 40 times.
✓ Branch 13 taken 42 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
|
404 | struct LogSettings |
| 61 | { | ||
| 62 | std::vector<LogLevel> modes; | ||
| 63 | LogFormat format; | ||
| 64 | |||
| 65 | 80 | LogSettings(LogFormat fmt = LF_TXT) | |
| 66 | 80 | { | |
| 67 |
1/4✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
80 | modes = std::vector<LogLevel>(8, LL_ERROR); |
| 68 | 80 | format = fmt; | |
| 69 | 80 | } | |
| 70 | |||
| 71 | void setAll(LogLevel l) | ||
| 72 | { | ||
| 73 | ✗ | for (unsigned i = 0; i < modes.size() ; ++i) | |
| 74 | ✗ | modes[i] = l; | |
| 75 | } | ||
| 76 | }; | ||
| 77 | |||
| 78 | class IGlobalSettings | ||
| 79 | { | ||
| 80 | public: | ||
| 81 | virtual ~IGlobalSettings() {} | ||
| 82 | ///< Start time of integration (default: 0.0) | ||
| 83 | virtual double getStartTime() = 0; | ||
| 84 | virtual void setStartTime(double) = 0; | ||
| 85 | ///< End time of integration (default: 1.0) | ||
| 86 | virtual double getEndTime() = 0; | ||
| 87 | virtual void setEndTime(double) = 0; | ||
| 88 | ///< Output step size (default: 20 ms) | ||
| 89 | virtual double gethOutput() = 0; | ||
| 90 | virtual void sethOutput(double) = 0; | ||
| 91 | ///< Allowed tolerance | ||
| 92 | virtual void setTolerance(double) = 0; | ||
| 93 | virtual double getTolerance() = 0; | ||
| 94 | ///< Write out results (default: EMIT_ALL) | ||
| 95 | virtual EmitResults getEmitResults() = 0; | ||
| 96 | virtual void setEmitResults(EmitResults) = 0; | ||
| 97 | ///< Write variables that match a name filter (default: .*) | ||
| 98 | virtual const string& getVariableFilter() = 0; | ||
| 99 | virtual void setVariableFilter(const string&) = 0; | ||
| 100 | virtual OutputPointType getOutputPointType() = 0; | ||
| 101 | virtual void setOutputPointType(OutputPointType) = 0; | ||
| 102 | virtual LogSettings getLogSettings() = 0; | ||
| 103 | virtual void setLogSettings(LogSettings) = 0; | ||
| 104 | virtual void setAlarmTime(unsigned int) = 0; | ||
| 105 | virtual unsigned int getAlarmTime() = 0; | ||
| 106 | |||
| 107 | virtual OutputFormat getOutputFormat() = 0; | ||
| 108 | virtual void setOutputFormat(OutputFormat) = 0; | ||
| 109 | virtual bool useEndlessSim() = 0; | ||
| 110 | virtual void useEndlessSim(bool) = 0; | ||
| 111 | ///< Write out statistical simulation infos, e.g. number of steps (at the end of simulation); [false,true]; default: true) | ||
| 112 | virtual bool getInfoOutput() = 0; | ||
| 113 | virtual void setInfoOutput(bool) = 0; | ||
| 114 | virtual string getOutputPath() = 0; | ||
| 115 | virtual void setOutputPath(string)= 0; | ||
| 116 | virtual string getSelectedSolver() = 0; | ||
| 117 | virtual void setSelectedSolver(string) = 0; | ||
| 118 | virtual string getSelectedLinSolver() = 0; | ||
| 119 | virtual void setSelectedLinSolver(string) = 0; | ||
| 120 | virtual string getSelectedNonLinSolver() = 0; | ||
| 121 | virtual void setSelectedNonLinSolver(string) = 0; | ||
| 122 | virtual void load(std::string xml_file) = 0; | ||
| 123 | virtual void setResultsFileName(string) = 0; | ||
| 124 | virtual string getResultsFileName() = 0; | ||
| 125 | virtual void setRuntimeLibrarypath(string) = 0; | ||
| 126 | virtual string getRuntimeLibrarypath() = 0; | ||
| 127 | ///< Directory for input files, like init.xml | ||
| 128 | virtual string getInputPath() = 0; | ||
| 129 | virtual void setInputPath(string) = 0; | ||
| 130 | |||
| 131 | virtual void setNonLinearSolverContinueOnError(bool) = 0; | ||
| 132 | virtual bool getNonLinearSolverContinueOnError() = 0; | ||
| 133 | |||
| 134 | virtual void setSolverThreads(int) = 0; | ||
| 135 | virtual int getSolverThreads() = 0; | ||
| 136 | }; | ||
| 137 | /** @} */ // end of coreSimulationSettings | ||
| 138 |