Eclipse SUMO - Simulation of Urban MObility
sumo2fmi_bridge.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2020-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // Declarations for the logic and data strcutures for the SUMO to FMI bridge
19 /****************************************************************************/
20 
21 #ifndef SUMO2FMI_BRIDGE_H
22 #define SUMO2FMI_BRIDGE_H
23 
24 #include <stdio.h>
25 #include <stdbool.h>
26 #include <stdarg.h>
27 
28 /* Type definitions for callback functions */
29 typedef void* (*allocateMemoryType)(size_t nobj, size_t size);
30 typedef void (*loggerType)(void* componentEnvironment, const char* instanceName, int status, const char* category, const char* message, ...);
31 typedef void (*freeMemoryType)(void* obj);
32 
33 /* Several declarations for the model component (housekeeping stuff) */
34 typedef struct {
36  const char* instanceName;
37  const char* resourceLocation;
38 
42 
43  double startTime;
44  double stopTime;
45 
47 
48  bool logEvents;
49  bool logErrors;
51 
52 /* Declarations of utility functions */
53 void sumo2fmi_logError(ModelInstance* comp, const char* message, ...);
54 void sumo2fmi_logMessage(ModelInstance* comp, int status, const char* category, const char* message, va_list args);
55 
56 /* Getter/Setter Functions */
58 fmi2Status sumo2fmi_getString(ModelInstance* comp, const fmi2ValueReference vr, const char* value);
60 
61 /* Stepping Functions */
62 fmi2Status sumo2fmi_step(ModelInstance* comp, double tNext);
63 
64 /* Setting the start values for all parameters */
66 
67 #endif /* SUMO2FMI_BRIDGE_H */
fmi2Status
unsigned int fmi2ValueReference
void * componentEnvironment
const char * resourceLocation
allocateMemoryType allocateMemory
const char * instanceName
freeMemoryType freeMemory
loggerType logger
char * libsumoCallOptions
void *(* allocateMemoryType)(size_t nobj, size_t size)
void sumo2fmi_set_startValues(ModelInstance *comp)
fmi2Status sumo2fmi_step(ModelInstance *comp, double tNext)
void(* freeMemoryType)(void *obj)
fmi2Status sumo2fmi_getInteger(ModelInstance *comp, const fmi2ValueReference vr, int *value)
void sumo2fmi_logError(ModelInstance *comp, const char *message,...)
void(* loggerType)(void *componentEnvironment, const char *instanceName, int status, const char *category, const char *message,...)
void sumo2fmi_logMessage(ModelInstance *comp, int status, const char *category, const char *message, va_list args)
fmi2Status sumo2fmi_setString(ModelInstance *comp, fmi2ValueReference vr, const char *value)
fmi2Status sumo2fmi_getString(ModelInstance *comp, const fmi2ValueReference vr, const char *value)