static void warningMessage_internal(char *warningMessage) {
#if USE_MODELICA_FUNCTIONS
    ModelicaMessage(warningMessage);
#else
    std::cerr << warningMessage << std::endl;
#endif
}
///////////////////////////////////////////////////////////////////////////////
/// Receive the feedback from CFD about the stop command
///
///\return 0 if no error occurred
///////////////////////////////////////////////////////////////////////////////
int cfdReceiveFeedback( ) {
  int i = 0, imax = 10000, flag;

  // Wait for the feedback from FFD
  while(cosim->para->flag==0 && i<imax) {
    if(cosim->para->ffdError==1) {
      ModelicaError(cosim->ffd->msg);
    }
    else {
      Sleep(10000);
      i++;
    }
  }

  if(i<imax) {
    if(cosim->para->ffdError==1) {
      ModelicaError(cosim->ffd->msg);
    }
    else {
      ModelicaMessage("Successfully stopped the FFD simulation.\n");
      flag = 0;
    }
  }
  else {
    ModelicaError("Error: Can not stop the FFD simulation in required time.\n");
  }

  free(cosim->para);
  free(cosim->modelica);
  free(cosim->ffd);
  free(cosim);

  return flag;
} // End of cfdReceiveFeedback()
Ejemplo n.º 3
0
static void ModelicaInternal_print(const char* string, const char* fileName) {
  /* Write string to terminal or to file */

     if ( fileName[0] == '\0' ) {
        /* Write string to terminal */
           ModelicaMessage(string);
     } else {
        /* Write string to file */
           FILE* fp = ModelicaStreams_openFileForWriting(fileName);
           if ( fputs(string,fp) < 0 ) goto ERROR;
           if ( fputs("\n",fp)   < 0 ) goto ERROR;
           fclose(fp);
           return;

           ERROR: fclose(fp);
                  ModelicaFormatError("Error when writing string to file \"%s\":\n"
                                      "%s\n", fileName, strerror(errno));
     }
}
Ejemplo n.º 4
0
void warningMessage(char *warningMessage){
	ModelicaMessage(warningMessage);
}