/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2020-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file sumo2fmi_bridge.h14/// @author Robert Hilbrich15/// @author Matthias Schwamborn16/// @date Mon, 24 Aug 202017///18// Declarations for the logic and data strcutures for the SUMO to FMI bridge19/****************************************************************************/2021#ifndef SUMO2FMI_BRIDGE_H22#define SUMO2FMI_BRIDGE_H2324#include <stdio.h>25#include <stdbool.h>26#include <stdarg.h>27#include <foreign/fmi/fmi2FunctionTypes.h>28#include <foreign/fmi/fmi2TypesPlatform.h>2930/* Type definitions for callback functions */31typedef void* (*allocateMemoryType)(size_t nobj, size_t size);32typedef void (*loggerType)(void* componentEnvironment, const char* instanceName, int status, const char* category, const char* message, ...);33typedef void (*freeMemoryType)(void* obj);3435/* Several declarations for the model component (housekeeping stuff) */36typedef struct {37void* componentEnvironment;38const char* instanceName;39const char* resourceLocation;4041loggerType logger;42allocateMemoryType allocateMemory;43freeMemoryType freeMemory;4445double startTime;46double stopTime;4748char* libsumoCallOptions;4950/**51* @brief Parameters stored for the next (libsumo) getter call.52* Workaround for FMIv2 not allowing input values for an output53* model variable (see modelDescription.xml).54*/55char* getterParameters;5657/* Buffer for string value array used in fmi2GetString(). */58fmi2String* bufferArray;59int bufferArrayLength;6061bool logEvents;62bool logErrors;63} ModelInstance;6465/* Declarations of utility functions */66void sumo2fmi_logEvent(ModelInstance* comp, const char* message, ...);67void sumo2fmi_logError(ModelInstance* comp, const char* message, ...);68void sumo2fmi_logMessage(ModelInstance* comp, int status, const char* category, const char* message, va_list args);6970/* Getter/Setter Functions */71fmi2Status sumo2fmi_getInteger(ModelInstance* comp, const fmi2ValueReference vr, int* value);72fmi2Status sumo2fmi_getString(ModelInstance* comp, const fmi2ValueReference vr, fmi2String* value);73fmi2Status sumo2fmi_setString(ModelInstance* comp, fmi2ValueReference vr, fmi2String value);7475/* Stepping Functions */76fmi2Status sumo2fmi_step(ModelInstance* comp, double tNext);7778/* Setting the start values for all parameters */79void sumo2fmi_set_startValues(ModelInstance* comp);8081#endif /* SUMO2FMI_BRIDGE_H */828384