def add_model_components(prereq_modules, module_to_test,
                         model, d, test_data_dir, subproblem, stage):
    """
    Create abstract model, add components from prerequisite modules, add
    components from the module being tested
    :param prereq_modules:
    :param module_to_test:
    :param model:
    :param dynamic_inputs:
    :return:
    """
    for m in prereq_modules:
        if hasattr(m, 'add_model_components'):
            m.add_model_components(
                model, d, test_data_dir, subproblem, stage
            )
    if hasattr(module_to_test, "add_model_components"):
        module_to_test.add_model_components(
            model, d, test_data_dir, subproblem, stage
        )

    return model