Skip to content

Serial Networks - Overview

API Documentation

feral.serial

Explanation

The serial component of FERAL realizes the simulation of serial networks. Supported are RS-232 and SPI.

Usage

The serial component is used like the other networks too. It is defined as a network component which connects two or more simulation workers.

Component Example

RS232.java
...
class RS232 {
    void setup() {
        simulationScenario = new SimulationScenario();
        director = new DiscreteEventMOCC("root director", simulationScenario);
        sender = new SenderEventWorker(director, 1, SimulationDuration.ms(500));
        receiver = new ReceiverEventWorker(director);

        network = new RS232Network(director, 2);

        // - Setup communication interfaces
        network.getTopology().getApplicationInterface(0).addTxMessageType("", "app", 2);
        network.getTopology().getApplicationInterface(1).addRxMessageType("", "app", 2);

        // - Setup links from/to network
        new Link(sender.getOutputPort("comm"), network.getTopology().getApplicationInterface(0).getInputPort("app"));
        new Link(network.getTopology().getApplicationInterface(1).getOutputPort("app"), receiver.getInputPort("comm"));
    }
    ...
}