What runs in a topology
The platform and the instance describe the vehicle and what to run. remotive topology build turns them into containers and networks that Docker or Podman runs. This page describes what runs, so you know what you're connecting to when you write models and tests, debug the topology, or connect hardware. RemotiveTopology also supports connecting to external ECUs, for example hardware or software running outside RemotiveTopology, see external ECUs.
An example
This instance of the sample vehicle runs three ECUs, each implemented in a different way, and a test container:
ecus:
SCCM:
mock: {}
BCM:
models:
bcm:
type: container
container:
build:
dockerfile: ../models/bcm/Dockerfile
command: python -m bcm
FLCM: {}
containers:
tester:
profiles: [tester]
build:
dockerfile: ../tests/Dockerfile
command: "pytest --broker_url=http://topology-broker.com:50051"
When it runs, it looks like this:
The following sections describe each part.
RemotiveBroker per ECU
By default each ECU runs as a RemotiveBroker that's connected to the channels of the ECU. The RemotiveBroker sends and receives on the channels as that ECU: on a CAN channel it uses the CAN interface of the ECU, and on an Ethernet channel it has the IP address of the ECU. It also encodes and decodes the signals with the signal databases of the ECU.
The RemotiveBroker doesn't have any behavior of its own. As for FLCM in the example, it receives what's sent to the ECU and lets you observe it. To make the ECU send something, you add a mock or a behavioral model.
To run several ECUs on one RemotiveBroker, see Grouping ECUs into a single broker.
Mocks and models
Mocks and behavioral models run in containers of their own, next to the RemotiveBroker of their ECU. They don't connect to the channels themselves. Instead they use the gRPC API of the RemotiveBroker of the ECU, which sends and receives on the channels for them.
- A mock runs a restbus that sends the cyclic frames of the ECU. Tests control its values through the TopologyBroker.
- A behavioral model is your code, typically written with the RemotiveTopology framework. An ECU can have several models, and both models and a mock.
FMU models are behavioral models too, and run the same way.
Namespaces
A RemotiveBroker has one namespace for each channel that its ECU is connected to. The namespace is how the ECU sees that channel, and it's named <ECU>-<Channel>, for example BCM-BodyCan. Models, mocks, and tests always refer to namespaces, not to channels.
Since each ECU has its own namespace on a channel, BCM-BodyCan and FLCM-BodyCan are two views of the same bus. A frame that BCM sends on BCM-BodyCan is received by FLCM on FLCM-BodyCan. If the ECUs have different signal databases for the channel, for example ECU extracts, each namespace decodes only what its ECU knows about.
The TopologyBroker
Every topology has a TopologyBroker, a RemotiveBroker that doesn't belong to any ECU. It has two roles:
- It forwards requests to the RemotiveBrokers of the ECUs, so tests and tools can reach every ECU namespace, for example
FLCM-BodyCan, through one URL. - It connects to the channels itself, with a namespace per channel named
topology-<Channel>, for exampletopology-BodyCan. This namespace decodes all traffic on the channel, including traffic between ECUs that don't use a RemotiveBroker. To do this, RemotiveTopology merges the signal databases of all ECUs on each channel, see TopologyBroker settings.
The TopologyBroker is reachable at:
http://localhost:50051from your computer, for example from tests you run in your editor, from RemotiveCLI, and from RemotiveStudio.http://topology-broker.com:50051from containers inside the topology, such as test containers.
To list the namespaces of a running topology:
remotive broker signals namespaces --url http://localhost:50051
Networks
Each channel becomes a network that connects the containers of the ECUs on that channel:
- CAN and LIN channels use RemotiveBus with SocketCAN by default, or UDP emulation. LIN frames travel inside CAN frames, see LIN channels.
- Ethernet channels use a Docker bridge network on the subnet of the channel, or RemotiveBus for VLANs. See Ethernet channels.
RemotiveTopology also adds a control network. It carries the gRPC traffic between models, tests, the RemotiveBrokers, and the TopologyBroker, separate from the vehicle networks.
Virtual ECUs replace the RemotiveBroker of their ECU and connect to the networks directly, with the interface names and IP addresses of the ECU. You can still see their traffic through the TopologyBroker.
What remotive topology build generates
remotive topology build resolves the instance against the platform, validates it, and writes a runnable environment to a folder:
remotive topology build -f topology/main.instance.yaml --name my-vehicle output
The folder, output/my-vehicle in this case, contains:
docker-compose.yml, with a service for each RemotiveBroker, mock, model, and container, and a network for each channel. The RemotiveBroker of an ECU is the service<ECU>-broker.com, which is also its host name inside the topology.- An
ecusfolder with the configuration of each RemotiveBroker, including the TopologyBroker: its namespaces, its network interfaces, and copies of its signal databases.
You run the topology with Docker Compose, see Running a topology. Don't edit the generated files, since remotive topology build overwrites them. Build again every time you change a platform or instance file. Changes to Python code in models and tests only need the containers to be rebuilt, with docker compose up --build.