/* update bound parameters and variable attributes (start, nominal, min, max) */
#include "Sum_model.h"
#if defined(__cplusplus)
extern "C" {
#endif

int Sum_updateBoundVariableAttributes(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  /* min ******************************************************** */
  
  infoStreamPrint(LOG_INIT, 1, "updating min-values");
  if (ACTIVE_STREAM(LOG_INIT)) messageClose(LOG_INIT);
  
  /* max ******************************************************** */
  
  infoStreamPrint(LOG_INIT, 1, "updating max-values");
  if (ACTIVE_STREAM(LOG_INIT)) messageClose(LOG_INIT);
  
  /* nominal **************************************************** */
  
  infoStreamPrint(LOG_INIT, 1, "updating nominal-values");
  if (ACTIVE_STREAM(LOG_INIT)) messageClose(LOG_INIT);
  
  /* start ****************************************************** */
  infoStreamPrint(LOG_INIT, 1, "updating primary start-values");
  if (ACTIVE_STREAM(LOG_INIT)) messageClose(LOG_INIT);
  
  TRACE_POP
  return 0;
}


/*
 equation index: 3
 type: SIMPLE_ASSIGN
 sum1._nu = 2
 */
void Sum_eqFunction_3(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int equationIndexes[2] = {1,3};
  data->simulationInfo->integerParameter[2] = ((modelica_integer) 2);
  TRACE_POP
}

/*
 equation index: 4
 type: ALGORITHM
 
   assert(sum1.nu >= 0, "Variable violating min constraint: 0 <= sum1.nu, has value: " + String(sum1.nu, "d"));
 */
void Sum_eqFunction_4(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int equationIndexes[2] = {1,4};
  modelica_boolean tmp0;
  static const MMC_DEFSTRINGLIT(tmp1,60,"Variable violating min constraint: 0 <= sum1.nu, has value: ");
  modelica_string tmp2;
  static int tmp3 = 0;
  modelica_metatype tmpMeta[1] __attribute__((unused)) = {0};
  if(!tmp3)
  {
    tmp0 = GreaterEq((modelica_integer)data->simulationInfo->integerParameter[2],((modelica_integer) 0));
    if(!tmp0)
    {
      tmp2 = modelica_integer_to_modelica_string_format((modelica_integer)data->simulationInfo->integerParameter[2], (modelica_string) mmc_strings_len1[100]);
      tmpMeta[0] = stringAppend(MMC_REFSTRINGLIT(tmp1),tmp2);
      {
        FILE_INFO info = {"/usr/lib/omlibrary/Modelica 3.2.2/Blocks/Interfaces.mo",913,5,914,65,1};
        omc_assert_warning(info, "The following assertion has been violated %sat time %f\nsum1.nu >= 0", initial() ? "during initialization " : "", data->localData[0]->timeValue);
        omc_assert_warning_withEquationIndexes(info, equationIndexes, MMC_STRINGDATA(tmpMeta[0]));
      }
      tmp3 = 1;
    }
  }
  TRACE_POP
}
int Sum_updateBoundParameters(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  Sum_eqFunction_3(data, threadData);

  Sum_eqFunction_4(data, threadData);
  
  TRACE_POP
  return 0;
}

#if defined(__cplusplus)
}
#endif

