-
Notifications
You must be signed in to change notification settings - Fork 296
/
solver_main.h
108 lines (88 loc) · 3.41 KB
/
solver_main.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC),
* c/o Linköpings universitet, Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE BSD NEW LICENSE OR THE
* GPL VERSION 3 LICENSE OR THE OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2.
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
* RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3,
* ACCORDING TO RECIPIENTS CHOICE.
*
* The OpenModelica software and the OSMC (Open Source Modelica Consortium)
* Public License (OSMC-PL) are obtained from OSMC, either from the above
* address, from the URLs: http://www.openmodelica.org or
* http://www.ida.liu.se/projects/OpenModelica, and in the OpenModelica
* distribution. GNU version 3 is obtained from:
* http://www.gnu.org/copyleft/gpl.html. The New BSD License is obtained from:
* http://www.opensource.org/licenses/BSD-3-Clause.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS
* EXPRESSLY SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE
* CONDITIONS OF OSMC-PL.
*
*/
/*! \file solver_main.h
*
* Description: This file is a C header file for the main solver function.
* It contains integration method for simulation.
*/
#ifndef OMC_SOLVER_MAIN_H
#define OMC_SOLVER_MAIN_H
#include "../../openmodelica.h"
#include "../../simulation_data.h"
#include "../../util/list.h"
#include "../../util/simulation_options.h"
static const unsigned int numStatistics = 5;
typedef struct SOLVER_INFO
{
double currentTime;
double currentStepSize;
double laststep;
enum SOLVER_METHOD solverMethod;
double solverStepSize; /* used by implicit radau solver */
/* set by solver if an internal root finding method is activated */
modelica_boolean solverRootFinding;
/* set by solver if output points are set by step size control */
modelica_boolean solverNoEquidistantGrid;
double lastdesiredStep;
/* events */
LIST* eventLst;
int didEventStep;
/* radau_new
void* userdata;
*/
/* stats */
unsigned long stateEvents;
unsigned long sampleEvents;
/* integrator stats */
unsigned int* solverStats;
unsigned int* solverStatsTmp;
/* further options */
int integratorSteps;
void* solverData;
}SOLVER_INFO;
#ifdef __cplusplus
extern "C" {
#endif
extern int solver_main(DATA* data, threadData_t *threadData, const char* init_initMethod,
const char* init_file, double init_time,
int solverID, const char* outputVariablesAtEnd, const char *argv_0);
/* Provide solver interface to interactive stuff */
extern int initializeSolverData(DATA* data, threadData_t *threadData, SOLVER_INFO* solverInfo);
extern int freeSolverData(DATA* data, SOLVER_INFO* solverInfo);
extern int initializeModel(DATA* data, threadData_t *threadData, const char* init_initMethod,
const char* init_file, double init_time);
extern int finishSimulation(DATA* data, threadData_t *threadData, SOLVER_INFO* solverInfo, const char* outputVariablesAtEnd);
extern int solver_main_step(DATA* data, threadData_t *threadData, SOLVER_INFO* solverInfo);
void checkTermination(DATA* data);
extern int stateSelection(DATA *data, threadData_t *threadData, char reportError, int switchStates);
#ifdef __cplusplus
}
#endif
#endif