Linux GNU 11.4.0 Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 81.7% 103 / 0 / 126
Functions: 77.8% 35 / 0 / 45
Branches: 47.1% 8 / 0 / 17

OMCompiler/SimulationRuntime/cpp/Core/SimulationSettings/GlobalSettings.cpp
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 /** @addtogroup coreSimulationSettings
29 *
30 * @{
31 */
32
33 #include <Core/ModelicaDefine.h>
34 #include <Core/Modelica.h>
35 //#define BOOST_EXTENSION_GLOBALSETTINGS_DECL BOOST_EXTENSION_EXPORT_DECL
36 #include <Core/SimulationSettings/GlobalSettings.h>
37
38 40 GlobalSettings::GlobalSettings()
39 40 : _startTime(0.0)
40 40 , _endTime(1.0)
41 40 , _hOutput(0.002)
42 40 , _tolerance(1e-6)
43 40 , _emitResults(EMIT_ALL)
44 80 , _variableFilter(".*")
45 40 , _infoOutput(true)
46
1/3
✓ Branch 1 taken 40 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
40 , _selected_solver("euler")
47
1/3
✓ Branch 1 taken 40 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
40 , _selected_lin_solver("dgesvSolver")
48
1/3
✓ Branch 1 taken 40 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
40 , _selected_nonlin_solver("kinsol")
49
2/4
✓ Branch 1 taken 40 times.
✓ Branch 4 taken 40 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
40 , _resultsfile_name("results.csv")
50 40 , _endless_sim(false)
51
1/1
✓ Branch 1 taken 40 times.
40 , _nonLinSolverContinueOnError(false)
52 40 , _outputPointType(OPT_ALL)
53 40 , _alarm_time(0)
54
1/1
✓ Branch 2 taken 40 times.
80 , _outputFormat(MAT)
55 {
56 40 }
57
58
1/2
✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
80 GlobalSettings::~GlobalSettings()
59 {
60 80 }
61
62 ///< Start time of integration (default: 0.0)
63 120 double GlobalSettings::getStartTime()
64 {
65 120 return _startTime;
66 }
67
68 40 void GlobalSettings::setStartTime(double time)
69 {
70 40 _startTime = time;
71 40 }
72
73 ///< End time of integraiton (default: 1.0)
74 121 double GlobalSettings::getEndTime()
75 {
76 121 return _endTime;
77 }
78
79 40 void GlobalSettings::setEndTime(double time)
80 {
81 40 _endTime = time;
82 40 }
83
84 ///< Output step size (default: 20 ms)
85 65318 double GlobalSettings::gethOutput()
86 {
87 65318 return _hOutput;
88 }
89
90 40 void GlobalSettings::sethOutput(double h)
91 {
92 40 _hOutput = h;
93 40 }
94
95 40 void GlobalSettings::setTolerance(double value)
96 {
97 40 _tolerance = value;
98 40 }
99
100 50 double GlobalSettings::getTolerance()
101 {
102 50 return _tolerance;
103 }
104
105 112 bool GlobalSettings::useEndlessSim()
106 {
107 112 return _endless_sim ;
108 }
109
110 ✗ void GlobalSettings::useEndlessSim(bool endles)
111 {
112 ✗ _endless_sim = endles;
113 ✗ }
114
115 351771 OutputPointType GlobalSettings::getOutputPointType()
116 {
117 351771 return _outputPointType;
118 }
119
120 40 void GlobalSettings::setOutputPointType(OutputPointType type)
121 {
122 40 _outputPointType = type;
123 40 }
124
125 ✗ LogSettings GlobalSettings::getLogSettings()
126 {
127 ✗ return _log_settings;
128 }
129
130 40 void GlobalSettings::setLogSettings(LogSettings set)
131 {
132 _log_settings = set;
133 40 }
134
135 ///< Write out results (default: EMIT_ALL)
136 40 EmitResults GlobalSettings::getEmitResults()
137 {
138 40 return _emitResults;
139 }
140
141 40 void GlobalSettings::setEmitResults(EmitResults emitResults)
142 {
143 40 _emitResults = emitResults;
144 40 }
145
146 40 const string& GlobalSettings::getVariableFilter()
147 {
148 40 return _variableFilter;
149 }
150
151 40 void GlobalSettings::setVariableFilter(const string& variableFilter)
152 {
153 40 _variableFilter = variableFilter;
154 40 }
155
156 40 void GlobalSettings::setResultsFileName(string name)
157 {
158 40 _resultsfile_name = name;
159 40 }
160
161 80 string GlobalSettings::getResultsFileName()
162 {
163 80 return _resultsfile_name;
164 }
165
166 ///< Write out statistical simulation infos, e.g. number of steps (at the end of simulation); [false,true]; default: true)
167 ✗ bool GlobalSettings::getInfoOutput()
168 {
169 ✗ return _infoOutput;
170 }
171
172 ✗ void GlobalSettings::setInfoOutput(bool output)
173 {
174 ✗ _infoOutput = output;
175 ✗ }
176
177 ✗ string GlobalSettings::getOutputPath()
178 {
179 ✗ return _output_path ;
180 }
181
182 40 void GlobalSettings::setOutputPath(string path)
183 {
184 40 _output_path = path;
185 40 }
186
187 40 string GlobalSettings::getInputPath()
188 {
189 40 return _input_path;
190 }
191
192 40 void GlobalSettings::setInputPath(string path)
193 {
194 40 _input_path = path;
195 40 }
196
197 80 string GlobalSettings::getSelectedSolver()
198 {
199 80 return _selected_solver;
200 }
201
202 40 void GlobalSettings::setSelectedSolver(string solver)
203 {
204 40 _selected_solver = solver;
205 40 }
206
207 68 string GlobalSettings::getSelectedLinSolver()
208 {
209 68 return _selected_lin_solver;
210 }
211
212 40 void GlobalSettings::setSelectedLinSolver(string solver)
213 {
214 40 _selected_lin_solver = solver;
215 40 }
216
217 50 string GlobalSettings::getSelectedNonLinSolver()
218 {
219 50 return _selected_nonlin_solver;
220 }
221
222 40 void GlobalSettings::setSelectedNonLinSolver(string solver)
223 {
224 40 _selected_nonlin_solver = solver;
225 40 }
226
227 /**
228 initializes settings object by an xml file
229 */
230 ✗ void GlobalSettings::load(std::string xml_file)
231 {
232 ✗ }
233
234 ✗ void GlobalSettings::setRuntimeLibrarypath(string path)
235 {
236 ✗ _runtimeLibraryPath = path;
237 ✗ }
238
239 ✗ string GlobalSettings::getRuntimeLibrarypath()
240 {
241 ✗ return _runtimeLibraryPath;
242 }
243
244 40 void GlobalSettings::setAlarmTime(unsigned int t)
245 {
246 40 _alarm_time = t;
247 40 }
248 ✗ unsigned int GlobalSettings::getAlarmTime()
249 {
250 ✗ return _alarm_time;
251 }
252
253 40 void GlobalSettings::setNonLinearSolverContinueOnError(bool value)
254 {
255 40 _nonLinSolverContinueOnError = value;
256 40 }
257
258 50 bool GlobalSettings::getNonLinearSolverContinueOnError()
259 {
260 50 return _nonLinSolverContinueOnError;
261 }
262
263 40 void GlobalSettings::setSolverThreads(int val)
264 {
265 40 _solverThreads = val;
266 40 }
267
268 ✗ int GlobalSettings::getSolverThreads()
269 {
270 ✗ return _solverThreads;
271 }
272
273 82 OutputFormat GlobalSettings::getOutputFormat()
274 {
275 82 return _outputFormat;
276 }
277 40 void GlobalSettings::setOutputFormat(OutputFormat outputFormat)
278 {
279 40 _outputFormat = outputFormat;
280 40 }
281 /** @} */ // end of coreSimulationSettings
282