py_canoe.core.child_elements.bus.Bus

The Bus object represents a bus of your application.

The instantiation of the Bus object is done by the Bus property of the Application object or by the Buses collection of the Simulation Setup.

Properties

active: Sets or returns the status of the Bus object. channels: Returns the Channels object (read-only). databases: Returns the Databases object (read-only). generators: Returns the Generators object (read-only). interactive_generators: Returns the InteractiveGenerators object (read-only). name: Sets or returns the name of the bus. nodes: Returns the Nodes object (read-only). ports: Returns the collection of Ports (read-only). replay_collection: Returns the ReplayCollection object (read-only). security_configuration: Returns the SecurityConfiguration (read-only).

Methods:

Name Description
autogenerate_nodes

Automatically generates network nodes based on the first assigned database (LIN buses only).

get_signal

Returns a Signal object.

get_j1939_signal

Returns a Signal object for J1939 buses.

The Bus object wraps a COM Bus object.

Parameters:
  • com_object

    The COM Bus object (e.g. obtained from app.com_object.GetBus(<bus-name>) or buses.Item(i)).

Source code in src\py_canoe\core\child_elements\bus.py
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
def __init__(self, com_object):
    """The Bus object wraps a COM Bus object.

    Args:
        com_object: The COM Bus object (e.g. obtained from
                    ``app.com_object.GetBus(<bus-name>)`` or ``buses.Item(i)``).
    """
    self.com_object = com_object
    self.VALUE_TABLE_SIGNAL_IS_ONLINE = {
        True: "measurement is running and the signal has been received.",
        False: "The signal is not online."
    }
    self.VALUE_TABLE_SIGNAL_STATE = {
        0: "The default value of the signal is returned.",
        1: "The measurement is not running. The value set by the application is returned.",
        2: "The measurement is not running. The value of the last measurement is returned.",
        3: "The signal has been received in the current measurement. The current value is returned."
    }

active property writable

Sets or returns the status of the Bus object (whether the bus is simulated).

channels property

Returns the Channels object associated with the bus.

databases property

Returns the Databases object of the bus.

generators property

Returns the Generators object of the bus.

interactive_generators property

Returns the InteractiveGenerators object of the bus.

name property writable

Sets or returns the name of the bus.

nodes property

Returns the Nodes object of the bus.

ports property

Returns the collection of Ports.

replay_collection property

Returns the ReplayCollection object of the bus.

security_configuration property

Returns the SecurityConfiguration of the bus.

autogenerate_nodes()

Automatically generates network nodes based on the first assigned database.

The function is restricted to LIN buses.

Source code in src\py_canoe\core\child_elements\bus.py
132
133
134
135
136
137
def autogenerate_nodes(self) -> None:
    """Automatically generates network nodes based on the first assigned database.

    The function is restricted to LIN buses.
    """
    self.com_object.AutogenerateNodes()

get_j1939_signal(channel, message, signal, source_addr, dest_addr)

Returns a Signal object for a J1939 bus.

Parameters:
  • channel (int) –

    The channel on which the signal is sent.

  • message (str) –

    The name of the message to which the signal belongs.

  • signal (str) –

    The name of the signal.

  • source_addr (int) –

    The source address of the ECU that sends the message.

  • dest_addr (int) –

    The destination address of the ECU that receives the message.

Returns:
  • Signal

    The Signal object.

Source code in src\py_canoe\core\child_elements\bus.py
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
def get_j1939_signal(self, channel: int, message: str, signal: str,
                     source_addr: int, dest_addr: int) -> Signal:
    """Returns a Signal object for a J1939 bus.

    Args:
        channel: The channel on which the signal is sent.
        message: The name of the message to which the signal belongs.
        signal: The name of the signal.
        source_addr: The source address of the ECU that sends the message.
        dest_addr: The destination address of the ECU that receives the message.

    Returns:
        The Signal object.
    """
    return Signal(self.com_object.GetJ1939Signal(channel, message, signal, source_addr, dest_addr))

get_signal(channel, message, signal)

Returns a Signal object.

Parameters:
  • channel (int) –

    The channel on which the signal is sent. -1 or 0 is the wildcard for the channel selection.

  • message (str) –

    The name of the message to which the signal belongs.

  • signal (str) –

    The name of the signal.

Returns:
  • Signal

    The Signal object.

Source code in src\py_canoe\core\child_elements\bus.py
139
140
141
142
143
144
145
146
147
148
149
150
151
def get_signal(self, channel: int, message: str, signal: str) -> Signal:
    """Returns a Signal object.

    Args:
        channel: The channel on which the signal is sent.
                 -1 or 0 is the wildcard for the channel selection.
        message: The name of the message to which the signal belongs.
        signal: The name of the signal.

    Returns:
        The Signal object.
    """
    return Signal(self.com_object.GetSignal(channel, message, signal))