@@ -672,7 +672,11 @@ int linearize(DATA* data, threadData_t *threadData)
672672 case OMC_LINEARIZE_DUMP_LANGUAGE_PYTHON: ext = " .py" ; break ;
673673 }
674674 /* ticket #5927: Don't use the model name to prevent bad names for certain languages. */
675- filename = " linearized_model" + string (ext);
675+ if (omc_flag[FLAG_OUTPUT_PATH]) {
676+ filename = string (omc_flagValue[FLAG_OUTPUT_PATH]) + " /" + " linearized_model" + string (ext);
677+ } else {
678+ filename = " linearized_model" + string (ext);
679+ }
676680
677681 FILE *fout = omc_fopen (filename.c_str ()," wb" );
678682 assertStreamPrint (threadData,0 !=fout," Cannot open File %s" ,filename.c_str ());
@@ -685,9 +689,6 @@ int linearize(DATA* data, threadData_t *threadData)
685689 frame = data->callback ->linear_model_frame ();
686690 fprintf (fout, frame, strX.c_str (), strU.c_str (), strA.c_str (), strB.c_str (), strC.c_str (), strD.c_str (), (double ) data->simulationInfo ->stopTime );
687691 }
688- if (OMC_ACTIVE_STREAM (OMC_LOG_STATS)) {
689- infoStreamPrint (OMC_LOG_STATS, 0 , data->callback ->linear_model_frame (), strX.c_str (), strU.c_str (), strA.c_str (), strB.c_str (), strC.c_str (), strD.c_str (), (double ) data->simulationInfo ->stopTime );
690- }
691692
692693 fflush (fout);
693694 fclose (fout);
@@ -699,6 +700,9 @@ int linearize(DATA* data, threadData_t *threadData)
699700 infoStreamPrint (OMC_LOG_STDOUT, 0 , " Linear model is created." );
700701 }
701702 else {
703+ if (omc_flag[FLAG_OUTPUT_PATH]) {
704+ infoStreamPrint (OMC_LOG_STDOUT, 0 , " Linear model is created at %s" , filename.c_str ());
705+ } else {
702706 char * cwd = getcwd (NULL , 0 ); /* call with NULL and 0 to allocate the buffer dynamically (no pathmax needed) */
703707 if (!cwd) {
704708 infoStreamPrint (OMC_LOG_STDOUT, 0 , " Linear model %s is created, but getting the full path failed." , filename.c_str ());
@@ -707,8 +711,10 @@ int linearize(DATA* data, threadData_t *threadData)
707711 infoStreamPrint (OMC_LOG_STDOUT, 0 , " Linear model is created at %s/%s" , cwd, filename.c_str ());
708712 free (cwd);
709713 }
710- infoStreamPrint (OMC_LOG_STDOUT, 0 , " The output format can be changed with the command line option --linearizationDumpLanguage." );
711- infoStreamPrint (OMC_LOG_STDOUT, 0 , " The options are: --linearizationDumpLanguage=none, modelica, matlab, julia, python." );
714+ }
715+ infoStreamPrint (OMC_LOG_STDOUT, 0 , " The output format can be changed with the command line option --linearizationDumpLanguage." );
716+ infoStreamPrint (OMC_LOG_STDOUT, 0 , " The options are: --linearizationDumpLanguage=none, modelica, matlab, julia, python." );
717+ infoStreamPrint (OMC_LOG_STDOUT, 0 , " In OMEdit Simulation Setup->Linearize->Target language for linearized model." );
712718 }
713719 }
714720 return 0 ;
0 commit comments