%% File : cartpend_sim.tlc
%% Created: Mon Feb  6 10:57:16 2017
%%
%% Description: 
%%   Simulink Coder wrapper functions interface generated for 
%%   S-function "cartpend_sim.c".
%%
%%         File generated by S-function Builder Block
%%
%%   For more information on using the Target Language with the 
%%   Simulink Coder, see the Target Language Compiler manual
%%   (under Simulink Coder) in the "Inlining S-Functions"
%%   chapter under the section and subsection:
%%     "Writing Block Target Files to Inline S-Functions",
%%        "Function-Based or Wrappered Code".
%%
%implements  cartpend_sim "C"
%% Function: BlockTypeSetup ===================================================
%%
%% Purpose:
%%      Set up external references for wrapper functions in the 
%%      generated code.
%%
%function BlockTypeSetup(block, system) Output
  %openfile externs
    
  extern void cartpend_sim_Outputs_wrapper(const real_T *u0,
			real_T *y0,
			const real_T *xC);
  extern void cartpend_sim_Derivatives_wrapper(const real_T *u0,
			const real_T *y0,
			real_T *dx,
			real_T *xC);
  %closefile externs
  %<LibCacheExtern(externs)>
  %%
%endfunction

%% InitializeConditions =========================================================
 %%
 %function InitializeConditions(block, system) Output
  /* %<Type> Block: %<Name> */
  
  { 
   real_T *xC   = &%<LibBlockContinuousState("", "", 0)>;
   
   
    xC[0] =  0;
    xC[1] =  0;
    xC[2] =  3.14;
    xC[3] =  0;
  }
 %endfunction
%% Function: Outputs ==========================================================
%%
%% Purpose:
%%      Code generation rules for mdlOutputs function.
%%
%function Outputs(block, system) Output
  %%
  %assign pu0 = LibBlockInputSignalAddr(0, "", "", 0)
  %assign py0 = LibBlockOutputSignalAddr(0, "", "", 0)
  %assign py_width = LibBlockOutputSignalWidth(0)
  %assign pu_width = LibBlockInputSignalWidth(0)
 { 
    real_T *pxc = &%<LibBlockContinuousState("", "", 0)>;
    cartpend_sim_Outputs_wrapper(%<pu0>, %<py0>, pxc);

  }  %%
%endfunction


%% Function: Derivatives ======================================================
%% Abstract:
%%      Derivatives
%%
%function Derivatives(block, system) Output
   /* S-Function "cartpend_sim_wrapper" Block: %<Name> */  

  
  %assign pu0 = LibBlockInputSignalAddr(0, "", "", 0)
  
  %assign py0 = LibBlockOutputSignalAddr(0, "", "", 0)
  
  
 
  
 { 
   real_T *pxc = &%<LibBlockContinuousState("", "", 0)>;
   real_T *dx  =  &%<LibBlockContinuousStateDerivative("","",0)>;
   cartpend_sim_Derivatives_wrapper(%<pu0>, %<py0>, dx, pxc);
  }
  %%
%endfunction 
%% [EOF] cartpend_sim.tlc





