.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_example/p2f/epid/plot_dyn_set.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_example_p2f_epid_plot_dyn_set.py: Set FMU simulation parameters ============================= .. GENERATED FROM PYTHON SOURCE LINES 7-12 :class:`~otfmi.FMUPointToFieldFunction` is an OpenTURNS-friendly overlay of the class otfmi.OpenTURNSFMUPointToFieldFunction, closer to the underlying PyFMI implementation. Some FMU simulation parameters can be given to :class:`~otfmi.FMUPointToFieldFunction`, yet most of them can only be passed to an OpenTURNSFMUPointToFieldFunction. .. GENERATED FROM PYTHON SOURCE LINES 14-15 First, retrieve the path to *epid.fmu*. .. GENERATED FROM PYTHON SOURCE LINES 15-20 .. code-block:: Python import otfmi.example.utility import openturns as ot path_fmu = otfmi.example.utility.get_path_fmu("epid") .. GENERATED FROM PYTHON SOURCE LINES 21-23 The FMU simulation start and final times are the only simulation-related parameter that can be passed to :class:`~otfmi.FMUPointToFieldFunction`. .. GENERATED FROM PYTHON SOURCE LINES 23-36 .. code-block:: Python function = otfmi.FMUPointToFieldFunction( path_fmu, inputs_fmu=["infection_rate", "healing_rate"], outputs_fmu=["infected"], start_time=0.0, final_time=15.0, ) inputPoint = ot.Point([0.007, 0.02]) outputSample = function(inputPoint) print(outputSample) .. rst-class:: sphx-glr-script-out .. code-block:: none [ infected ] 0 : [ 1 ] 1 : [ 0.9987 ] 2 : [ 0.997401 ] 3 : [ 0.996104 ] 4 : [ 0.994809 ] 5 : [ 0.993515 ] 6 : [ 0.992223 ] 7 : [ 0.990933 ] 8 : [ 0.989645 ] 9 : [ 0.988358 ] 10 : [ 0.987073 ] 11 : [ 0.985789 ] 12 : [ 0.984507 ] 13 : [ 0.983227 ] 14 : [ 0.981948 ] 15 : [ 0.980672 ] 16 : [ 0.979396 ] 17 : [ 0.978123 ] 18 : [ 0.976851 ] 19 : [ 0.975581 ] 20 : [ 0.974312 ] 21 : [ 0.973045 ] 22 : [ 0.97178 ] 23 : [ 0.970516 ] 24 : [ 0.969254 ] 25 : [ 0.967994 ] 26 : [ 0.966735 ] 27 : [ 0.965478 ] 28 : [ 0.964223 ] 29 : [ 0.962969 ] 30 : [ 0.961717 ] 31 : [ 0.960466 ] 32 : [ 0.959217 ] 33 : [ 0.95797 ] 34 : [ 0.956724 ] 35 : [ 0.95548 ] 36 : [ 0.954238 ] 37 : [ 0.952997 ] 38 : [ 0.951758 ] 39 : [ 0.95052 ] 40 : [ 0.949284 ] 41 : [ 0.94805 ] 42 : [ 0.946817 ] 43 : [ 0.945586 ] 44 : [ 0.944356 ] 45 : [ 0.943128 ] 46 : [ 0.941902 ] 47 : [ 0.940677 ] 48 : [ 0.939454 ] 49 : [ 0.938232 ] 50 : [ 0.937012 ] 51 : [ 0.935793 ] 52 : [ 0.934577 ] 53 : [ 0.933361 ] 54 : [ 0.932148 ] 55 : [ 0.930935 ] 56 : [ 0.929725 ] 57 : [ 0.928516 ] 58 : [ 0.927309 ] 59 : [ 0.926103 ] 60 : [ 0.924898 ] 61 : [ 0.923696 ] 62 : [ 0.922495 ] 63 : [ 0.921295 ] 64 : [ 0.920097 ] 65 : [ 0.9189 ] 66 : [ 0.917706 ] 67 : [ 0.916512 ] 68 : [ 0.91532 ] 69 : [ 0.91413 ] 70 : [ 0.912941 ] 71 : [ 0.911754 ] 72 : [ 0.910569 ] 73 : [ 0.909385 ] 74 : [ 0.908202 ] 75 : [ 0.907021 ] 76 : [ 0.905842 ] 77 : [ 0.904664 ] 78 : [ 0.903487 ] 79 : [ 0.902312 ] 80 : [ 0.901139 ] 81 : [ 0.899967 ] 82 : [ 0.898797 ] 83 : [ 0.897628 ] 84 : [ 0.896461 ] 85 : [ 0.895295 ] 86 : [ 0.894131 ] 87 : [ 0.892968 ] 88 : [ 0.891807 ] 89 : [ 0.890647 ] 90 : [ 0.889489 ] 91 : [ 0.888333 ] 92 : [ 0.887177 ] 93 : [ 0.886024 ] 94 : [ 0.884872 ] 95 : [ 0.883721 ] 96 : [ 0.882572 ] 97 : [ 0.881424 ] 98 : [ 0.880278 ] 99 : [ 0.879133 ] 100 : [ 0.87799 ] 101 : [ 0.876848 ] 102 : [ 0.875708 ] 103 : [ 0.874569 ] 104 : [ 0.873432 ] 105 : [ 0.872296 ] 106 : [ 0.871162 ] 107 : [ 0.870029 ] 108 : [ 0.868898 ] 109 : [ 0.867768 ] 110 : [ 0.866639 ] 111 : [ 0.865512 ] 112 : [ 0.864387 ] 113 : [ 0.863263 ] 114 : [ 0.86214 ] 115 : [ 0.861019 ] 116 : [ 0.859899 ] 117 : [ 0.858781 ] 118 : [ 0.857664 ] 119 : [ 0.856549 ] 120 : [ 0.855435 ] 121 : [ 0.854323 ] 122 : [ 0.853212 ] 123 : [ 0.852102 ] 124 : [ 0.850994 ] 125 : [ 0.849888 ] 126 : [ 0.848782 ] 127 : [ 0.847679 ] 128 : [ 0.846576 ] 129 : [ 0.845475 ] 130 : [ 0.844376 ] 131 : [ 0.843278 ] 132 : [ 0.842181 ] 133 : [ 0.841086 ] 134 : [ 0.839992 ] 135 : [ 0.8389 ] 136 : [ 0.837809 ] 137 : [ 0.83672 ] 138 : [ 0.835632 ] 139 : [ 0.834545 ] 140 : [ 0.83346 ] 141 : [ 0.832376 ] 142 : [ 0.831293 ] 143 : [ 0.830212 ] 144 : [ 0.829133 ] 145 : [ 0.828055 ] 146 : [ 0.826978 ] 147 : [ 0.825902 ] 148 : [ 0.824828 ] 149 : [ 0.823756 ] 150 : [ 0.822685 ] .. GENERATED FROM PYTHON SOURCE LINES 37-40 To set more parameters for the FMU simulation, OpenTURNSFMUPointToFieldFunction can be employed. Below, we set the PyFMI algorithm running the simulation, and require simulation silent mode. .. GENERATED FROM PYTHON SOURCE LINES 40-53 .. code-block:: Python midlevel_function = otfmi.OpenTURNSFMUPointToFieldFunction( path_fmu, inputs_fmu=["infection_rate", "healing_rate"], outputs_fmu=["infected"], start_time=0.0, final_time=15.0, ) outputPoint = midlevel_function.base.simulate( inputPoint, algorithm="FMICSAlg", options={"silent_mode": True} ) .. GENERATED FROM PYTHON SOURCE LINES 54-56 For advanced users, the middle-level class otfmi.OpenTURNSFMUPointToFieldFunction also gives access to the PyFMI model. We can hence access all PyFMI's object methods: .. GENERATED FROM PYTHON SOURCE LINES 56-60 .. code-block:: Python pyfmi_model = midlevel_function.base.get_model() print(dir(pyfmi_model)) .. rst-class:: sphx-glr-script-out .. code-block:: none ['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__pyx_vtable__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '_additional_logger', '_close_log_file', '_convert_filter', '_current_log_size', '_deactivate_logging', '_default_options', '_enable_logging', '_exec_algorithm', '_exec_estimate_algorithm', '_exec_simulate_algorithm', '_get', '_get_A', '_get_B', '_get_C', '_get_D', '_get_default_log_file_name', '_get_directional_proxy', '_get_module_name', '_get_time', '_group_A', '_group_B', '_group_C', '_group_D', '_has_entered_init_mode', '_init_log_state', '_invoked_dealloc', '_last_accepted_time', '_loaded_with_log_level', '_log_handler', '_log_is_stream', '_log_open', '_log_stream', '_log_stream_is_open', '_max_log_size', '_max_log_size_msg_sent', '_open_log_file', '_provides_directional_derivatives', '_pyEventInfo', '_relative_tolerance', '_result_file', '_save_bool_variables_val', '_save_int_variables_val', '_save_real_variables_val', '_set', '_set_log_stream', '_set_time', '_setup_log_state', '_supports_get_set_FMU_state', 'append_log_message', 'cache', 'cancel_step', 'deserialize_fmu_state', 'do_step', 'enter_initialization_mode', 'estimate', 'estimate_options', 'exit_initialization_mode', 'extract_xml_log', 'file_object', 'free_fmu_state', 'free_instance', 'get', 'get_author', 'get_boolean', 'get_boolean_status', 'get_capability_flags', 'get_categories', 'get_copyright', 'get_default_experiment_start_time', 'get_default_experiment_step', 'get_default_experiment_stop_time', 'get_default_experiment_tolerance', 'get_derivatives_dependencies', 'get_derivatives_dependencies_kind', 'get_derivatives_list', 'get_description', 'get_directional_derivative', 'get_fmil_log_level', 'get_fmu_state', 'get_generation_date_and_time', 'get_generation_tool', 'get_guid', 'get_identifier', 'get_input_list', 'get_integer', 'get_integer_status', 'get_last_result_file', 'get_license', 'get_log', 'get_log_categories', 'get_log_filename', 'get_log_level', 'get_max_log_size', 'get_model_time_varying_value_references', 'get_model_types_platform', 'get_model_variables', 'get_model_version', 'get_name', 'get_number_of_lines_log', 'get_ode_sizes', 'get_output_dependencies', 'get_output_dependencies_kind', 'get_output_derivatives', 'get_output_list', 'get_real', 'get_real_status', 'get_scalar_variable', 'get_state_space_representation', 'get_states_list', 'get_status', 'get_string', 'get_string_status', 'get_unpacked_fmu_path', 'get_variable_alias', 'get_variable_alias_base', 'get_variable_by_valueref', 'get_variable_causality', 'get_variable_data_type', 'get_variable_declared_type', 'get_variable_description', 'get_variable_display_unit', 'get_variable_display_value', 'get_variable_initial', 'get_variable_max', 'get_variable_min', 'get_variable_naming_convention', 'get_variable_nominal', 'get_variable_references', 'get_variable_relative_quantity', 'get_variable_start', 'get_variable_unbounded', 'get_variable_unit', 'get_variable_valueref', 'get_variable_variability', 'get_version', 'has_reached_max_log_size', 'initialize', 'instantiate', 'print_log', 'reset', 'serialize_fmu_state', 'serialized_fmu_state_size', 'set', 'set_additional_logger', 'set_boolean', 'set_debug_logging', 'set_fmu_state', 'set_input_derivatives', 'set_integer', 'set_log_level', 'set_max_log_size', 'set_real', 'set_string', 'setup_experiment', 'simulate', 'simulate_options', 'terminate', 'time'] .. GENERATED FROM PYTHON SOURCE LINES 61-64 .. note:: otfmi' classes :class:`~otfmi.FMUPointToFieldFunction` and otfmi.OpenTURNSFMUPointToFieldFunction are designed to highlight the most useful PyFMI's methods and simplify their use! .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.119 seconds) .. _sphx_glr_download_auto_example_p2f_epid_plot_dyn_set.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_dyn_set.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_dyn_set.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_dyn_set.zip `