Main Content

padv.Subprocess

Group of tasks and subprocesses in process

    Description

    This object requires CI/CD Automation for Simulink Check. A padv.Subprocess object represents a group of tasks and subprocesses in your process. You can have multiple processes inside your process model. In your process model, use the object functions addTask and addSubprocess to group tasks and other subprocesses inside your subprocess. You can specify a dependency between tasks or a desired execution order by using either dependsOn or runsAfter. Use dependsOn when a subprocess cannot start without another task or subprocess finishing first. Otherwise, if you only want to specify a preferred execution order, you can use runsAfter instead.

    Creation

    Description

    subprocessObject = padv.Subprocess(Name) represents a subprocess, named Name, in a process. Each subprocess in a process must have a unique Name.

    example

    subprocessObject = padv.Subprocess(___,Name=Value) sets properties using one or more name-value arguments. For example, padv.Subprocess("mySubprocess",Title="My Subprocess") creates a subprocess with the title My Subprocess in Process Advisor.

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Properties

    expand all

    Unique identifier for subprocess, returned as a string. When you specify the Name, you specify the Name property of the subprocess object.

    Each subprocess must have a unique Name.

    Example: padv.Subprocess("mySubprocess")

    Data Types: string

    Human readable name that appears in the Tasks column of the Process Advisor app, returned as a string. By default, the Process Advisor app uses the Name property of the subprocess as the Title.

    Example: padv.Subprocess("mySubprocess",Title = "My Subprocess")

    Data Types: string

    Subprocess description, returned as a string.

    Example: padv.Subprocess("mySubprocess",DescriptionText = "This is my subprocess.")

    Data Types: string

    Path to subprocess documentation, returned as a string.

    Example: padv.Subprocess("mySubprocess",DescriptionCSH = fullfile(pwd,"subprocessHelpFiles","mySubprocessDocumentation.pdf"))

    Data Types: string

    Type of artifact, specified as one or more of the values listed in this table. To specify multiple values, use an array.

    CategoryArtifact TypeDescription

    MATLAB®

    "m_class"MATLAB class
    "m_file"MATLAB file
    "m_func"MATLAB function
    "m_method"MATLAB class method
    "m_property"MATLAB class property

    Model Advisor

    "ma_config_file"Model Advisor configuration file
    "ma_justification_file"Model Advisor justification file

    Process Advisor

    "padv_dep_artifacts"

    Related artifacts that current artifact depends on

    "padv_output_file"

    Process Advisor output file

    Project

    "project"Current project file

    Requirements

    "mwreq_item"Requirement (since R2024b)

    "sl_req"

    Requirement (for R2024a and earlier)
    "sl_req_file"Requirement file
    "sl_req_table"Requirements Table

    Stateflow®

    "sf_chart"Stateflow chart
    "sf_graphical_fcn"Stateflow graphical function
    "sf_group"Stateflow group
    "sf_state"Stateflow state
    "sf_state_transition_chart"Stateflow state transition chart
    "sf_truth_table"Stateflow truth table

    Simulink®

    "sl_block_diagram"Block diagram
    "sl_data_dictionary_file"Data dictionary file
    "sl_embedded_matlab_fcn"MATLAB function
    "sl_block_diagram"Block diagram
    "sl_library_file"Library file
    "sl_model_file"Simulink model file
    "sl_protected_model_file"Protected Simulink model file
    "sl_subsystem"Subsystem
    "sl_subsystem_file"Subsystem file

    System Composer™

    "zc_block_diagram"System Composer architecture
    "zc_component"System Composer architecture component
    "zc_file"System Composer architecture file
    Tests"harness_info_file"Harness info file
    "sl_harness_block_diagram"Harness block diagram
    "sl_harness_file"Test harness file
    "sl_test_case"Simulink Test™ case
    "sl_test_case_result"Simulink Test case result
    "sl_test_file"Simulink Test file
    "sl_test_iteration"Simulink Test iteration
    "sl_test_iteration_result"Simulink Test iteration result
    "sl_test_report_file"Simulink Test result report
    "sl_test_result_file"Simulink Test result file
    "sl_test_resultset"Simulink Test result set
    "sl_test_seq"Test Sequence
    "sl_test_suite"Simulink Test suite
    "sl_test_suite_result"Simulink Test suite result

    Example: "m_file"

    Example: ["sl_model_file" "zc_file"]

    Function that launches a tool, returned as the function handle.

    When the property LaunchToolAction is specified, you can point to the subprocess in the Process Advisor app and click the ellipsis (...) and then Open Tool Name to open the tool associated with the subprocess.

    Example: padv.Subprocess("mySubprocess",LaunchToolAction = @openTool)

    Data Types: function_handle

    Description of the action that the LaunchToolAction property performs, returned as a string scalar.

    Example: padv.Subprocess("mySubprocess",LaunchToolAction = @openTool, LaunchToolText = "Open tool.")

    Data Types: string

    Controls if the padv.Subprocess is enabled in the process model, returned as a numeric or logical 1 (true) or 0 (false).

    Example: padv.Subprocess("mySubprocess",Enabled = false)

    Data Types: logical

    Dry run checks out product license, returned as a numeric or logical 1 (true) or 0 (false).

    For more information, see Dry Run Tasks to Test Process Model.

    Example: true

    Data Types: logical

    Location for standard outputs that tasks in the subprocess produce, specified as a string.

    Example: fullfile("folder", "subfolder")

    Data Types: string

    Location for additional cache files that tasks in the subprocess produce, specified as a string. The cache directory can contain temporary files that do not need to be either saved in the task results or archived by a CI system.

    Example: fullfile("folder", "subfolder")

    Data Types: string

    Object Functions

    addTaskAdd task to subprocess object. See Group Tasks with Subprocesses.
    addTask(subprocessObject, taskNameOrInstance)
    addSubprocessAdd subprocess to subprocess object.
    addSubprocess(subprocessObject, subprocessNameOrInstance)
    dependsOnSpecify tasks or subprocesses that the subprocess object depends on. See Group Tasks with Subprocesses.
    dependsOn(subprocessObject, DEPENDENCIES)
    runsAfterSpecify tasks or subprocesses that the subprocess object runs after.
    runsAfter(subprocessObject, PREDECESSORS)

    Examples

    collapse all

    You can use a subprocess to group related tasks, create a hierarchy of tasks, and share parts of a process. A subprocess is a self-contained sequence of tasks, inside a process or other subprocess, that can run standalone.

    Process Advisor UI with mouse pointing to run button for example subprocess

    To group the tasks in your process model, in the process model, add a subprocess by using addSubprocess on your process model object.

    spA = pm.addSubprocess("Subprocess A");

    Add your tasks directly to the subprocess by using addTask.

    tA1 = spA.addTask("Task A1");
    tA2 = spA.addTask("Task A2");

    Note

    You do not need to add the task to both the subprocess and process model.

    Specify the relationship between the tasks and subprocesses in your process.

    You can use either dependsOn or runsAfter to define a relationship.

    For example, the following process model defines a process in which Task 1 runs, then Subprocess A, and then Subprocess B.

    function processmodel(pm)
        % Defines the project's processmodel
    
        arguments
            pm padv.ProcessModel
        end
    
        t1 = pm.addTask("Task 1");
    
        spA = pm.addSubprocess("Subprocess A");
            tA1 = spA.addTask("Task A1");
            tA2 = spA.addTask("Task A2");
        spB = pm.addSubprocess("Subprocess B");
            tB1 = spB.addTask("Task B1");
            tB2 = spB.addTask("Task B2");
        
        % Relationships
        spA.dependsOn(t1);
            tA2.dependsOn(tA1);
        spB.dependsOn(spA);
            tB2.dependsOn(tB1);
    
    end
    The build system executes each of the tasks inside a subprocess before existing the subprocess.

    The following diagram shows a graphical representation of the relationships defined by that process model.

    Diagram showing relationships between Task 1, Subprocess A, and Subprocess B as arrows

    Note

    Relationships cannot cross any subprocess boundaries. For example, in this process model, you cannot directly specify that Task A1 depends on Task 1 because that relationship would enter into Subprocess A, crossing the subprocess boundary.

    Diagram showing invalid relationship between Task 1 and Task A1, marked with a red X