Skip to content

Commit

Permalink
*Removed some debug library dependencies
Browse files Browse the repository at this point in the history
*Removed some unused function arguments

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@2941 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Henrik Eriksson committed Oct 9, 2007
1 parent 52c74ab commit 17f25d9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
3 changes: 2 additions & 1 deletion Compiler/runtime/systemimpl.c
Expand Up @@ -1253,11 +1253,12 @@ RML_BEGIN_LABEL(System__sendData)
//char* yRange = RML_STRINGDATA(rmlA11);
// emulateStreamData(data, 7778);


// emulateStreamData(data, 7778, "Plot by OpenModelica", "time", "", 1, 1, 0, 0, 0, 0, 0, 0, "linear", 1);
/// emulateStreamData(data, 7778, "Plot by OpenModelica", "time", "", 1, 1, 0, 0, 0, 0, 0, 0, interpolation, 1);

// emulateStreamData(data, 7778, title, "time", "", legend, grid, 0, 0, 0, 0, logX, logY, interpolation, 1);
emulateStreamData(data, 7778, title, xLabel, yLabel , interpolation, legend, grid, 0, 0, 0, 0, logX, logY, points, range);
emulateStreamData(data, title, xLabel, yLabel , interpolation, legend, grid, logX, logY, points, range);

// emulateStreamData(data, 7778, "Plot by OpenModelica", "time", "", 1, 1, 0, 0, 0, 0, 0, 0, "linear");

Expand Down
28 changes: 11 additions & 17 deletions c_runtime/sendData/sendData.cpp
Expand Up @@ -311,14 +311,16 @@ bool pltWait(unsigned long msecs)
return true;
}

void emulateStreamData(const char* data, int port, const char* title, const char* xLabel, const char* yLabel, const char* interpolation5, int legend, int grid, double xMin, double xMax, double yMin, double yMax, int logX, int logY, int drawPoints, const char* range)
void emulateStreamData(const char* data, const char* title, const char* xLabel, const char* yLabel, const char* interpolation5, int legend, int grid, int logX, int logY, int drawPoints, const char* range)
{
Connection c;

QTcpSocket* socket = c.newConnection();

QString data_(data);
QTextStream ts(&data_);
QString tmp;

vector<vector<double>*> variableValues;
vector<QString> variableNames;

Expand Down Expand Up @@ -362,21 +364,19 @@ void emulateStreamData(const char* data, int port, const char* title, const char
}
}


QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_2);

out << (quint32)0;
out << QString("ptolemyDataStream-1.1");
out << QString("ptolemyDataStream-1.2");
out.device()->seek(0);
out << (quint32)(block.size() - sizeof(quint32));

socket->write(block);
socket->flush();

//ofstream of2("ut225.txt");
// of2 << title << endl << xLabel << endl << range << endl;
// of2.close();

block.clear();

Expand All @@ -385,18 +385,14 @@ void emulateStreamData(const char* data, int port, const char* title, const char
out << QString(title);
out << QString(xLabel);
out << QString(yLabel);

out << (int)legend;
out << (int)grid;
out << xMin << xMax << yMin << yMax;

// out << xMin << xMax << yMin << yMax;
out << (int)logX;
out << (int)logY;
out << QString(interpolation5);
out << (int)drawPoints;
out << QString(range);


out << (quint32)variableNames.size();

for(unsigned int i = 0; i < variableNames.size(); ++i)
Expand All @@ -414,7 +410,6 @@ void emulateStreamData(const char* data, int port, const char* title, const char

block.clear();

//ofstream of("ut2.txt");

for(quint32 i = 0; i < variableValues[0]->size(); ++i)
{
Expand All @@ -427,9 +422,6 @@ void emulateStreamData(const char* data, int port, const char* title, const char
out << variableNames[j];
out << (*variableValues[j])[i];

// of << variableNames[j].toStdString() << endl;
// of << (*variableValues[j])[i] << endl;

}
out.device()->seek(0);
out << (quint32)(block.size() - sizeof(quint32));
Expand All @@ -441,20 +433,22 @@ if(!(i%100))
socket->flush();

}
//of.close();

socket->flush();

for(quint32 i = 0; i < variableValues.size(); ++i)
delete variableValues[i];


socket->disconnectFromHost();
if(socket->state() == QAbstractSocket::ConnectedState)
socket->waitForDisconnected(-1);
if(socket)
delete socket;

}

bool plt(const char* var, const char* model, const char* title, const char* xLabel, const char* yLabel, bool legend, bool grid, double xmin, double xmax, double ymin, double ymax, bool logX, bool logY, const char* interpolation, bool drawPoints, const char* range)
bool plt(const char* var, const char* model, const char* title, const char* xLabel, const char* yLabel, bool legend, bool grid, bool logX, bool logY, const char* interpolation, bool drawPoints, const char* range)
{
QDir dir(QString(getenv("OPENMODELICAHOME")));
dir.cd("bin");
Expand Down Expand Up @@ -524,6 +518,6 @@ bool plt(const char* var, const char* model, const char* title, const char* xLab

file.close();

emulateStreamData(res.toStdString().c_str(), 7778, title, xLabel, yLabel, interpolation, (int)legend, (int)grid, xmin, xmax, ymin, ymax, (int)logX, (int)logY, (int)drawPoints, range);
emulateStreamData(res.toStdString().c_str(), title, xLabel, yLabel, interpolation, (int)legend, (int)grid, (int)logX, (int)logY, (int)drawPoints, range);
return true;
}
2 changes: 1 addition & 1 deletion c_runtime/sendData/sendData.h
Expand Up @@ -62,7 +62,7 @@ extern "C"
{
#endif

void emulateStreamData(const char* data, int port=7778, const char* title="Plot by OpenModelica", const char* xLabel = "time", const char* yLabel = "", const char* interpolation="linear", int legend = 1, int grid = 1, double xMin=0, double xMax=0, double yMin=0, double yMax=0, int logX=0, int logY=0, int drawPoints = 1, const char* range = "0.0,0.0 0.0,0.0");
void emulateStreamData(const char* data, const char* title="Plot by OpenModelica", const char* xLabel = "time", const char* yLabel = "", const char* interpolation="linear", int legend = 1, int grid = 1, int logX=0, int logY=0, int drawPoints = 1, const char* range = "0.0,0.0 0.0,0.0");

bool plt(const char* var, const char* mdl, const char* title, const char* xLabel, const char* yLabel, bool legend, bool grid, double xmin, double xmax, double ymin, double ymax, bool logX, bool logY, const char* interpolation, bool drawPoints, const char* range);
bool pltParametric(const char*, const char*, const char*);
Expand Down

0 comments on commit 17f25d9

Please sign in to comment.