modelon/impact/client/entities.py
def compile(
        self,
        compiler_options,
        runtime_options=None,
        compiler_log_level="warning",
        fmi_target="me",
        fmi_version="2.0",
        platform="auto",
        force_compilation=False,
    ):
        """Compiles the model to an FMU.
        Returns an modelon.impact.client.operations.ModelExecutableOperation class
        object.

        Parameters:

            compiler_options --
                An compilation options class instance of
                modelon.impact.client.options.ExecutionOptions or
                a dictionary object containing the compiler options.

            runtime_options --
                An runtime options class instance of
                modelon.impact.client.options.ExecutionOptions or
                a dictionary object containing the runtime options. Default: None.

            compiler_log_level --
                The logging for the compiler. Possible values are "error",
                "warning", "info", "verbose" and "debug". Default: 'warning'.

            fmi_target --
                Compiler target. Possible values are 'me' and 'cs'. Default: 'me'.

            fmi_version --
                The FMI version. Valid options are '1.0' and '2.0'. Default: '2.0'.

            platform --
                Platform for FMU binary.The OS running the Impact server must match the
                environment that runs the compiled FMU. This is necessary as the
                binaries packaged with the FMU are based on the platform generating
                the FMU. For example, if the Impact server is running Linux the binary
                in the downloaded FMU is compiled for Linux. The downloaded FMU can
                then not be simulated on Windows.
                Supported options are:-
                    - 'auto': platform is selected automatically.
                    - "linux64": generate a 32 bit FMU.
                    - "win32": generate a 32 bit FMU.
                    - "win64": generate a 64 bit FMU
                Default: 'auto'.

            force_compilation --
                Force a model compilation.

        Returns:

            modelexecutableoperation --
                An modelon.impact.client.operations.ModelExecutableOperation class
                object.

        Example::

            compile_ops=model.compile(compiler_options)
            compile_ops.cancel()
            compile_ops.status()
            compiler_options=custom_function.get_compiler_options.with_values(c_compiler='gcc')
            runtime_options={'cs_solver':0}
            model.compile(compiler_options, runtime_options).wait()
            model.compile({'c_compiler':'gcc'}).wait()
        """
        assert_valid_args(
            compiler_options=compiler_options, runtime_options=runtime_options
        )
        compiler_options = (
            dict(compiler_options)
            if isinstance(compiler_options, ExecutionOptions)
            else compiler_options
            if isinstance(compiler_options, dict)
            else {}
        )
        runtime_options = (
            dict(runtime_options)
            if isinstance(runtime_options, ExecutionOptions)
            else runtime_options
            if isinstance(runtime_options, dict)
            else {}
        )

        body = {
            "input": {
                "class_name": self._class_name,
                "compiler_options": compiler_options,
                "runtime_options": runtime_options,
                "compiler_log_level": compiler_log_level,
                "fmi_target": fmi_target,
                "fmi_version": fmi_version,
                "platform": platform,
            }
        }
        if not force_compilation:
            fmu_id, modifiers = self._model_exe_sal.fmu_setup(
                self._workspace_id, body, True
            )
            if fmu_id:
                return operations.CachedModelExecutableOperation(
                    self._workspace_id,
                    fmu_id,
                    self._workspace_sal,
                    self._model_exe_sal,
                    None,
                    modifiers,
                )

        # No cached FMU, setup up a new one
        fmu_id, _ = self._model_exe_sal.fmu_setup(self._workspace_id, body, False)

        return operations.ModelExecutableOperation(
            self._workspace_id,
            self._model_exe_sal.compile_model(self._workspace_id, fmu_id),
            self._workspace_sal,
            self._model_exe_sal,
        )
Compiles the model to an FMU.
        Returns an modelon.impact.client.operations.ModelExecutableOperation class
        object.

        Parameters:

            compiler_options --
                An compilation options class instance of
                modelon.impact.client.options.ExecutionOptions or
                a dictionary object containing the compiler options.

            runtime_options --
                An runtime options class instance of
                modelon.impact.client.options.ExecutionOptions or
                a dictionary object containing the runtime options. Default: None.

            compiler_log_level --
                The logging for the compiler. Possible values are "error",
                "warning", "info", "verbose" and "debug". Default: 'warning'.

            fmi_target --
                Compiler target. Possible values are 'me' and 'cs'. Default: 'me'.

            fmi_version --
                The FMI version. Valid options are '1.0' and '2.0'. Default: '2.0'.

            platform --
                Platform for FMU binary.The OS running the Impact server must match the
                environment that runs the compiled FMU. This is necessary as the
                binaries packaged with the FMU are based on the platform generating
                the FMU. For example, if the Impact server is running Linux the binary
                in the downloaded FMU is compiled for Linux. The downloaded FMU can
                then not be simulated on Windows.
                Supported options are:-
                    - 'auto': platform is selected automatically.
                    - "linux64": generate a 32 bit FMU.
                    - "win32": generate a 32 bit FMU.
                    - "win64": generate a 64 bit FMU
                Default: 'auto'.

            force_compilation --
                Force a model compilation.

        Returns:

            modelexecutableoperation --
                An modelon.impact.client.operations.ModelExecutableOperation class
                object.

        Example::

            compile_ops=model.compile(compiler_options)
            compile_ops.cancel()
            compile_ops.status()
            compiler_options=custom_function.get_compiler_options.with_values(c_compiler='gcc')
            runtime_options={'cs_solver':0}
            model.compile(compiler_options, runtime_options).wait()
            model.compile({'c_compiler':'gcc'}).wait()
        
Compiles the model to an FMU.
Returns an modelon.impact.client.operations.ModelExecutableOperation class
object.



compiler_options
An compilation options class instance of
modelon.impact.client.options.ExecutionOptions or
a dictionary object containing the compiler options.

runtime_options
An runtime options class instance of
modelon.impact.client.options.ExecutionOptions or
a dictionary object containing the runtime options. Default: None.

compiler_log_level
The logging for the compiler.



fmi_version
The FMI version.

platform
Platform for FMU binary.The OS running the Impact server must match the
environment that runs the compiled FMU. This is necessary as the
binaries packaged with the FMU are based on the platform generating
the FMU. For example, if the Impact server is running Linux the binary
in the downloaded FMU is compiled for Linux. The downloaded FMU can
then not be simulated on Windows.
Supported options are:
'auto': platform is selected automatically.
"linux64": generate a 32 bit FMU.
"win32": generate a 32 bit FMU.
"win64": generate a 64 bit FMU
Default: 'auto'.

force_compilation
Force a model compilation.



modelexecutableoperation
An modelon.impact.client.operations.ModelExecutableOperation class
object.




Compiles the model to an FMU . Returns an modelon . impact . client . operations . ModelExecutableOperation class object . compiler_options An compilation options class instance of modelon . impact . client . options . ExecutionOptions or a dictionary object containing the compiler options . runtime_options An runtime options class instance of modelon . impact . client . options . ExecutionOptions or a dictionary object containing the runtime options . Default : None . compiler_log_level The logging for the compiler . fmi_version The FMI version . platform Platform for FMU binary . The OS running the Impact server must match the environment that runs the compiled FMU . This is necessary as the binaries packaged with the FMU are based on the platform generating the FMU . For example if the Impact server is running Linux the binary in the downloaded FMU is compiled for Linux . The downloaded FMU can then not be simulated on Windows . Supported options are : ' auto ' : platform is selected automatically . " linux64 " : generate a 32 bit FMU . " win32 " : generate a 32 bit FMU . " win64 " : generate a 64 bit FMU Default : ' auto ' . force_compilation Force a model compilation . modelexecutableoperation An modelon . impact . client . operations . ModelExecutableOperation class object .
def compile(
        self,
        compiler_options,
        runtime_options=None,
        compiler_log_level="warning",
        fmi_target="me",
        fmi_version="2.0",
        platform="auto",
        force_compilation=False,
    ):
        assert_valid_args(
            compiler_options=compiler_options, runtime_options=runtime_options
        )
        compiler_options = (
            dict(compiler_options)
            if isinstance(compiler_options, ExecutionOptions)
            else compiler_options
            if isinstance(compiler_options, dict)
            else {}
        )
        runtime_options = (
            dict(runtime_options)
            if isinstance(runtime_options, ExecutionOptions)
            else runtime_options
            if isinstance(runtime_options, dict)
            else {}
        )
        body = {
            "input": {
                "class_name": self._class_name,
                "compiler_options": compiler_options,
                "runtime_options": runtime_options,
                "compiler_log_level": compiler_log_level,
                "fmi_target": fmi_target,
                "fmi_version": fmi_version,
                "platform": platform,
            }
        }
        if not force_compilation:
            fmu_id, modifiers = self._model_exe_sal.fmu_setup(
                self._workspace_id, body, True
            )
            if fmu_id:
                return operations.CachedModelExecutableOperation(
                    self._workspace_id,
                    fmu_id,
                    self._workspace_sal,
                    self._model_exe_sal,
                    None,
                    modifiers,
                )
        fmu_id, _ = self._model_exe_sal.fmu_setup(self._workspace_id, body, False)
        return operations.ModelExecutableOperation(
            self._workspace_id,
            self._model_exe_sal.compile_model(self._workspace_id, fmu_id),
            self._workspace_sal,
            self._model_exe_sal,
        )
def compile ( self , compiler_options , runtime_options = None , compiler_log_level = "warning" , fmi_target = "me" , fmi_version = "2.0" , platform = "auto" , force_compilation = False , ) : assert_valid_args ( compiler_options = compiler_options , runtime_options = runtime_options ) compiler_options = ( dict ( compiler_options ) if isinstance ( compiler_options , ExecutionOptions ) else compiler_options if isinstance ( compiler_options , dict ) else { } ) runtime_options = ( dict ( runtime_options ) if isinstance ( runtime_options , ExecutionOptions ) else runtime_options if isinstance ( runtime_options , dict ) else { } ) body = { "input" : { "class_name" : self . _class_name , "compiler_options" : compiler_options , "runtime_options" : runtime_options , "compiler_log_level" : compiler_log_level , "fmi_target" : fmi_target , "fmi_version" : fmi_version , "platform" : platform , } } if not force_compilation : fmu_id , modifiers = self . _model_exe_sal . fmu_setup ( self . _workspace_id , body , True ) if fmu_id : return operations . CachedModelExecutableOperation ( self . _workspace_id , fmu_id , self . _workspace_sal , self . _model_exe_sal , None , modifiers , ) fmu_id , _ = self . _model_exe_sal . fmu_setup ( self . _workspace_id , body , False ) return operations . ModelExecutableOperation ( self . _workspace_id , self . _model_exe_sal . compile_model ( self . _workspace_id , fmu_id ) , self . _workspace_sal , self . _model_exe_sal , )
Compiles the model to an FMU.
Compiles the model to an FMU .
"""Compiles the model to an FMU.
        Returns an modelon.impact.client.operations.ModelExecutableOperation class
        object.

        Parameters:

            compiler_options --
                An compilation options class instance of
                modelon.impact.client.options.ExecutionOptions or
                a dictionary object containing the compiler options.

            runtime_options --
                An runtime options class instance of
                modelon.impact.client.options.ExecutionOptions or
                a dictionary object containing the runtime options. Default: None.

            compiler_log_level --
                The logging for the compiler. Possible values are "error",
                "warning", "info", "verbose" and "debug". Default: 'warning'.

            fmi_target --
                Compiler target. Possible values are 'me' and 'cs'. Default: 'me'.

            fmi_version --
                The FMI version. Valid options are '1.0' and '2.0'. Default: '2.0'.

            platform --
                Platform for FMU binary.The OS running the Impact server must match the
                environment that runs the compiled FMU. This is necessary as the
                binaries packaged with the FMU are based on the platform generating
                the FMU. For example, if the Impact server is running Linux the binary
                in the downloaded FMU is compiled for Linux. The downloaded FMU can
                then not be simulated on Windows.
                Supported options are:-
                    - 'auto': platform is selected automatically.
                    - "linux64": generate a 32 bit FMU.
                    - "win32": generate a 32 bit FMU.
                    - "win64": generate a 64 bit FMU
                Default: 'auto'.

            force_compilation --
                Force a model compilation.

        Returns:

            modelexecutableoperation --
                An modelon.impact.client.operations.ModelExecutableOperation class
                object.

        Example::

            compile_ops=model.compile(compiler_options)
            compile_ops.cancel()
            compile_ops.status()
            compiler_options=custom_function.get_compiler_options.with_values(c_compiler='gcc')
            runtime_options={'cs_solver':0}
            model.compile(compiler_options, runtime_options).wait()
            model.compile({'c_compiler':'gcc'}).wait()
        """ # No cached FMU, setup up a new one
self
compiler_options
runtime_options
compiler_log_level
fmi_target
fmi_version
platform
force_compilation