Second method: Beside your Modelica program, you need to define an interfacing function for your block. In the interfacing function, the name of the joint Modelica model, input/output variable names, input/output types (explicit or implicit), as well as the dialog box for modifying the the block parameters in Scicos can be defined. Several examples of Modelica blocks are available in Electrical and Thermo-Hydraulics palettes.
Remind that, once the interfacing function built, it should be loaded in Scilab, by executing this command in Scilab:
getf("myblock.sci");
You can load your block using "add new block" item in the "Edit" menu of Scicos.
modelica_libs=[modelica_libs,'MyModelicalibs']
The Modelica compiler looks for all Modelica files in the directories given by "modelica_libs" and use them for compile the main Modelica model generated by Scicos.
function Optimal input Real x; input Real y; output Real Optimal_out; external; end Optimal;
#include "Maths.h" double Optimal(double x,double y);
The modelica compiler looks for required external libraries in the directories given by "modelica_libs". The user can place the Modelica model, the header file, and the libraries in a directory e.g., Mylibs and then in Scilab execute the command:
modelica_libs=[modelica_libs,'Mylibs']