AmesimKnowledge

Co-simulation with the Libcosim Library > Use with third-party applications > API Documentation

amecommunication_shm.c File Reference

Copy

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "rtsharedmem.h"
#include "amecommunication_shm.h"

Include dependency graph for amecommunication_shm.c:

Defines

Copy

#define MAX(a, b) (a > b ? a : b)

Functions

Copy

int ameshm_init (ameshm_conn_attributes *connection, int ismaster, char *name, int input_size, int output_size);
int ameshm_exchange (ameshm_conn_attributes *connection, double *input, double *output);
int ameshm_close (ameshm_conn_attributes *connection);

Define Documentation

Copy

#define MAX(a, b) (a > b ? a : b)

Referenced by ameshm_close(), and ameshm_exchange().

Function Documentation

int ameshm_init (ameshm_conn_attributes * connection, int ismaster, char * name, int input_size, int output_size)
Initializes the connection attributes with given arguments so that it can be used with ameshm_exchange.
Parameters connection [OUT] contains the information needed by ameshm_exchange. ismaster [IN] defines whether this executable should act as a slave and simply get a communicator with its master, or a master and spawn a slave. name [IN] identifier for the shm: must be the same string for slave and master. input_size size of the data vectors that will be sent. output_size size of the data vectors that will be received.
See also ameshm_exchange()
Returns SUCCESS, BAD_ARGUMENT.
int ameshm_close (ameshm_conn_attributes * connection)
Ends the communication by sending a message with a next meeting point equal to -1.0.
Parameters connection [IN] contains info about the communication.
See also ameshm_init()
Returns SUCCESS.
int ameshm_exchange (ameshm_conn_attributes * connection, double * input, double * output)
Exchanges data between the slave and the master.
Parameters connection [IN] contains the info needed by ameshm_exchange. input vector that will be sent. Vector size should be the one given to ameshm_init. output vector that will be received. Vector size should be the one given to ameshm_init.
See also ameshm_init()
Returns SUCCESS, UNKNOWN_ERROR or CONNECTION_SHUTDOWN if the partner send a tag for communication shutdown.

Source: https://docs.sw.siemens.com/en-US/doc/254352342/PL20250521841123434.amesim_collection.lib-cosim/xid1852557 · retrieved 2026-07-17