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.dev/sumo
3 // Copyright (C) 2020-2024 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 /****************************************************************************/
19 // Declarations for the logic and data strcutures for the SUMO to FMI bridge
20 /****************************************************************************/
21 
22 #ifndef SUMO2FMI_BRIDGE_H
23 #define SUMO2FMI_BRIDGE_H
24 
25 #include <stdio.h>
26 #include <stdbool.h>
27 #include <stdarg.h>
30 
31 /* Type definitions for callback functions */
32 typedef void* (*allocateMemoryType)(size_t nobj, size_t size);
33 typedef void (*loggerType)(void* componentEnvironment, const char* instanceName, int status, const char* category, const char* message, ...);
34 typedef void (*freeMemoryType)(void* obj);
35 
36 /* Several declarations for the model component (housekeeping stuff) */
37 typedef struct {
39  const char* instanceName;
40  const char* resourceLocation;
41 
45 
46  double startTime;
47  double stopTime;
48 
50 
57 
58  /* Buffer for string value array used in fmi2GetString(). */
61 
62  bool logEvents;
63  bool logErrors;
65 
66 /* Declarations of utility functions */
67 void sumo2fmi_logEvent(ModelInstance* comp, const char* message, ...);
68 void sumo2fmi_logError(ModelInstance* comp, const char* message, ...);
69 void sumo2fmi_logMessage(ModelInstance* comp, int status, const char* category, const char* message, va_list args);
70 
71 /* Getter/Setter Functions */
75 
76 /* Stepping Functions */
77 fmi2Status sumo2fmi_step(ModelInstance* comp, double tNext);
78 
79 /* Setting the start values for all parameters */
81 
82 #endif /* SUMO2FMI_BRIDGE_H */
fmi2Status
unsigned int fmi2ValueReference
const fmi2Char * fmi2String
void * componentEnvironment
char * getterParameters
Parameters stored for the next (libsumo) getter call. Workaround for FMIv2 not allowing input values ...
const char * resourceLocation
fmi2String * bufferArray
allocateMemoryType allocateMemory
const char * instanceName
freeMemoryType freeMemory
loggerType logger
char * libsumoCallOptions
void *(* allocateMemoryType)(size_t nobj, size_t size)
fmi2Status sumo2fmi_getString(ModelInstance *comp, const fmi2ValueReference vr, fmi2String *value)
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,...)
fmi2Status sumo2fmi_setString(ModelInstance *comp, fmi2ValueReference vr, fmi2String value)
void sumo2fmi_logMessage(ModelInstance *comp, int status, const char *category, const char *message, va_list args)
void sumo2fmi_logEvent(ModelInstance *comp, const char *message,...)