[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[TRNSYS-users] Exporting Types to SIMULINK (or not...)



Dear users,

A growing number of users have contacted me about difficulties to export Trnsys types (such as the ones from the latest version of the TESS libraries) to SIMULINK.

It turns out that the current ‘export to SIMULINK’ function has been designed for Trnsys 16 coding conventions; it does not work for types using Trnsys 17 coding conventions. In other words, types containing the line

     Call SetTypeVersion(17)

cannot be exported, only those containing

                   INFO(12)=16

(and earlier, such as = 15) will currently work in Matlab/SIMULINK using this approach. The mechanism relies on the function signature using arguments, like in

extern "C" __declspec(dllexport)

int TYPE6 (  double &time,  // the simulation time

             double xin[],  // the array containing the component Inputs

             double xout[], // the array which the component fills with its appropriate OUTPUTS

             double &t,     // the array containing the dependent variables for which the derivatives are evaluated

             double &dtdt,  // the array containing the derivatives of T which are evaluated

             double par[],  // the array containing the PARAMETERS of the component

             int info[],    // the information array described in Section 3.3.3 of the manual

             int icntrl     // the control array described in Section 3.3.4 of the manual

            );

Werner