Skip to content

Simulink

Source code in feral3gp/feral/simulink/simulink.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
def simulink(config: SimulinkConfig, director=Simulation.director_dt):
    __validate(config)

    input_port_definitions = __get_port_definitions(config, SimulinkPortType.INPUT)
    output_port_definitions = __get_port_definitions(config, SimulinkPortType.OUTPUT)
    global_parameter_definitions = __get_port_definitions(config, SimulinkPortType.GLOBAL_PARAMETER)

    model_name = config.model_name
    file_name = config.file_name

    java_simulink_native_library = JSimulinkNativeLibrary(input_port_definitions, output_port_definitions,
                                                          global_parameter_definitions, file_name, model_name)
    java_simulink_worker = JSimulinkNativeLibraryWorker(config.name, director, java_simulink_native_library)

    return java_simulink_worker

feral3gp.feral.SimulinkConfig dataclass

Source code in feral3gp/feral/simulink/simulink_config.py
41
42
43
44
45
46
47
48
49
50
51
@dataclass
class SimulinkConfig:
    name: str = None
    file_name: str = None
    model_name: str = None
    console: ConsoleConfig = None
    """
    If no console config is provided, the network will use the default 
    console of the simulation
    """
    ports: typing.List[SimulinkPortConfig] = None

console: ConsoleConfig = None class-attribute instance-attribute

If no console config is provided, the network will use the default console of the simulation

feral3gp.feral.SimulinkPortConfig dataclass

Source code in feral3gp/feral/simulink/simulink_config.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@dataclass
class SimulinkPortConfig:
    name: str = None
    """
    The name of the port
    """
    size: int = None
    """
    The size of the port.  1 = scalar, 2 = array with 2 elements, 3 = array with 3 elements, ...
    """
    type: SimulinkPortType = None
    """
    The type of the port
    """
    data_type: SimulinkPortDataType = None
    """
    The data type of the port
    """

data_type: SimulinkPortDataType = None class-attribute instance-attribute

The data type of the port

name: str = None class-attribute instance-attribute

The name of the port

size: int = None class-attribute instance-attribute

The size of the port. 1 = scalar, 2 = array with 2 elements, 3 = array with 3 elements, ...

type: SimulinkPortType = None class-attribute instance-attribute

The type of the port

feral3gp.feral.SimulinkPortDataType

Bases: Enum

Source code in feral3gp/feral/simulink/simulink_config.py
13
14
15
16
17
18
class SimulinkPortDataType(Enum):
    DOUBLE = 0
    INTEGER = 1
    FLOAT = 2
    LONG = 3
    SHORT = 4

feral3gp.feral.SimulinkPortType

Bases: Enum

Source code in feral3gp/feral/simulink/simulink_config.py
 7
 8
 9
10
class SimulinkPortType(Enum):
    INPUT = 0
    OUTPUT = 1
    GLOBAL_PARAMETER = 2