Roshna
Sun, 11 Oct 2009 01:57:29 -0700
Hi Adrian, In this file I tried to write one read and write function using externalfunctions. I put one value(say 50)in READ1.txt and my aim is to read that value by the externalfunction and to write the same value in another text file OUTFILE.txt. I am getting one value, but it is -1.923905.What is happening here? If I want to feed model input data externally, how to set/control the time?
-----Original Message----- From: owner-openmodelicainter...@ida.liu.se [mailto:owner-openmodelicainter...@ida.liu.se] On Behalf Of Adrian Pop Sent: Saturday, October 10, 2009 8:26 PM To: openmodelicainterest@ida.liu.se Cc: nilanc...@cdactvm.in Subject: Re: problem regarding writing the value into a text file using open modelica Hi Roshna, You need to open the file in append mode and don't rewind the file. See the attached .zip. ad...@kafka ~/dev/OpenModelicaMathCore/build/bin/Roshna $ ../omc external.mos 1.000000 1.000000 1.000000 true 0 0 0 record SimulationResult resultFile = "ExternalLibraries_res.plt" end SimulationResult; 0 Cheers, Adrian Pop/ Roshna wrote: > > > > > > > Hai all, > > > > I want to write the value of one variable into a external text file > using external function interface while running the .mo file. So I > tried to modify the example program, which is given in users guide to > get the value printed.(please see the attachment).I am not getting any > errors, but the value is not getting printed even a single time. I did > the following way. > > > > loadFile("C:/OpenModelica1.5.0/tmp/ExternalLibraries.mo") > > true > > *>>* system("gcc -c -o libExternalFunc1_ext.o ExternalFunc1.c"); > > *>>* system("gcc -c -o libExternalFunc2.a ExternalFunc2.c"); > > *>>* simulate(ExternalLibraries) > > record SimulationResult > > resultFile = "ExternalLibraries_res.plt" > > end SimulationResult; > > *>>* plot({x,y}) > > true > > > > > > Can anybody help me? > > Thanks n Regards, > > > > Roshna C P > > Control & Instrumentation Group, > > Centre for Development of Advanced Computing, > > Trivandrum, India. > > > > > > > -- _____________________________________________________________________ Adrian Pop | PhD Open Source Modelica Consortium | Technical Coordinator Department of Computer Science | http://www.ida.liu.se/~adrpo Linköping University | phone:+46 76 2343499/+46 13 285781 S-581 83 Linköping, Sweden | fax: +46 13 142231 OSMC & LiU/IDA/PELAB | office: 3B:478 ______________________________________ Scanned and protected by Email scanner
50
ExternalFunc1.c
Description: Binary data
ExternalFunc1_ext.h
Description: Binary data
ExternalFunc2.c
Description: Binary data
ExternalFunc2.h
Description: Binary data
ExternalLibraries.mo
Description: Binary data
ExternalLibraries.mos
Description: Binary data
-1.923905