// Copyright (c) CNES 2008 // // This software is part of CelestLab, a CNES toolbox for Scilab // // This software is governed by the CeCILL license under French law and // abiding by the rules of distribution of free software. You can use, // modify and/ or redistribute the software under the terms of the CeCILL // license as circulated by CEA, CNRS and INRIA at the following URL // 'http://www.cecill.info'. function CL_init(init_glob) // Creation of useful (local) variables // // Calling Sequence // CL_init() // // Description // // //

Convenience function that creates a few (local) variables containing useful data.

//

These data consist of physical quantities and constants that are commonly used // in practice.

//

//

The created variables are:

//
// // %CL_mu: Gravitational constant default value // %CL_eqRad: Equatorial radius default value // %CL_obla: Oblateness default value // %CL_j1jn: Zonal harmonics default value // %CL_cs1nm: Tesseral and sectorial harmonics default value // %CL_rotrBody: Body rotation rate default value // %CL_rotrBodySun: Body to Sun direction (mean) rotation rate default value // %CL_TT_TREF: TT time scale minus TREF time scale defaut value // %CL_UT1_TREF: UT1 time scale minus TREF time scale defaut value // %CL_deg2rad: Degrees to radians conversion factor // %CL_rad2deg: Radians to degrees conversion factor // %CL_au: Astronomical unit (mean Earth to Sun distance) // %CL_body: Structure of solar system bodies data (eqRad,mu,obla) // //
// // Authors // CNES - DCT/SB // // See also // CL_dataGet // // Examples // CL_init(); // whos -name "%CL" // Declarations: global %CL__PRIV; // Code: // NB: init_glob not used anymore but still in the calling sequence for backward compatibility // Check that %CL__PRIV is a structure if (~isstruct(%CL__PRIV)) CL__error("Invalid global variable %CL__PRIV. Restart CelestLab."); end // Check that data exists if (~isfield(%CL__PRIV, "DATA")) CL__error("Invalid global variable %CL__PRIV. Restart CelestLab.") end // Variables returned as locals = // variables that are used as default arguments of CelestLab functions str_var = ["deg2rad", "rad2deg", "eqRad", "mu", "obla", "j1jn", "cs1nm", ... "au", "rotrBody", "rotrBodySun", "TT_TREF", "UT1_TREF", "body" ]; for str = str_var if (~isfield(%CL__PRIV.DATA,str)); CL__error("Variable " + str + " missing in %CL__PRIV.DATA. Restart CelestLab."); end end str_loc = strcat("%CL_" + str_var, ","); str_glob = strcat("%CL__PRIV.DATA." + str_var, ","); cmd = "[" + str_loc + "] = return(" + str_glob + ")"; // WARNING: Do NOT use errcatch argument of execstr // (Scilab bug with 'return' instruction) execstr(cmd); endfunction