/* Include files */

#include "blascompat32.h"
#include "Merici_jednotka_sfun.h"
#include "c2_Merici_jednotka.h"
#include "mwmathutil.h"
#define CHARTINSTANCE_CHARTNUMBER      (chartInstance.chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER   (chartInstance.instanceNumber)
#include "Merici_jednotka_sfun_debug_macros.h"

/* Type Definitions */

/* Named Constants */
#define c2_IN_NO_ACTIVE_CHILD          (0)

/* Variable Declarations */

/* Variable Definitions */
static SFc2_Merici_jednotkaInstanceStruct chartInstance;

/* Function Declarations */
static void initialize_c2_Merici_jednotka(void);
static void initialize_params_c2_Merici_jednotka(void);
static void enable_c2_Merici_jednotka(void);
static void disable_c2_Merici_jednotka(void);
static void c2_update_debugger_state_c2_Merici_jednotka(void);
static const mxArray *get_sim_state_c2_Merici_jednotka(void);
static void set_sim_state_c2_Merici_jednotka(const mxArray *c2_st);
static void finalize_c2_Merici_jednotka(void);
static void sf_c2_Merici_jednotka(void);
static void c2_c2_Merici_jednotka(void);
static void init_script_number_translation(uint32_T c2_machineNumber, uint32_T
  c2_chartNumber);
static int16_T c2_abs(int16_T c2_x);
static const mxArray *c2_sf_marshall(void *c2_chartInstance, void *c2_u);
static const mxArray *c2_b_sf_marshall(void *c2_chartInstance, void *c2_u);
static const mxArray *c2_c_sf_marshall(void *c2_chartInstance, void *c2_u);
static void c2_info_helper(c2_ResolvedFunctionInfo c2_info[17]);
static real_T c2_emlrt_marshallIn(const mxArray *c2_H1, char *c2_name);
static real_T c2_b_emlrt_marshallIn(const mxArray *c2_H2, char *c2_name);
static real_T c2_c_emlrt_marshallIn(const mxArray *c2_L, char *c2_name);
static real_T c2_d_emlrt_marshallIn(const mxArray *c2_T1, char *c2_name);
static real_T c2_e_emlrt_marshallIn(const mxArray *c2_T2, char *c2_name);
static real_T c2_f_emlrt_marshallIn(const mxArray *c2_T3, char *c2_name);
static real_T c2_g_emlrt_marshallIn(const mxArray *c2_Ts, char *c2_name);
static uint8_T c2_h_emlrt_marshallIn(const mxArray
  *c2_b_is_active_c2_Merici_jednotka, char *c2_name);
static void init_io_bus_offset(void);
static void init_dsm_address_info(void);

/* Function Definitions */
static void initialize_c2_Merici_jednotka(void)
{
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  chartInstance.c2_is_active_c2_Merici_jednotka = 0U;
}

static void initialize_params_c2_Merici_jednotka(void)
{
}

static void enable_c2_Merici_jednotka(void)
{
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
}

static void disable_c2_Merici_jednotka(void)
{
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
}

static void c2_update_debugger_state_c2_Merici_jednotka(void)
{
}

static const mxArray *get_sim_state_c2_Merici_jednotka(void)
{
  const mxArray *c2_st = NULL;
  const mxArray *c2_y = NULL;
  real_T c2_u;
  const mxArray *c2_b_y = NULL;
  real_T c2_b_u;
  const mxArray *c2_c_y = NULL;
  real_T c2_c_u;
  const mxArray *c2_d_y = NULL;
  real_T c2_d_u;
  const mxArray *c2_e_y = NULL;
  real_T c2_e_u;
  const mxArray *c2_f_y = NULL;
  real_T c2_f_u;
  const mxArray *c2_g_y = NULL;
  real_T c2_g_u;
  const mxArray *c2_h_y = NULL;
  uint8_T c2_h_u;
  const mxArray *c2_i_y = NULL;
  real_T *c2_H1;
  real_T *c2_H2;
  real_T *c2_L;
  real_T *c2_T1;
  real_T *c2_T2;
  real_T *c2_T3;
  real_T *c2_Ts;
  c2_L = (real_T *)ssGetOutputPortSignal(chartInstance.S, 7);
  c2_H1 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 5);
  c2_T2 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 3);
  c2_T3 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 4);
  c2_Ts = (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
  c2_H2 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 6);
  c2_T1 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 2);
  c2_st = NULL;
  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_createcellarray(8));
  c2_u = *c2_H1;
  c2_b_y = NULL;
  sf_mex_assign(&c2_b_y, sf_mex_create("y", &c2_u, 0, 0U, 0U, 0U, 0));
  sf_mex_setcell(c2_y, 0, c2_b_y);
  c2_b_u = *c2_H2;
  c2_c_y = NULL;
  sf_mex_assign(&c2_c_y, sf_mex_create("y", &c2_b_u, 0, 0U, 0U, 0U, 0));
  sf_mex_setcell(c2_y, 1, c2_c_y);
  c2_c_u = *c2_L;
  c2_d_y = NULL;
  sf_mex_assign(&c2_d_y, sf_mex_create("y", &c2_c_u, 0, 0U, 0U, 0U, 0));
  sf_mex_setcell(c2_y, 2, c2_d_y);
  c2_d_u = *c2_T1;
  c2_e_y = NULL;
  sf_mex_assign(&c2_e_y, sf_mex_create("y", &c2_d_u, 0, 0U, 0U, 0U, 0));
  sf_mex_setcell(c2_y, 3, c2_e_y);
  c2_e_u = *c2_T2;
  c2_f_y = NULL;
  sf_mex_assign(&c2_f_y, sf_mex_create("y", &c2_e_u, 0, 0U, 0U, 0U, 0));
  sf_mex_setcell(c2_y, 4, c2_f_y);
  c2_f_u = *c2_T3;
  c2_g_y = NULL;
  sf_mex_assign(&c2_g_y, sf_mex_create("y", &c2_f_u, 0, 0U, 0U, 0U, 0));
  sf_mex_setcell(c2_y, 5, c2_g_y);
  c2_g_u = *c2_Ts;
  c2_h_y = NULL;
  sf_mex_assign(&c2_h_y, sf_mex_create("y", &c2_g_u, 0, 0U, 0U, 0U, 0));
  sf_mex_setcell(c2_y, 6, c2_h_y);
  c2_h_u = chartInstance.c2_is_active_c2_Merici_jednotka;
  c2_i_y = NULL;
  sf_mex_assign(&c2_i_y, sf_mex_create("y", &c2_h_u, 3, 0U, 0U, 0U, 0));
  sf_mex_setcell(c2_y, 7, c2_i_y);
  sf_mex_assign(&c2_st, c2_y);
  return c2_st;
}

static void set_sim_state_c2_Merici_jednotka(const mxArray *c2_st)
{
  const mxArray *c2_u;
  real_T *c2_H1;
  real_T *c2_H2;
  real_T *c2_L;
  real_T *c2_T1;
  real_T *c2_T2;
  real_T *c2_T3;
  real_T *c2_Ts;
  c2_L = (real_T *)ssGetOutputPortSignal(chartInstance.S, 7);
  c2_H1 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 5);
  c2_T2 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 3);
  c2_T3 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 4);
  c2_Ts = (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
  c2_H2 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 6);
  c2_T1 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 2);
  chartInstance.c2_doneDoubleBufferReInit = true;
  c2_u = sf_mex_dup(c2_st);
  *c2_H1 = c2_emlrt_marshallIn(sf_mex_dup(sf_mex_getcell(c2_u, 0)), "H1");
  *c2_H2 = c2_b_emlrt_marshallIn(sf_mex_dup(sf_mex_getcell(c2_u, 1)), "H2");
  *c2_L = c2_c_emlrt_marshallIn(sf_mex_dup(sf_mex_getcell(c2_u, 2)), "L");
  *c2_T1 = c2_d_emlrt_marshallIn(sf_mex_dup(sf_mex_getcell(c2_u, 3)), "T1");
  *c2_T2 = c2_e_emlrt_marshallIn(sf_mex_dup(sf_mex_getcell(c2_u, 4)), "T2");
  *c2_T3 = c2_f_emlrt_marshallIn(sf_mex_dup(sf_mex_getcell(c2_u, 5)), "T3");
  *c2_Ts = c2_g_emlrt_marshallIn(sf_mex_dup(sf_mex_getcell(c2_u, 6)), "Ts");
  chartInstance.c2_is_active_c2_Merici_jednotka = c2_h_emlrt_marshallIn
    (sf_mex_dup(sf_mex_getcell(c2_u, 7)),
     "is_active_c2_Merici_jednotka");
  sf_mex_destroy(&c2_u);
  c2_update_debugger_state_c2_Merici_jednotka();
  sf_mex_destroy(&c2_st);
}

static void finalize_c2_Merici_jednotka(void)
{
}

static void sf_c2_Merici_jednotka(void)
{
  uint8_T c2_previousEvent;
  real_T *c2_Ts;
  real_T *c2_T1;
  real_T *c2_T2;
  int16_T *c2_Temp;
  int16_T *c2_Hum;
  uint8_T *c2_Light;
  real_T *c2_T3;
  real_T *c2_H1;
  real_T *c2_H2;
  real_T *c2_L;
  c2_L = (real_T *)ssGetOutputPortSignal(chartInstance.S, 7);
  c2_Hum = (int16_T *)ssGetInputPortSignal(chartInstance.S, 1);
  c2_H1 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 5);
  c2_T2 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 3);
  c2_T3 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 4);
  c2_Ts = (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
  c2_Light = (uint8_T *)ssGetInputPortSignal(chartInstance.S, 2);
  c2_H2 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 6);
  c2_T1 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 2);
  c2_Temp = (int16_T *)ssGetInputPortSignal(chartInstance.S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG,1);
  _SFD_DATA_RANGE_CHECK(*c2_Ts, 0U);
  _SFD_DATA_RANGE_CHECK(*c2_T1, 1U);
  _SFD_DATA_RANGE_CHECK(*c2_T2, 2U);
  _SFD_DATA_RANGE_CHECK((real_T)*c2_Temp, 3U);
  _SFD_DATA_RANGE_CHECK((real_T)*c2_Hum, 4U);
  _SFD_DATA_RANGE_CHECK((real_T)*c2_Light, 5U);
  _SFD_DATA_RANGE_CHECK(*c2_T3, 6U);
  _SFD_DATA_RANGE_CHECK(*c2_H1, 7U);
  _SFD_DATA_RANGE_CHECK(*c2_H2, 8U);
  _SFD_DATA_RANGE_CHECK(*c2_L, 9U);
  c2_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  c2_c2_Merici_jednotka();
  _sfEvent_ = c2_previousEvent;
  sf_debug_check_for_state_inconsistency(_Merici_jednotkaMachineNumber_,
    chartInstance.chartNumber, chartInstance.instanceNumber);
}

static void c2_c2_Merici_jednotka(void)
{
  int16_T c2_Temp;
  int16_T c2_Hum;
  uint8_T c2_Light;
  real_T c2_nargout = 7.0;
  real_T c2_nargin = 3.0;
  int16_T c2_Hum1;
  real_T c2_h1;
  int16_T c2_Temp3;
  real_T c2_t2;
  int16_T c2_Temp2;
  real_T c2_t1;
  int16_T c2_Temp1;
  real_T c2_L;
  real_T c2_H2;
  real_T c2_H1;
  real_T c2_T3;
  real_T c2_T2;
  real_T c2_T1;
  real_T c2_Ts;
  real_T c2_d0;
  real_T c2_d1;
  real_T c2_d2;
  int16_T c2_i0;
  real_T c2_d3;
  real_T c2_d4;
  real_T c2_d5;
  int16_T c2_i1;
  real_T c2_d6;
  real_T c2_d7;
  real_T c2_d8;
  int16_T c2_i2;
  int16_T *c2_b_Temp;
  int16_T *c2_b_Hum;
  uint8_T *c2_b_Light;
  real_T *c2_b_Ts;
  real_T *c2_b_T1;
  real_T *c2_b_T2;
  real_T *c2_b_T3;
  real_T *c2_b_H1;
  real_T *c2_b_H2;
  real_T *c2_b_L;
  c2_b_L = (real_T *)ssGetOutputPortSignal(chartInstance.S, 7);
  c2_b_Hum = (int16_T *)ssGetInputPortSignal(chartInstance.S, 1);
  c2_b_H1 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 5);
  c2_b_T2 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 3);
  c2_b_T3 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 4);
  c2_b_Ts = (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
  c2_b_Light = (uint8_T *)ssGetInputPortSignal(chartInstance.S, 2);
  c2_b_H2 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 6);
  c2_b_T1 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 2);
  c2_b_Temp = (int16_T *)ssGetInputPortSignal(chartInstance.S, 0);
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,1);
  c2_Temp = *c2_b_Temp;
  c2_Hum = *c2_b_Hum;
  c2_Light = *c2_b_Light;
  sf_debug_symbol_scope_push(19U, 0U);
  sf_debug_symbol_scope_add("nargout", &c2_nargout, c2_c_sf_marshall);
  sf_debug_symbol_scope_add("nargin", &c2_nargin, c2_c_sf_marshall);
  sf_debug_symbol_scope_add("Hum1", &c2_Hum1, c2_sf_marshall);
  sf_debug_symbol_scope_add("h1", &c2_h1, c2_c_sf_marshall);
  sf_debug_symbol_scope_add("Temp3", &c2_Temp3, c2_sf_marshall);
  sf_debug_symbol_scope_add("t2", &c2_t2, c2_c_sf_marshall);
  sf_debug_symbol_scope_add("Temp2", &c2_Temp2, c2_sf_marshall);
  sf_debug_symbol_scope_add("t1", &c2_t1, c2_c_sf_marshall);
  sf_debug_symbol_scope_add("Temp1", &c2_Temp1, c2_sf_marshall);
  sf_debug_symbol_scope_add("L", &c2_L, c2_c_sf_marshall);
  sf_debug_symbol_scope_add("H2", &c2_H2, c2_c_sf_marshall);
  sf_debug_symbol_scope_add("H1", &c2_H1, c2_c_sf_marshall);
  sf_debug_symbol_scope_add("T3", &c2_T3, c2_c_sf_marshall);
  sf_debug_symbol_scope_add("T2", &c2_T2, c2_c_sf_marshall);
  sf_debug_symbol_scope_add("T1", &c2_T1, c2_c_sf_marshall);
  sf_debug_symbol_scope_add("Ts", &c2_Ts, c2_c_sf_marshall);
  sf_debug_symbol_scope_add("Light", &c2_Light, c2_b_sf_marshall);
  sf_debug_symbol_scope_add("Hum", &c2_Hum, c2_sf_marshall);
  sf_debug_symbol_scope_add("Temp", &c2_Temp, c2_sf_marshall);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0,3);
  if (CV_EML_IF(0, 0, (real_T)c2_Temp < 0.0)) {
    _SFD_EML_CALL(0,4);
    c2_Ts = 45.0;
  } else {
    _SFD_EML_CALL(0,6);
    c2_Ts = 43.0;
  }

  _SFD_EML_CALL(0,9);
  c2_Temp1 = c2_abs(c2_Temp);

  /*  prevod teploty */
  _SFD_EML_CALL(0,11);
  if (CV_EML_COND(0, 0, (real_T)c2_Temp1 >= 100.0)) {
    if (CV_EML_COND(0, 1, (real_T)c2_Temp1 < 200.0)) {
      CV_EML_MCDC(0, 0, true);
      CV_EML_IF(0, 1, true);
      _SFD_EML_CALL(0,12);
      c2_T1 = 49.0;
      _SFD_EML_CALL(0,13);
      c2_t1 = 100.0;
      goto label_1;
    }
  }

  CV_EML_MCDC(0, 0, false);
  CV_EML_IF(0, 1, false);
  _SFD_EML_CALL(0,14);
  if (CV_EML_COND(0, 2, (real_T)c2_Temp1 >= 200.0)) {
    if (CV_EML_COND(0, 3, (real_T)c2_Temp1 < 300.0)) {
      CV_EML_MCDC(0, 1, true);
      CV_EML_IF(0, 2, true);
      _SFD_EML_CALL(0,15);
      c2_T1 = 50.0;
      _SFD_EML_CALL(0,16);
      c2_t1 = 200.0;
      goto label_2;
    }
  }

  CV_EML_MCDC(0, 1, false);
  CV_EML_IF(0, 2, false);
  _SFD_EML_CALL(0,17);
  if (CV_EML_COND(0, 4, (real_T)c2_Temp1 > 300.0)) {
    if (CV_EML_COND(0, 5, (real_T)c2_Temp1 < 400.0)) {
      CV_EML_MCDC(0, 2, true);
      CV_EML_IF(0, 3, true);
      _SFD_EML_CALL(0,18);
      c2_T1 = 51.0;
      _SFD_EML_CALL(0,19);
      c2_t1 = 300.0;
      goto label_3;
    }
  }

  CV_EML_MCDC(0, 2, false);
  CV_EML_IF(0, 3, false);
  _SFD_EML_CALL(0,20);
  if (CV_EML_COND(0, 6, (real_T)c2_Temp1 >= 400.0)) {
    if (CV_EML_COND(0, 7, (real_T)c2_Temp1 < 500.0)) {
      CV_EML_MCDC(0, 3, true);
      CV_EML_IF(0, 4, true);
      _SFD_EML_CALL(0,21);
      c2_T1 = 52.0;
      _SFD_EML_CALL(0,22);
      c2_t1 = 400.0;
      goto label_4;
    }
  }

  CV_EML_MCDC(0, 3, false);
  CV_EML_IF(0, 4, false);
  _SFD_EML_CALL(0,23);
  if (CV_EML_COND(0, 8, (real_T)c2_Temp1 >= 500.0)) {
    if (CV_EML_COND(0, 9, (real_T)c2_Temp1 < 600.0)) {
      CV_EML_MCDC(0, 4, true);
      CV_EML_IF(0, 5, true);
      _SFD_EML_CALL(0,24);
      c2_T1 = 53.0;
      _SFD_EML_CALL(0,25);
      c2_t1 = 500.0;
      goto label_5;
    }
  }

  CV_EML_MCDC(0, 4, false);
  CV_EML_IF(0, 5, false);
  _SFD_EML_CALL(0,26);
  if (CV_EML_COND(0, 10, (real_T)c2_Temp1 >= 600.0)) {
    if (CV_EML_COND(0, 11, (real_T)c2_Temp1 < 700.0)) {
      CV_EML_MCDC(0, 5, true);
      CV_EML_IF(0, 6, true);
      _SFD_EML_CALL(0,27);
      c2_T1 = 54.0;
      _SFD_EML_CALL(0,28);
      c2_t1 = 600.0;
      goto label_6;
    }
  }

  CV_EML_MCDC(0, 5, false);
  CV_EML_IF(0, 6, false);
  _SFD_EML_CALL(0,29);
  if (CV_EML_COND(0, 12, (real_T)c2_Temp1 >= 700.0)) {
    if (CV_EML_COND(0, 13, (real_T)c2_Temp1 < 800.0)) {
      CV_EML_MCDC(0, 6, true);
      CV_EML_IF(0, 7, true);
      _SFD_EML_CALL(0,30);
      c2_T1 = 55.0;
      _SFD_EML_CALL(0,31);
      c2_t1 = 700.0;
      goto label_7;
    }
  }

  CV_EML_MCDC(0, 6, false);
  CV_EML_IF(0, 7, false);
  _SFD_EML_CALL(0,32);
  if (CV_EML_COND(0, 14, (real_T)c2_Temp1 >= 800.0)) {
    if (CV_EML_COND(0, 15, (real_T)c2_Temp1 < 900.0)) {
      CV_EML_MCDC(0, 7, true);
      CV_EML_IF(0, 8, true);
      _SFD_EML_CALL(0,33);
      c2_T1 = 56.0;
      _SFD_EML_CALL(0,34);
      c2_t1 = 800.0;
      goto label_8;
    }
  }

  CV_EML_MCDC(0, 7, false);
  CV_EML_IF(0, 8, false);
  _SFD_EML_CALL(0,35);
  if (CV_EML_IF(0, 9, (real_T)c2_Temp1 >= 900.0)) {
    _SFD_EML_CALL(0,36);
    c2_T1 = 57.0;
    _SFD_EML_CALL(0,37);
    c2_t1 = 900.0;
  } else {
    _SFD_EML_CALL(0,39);
    c2_T1 = 48.0;
    _SFD_EML_CALL(0,40);
    c2_t1 = 0.0;
  }

 label_8:
  ;
 label_7:
  ;
 label_6:
  ;
 label_5:
  ;
 label_4:
  ;
 label_3:
  ;
 label_2:
  ;
 label_1:
  ;
  _SFD_EML_CALL(0,43);
  c2_d0 = (real_T)c2_Temp1 - c2_t1;
  c2_d1 = c2_d0;
  c2_d1 = c2_d1 < 0.0 ? muDoubleScalarCeil(c2_d1 - 0.5) : muDoubleScalarFloor
    (c2_d1 + 0.5);
  c2_d2 = c2_d1;
  if (c2_d2 < 32768.0) {
    if (c2_d2 >= -32768.0) {
      c2_i0 = (int16_T)c2_d2;
    } else {
      c2_i0 = MIN_int16_T;
    }
  } else if (c2_d2 >= 32768.0) {
    c2_i0 = MAX_int16_T;
  } else {
    c2_i0 = 0;
  }

  c2_Temp2 = c2_i0;
  _SFD_EML_CALL(0,45);
  if (CV_EML_COND(0, 16, (real_T)c2_Temp2 >= 10.0)) {
    if (CV_EML_COND(0, 17, (real_T)c2_Temp2 < 20.0)) {
      CV_EML_MCDC(0, 8, true);
      CV_EML_IF(0, 10, true);
      _SFD_EML_CALL(0,46);
      c2_T2 = 49.0;
      _SFD_EML_CALL(0,47);
      c2_t2 = 10.0;
      goto label_9;
    }
  }

  CV_EML_MCDC(0, 8, false);
  CV_EML_IF(0, 10, false);
  _SFD_EML_CALL(0,48);
  if (CV_EML_COND(0, 18, (real_T)c2_Temp2 >= 20.0)) {
    if (CV_EML_COND(0, 19, (real_T)c2_Temp2 < 30.0)) {
      CV_EML_MCDC(0, 9, true);
      CV_EML_IF(0, 11, true);
      _SFD_EML_CALL(0,49);
      c2_T2 = 50.0;
      _SFD_EML_CALL(0,50);
      c2_t2 = 20.0;
      goto label_10;
    }
  }

  CV_EML_MCDC(0, 9, false);
  CV_EML_IF(0, 11, false);
  _SFD_EML_CALL(0,51);
  if (CV_EML_COND(0, 20, (real_T)c2_Temp2 >= 30.0)) {
    if (CV_EML_COND(0, 21, (real_T)c2_Temp2 < 40.0)) {
      CV_EML_MCDC(0, 10, true);
      CV_EML_IF(0, 12, true);
      _SFD_EML_CALL(0,52);
      c2_T2 = 51.0;
      _SFD_EML_CALL(0,53);
      c2_t2 = 30.0;
      goto label_11;
    }
  }

  CV_EML_MCDC(0, 10, false);
  CV_EML_IF(0, 12, false);
  _SFD_EML_CALL(0,54);
  if (CV_EML_COND(0, 22, (real_T)c2_Temp2 >= 40.0)) {
    if (CV_EML_COND(0, 23, (real_T)c2_Temp2 < 50.0)) {
      CV_EML_MCDC(0, 11, true);
      CV_EML_IF(0, 13, true);
      _SFD_EML_CALL(0,55);
      c2_T2 = 52.0;
      _SFD_EML_CALL(0,56);
      c2_t2 = 40.0;
      goto label_12;
    }
  }

  CV_EML_MCDC(0, 11, false);
  CV_EML_IF(0, 13, false);
  _SFD_EML_CALL(0,57);
  if (CV_EML_COND(0, 24, (real_T)c2_Temp2 >= 50.0)) {
    if (CV_EML_COND(0, 25, (real_T)c2_Temp2 < 60.0)) {
      CV_EML_MCDC(0, 12, true);
      CV_EML_IF(0, 14, true);
      _SFD_EML_CALL(0,58);
      c2_T2 = 53.0;
      _SFD_EML_CALL(0,59);
      c2_t2 = 50.0;
      goto label_13;
    }
  }

  CV_EML_MCDC(0, 12, false);
  CV_EML_IF(0, 14, false);
  _SFD_EML_CALL(0,60);
  if (CV_EML_COND(0, 26, (real_T)c2_Temp2 >= 60.0)) {
    if (CV_EML_COND(0, 27, (real_T)c2_Temp2 < 70.0)) {
      CV_EML_MCDC(0, 13, true);
      CV_EML_IF(0, 15, true);
      _SFD_EML_CALL(0,61);
      c2_T2 = 54.0;
      _SFD_EML_CALL(0,62);
      c2_t2 = 60.0;
      goto label_14;
    }
  }

  CV_EML_MCDC(0, 13, false);
  CV_EML_IF(0, 15, false);
  _SFD_EML_CALL(0,63);
  if (CV_EML_COND(0, 28, (real_T)c2_Temp2 >= 70.0)) {
    if (CV_EML_COND(0, 29, (real_T)c2_Temp2 < 80.0)) {
      CV_EML_MCDC(0, 14, true);
      CV_EML_IF(0, 16, true);
      _SFD_EML_CALL(0,64);
      c2_T2 = 55.0;
      _SFD_EML_CALL(0,65);
      c2_t2 = 70.0;
      goto label_15;
    }
  }

  CV_EML_MCDC(0, 14, false);
  CV_EML_IF(0, 16, false);
  _SFD_EML_CALL(0,66);
  if (CV_EML_COND(0, 30, (real_T)c2_Temp1 >= 80.0)) {
    if (CV_EML_COND(0, 31, (real_T)c2_Temp1 < 90.0)) {
      CV_EML_MCDC(0, 15, true);
      CV_EML_IF(0, 17, true);
      _SFD_EML_CALL(0,67);
      c2_T2 = 56.0;
      _SFD_EML_CALL(0,68);
      c2_t2 = 80.0;
      goto label_16;
    }
  }

  CV_EML_MCDC(0, 15, false);
  CV_EML_IF(0, 17, false);
  _SFD_EML_CALL(0,69);
  if (CV_EML_IF(0, 18, (real_T)c2_Temp >= 90.0)) {
    _SFD_EML_CALL(0,70);
    c2_T2 = 57.0;
    _SFD_EML_CALL(0,71);
    c2_t2 = 90.0;
  } else {
    _SFD_EML_CALL(0,73);
    c2_T2 = 48.0;
    _SFD_EML_CALL(0,74);
    c2_t2 = 0.0;
  }

 label_16:
  ;
 label_15:
  ;
 label_14:
  ;
 label_13:
  ;
 label_12:
  ;
 label_11:
  ;
 label_10:
  ;
 label_9:
  ;
  _SFD_EML_CALL(0,77);
  c2_d3 = (real_T)c2_Temp2 - c2_t2;
  c2_d4 = c2_d3;
  c2_d4 = c2_d4 < 0.0 ? muDoubleScalarCeil(c2_d4 - 0.5) : muDoubleScalarFloor
    (c2_d4 + 0.5);
  c2_d5 = c2_d4;
  if (c2_d5 < 32768.0) {
    if (c2_d5 >= -32768.0) {
      c2_i1 = (int16_T)c2_d5;
    } else {
      c2_i1 = MIN_int16_T;
    }
  } else if (c2_d5 >= 32768.0) {
    c2_i1 = MAX_int16_T;
  } else {
    c2_i1 = 0;
  }

  c2_Temp3 = c2_i1;
  _SFD_EML_CALL(0,79);
  if (CV_EML_IF(0, 19, (real_T)c2_Temp3 == 1.0)) {
    _SFD_EML_CALL(0,80);
    c2_T3 = 49.0;
  } else {
    _SFD_EML_CALL(0,81);
    if (CV_EML_IF(0, 20, (real_T)c2_Temp3 == 2.0)) {
      _SFD_EML_CALL(0,82);
      c2_T3 = 50.0;
    } else {
      _SFD_EML_CALL(0,83);
      if (CV_EML_IF(0, 21, (real_T)c2_Temp3 == 3.0)) {
        _SFD_EML_CALL(0,84);
        c2_T3 = 51.0;
      } else {
        _SFD_EML_CALL(0,85);
        if (CV_EML_IF(0, 22, (real_T)c2_Temp3 == 4.0)) {
          _SFD_EML_CALL(0,86);
          c2_T3 = 52.0;
        } else {
          _SFD_EML_CALL(0,87);
          if (CV_EML_IF(0, 23, (real_T)c2_Temp3 == 5.0)) {
            _SFD_EML_CALL(0,88);
            c2_T3 = 53.0;
          } else {
            _SFD_EML_CALL(0,89);
            if (CV_EML_IF(0, 24, (real_T)c2_Temp3 == 6.0)) {
              _SFD_EML_CALL(0,90);
              c2_T3 = 54.0;
            } else {
              _SFD_EML_CALL(0,91);
              if (CV_EML_IF(0, 25, (real_T)c2_Temp3 == 7.0)) {
                _SFD_EML_CALL(0,92);
                c2_T3 = 55.0;
              } else {
                _SFD_EML_CALL(0,93);
                if (CV_EML_IF(0, 26, (real_T)c2_Temp3 == 8.0)) {
                  _SFD_EML_CALL(0,94);
                  c2_T3 = 56.0;
                } else {
                  _SFD_EML_CALL(0,95);
                  if (CV_EML_IF(0, 27, (real_T)c2_Temp3 == 9.0)) {
                    _SFD_EML_CALL(0,96);
                    c2_T3 = 57.0;
                  } else {
                    _SFD_EML_CALL(0,98);
                    c2_T3 = 48.0;
                  }
                }
              }
            }
          }
        }
      }
    }
  }

  /*  prevod vlhkosti */
  _SFD_EML_CALL(0,102);
  if (CV_EML_COND(0, 32, (real_T)c2_Hum >= 10.0)) {
    if (CV_EML_COND(0, 33, (real_T)c2_Hum < 20.0)) {
      CV_EML_MCDC(0, 16, true);
      CV_EML_IF(0, 28, true);
      _SFD_EML_CALL(0,103);
      c2_H1 = 49.0;
      _SFD_EML_CALL(0,104);
      c2_h1 = 10.0;
      goto label_17;
    }
  }

  CV_EML_MCDC(0, 16, false);
  CV_EML_IF(0, 28, false);
  _SFD_EML_CALL(0,105);
  if (CV_EML_COND(0, 34, (real_T)c2_Hum >= 20.0)) {
    if (CV_EML_COND(0, 35, (real_T)c2_Hum < 30.0)) {
      CV_EML_MCDC(0, 17, true);
      CV_EML_IF(0, 29, true);
      _SFD_EML_CALL(0,106);
      c2_H1 = 50.0;
      _SFD_EML_CALL(0,107);
      c2_h1 = 20.0;
      goto label_18;
    }
  }

  CV_EML_MCDC(0, 17, false);
  CV_EML_IF(0, 29, false);
  _SFD_EML_CALL(0,108);
  if (CV_EML_COND(0, 36, (real_T)c2_Hum >= 30.0)) {
    if (CV_EML_COND(0, 37, (real_T)c2_Hum < 40.0)) {
      CV_EML_MCDC(0, 18, true);
      CV_EML_IF(0, 30, true);
      _SFD_EML_CALL(0,109);
      c2_H1 = 51.0;
      _SFD_EML_CALL(0,110);
      c2_h1 = 30.0;
      goto label_19;
    }
  }

  CV_EML_MCDC(0, 18, false);
  CV_EML_IF(0, 30, false);
  _SFD_EML_CALL(0,111);
  if (CV_EML_COND(0, 38, (real_T)c2_Hum >= 40.0)) {
    if (CV_EML_COND(0, 39, (real_T)c2_Hum < 50.0)) {
      CV_EML_MCDC(0, 19, true);
      CV_EML_IF(0, 31, true);
      _SFD_EML_CALL(0,112);
      c2_H1 = 52.0;
      _SFD_EML_CALL(0,113);
      c2_h1 = 40.0;
      goto label_20;
    }
  }

  CV_EML_MCDC(0, 19, false);
  CV_EML_IF(0, 31, false);
  _SFD_EML_CALL(0,114);
  if (CV_EML_COND(0, 40, (real_T)c2_Hum >= 50.0)) {
    if (CV_EML_COND(0, 41, (real_T)c2_Hum < 60.0)) {
      CV_EML_MCDC(0, 20, true);
      CV_EML_IF(0, 32, true);
      _SFD_EML_CALL(0,115);
      c2_H1 = 53.0;
      _SFD_EML_CALL(0,116);
      c2_h1 = 50.0;
      goto label_21;
    }
  }

  CV_EML_MCDC(0, 20, false);
  CV_EML_IF(0, 32, false);
  _SFD_EML_CALL(0,117);
  if (CV_EML_COND(0, 42, (real_T)c2_Hum >= 60.0)) {
    if (CV_EML_COND(0, 43, (real_T)c2_Hum < 70.0)) {
      CV_EML_MCDC(0, 21, true);
      CV_EML_IF(0, 33, true);
      _SFD_EML_CALL(0,118);
      c2_H1 = 54.0;
      _SFD_EML_CALL(0,119);
      c2_h1 = 60.0;
      goto label_22;
    }
  }

  CV_EML_MCDC(0, 21, false);
  CV_EML_IF(0, 33, false);
  _SFD_EML_CALL(0,120);
  if (CV_EML_COND(0, 44, (real_T)c2_Hum >= 70.0)) {
    if (CV_EML_COND(0, 45, (real_T)c2_Hum < 80.0)) {
      CV_EML_MCDC(0, 22, true);
      CV_EML_IF(0, 34, true);
      _SFD_EML_CALL(0,121);
      c2_H1 = 55.0;
      _SFD_EML_CALL(0,122);
      c2_h1 = 70.0;
      goto label_23;
    }
  }

  CV_EML_MCDC(0, 22, false);
  CV_EML_IF(0, 34, false);
  _SFD_EML_CALL(0,123);
  if (CV_EML_COND(0, 46, (real_T)c2_Hum >= 80.0)) {
    if (CV_EML_COND(0, 47, (real_T)c2_Hum < 90.0)) {
      CV_EML_MCDC(0, 23, true);
      CV_EML_IF(0, 35, true);
      _SFD_EML_CALL(0,124);
      c2_H1 = 56.0;
      _SFD_EML_CALL(0,125);
      c2_h1 = 80.0;
      goto label_24;
    }
  }

  CV_EML_MCDC(0, 23, false);
  CV_EML_IF(0, 35, false);
  _SFD_EML_CALL(0,126);
  if (CV_EML_IF(0, 36, (real_T)c2_Hum >= 90.0)) {
    _SFD_EML_CALL(0,127);
    c2_H1 = 57.0;
    _SFD_EML_CALL(0,128);
    c2_h1 = 90.0;
  } else {
    _SFD_EML_CALL(0,131);
    c2_H1 = 48.0;
    _SFD_EML_CALL(0,132);
    c2_h1 = 0.0;
  }

 label_24:
  ;
 label_23:
  ;
 label_22:
  ;
 label_21:
  ;
 label_20:
  ;
 label_19:
  ;
 label_18:
  ;
 label_17:
  ;
  _SFD_EML_CALL(0,135);
  c2_d6 = (real_T)c2_Hum - c2_h1;
  c2_d7 = c2_d6;
  c2_d7 = c2_d7 < 0.0 ? muDoubleScalarCeil(c2_d7 - 0.5) : muDoubleScalarFloor
    (c2_d7 + 0.5);
  c2_d8 = c2_d7;
  if (c2_d8 < 32768.0) {
    if (c2_d8 >= -32768.0) {
      c2_i2 = (int16_T)c2_d8;
    } else {
      c2_i2 = MIN_int16_T;
    }
  } else if (c2_d8 >= 32768.0) {
    c2_i2 = MAX_int16_T;
  } else {
    c2_i2 = 0;
  }

  c2_Hum1 = c2_i2;
  _SFD_EML_CALL(0,137);
  if (CV_EML_IF(0, 37, (real_T)c2_Hum1 == 1.0)) {
    _SFD_EML_CALL(0,138);
    c2_H2 = 49.0;
  } else {
    _SFD_EML_CALL(0,139);
    if (CV_EML_IF(0, 38, (real_T)c2_Hum1 == 2.0)) {
      _SFD_EML_CALL(0,140);
      c2_H2 = 50.0;
    } else {
      _SFD_EML_CALL(0,141);
      if (CV_EML_IF(0, 39, (real_T)c2_Hum1 == 3.0)) {
        _SFD_EML_CALL(0,142);
        c2_H2 = 51.0;
      } else {
        _SFD_EML_CALL(0,143);
        if (CV_EML_IF(0, 40, (real_T)c2_Hum1 == 4.0)) {
          _SFD_EML_CALL(0,144);
          c2_H2 = 52.0;
        } else {
          _SFD_EML_CALL(0,145);
          if (CV_EML_IF(0, 41, (real_T)c2_Hum1 == 5.0)) {
            _SFD_EML_CALL(0,146);
            c2_H2 = 53.0;
          } else {
            _SFD_EML_CALL(0,147);
            if (CV_EML_IF(0, 42, (real_T)c2_Hum1 == 6.0)) {
              _SFD_EML_CALL(0,148);
              c2_H2 = 54.0;
            } else {
              _SFD_EML_CALL(0,149);
              if (CV_EML_IF(0, 43, (real_T)c2_Hum1 == 7.0)) {
                _SFD_EML_CALL(0,150);
                c2_H2 = 55.0;
              } else {
                _SFD_EML_CALL(0,151);
                if (CV_EML_IF(0, 44, (real_T)c2_Hum1 == 8.0)) {
                  _SFD_EML_CALL(0,152);
                  c2_H2 = 56.0;
                } else {
                  _SFD_EML_CALL(0,153);
                  if (CV_EML_IF(0, 45, (real_T)c2_Hum1 == 9.0)) {
                    _SFD_EML_CALL(0,154);
                    c2_H2 = 57.0;
                  } else {
                    _SFD_EML_CALL(0,156);
                    c2_H2 = 48.0;
                  }
                }
              }
            }
          }
        }
      }
    }
  }

  /*  prevod svetla */
  _SFD_EML_CALL(0,161);
  if (CV_EML_IF(0, 46, (real_T)c2_Light == 1.0)) {
    _SFD_EML_CALL(0,162);
    c2_L = 49.0;
  } else {
    _SFD_EML_CALL(0,164);
    c2_L = 48.0;
  }

  _SFD_EML_CALL(0,-164);
  sf_debug_symbol_scope_pop();
  *c2_b_Ts = c2_Ts;
  *c2_b_T1 = c2_T1;
  *c2_b_T2 = c2_T2;
  *c2_b_T3 = c2_T3;
  *c2_b_H1 = c2_H1;
  *c2_b_H2 = c2_H2;
  *c2_b_L = c2_L;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,1);
}

static void init_script_number_translation(uint32_T c2_machineNumber, uint32_T
  c2_chartNumber)
{
}

static int16_T c2_abs(int16_T c2_x)
{
  int16_T c2_b_x;
  int32_T c2_i3;
  int16_T c2_i4;
  c2_b_x = c2_x;
  if ((real_T)c2_b_x < 0.0) {
    c2_i3 = -c2_b_x;
    if (c2_i3 > 32767) {
      c2_i4 = MAX_int16_T;
    } else if (c2_i3 <= -32768) {
      c2_i4 = MIN_int16_T;
    } else {
      c2_i4 = (int16_T)c2_i3;
    }

    return c2_i4;
  } else {
    return c2_b_x;
  }
}

static const mxArray *c2_sf_marshall(void *c2_chartInstance, void *c2_u)
{
  const mxArray *c2_y = NULL;
  int16_T c2_b_u;
  const mxArray *c2_b_y = NULL;
  c2_y = NULL;
  c2_b_u = *((int16_T *)c2_u);
  c2_b_y = NULL;
  sf_mex_assign(&c2_b_y, sf_mex_create("y", &c2_b_u, 4, 0U, 0U, 0U, 0));
  sf_mex_assign(&c2_y, c2_b_y);
  return c2_y;
}

static const mxArray *c2_b_sf_marshall(void *c2_chartInstance, void *c2_u)
{
  const mxArray *c2_y = NULL;
  uint8_T c2_b_u;
  const mxArray *c2_b_y = NULL;
  c2_y = NULL;
  c2_b_u = *((uint8_T *)c2_u);
  c2_b_y = NULL;
  sf_mex_assign(&c2_b_y, sf_mex_create("y", &c2_b_u, 3, 0U, 0U, 0U, 0));
  sf_mex_assign(&c2_y, c2_b_y);
  return c2_y;
}

static const mxArray *c2_c_sf_marshall(void *c2_chartInstance, void *c2_u)
{
  const mxArray *c2_y = NULL;
  real_T c2_b_u;
  const mxArray *c2_b_y = NULL;
  c2_y = NULL;
  c2_b_u = *((real_T *)c2_u);
  c2_b_y = NULL;
  sf_mex_assign(&c2_b_y, sf_mex_create("y", &c2_b_u, 0, 0U, 0U, 0U, 0));
  sf_mex_assign(&c2_y, c2_b_y);
  return c2_y;
}

const mxArray *sf_c2_Merici_jednotka_get_eml_resolved_functions_info(void)
{
  const mxArray *c2_nameCaptureInfo = NULL;
  c2_ResolvedFunctionInfo c2_info[17];
  const mxArray *c2_m0 = NULL;
  int32_T c2_i5;
  c2_ResolvedFunctionInfo *c2_r0;
  c2_nameCaptureInfo = NULL;
  c2_info_helper(c2_info);
  sf_mex_assign(&c2_m0, sf_mex_createstruct("nameCaptureInfo", 1, 17));
  for (c2_i5 = 0; c2_i5 < 17; c2_i5 = c2_i5 + 1) {
    c2_r0 = &c2_info[c2_i5];
    sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", c2_r0->context, 15,
      0U, 0U, 0U, 2, 1, strlen(c2_r0->context)), "context",
                    "nameCaptureInfo", c2_i5);
    sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", c2_r0->name, 15, 0U,
      0U, 0U, 2, 1, strlen(c2_r0->name)), "name",
                    "nameCaptureInfo", c2_i5);
    sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", c2_r0->dominantType,
      15, 0U, 0U, 0U, 2, 1, strlen(c2_r0->dominantType)),
                    "dominantType", "nameCaptureInfo", c2_i5);
    sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", c2_r0->resolved, 15,
      0U, 0U, 0U, 2, 1, strlen(c2_r0->resolved)), "resolved"
                    , "nameCaptureInfo", c2_i5);
    sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", &c2_r0->fileLength,
      7, 0U, 0U, 0U, 0), "fileLength", "nameCaptureInfo",
                    c2_i5);
    sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", &c2_r0->fileTime1, 7,
      0U, 0U, 0U, 0), "fileTime1", "nameCaptureInfo", c2_i5);
    sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", &c2_r0->fileTime2, 7,
      0U, 0U, 0U, 0), "fileTime2", "nameCaptureInfo", c2_i5);
  }

  sf_mex_assign(&c2_nameCaptureInfo, c2_m0);
  return c2_nameCaptureInfo;
}

static void c2_info_helper(c2_ResolvedFunctionInfo c2_info[17])
{
  c2_info[0].context = "";
  c2_info[0].name = "lt";
  c2_info[0].dominantType = "int16";
  c2_info[0].resolved = "[B]lt";
  c2_info[0].fileLength = 0U;
  c2_info[0].fileTime1 = 0U;
  c2_info[0].fileTime2 = 0U;
  c2_info[1].context = "";
  c2_info[1].name = "abs";
  c2_info[1].dominantType = "int16";
  c2_info[1].resolved = "[I]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m";
  c2_info[1].fileLength = 566U;
  c2_info[1].fileTime1 = 1221267134U;
  c2_info[1].fileTime2 = 0U;
  c2_info[2].context = "[I]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m";
  c2_info[2].name = "nargin";
  c2_info[2].dominantType = "";
  c2_info[2].resolved = "[B]nargin";
  c2_info[2].fileLength = 0U;
  c2_info[2].fileTime1 = 0U;
  c2_info[2].fileTime2 = 0U;
  c2_info[3].context = "[I]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m";
  c2_info[3].name = "gt";
  c2_info[3].dominantType = "double";
  c2_info[3].resolved = "[B]gt";
  c2_info[3].fileLength = 0U;
  c2_info[3].fileTime1 = 0U;
  c2_info[3].fileTime2 = 0U;
  c2_info[4].context = "[I]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m";
  c2_info[4].name = "isa";
  c2_info[4].dominantType = "int16";
  c2_info[4].resolved = "[B]isa";
  c2_info[4].fileLength = 0U;
  c2_info[4].fileTime1 = 0U;
  c2_info[4].fileTime2 = 0U;
  c2_info[5].context = "[I]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m";
  c2_info[5].name = "isreal";
  c2_info[5].dominantType = "int16";
  c2_info[5].resolved = "[B]isreal";
  c2_info[5].fileLength = 0U;
  c2_info[5].fileTime1 = 0U;
  c2_info[5].fileTime2 = 0U;
  c2_info[6].context = "[I]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m";
  c2_info[6].name = "ischar";
  c2_info[6].dominantType = "int16";
  c2_info[6].resolved = "[B]ischar";
  c2_info[6].fileLength = 0U;
  c2_info[6].fileTime1 = 0U;
  c2_info[6].fileTime2 = 0U;
  c2_info[7].context = "[I]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m";
  c2_info[7].name = "islogical";
  c2_info[7].dominantType = "int16";
  c2_info[7].resolved = "[B]islogical";
  c2_info[7].fileLength = 0U;
  c2_info[7].fileTime1 = 0U;
  c2_info[7].fileTime2 = 0U;
  c2_info[8].context = "[I]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m";
  c2_info[8].name = "size";
  c2_info[8].dominantType = "int16";
  c2_info[8].resolved = "[B]size";
  c2_info[8].fileLength = 0U;
  c2_info[8].fileTime1 = 0U;
  c2_info[8].fileTime2 = 0U;
  c2_info[9].context = "[I]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m";
  c2_info[9].name = "class";
  c2_info[9].dominantType = "int16";
  c2_info[9].resolved = "[B]class";
  c2_info[9].fileLength = 0U;
  c2_info[9].fileTime1 = 0U;
  c2_info[9].fileTime2 = 0U;
  c2_info[10].context = "[I]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m";
  c2_info[10].name = "zeros";
  c2_info[10].dominantType = "double";
  c2_info[10].resolved = "[B]zeros";
  c2_info[10].fileLength = 0U;
  c2_info[10].fileTime1 = 0U;
  c2_info[10].fileTime2 = 0U;
  c2_info[11].context = "[I]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m";
  c2_info[11].name = "eml_scalar_abs";
  c2_info[11].dominantType = "int16";
  c2_info[11].resolved =
    "[I]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_abs.m";
  c2_info[11].fileLength = 461U;
  c2_info[11].fileTime1 = 1203447960U;
  c2_info[11].fileTime2 = 0U;
  c2_info[12].context =
    "[I]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_abs.m";
  c2_info[12].name = "isinteger";
  c2_info[12].dominantType = "int16";
  c2_info[12].resolved = "[B]isinteger";
  c2_info[12].fileLength = 0U;
  c2_info[12].fileTime1 = 0U;
  c2_info[12].fileTime2 = 0U;
  c2_info[13].context =
    "[I]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_abs.m";
  c2_info[13].name = "uminus";
  c2_info[13].dominantType = "int16";
  c2_info[13].resolved = "[B]uminus";
  c2_info[13].fileLength = 0U;
  c2_info[13].fileTime1 = 0U;
  c2_info[13].fileTime2 = 0U;
  c2_info[14].context = "";
  c2_info[14].name = "ge";
  c2_info[14].dominantType = "int16";
  c2_info[14].resolved = "[B]ge";
  c2_info[14].fileLength = 0U;
  c2_info[14].fileTime1 = 0U;
  c2_info[14].fileTime2 = 0U;
  c2_info[15].context = "";
  c2_info[15].name = "minus";
  c2_info[15].dominantType = "int16";
  c2_info[15].resolved = "[B]minus";
  c2_info[15].fileLength = 0U;
  c2_info[15].fileTime1 = 0U;
  c2_info[15].fileTime2 = 0U;
  c2_info[16].context = "";
  c2_info[16].name = "eq";
  c2_info[16].dominantType = "int16";
  c2_info[16].resolved = "[B]eq";
  c2_info[16].fileLength = 0U;
  c2_info[16].fileTime1 = 0U;
  c2_info[16].fileTime2 = 0U;
}

static real_T c2_emlrt_marshallIn(const mxArray *c2_H1, char *c2_name)
{
  real_T c2_y;
  real_T c2_d9;
  sf_mex_import(c2_name, sf_mex_dup(c2_H1), &c2_d9, 1, 0, 0U, 0, 0U, 0);
  c2_y = c2_d9;
  sf_mex_destroy(&c2_H1);
  return c2_y;
}

static real_T c2_b_emlrt_marshallIn(const mxArray *c2_H2, char *c2_name)
{
  real_T c2_y;
  real_T c2_d10;
  sf_mex_import(c2_name, sf_mex_dup(c2_H2), &c2_d10, 1, 0, 0U, 0, 0U, 0);
  c2_y = c2_d10;
  sf_mex_destroy(&c2_H2);
  return c2_y;
}

static real_T c2_c_emlrt_marshallIn(const mxArray *c2_L, char *c2_name)
{
  real_T c2_y;
  real_T c2_d11;
  sf_mex_import(c2_name, sf_mex_dup(c2_L), &c2_d11, 1, 0, 0U, 0, 0U, 0);
  c2_y = c2_d11;
  sf_mex_destroy(&c2_L);
  return c2_y;
}

static real_T c2_d_emlrt_marshallIn(const mxArray *c2_T1, char *c2_name)
{
  real_T c2_y;
  real_T c2_d12;
  sf_mex_import(c2_name, sf_mex_dup(c2_T1), &c2_d12, 1, 0, 0U, 0, 0U, 0);
  c2_y = c2_d12;
  sf_mex_destroy(&c2_T1);
  return c2_y;
}

static real_T c2_e_emlrt_marshallIn(const mxArray *c2_T2, char *c2_name)
{
  real_T c2_y;
  real_T c2_d13;
  sf_mex_import(c2_name, sf_mex_dup(c2_T2), &c2_d13, 1, 0, 0U, 0, 0U, 0);
  c2_y = c2_d13;
  sf_mex_destroy(&c2_T2);
  return c2_y;
}

static real_T c2_f_emlrt_marshallIn(const mxArray *c2_T3, char *c2_name)
{
  real_T c2_y;
  real_T c2_d14;
  sf_mex_import(c2_name, sf_mex_dup(c2_T3), &c2_d14, 1, 0, 0U, 0, 0U, 0);
  c2_y = c2_d14;
  sf_mex_destroy(&c2_T3);
  return c2_y;
}

static real_T c2_g_emlrt_marshallIn(const mxArray *c2_Ts, char *c2_name)
{
  real_T c2_y;
  real_T c2_d15;
  sf_mex_import(c2_name, sf_mex_dup(c2_Ts), &c2_d15, 1, 0, 0U, 0, 0U, 0);
  c2_y = c2_d15;
  sf_mex_destroy(&c2_Ts);
  return c2_y;
}

static uint8_T c2_h_emlrt_marshallIn(const mxArray
  *c2_b_is_active_c2_Merici_jednotka, char *c2_name)
{
  uint8_T c2_y;
  uint8_T c2_u0;
  sf_mex_import(c2_name, sf_mex_dup(c2_b_is_active_c2_Merici_jednotka), &c2_u0,
                1, 3, 0U, 0, 0U, 0);
  c2_y = c2_u0;
  sf_mex_destroy(&c2_b_is_active_c2_Merici_jednotka);
  return c2_y;
}

static void init_io_bus_offset(void)
{
}

static void init_dsm_address_info(void)
{
}

/* SFunction Glue Code */
void sf_c2_Merici_jednotka_get_check_sum(mxArray *plhs[])
{
  ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(185587501U);
  ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(1715660202U);
  ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(1262220167U);
  ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(1493176395U);
}

mxArray *sf_c2_Merici_jednotka_get_autoinheritance_info(void)
{
  const char *autoinheritanceFields[] = { "checksum", "inputs", "parameters",
    "outputs" };

  mxArray *mxAutoinheritanceInfo = mxCreateStructMatrix(1,1,4,
    autoinheritanceFields);

  {
    mxArray *mxChecksum = mxCreateDoubleMatrix(4,1,mxREAL);
    double *pr = mxGetPr(mxChecksum);
    pr[0] = (double)(1894243704U);
    pr[1] = (double)(2943916470U);
    pr[2] = (double)(3257936930U);
    pr[3] = (double)(112951579U);
    mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum);
  }

  {
    const char *dataFields[] = { "size", "type", "complexity" };

    mxArray *mxData = mxCreateStructMatrix(1,3,3,dataFields);

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,0,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(6));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,0,"type",mxType);
    }

    mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,1,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(6));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,1,"type",mxType);
    }

    mxSetField(mxData,1,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,2,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(3));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,2,"type",mxType);
    }

    mxSetField(mxData,2,"complexity",mxCreateDoubleScalar(0));
    mxSetField(mxAutoinheritanceInfo,0,"inputs",mxData);
  }

  {
    mxSetField(mxAutoinheritanceInfo,0,"parameters",mxCreateDoubleMatrix(0,0,
                mxREAL));
  }

  {
    const char *dataFields[] = { "size", "type", "complexity" };

    mxArray *mxData = mxCreateStructMatrix(1,7,3,dataFields);

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,0,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,0,"type",mxType);
    }

    mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,1,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,1,"type",mxType);
    }

    mxSetField(mxData,1,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,2,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,2,"type",mxType);
    }

    mxSetField(mxData,2,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,3,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,3,"type",mxType);
    }

    mxSetField(mxData,3,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,4,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,4,"type",mxType);
    }

    mxSetField(mxData,4,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,5,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,5,"type",mxType);
    }

    mxSetField(mxData,5,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,6,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,6,"type",mxType);
    }

    mxSetField(mxData,6,"complexity",mxCreateDoubleScalar(0));
    mxSetField(mxAutoinheritanceInfo,0,"outputs",mxData);
  }

  return(mxAutoinheritanceInfo);
}

static mxArray *sf_get_sim_state_info_c2_Merici_jednotka(void)
{
  const char *infoFields[] = { "chartChecksum", "varInfo" };

  mxArray *mxInfo = mxCreateStructMatrix(1, 1, 2, infoFields);
  char *infoEncStr[] = {
    "100 S1x8'type','srcId','name','auxInfo'{{M[1],M[16],T\"H1\",},{M[1],M[17],T\"H2\",},{M[1],M[18],T\"L\",},{M[1],M[14],T\"T1\",},{M[1],M[4],T\"T2\",},{M[1],M[15],T\"T3\",},{M[1],M[21],T\"Ts\",},{M[8],M[0],T\"is_active_c2_Merici_jednotka\",}}"
  };

  mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 8, 10);
  mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
  sf_c2_Merici_jednotka_get_check_sum(&mxChecksum);
  mxSetField(mxInfo, 0, infoFields[0], mxChecksum);
  mxSetField(mxInfo, 0, infoFields[1], mxVarInfo);
  return mxInfo;
}

static void chart_debug_initialization(SimStruct *S, unsigned int
  fullDebuggerInitialization)
{
  if (!sim_mode_is_rtw_gen(S)) {
    if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
      /* do this only if simulation is starting */
      {
        unsigned int chartAlreadyPresent;
        chartAlreadyPresent = sf_debug_initialize_chart
          (_Merici_jednotkaMachineNumber_,
           2,
           1,
           1,
           10,
           0,
           0,
           0,
           0,
           0,
           &(chartInstance.chartNumber),
           &(chartInstance.instanceNumber),
           ssGetPath(S),
           (void *)S);
        if (chartAlreadyPresent==0) {
          /* this is the first instance */
          init_script_number_translation(_Merici_jednotkaMachineNumber_,
            chartInstance.chartNumber);
          sf_debug_set_chart_disable_implicit_casting
            (_Merici_jednotkaMachineNumber_,chartInstance.chartNumber,1);
          sf_debug_set_chart_event_thresholds(_Merici_jednotkaMachineNumber_,
            chartInstance.chartNumber,
            0,
            0,
            0);
          _SFD_SET_DATA_PROPS(0,2,0,1,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,"Ts",0,
                              c2_c_sf_marshall);
          _SFD_SET_DATA_PROPS(1,2,0,1,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,"T1",0,
                              NULL);
          _SFD_SET_DATA_PROPS(2,2,0,1,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,"T2",0,
                              NULL);
          _SFD_SET_DATA_PROPS(3,1,1,0,SF_INT16,0,NULL,0,0,0,0.0,1.0,0,"Temp",0,
                              c2_sf_marshall);
          _SFD_SET_DATA_PROPS(4,1,1,0,SF_INT16,0,NULL,0,0,0,0.0,1.0,0,"Hum",0,
                              NULL);
          _SFD_SET_DATA_PROPS(5,1,1,0,SF_UINT8,0,NULL,0,0,0,0.0,1.0,0,"Light",0,
                              c2_b_sf_marshall);
          _SFD_SET_DATA_PROPS(6,2,0,1,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,"T3",0,
                              NULL);
          _SFD_SET_DATA_PROPS(7,2,0,1,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,"H1",0,
                              NULL);
          _SFD_SET_DATA_PROPS(8,2,0,1,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,"H2",0,
                              NULL);
          _SFD_SET_DATA_PROPS(9,2,0,1,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,"L",0,
                              NULL);
          _SFD_STATE_INFO(0,0,2);
          _SFD_CH_SUBSTATE_COUNT(0);
          _SFD_CH_SUBSTATE_DECOMP(0);
        }

        _SFD_CV_INIT_CHART(0,0,0,0);

        {
          _SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
        }

        _SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);

        /* Initialization of EML Model Coverage */
        _SFD_CV_INIT_EML(0,1,47,0,0,0,48,24);
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,2363);
        _SFD_CV_INIT_EML_IF(0,0,62,71,85,106);
        _SFD_CV_INIT_EML_IF(0,1,144,170,198,680);
        _SFD_CV_INIT_EML_IF(0,2,198,228,256,680);
        _SFD_CV_INIT_EML_IF(0,3,256,285,313,680);
        _SFD_CV_INIT_EML_IF(0,4,313,343,371,680);
        _SFD_CV_INIT_EML_IF(0,5,371,401,429,680);
        _SFD_CV_INIT_EML_IF(0,6,429,459,487,680);
        _SFD_CV_INIT_EML_IF(0,7,487,517,545,680);
        _SFD_CV_INIT_EML_IF(0,8,545,575,603,680);
        _SFD_CV_INIT_EML_IF(0,9,603,620,648,680);
        _SFD_CV_INIT_EML_IF(0,10,701,725,752,1212);
        _SFD_CV_INIT_EML_IF(0,11,752,780,807,1212);
        _SFD_CV_INIT_EML_IF(0,12,807,835,862,1212);
        _SFD_CV_INIT_EML_IF(0,13,862,890,917,1212);
        _SFD_CV_INIT_EML_IF(0,14,917,945,972,1212);
        _SFD_CV_INIT_EML_IF(0,15,972,1000,1027,1212);
        _SFD_CV_INIT_EML_IF(0,16,1027,1055,1082,1212);
        _SFD_CV_INIT_EML_IF(0,17,1082,1110,1137,1212);
        _SFD_CV_INIT_EML_IF(0,18,1137,1152,1179,1212);
        _SFD_CV_INIT_EML_IF(0,19,1233,1244,1258,1511);
        _SFD_CV_INIT_EML_IF(0,20,1258,1273,1287,1511);
        _SFD_CV_INIT_EML_IF(0,21,1287,1302,1316,1511);
        _SFD_CV_INIT_EML_IF(0,22,1316,1331,1345,1511);
        _SFD_CV_INIT_EML_IF(0,23,1345,1360,1374,1511);
        _SFD_CV_INIT_EML_IF(0,24,1374,1389,1403,1511);
        _SFD_CV_INIT_EML_IF(0,25,1403,1418,1432,1511);
        _SFD_CV_INIT_EML_IF(0,26,1432,1447,1461,1511);
        _SFD_CV_INIT_EML_IF(0,27,1461,1476,1490,1511);
        _SFD_CV_INIT_EML_IF(0,28,1531,1551,1578,2010);
        _SFD_CV_INIT_EML_IF(0,29,1578,1602,1629,2010);
        _SFD_CV_INIT_EML_IF(0,30,1629,1653,1680,2010);
        _SFD_CV_INIT_EML_IF(0,31,1680,1704,1731,2010);
        _SFD_CV_INIT_EML_IF(0,32,1731,1755,1782,2010);
        _SFD_CV_INIT_EML_IF(0,33,1782,1806,1833,2010);
        _SFD_CV_INIT_EML_IF(0,34,1833,1857,1884,2010);
        _SFD_CV_INIT_EML_IF(0,35,1884,1908,1935,2010);
        _SFD_CV_INIT_EML_IF(0,36,1935,1949,1977,2010);
        _SFD_CV_INIT_EML_IF(0,37,2028,2038,2052,2297);
        _SFD_CV_INIT_EML_IF(0,38,2052,2066,2080,2297);
        _SFD_CV_INIT_EML_IF(0,39,2080,2094,2108,2297);
        _SFD_CV_INIT_EML_IF(0,40,2108,2122,2136,2297);
        _SFD_CV_INIT_EML_IF(0,41,2136,2150,2164,2297);
        _SFD_CV_INIT_EML_IF(0,42,2164,2178,2192,2297);
        _SFD_CV_INIT_EML_IF(0,43,2192,2206,2220,2297);
        _SFD_CV_INIT_EML_IF(0,44,2220,2234,2248,2297);
        _SFD_CV_INIT_EML_IF(0,45,2248,2262,2276,2297);
        _SFD_CV_INIT_EML_IF(0,46,2316,2327,2340,2361);

        {
          static int condStart[] = { 147, 161 };

          static int condEnd[] = { 157, 170 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,0,147,170,2,0,&(condStart[0]),&(condEnd[0]),3,
                                &(pfixExpr[0]));
        }

        {
          static int condStart[] = { 205, 219 };

          static int condEnd[] = { 215, 228 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,1,205,228,2,2,&(condStart[0]),&(condEnd[0]),3,
                                &(pfixExpr[0]));
        }

        {
          static int condStart[] = { 263, 276 };

          static int condEnd[] = { 272, 285 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,2,263,285,2,4,&(condStart[0]),&(condEnd[0]),3,
                                &(pfixExpr[0]));
        }

        {
          static int condStart[] = { 320, 334 };

          static int condEnd[] = { 330, 343 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,3,320,343,2,6,&(condStart[0]),&(condEnd[0]),3,
                                &(pfixExpr[0]));
        }

        {
          static int condStart[] = { 378, 392 };

          static int condEnd[] = { 388, 401 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,4,378,401,2,8,&(condStart[0]),&(condEnd[0]),3,
                                &(pfixExpr[0]));
        }

        {
          static int condStart[] = { 436, 450 };

          static int condEnd[] = { 446, 459 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,5,436,459,2,10,&(condStart[0]),&(condEnd[0]),3,
                                &(pfixExpr[0]));
        }

        {
          static int condStart[] = { 494, 508 };

          static int condEnd[] = { 504, 517 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,6,494,517,2,12,&(condStart[0]),&(condEnd[0]),3,
                                &(pfixExpr[0]));
        }

        {
          static int condStart[] = { 552, 566 };

          static int condEnd[] = { 562, 575 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,7,552,575,2,14,&(condStart[0]),&(condEnd[0]),3,
                                &(pfixExpr[0]));
        }

        {
          static int condStart[] = { 704, 717 };

          static int condEnd[] = { 713, 725 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,8,704,725,2,16,&(condStart[0]),&(condEnd[0]),3,
                                &(pfixExpr[0]));
        }

        {
          static int condStart[] = { 759, 772 };

          static int condEnd[] = { 768, 780 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,9,759,780,2,18,&(condStart[0]),&(condEnd[0]),3,
                                &(pfixExpr[0]));
        }

        {
          static int condStart[] = { 814, 827 };

          static int condEnd[] = { 823, 835 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,10,814,835,2,20,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 869, 882 };

          static int condEnd[] = { 878, 890 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,11,869,890,2,22,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 924, 937 };

          static int condEnd[] = { 933, 945 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,12,924,945,2,24,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 979, 992 };

          static int condEnd[] = { 988, 1000 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,13,979,1000,2,26,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 1034, 1047 };

          static int condEnd[] = { 1043, 1055 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,14,1034,1055,2,28,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 1089, 1102 };

          static int condEnd[] = { 1098, 1110 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,15,1089,1110,2,30,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 1534, 1545 };

          static int condEnd[] = { 1541, 1551 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,16,1534,1551,2,32,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 1585, 1596 };

          static int condEnd[] = { 1592, 1602 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,17,1585,1602,2,34,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 1636, 1647 };

          static int condEnd[] = { 1643, 1653 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,18,1636,1653,2,36,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 1687, 1698 };

          static int condEnd[] = { 1694, 1704 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,19,1687,1704,2,38,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 1738, 1749 };

          static int condEnd[] = { 1745, 1755 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,20,1738,1755,2,40,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 1789, 1800 };

          static int condEnd[] = { 1796, 1806 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,21,1789,1806,2,42,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 1840, 1851 };

          static int condEnd[] = { 1847, 1857 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,22,1840,1857,2,44,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 1891, 1902 };

          static int condEnd[] = { 1898, 1908 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,23,1891,1908,2,46,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        _SFD_TRANS_COV_WTS(0,0,0,1,0);
        if (chartAlreadyPresent==0) {
          _SFD_TRANS_COV_MAPS(0,
                              0,NULL,NULL,
                              0,NULL,NULL,
                              1,NULL,NULL,
                              0,NULL,NULL);
        }

        {
          real_T *c2_Ts;
          real_T *c2_T1;
          real_T *c2_T2;
          int16_T *c2_Temp;
          int16_T *c2_Hum;
          uint8_T *c2_Light;
          real_T *c2_T3;
          real_T *c2_H1;
          real_T *c2_H2;
          real_T *c2_L;
          c2_L = (real_T *)ssGetOutputPortSignal(chartInstance.S, 7);
          c2_Hum = (int16_T *)ssGetInputPortSignal(chartInstance.S, 1);
          c2_H1 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 5);
          c2_T2 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 3);
          c2_T3 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 4);
          c2_Ts = (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
          c2_Light = (uint8_T *)ssGetInputPortSignal(chartInstance.S, 2);
          c2_H2 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 6);
          c2_T1 = (real_T *)ssGetOutputPortSignal(chartInstance.S, 2);
          c2_Temp = (int16_T *)ssGetInputPortSignal(chartInstance.S, 0);
          _SFD_SET_DATA_VALUE_PTR(0U, c2_Ts);
          _SFD_SET_DATA_VALUE_PTR(1U, c2_T1);
          _SFD_SET_DATA_VALUE_PTR(2U, c2_T2);
          _SFD_SET_DATA_VALUE_PTR(3U, c2_Temp);
          _SFD_SET_DATA_VALUE_PTR(4U, c2_Hum);
          _SFD_SET_DATA_VALUE_PTR(5U, c2_Light);
          _SFD_SET_DATA_VALUE_PTR(6U, c2_T3);
          _SFD_SET_DATA_VALUE_PTR(7U, c2_H1);
          _SFD_SET_DATA_VALUE_PTR(8U, c2_H2);
          _SFD_SET_DATA_VALUE_PTR(9U, c2_L);
        }
      }
    } else {
      sf_debug_reset_current_state_configuration(_Merici_jednotkaMachineNumber_,
        chartInstance.chartNumber,chartInstance.instanceNumber);
    }
  }
}

static void sf_opaque_initialize_c2_Merici_jednotka(void *chartInstanceVar)
{
  chart_debug_initialization(chartInstance.S,0);
  initialize_params_c2_Merici_jednotka();
  initialize_c2_Merici_jednotka();
}

static void sf_opaque_enable_c2_Merici_jednotka(void *chartInstanceVar)
{
  enable_c2_Merici_jednotka();
}

static void sf_opaque_disable_c2_Merici_jednotka(void *chartInstanceVar)
{
  disable_c2_Merici_jednotka();
}

static void sf_opaque_gateway_c2_Merici_jednotka(void *chartInstanceVar)
{
  sf_c2_Merici_jednotka();
}

static mxArray* sf_opaque_get_sim_state_c2_Merici_jednotka(void
  *chartInstanceVar)
{
  mxArray *st = (mxArray *) get_sim_state_c2_Merici_jednotka();
  return st;
}

static void sf_opaque_set_sim_state_c2_Merici_jednotka(void *chartInstanceVar,
  const mxArray *st)
{
  set_sim_state_c2_Merici_jednotka(sf_mex_dup(st));
}

static void sf_opaque_terminate_c2_Merici_jednotka(void *chartInstanceVar)
{
  if (sim_mode_is_rtw_gen(chartInstance.S) || sim_mode_is_external
      (chartInstance.S)) {
    sf_clear_rtw_identifier(chartInstance.S);
  }

  finalize_c2_Merici_jednotka();
}

extern unsigned int sf_machine_global_initializer_called(void);
static void mdlProcessParameters_c2_Merici_jednotka(SimStruct *S)
{
  int i;
  for (i=0;i<ssGetNumRunTimeParams(S);i++) {
    if (ssGetSFcnParamTunable(S,i)) {
      ssUpdateDlgParamAsRunTimeParam(S,i);
    }
  }

  if (sf_machine_global_initializer_called()) {
    initialize_params_c2_Merici_jednotka();
  }
}

static void mdlSetWorkWidths_c2_Merici_jednotka(SimStruct *S)
{
  if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
    int_T chartIsInlinable =
      (int_T)sf_is_chart_inlinable("Merici_jednotka","Merici_jednotka",2);
    ssSetStateflowIsInlinable(S,chartIsInlinable);
    ssSetRTWCG(S,sf_rtw_info_uint_prop("Merici_jednotka","Merici_jednotka",2,
                "RTWCG"));
    ssSetEnableFcnIsTrivial(S,1);
    ssSetDisableFcnIsTrivial(S,1);
    ssSetNotMultipleInlinable(S,sf_rtw_info_uint_prop("Merici_jednotka",
      "Merici_jednotka",2,"gatewayCannotBeInlinedMultipleTimes"));
    if (chartIsInlinable) {
      ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 1, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 2, SS_REUSABLE_AND_LOCAL);
      sf_mark_chart_expressionable_inputs(S,"Merici_jednotka","Merici_jednotka",
        2,3);
      sf_mark_chart_reusable_outputs(S,"Merici_jednotka","Merici_jednotka",2,7);
    }

    sf_set_rtw_dwork_info(S,"Merici_jednotka","Merici_jednotka",2);
    ssSetHasSubFunctions(S,!(chartIsInlinable));
    ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE);
  }

  ssSetChecksum0(S,(784509570U));
  ssSetChecksum1(S,(754920453U));
  ssSetChecksum2(S,(1274972345U));
  ssSetChecksum3(S,(4279415761U));
  ssSetmdlDerivatives(S, NULL);
  ssSetExplicitFCSSCtrl(S,1);
}

static void mdlRTW_c2_Merici_jednotka(SimStruct *S)
{
  if (sim_mode_is_rtw_gen(S)) {
    sf_write_symbol_mapping(S, "Merici_jednotka", "Merici_jednotka",2);
    ssWriteRTWStrParam(S, "StateflowChartType", "Embedded MATLAB");
  }
}

static void mdlStart_c2_Merici_jednotka(SimStruct *S)
{
  chartInstance.chartInfo.chartInstance = NULL;
  chartInstance.chartInfo.isEMLChart = 1;
  chartInstance.chartInfo.chartInitialized = 0;
  chartInstance.chartInfo.sFunctionGateway =
    sf_opaque_gateway_c2_Merici_jednotka;
  chartInstance.chartInfo.initializeChart =
    sf_opaque_initialize_c2_Merici_jednotka;
  chartInstance.chartInfo.terminateChart =
    sf_opaque_terminate_c2_Merici_jednotka;
  chartInstance.chartInfo.enableChart = sf_opaque_enable_c2_Merici_jednotka;
  chartInstance.chartInfo.disableChart = sf_opaque_disable_c2_Merici_jednotka;
  chartInstance.chartInfo.getSimState =
    sf_opaque_get_sim_state_c2_Merici_jednotka;
  chartInstance.chartInfo.setSimState =
    sf_opaque_set_sim_state_c2_Merici_jednotka;
  chartInstance.chartInfo.getSimStateInfo =
    sf_get_sim_state_info_c2_Merici_jednotka;
  chartInstance.chartInfo.zeroCrossings = NULL;
  chartInstance.chartInfo.outputs = NULL;
  chartInstance.chartInfo.derivatives = NULL;
  chartInstance.chartInfo.mdlRTW = mdlRTW_c2_Merici_jednotka;
  chartInstance.chartInfo.mdlStart = mdlStart_c2_Merici_jednotka;
  chartInstance.chartInfo.mdlSetWorkWidths = mdlSetWorkWidths_c2_Merici_jednotka;
  chartInstance.chartInfo.extModeExec = NULL;
  chartInstance.chartInfo.restoreLastMajorStepConfiguration = NULL;
  chartInstance.chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
  chartInstance.chartInfo.storeCurrentConfiguration = NULL;
  chartInstance.S = S;
  ssSetUserData(S,(void *)(&(chartInstance.chartInfo)));/* register the chart instance with simstruct */
  if (!sim_mode_is_rtw_gen(S)) {
    init_dsm_address_info();
  }

  chart_debug_initialization(S,1);
}

void c2_Merici_jednotka_method_dispatcher(SimStruct *S, int_T method, void *data)
{
  switch (method) {
   case SS_CALL_MDL_START:
    mdlStart_c2_Merici_jednotka(S);
    break;

   case SS_CALL_MDL_SET_WORK_WIDTHS:
    mdlSetWorkWidths_c2_Merici_jednotka(S);
    break;

   case SS_CALL_MDL_PROCESS_PARAMETERS:
    mdlProcessParameters_c2_Merici_jednotka(S);
    break;

   default:
    /* Unhandled method */
    sf_mex_error_message("Stateflow Internal Error:\n"
                         "Error calling c2_Merici_jednotka_method_dispatcher.\n"
                         "Can't handle method %d.\n", method);
    break;
  }
}
