Linux GNU 11.4.0 Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 0.0% 0 / 0 / 23
Functions: 0.0% 0 / 0 / 5
Branches: 0.0% 0 / 0 / 6

OMCompiler/SimulationRuntime/c/simulation/solver/dae_mode.c
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 #include "../arrayIndex.h"
29
30 #include "dae_mode.h"
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 /* EVAL_DYNAMIC = 1000 */
37 const int EVAL_DYNAMIC = 1;
38 /* EVAL_ALGEBRAIC = 0100 */
39 const int EVAL_ALGEBRAIC = 2;
40 /* EVAL_ZEROCROSS = 0010 */
41 const int EVAL_ZEROCROSS = 4;
42 /* EVAL_DISCRETE = 0001 */
43 const int EVAL_DISCRETE = 8;
44 /* EVAL_ALL = 1111 */
45 const int EVAL_ALL = 15;
46
47
48 /*! \fn void evaluateDAEResiduals_wrapperEventUpdate
49 *
50 * wrapper function of the main evaluation function for DAE mode
51 */
52 ✗ int evaluateDAEResiduals_wrapperEventUpdate(DATA* data, threadData_t* threadData)
53 {
54 int retVal;
55
56 ✗ data->simulationInfo->discreteCall = 1;
57 ✗ retVal = data->simulationInfo->daeModeData->evaluateDAEResiduals(data, threadData, EVAL_DISCRETE);
58 ✗ data->simulationInfo->discreteCall = 0;
59
60 ✗ return retVal;
61 }
62
63 /*! \fn void evaluateDAEResiduals_wrapperZeroCrossingsEquations
64 *
65 * wrapper function of the ZeroCrossing function for DAE mode
66 */
67 ✗ int evaluateDAEResiduals_wrapperZeroCrossingsEquations(DATA* data, threadData_t* threadData)
68 {
69 int retVal;
70 ✗ retVal = data->simulationInfo->daeModeData->evaluateDAEResiduals(data, threadData, EVAL_ZEROCROSS);
71
72 ✗ return retVal;
73 }
74
75 /*! \fn void getAlgebraicDAEVarNominals
76 *
77 * collects DAE mode algebraic nominal values from modelData
78 */
79 ✗ void getAlgebraicDAEVarNominals(DATA* data, double *algebraicNominals)
80 {
81 int i;
82
83 ✗ DAEMODE_DATA* daeModeData = data->simulationInfo->daeModeData;
84 ✗ for(i=0; i < daeModeData->nAlgebraicDAEVars; i++){
85 ✗ algebraicNominals[i] = getNominalFromScalarIdx(data->simulationInfo, data->modelData, VAR_KIND_VARIABLE, daeModeData->algIndexes[i]);
86 }
87 ✗ }
88
89 /*! \fn getAlgebraicVars
90 *
91 * function obtains algebraic variable values for DAEmode
92 */
93 ✗ void getAlgebraicDAEVars(DATA *data, double* algebraic)
94 {
95 int i;
96 ✗ DAEMODE_DATA* daeModeData = data->simulationInfo->daeModeData;
97 ✗ for(i=0; i < daeModeData->nAlgebraicDAEVars; i++){
98 ✗ algebraic[i] = data->localData[0]->realVars[daeModeData->algIndexes[i]];
99 }
100 ✗ }
101
102 /*! \fn setAlgebraicVars
103 *
104 * function set algebraic variable values for DAEmode
105 */
106 ✗ void setAlgebraicDAEVars(DATA *data, double* algebraic)
107 {
108 int i;
109 ✗ DAEMODE_DATA* daeModeData = data->simulationInfo->daeModeData;
110 ✗ for(i=0; i < daeModeData->nAlgebraicDAEVars; i++){
111 ✗ data->localData[0]->realVars[daeModeData->algIndexes[i]] = algebraic[i];
112 }
113 ✗ }
114
115 #ifdef __cplusplus
116 }
117 #endif
118