myFunction#

Python module for external functions

WARNING: You must add all the necessary libraries here to make the function work in the main loop.

This file includes an example with a gain function. It only scales the input with the value set in the parameter ‘gain’.

Functions

myFunction(time, inputs, params)

External function 'myFunction'

myFunction._init_()#

External function initialization data

Data and parameters must be set in this function before loading it in the simulator. It contains 2 dictionary variables:

  • io_data: Contains the block run_ord parameter, number of inputs and outputs.

  • params: Contains all the required parameters for the function. For this example, it contains ‘gain’ only.

myFunction.myFunction(time, inputs, params)#

External function ‘myFunction’

WARNING: This function needs to have the same name as the file/module that contains it, otherwise it won’t work.

Parameters
  • time (float) – Time value for the main loop.

  • inputs (dict{numpy.darray}) – Dictionary with all the input values

  • params (dict{str}) – Dictionary with all the necessary parameters for the function

Returns

Dictionary with the output(s) as float or numpy vector

Return type

dict{numpy.darray}