diff --git a/README.md b/README.md index 0b8514a..f16524a 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,69 @@ SPDX-License-Identifier: Apache-2.0 Network Model of the Dynamic Simulation Environment (DSE) Core Platform. +The Network Model can be used in simulations to connect Models to a (virtual) Network in cases where +the Models themselves do not include a Communication Stack (which would connect to that Network). +The resultant Functional Simulation (FSIL) may be used to validate complex functional interactions that span the entire network/ecu topology. + +The following diagram shows how Network Functions and a Virtual ECU may be connected using the Network Model to form a typical FSIL simulation. + + + +![](doc/static/network-introduction.png) + + +The Network Model is implemented with the [Model C Library](https://github.com/boschglobal/dse.modelc) and uses the +[Network Codec](https://github.com/boschglobal/dse.standards/tree/main/dse/ncodec) for interfacing with (virtual) Networks/Buses. +The [Network Codec](https://github.com/boschglobal/dse.standards/tree/main/dse/ncodec) provides an implementation of the [Automotive Bus Schema](https://github.com/boschglobal/automotive-bus-schema). + ### Project Structure ``` L- dse/network Network Model source code. L- extra Build infrastructure. - L- docker Containerised tools. + L- tools Containerised tools. L- licenses Third Party Licenses. L- tests Unit and integration tests. ``` @@ -29,26 +85,47 @@ L- tests Unit and integration tests. ## Usage -### Toolchains - -The Network Model is built using containerised toolchains. Those are -available from the DSE C Library and can be built as follows: +Network models can be built using the `network` tool (part of this project). +A simulation comprised of both network models and other models can be run using the `simer` tool (part of the Model C project). ```bash -$ git clone https://github.com/boschglobal/dse.clib.git -$ cd dse.clib -$ make docker -``` +# Install Task and clone the network repo (includes Taskfile automation). +$ sudo snap install task --classic +$ git clone https://github.com/boschglobal/dse.network.git +$ cd dse.network -Alternatively, the latest Docker Images are available on ghcr.io and can be -used as follows: +# Download the tutorial (or build locally with `make` command) ... +$ export NETWORK_URL=https://github.com/boschglobal/dse.network/releases/download/v1.0.1/Network-1.0.2-linux-amd64.zip +$ curl -fSL -o /tmp/network.zip $NETWORK_URL; unzip -d ./tutorial /tmp/network.zip -```bash -$ export GCC_BUILDER_IMAGE=ghcr.io/boschglobal/dse-gcc-builder:main +# Change to the simulation root directory (i.e. the tutorial directory). +$ cd tutorial/Network-1.0.2-linux-amd64/examples/brake-by-wire + +# Generate network code and configuration files. +$ task generate \ + DBCFILE=networks/brake/brake.dbc \ + SIGNAL=can \ + MIMETYPE="application/x-automotive-bus; interface=stream; type=frame; bus=can; schema=fbs; bus_id=1; node_id=1; interface_id=1" +$ task generate \ + DBCFILE=networks/vehicle/vehicle.dbc \ + SIGNAL=can \ + MIMETYPE="application/x-automotive-bus; interface=stream; type=frame; bus=can; schema=fbs; bus_id=1; node_id=2; interface_id=1" + + +# Define a shell function for the Simer tool. +$ export SIMER_IMAGE=ghcr.io/boschglobal/dse-simer:2.0.11 +$ simer() { ( cd "$1" && shift && docker run -it --rm -v $(pwd):/sim $SIMER_IMAGE "$@"; ) } + +# Run the simulation. +$ simer . -endtime 0.04 ``` +Documentation for the `simer` tool is available here : https://boschglobal.github.io/dse.doc/docs/user/simer + -### Build +## Build + +> Note : see the following section on configuring toolchains. ```bash # Get the repo. @@ -64,51 +141,32 @@ $ make # Run tests. $ make test +# Build containerised tools. +$ make tools + # Remove (clean) temporary build artifacts. $ make clean $ make cleanall ``` -### Example - -The Network Model includes a sample Network (CAN database) which can be used to -generate a Message Library. This Message Library is then loaded by the -Network Model and together they provide a connection between the Signal and -Network interfaces of a Simulation. +### Toolchains -The following commands illustrate the process of generating a Message Library. +The Network Model is built using containerised toolchains. Those are +available from the DSE C Library and can be built as follows: ```bash -# Get the example from repo. -$ git clone https://github.com/boschglobal/dse.network.git -$ cd dse.network/dse/network/examples/stub - -# Generate C files (stub.h & stub.c). -$ python -m cantools generate_c_source stub.dbc - -# Generate the Network configuration (network.yaml). -$ dse.codegen cantools-network \ - --input stub.h \ - --output network.yaml \ - --dbc stub.dbc \ - --message_lib examples/stub/lib/message.so \ - --node_id 2 \ - --interface_id 3 \ - --bus_id 4 - -# Generate a Signal Group (signalgroup.yaml) to represent Signals in the Simulation. -$ dse.convert signalgroup \ - --input network.yaml \ - --output signalgroup.ymal \ - --name "signal" \ - --labels "{'channel': 'signal_vector'}" +$ git clone https://github.com/boschglobal/dse.clib.git +$ cd dse.clib +$ make docker ``` -After those steps the Message Library can be configured as a part of a -Simulation. The user documentation contains full details of how to build, -configure and use the Network Model. The `dse/network/examples/stub` folder -includes a complete example configuration. +Alternatively, the latest Docker Images are available on ghcr.io and can be +used as follows: + +```bash +$ export GCC_BUILDER_IMAGE=ghcr.io/boschglobal/dse-gcc-builder:main +``` ## Contribute diff --git a/Taskfile.yml b/Taskfile.yml index 5ec4b42..e490c85 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -4,8 +4,8 @@ version: '3' vars: - NETWORK_IMAGE: network - NETWORK_TAG: test + NETWORK_IMAGE: ghcr.io/boschglobal/dse-network + NETWORK_TAG: latest GCC_IMAGE: ghcr.io/boschglobal/dse-gcc-builder GCC_TAG: main diff --git a/doc/static/network-introduction.png b/doc/static/network-introduction.png new file mode 100644 index 0000000..9ed5108 Binary files /dev/null and b/doc/static/network-introduction.png differ diff --git a/doc/yed/rough_design.graphml b/doc/yed/rough_design.graphml deleted file mode 100644 index b23d6d8..0000000 --- a/doc/yed/rough_design.graphml +++ /dev/null @@ -1,563 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - << channel >> FSIL SimBus - - - - - - - - - - Folder 1 - - - - - - - - - - - - - - - - - signal (double) - - - - - - - - - - - signal (double) - - - - - - - - - - - - - - - - << channel >> CAN Bus - - - - - - - - - - Folder 2 - - - - - - - - - - - - - - - - - Message - -PDU - -signal (binary) - - - - - - - - - - - - - - - - << model >> Network - - - - - - - - - - Folder 3 - - - - - - - - - - - - - - - - - Timing - - - - - - - - - - - - - - NCodec - - - - - - - - - - Folder 5 - - - - - - - - - - - - - - - - - NCodec (.c) - - - - - - - - - - - Message (.h) - - - - - - - - - - - - - - - - Engine - - - - - - - - - - Folder 6 - - - - - - - - - - - - - - - - - Marshal List -List of Message Objects - - - - - - - - - - - Message Factory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Custom Functions -CRC (customer specific) -Alive counter -Models (simple models) -MUXes ... - - - - - - - - - - - - - DBC File (CAN) - - - - - - - - - - - Can Tools - - - - - - - - - - - - - - Workflow - - - - - - - - - - Folder 4 - - - - - - - - - - - - - - - - - AUTOSAR - - - - - - - - - - - DBC File (CAN) - - - - - - - - - - - Manual config - - - - - - - - - - - - - Network YAML - - - - - - - - - - - encode /decode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - loads - - - - - - - - - - - - - - - - - - - - - - - Code parsing - - - - - - - - - - - - - - - - - - - - - Message Objects - - - - - - - - - - - - - - - - - - - - - - Function Call - - - - - - - - - - - - - - - - - - - - - - - - - - - - -