forked from modelica/Reference-FMUs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FMISolver.h
47 lines (36 loc) · 1.76 KB
/
FMISolver.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
#pragma once
#include <stddef.h>
#include <stdbool.h>
typedef struct FMISolverImpl FMISolver;
typedef enum {
FMISolverOK,
FMISolverError
} FMISolverStatus;
typedef int (*FMISolverSetTime)(void* modelInstance, double time);
typedef int (*FMISolverApplyInput)(void* modelInstance, const void* input, double time, bool discrete, bool continuous, bool afterEvent);
typedef int (*FMISolverGetContinuousStates)(void* modelInstance, double x[], size_t nx);
typedef int (*FMISolverSetContinuousStates)(void* modelInstance, const double x[], size_t nx);
typedef int (*FMISolverGetNominalsOfContinuousStates)(void* modelInstance, double nominals[], size_t nx);
typedef int (*FMISolverGetContinuousStateDerivatives)(void* modelInstance, double dx[], size_t nx);
typedef int (*FMISolverGetEventIndicators)(void* modelInstance, double z[], size_t nz);
typedef void (*FMISolverLogError)(const char* message);
typedef struct {
void* modelInstance;
const void* input;
double startTime;
double tolerance;
size_t nx;
size_t nz;
FMISolverSetTime setTime;
FMISolverApplyInput applyInput;
FMISolverGetContinuousStates getContinuousStates;
FMISolverSetContinuousStates setContinuousStates;
FMISolverGetNominalsOfContinuousStates getNominalsOfContinuousStates;
FMISolverGetContinuousStateDerivatives getContinuousStateDerivatives;
FMISolverGetEventIndicators getEventIndicators;
FMISolverLogError logError;
} FMISolverParameters;
typedef FMISolver* (*SolverCreate)(const FMISolverParameters* solverFunctions);
typedef void (*SolverFree)(FMISolver* solver);
typedef FMISolverStatus (*SolverStep)(FMISolver* solver, double nextTime, double* timeReached, bool* stateEvent);
typedef FMISolverStatus (*SolverReset)(FMISolver* solver, double time);