?? main.cpp
字號(hào):
#ifndef OCCI_ORACLE
#define WIN32COMMON
#include "occi.h"
using namespace oracle::occi;
#endif
#include "occicontrol.h"
#include <vector>
using std::vector;
#pragma comment( lib, "oraocci9.lib" )
#pragma comment( lib, "oci.lib" )
#pragma comment( lib, "msvcrt.lib" )
#pragma comment( lib, "msvcprt.lib" )
#include <iostream.h>
#include "kalman_filter.h"
/*
typedef struct datasource
{
float speed1;
float speed2;
float speed3;
}mydata;
*/
void main()
{
matrix *Ai = new matrix(1, 1, new membuffer(100));
matrix *Qi = new matrix(1, 1, new membuffer(100));
matrix *Hi = new matrix(3, 1, new membuffer(100));
matrix *Ri = new matrix(3, 3, new membuffer(100));
matrix *x_initial = new matrix(1, 1, new membuffer(100));
matrix *Pi = new matrix(1, 1, new membuffer(100));
KalmanFilter *myKalman = new KalmanFilter(1, 3, *Ai, *Hi, *Qi,*Ri, *x_initial, *Pi);
myKalman->A.set(0,0.4);
myKalman->Q.set(0,0.01);
myKalman->H.set(0,0.4);
myKalman->H.set(1,0.3);
myKalman->H.set(2,0.3);
myKalman->R.set(0,0,0.01);
myKalman->R.set(1,1,0.01);
myKalman->R.set(2,2,0.01);
myKalman->R.set(0,1,0);
myKalman->R.set(0,2,0);
myKalman->R.set(1,0,0);
myKalman->R.set(1,2,0);
myKalman->R.set(2,0,0);
myKalman->R.set(2,1,0);
myKalman->P.set(0,0.01);
myKalman->x.set(0,0);
//cout<<" Matrix A is: "<<myKalman->A;
//cout<<" Mtraix H is: "<<myKalman->H;
//cout<<" Mtraix P is: "<<myKalman->P;
//cout<<" Matrix Q is: "<<myKalman->Q;
//cout<<" Matrix R is: "<<myKalman->R;
Environment *env = Environment::createEnvironment(Environment::DEFAULT);
//vector<struct datasource> vec;
//mydata aa;
try
{
Connection *conn = env->createConnection("rtfishz","rtfishz","ora9i");
if (conn)
cout << "SUCCESS - createConnection" << endl;
else
cout << "FAILURE - createConnection" << endl;
Statement *stmt = conn->createStatement("select * from everyminutetest ");
ResultSet *rset = stmt->executeQuery();
while (rset->next())
{
myKalman->z.set(0,rset->getFloat(2));
myKalman->z.set(1,rset->getFloat(5));
myKalman->z.set(2,rset->getFloat(6));
//cout << " Matrix z is: " << myKalman->z;
//cout << " Matrix x is: " << myKalman->x;
//cout << " estimation of x is: " << myKalman->estimate();
cout << " prediction is: " << myKalman->next(myKalman->z) << endl;
//cout << " the v1 is:" << rset->getFloat(2);
//cout << " the v2 is:" << rset->getFloat(3);
//cout << " the v3 is:" << rset->getFloat(4)<<endl;
}
cout<<endl;
/*
for(vector<struct datasource>::size_type it = 0; it < vec.size(); ++it)
{
struct datasource aa=vec[it];
cout<<" vector speed1 is: "<<aa.speed1;
cout<<" vector speed2 is: "<<aa.speed2;
cout<<" vector speed3 is: "<<aa.speed3<<endl;
}
*/
stmt->closeResultSet (rset);
conn->terminateStatement (stmt);
env->terminateConnection (conn);
}catch (SQLException ex){
std::cout << ex.getMessage();}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -