Ejemplo n.º 1
0
CHYSTBlock::CHYSTBlock(const char* configString)
    : CBlock(configString)
{
    CString tempString;
    float setpoint=0.0, delta=0.0, Min=0.0, Max=0.0;
    //Get HYST type and parameters
    m_LibIniReader.GetConfigParamString( configString, "TYPE", &tempString, "HYST");
    
    for (int i = 0; i < HYST_TYPE_NUM_TOT; i++)
    {
        if (tempString == HYST_Type_Strings[i])
        {
            m_HYSTType = (e_HYSTType)i;
	    m_LibIniReader.GetConfigParamFloat( configString, "SETPOINT", &setpoint, 0.0);
            m_LibIniReader.GetConfigParamFloat( configString, "DELTA", &delta, 0.0);
	    m_LibIniReader.GetConfigParamFloat( configString, "MIN", &Min, 0.0);
            m_LibIniReader.GetConfigParamFloat( configString, "MAX", &Max, 0.0);
	    setSetpoint(&setpoint);
            setDelta(&delta);
	    setLastOutput(&Min);
		
	    setMin(&Min);
	    setMax(&Max);
	}
    }
}
Ejemplo n.º 2
0
TArray<Object>& TArray<Object>::operator=(const TArray<Object> &rhs)
{
  setDelta(rhs.Delta);
  if(setSize(rhs.Count))
  {
    for(unsigned i=0;i<Count;++i)
    {
      if(rhs.items[i])
      {
        if(!items[i])
          items[i]=new Object;
        if(items[i])
          *items[i]=*rhs.items[i];
        else
        {
          Free();
          break;
        }
      }
      else
      {
        delete items[i];
        items[i]=NULL;
      }
    }
  }
  return *this;
}
Ejemplo n.º 3
0
	void CellElement::spawnOverlayAndContainer(string type){
		mOverlay = OverlayManager::getSingleton().create(getId());
		mDeltaContainer = static_cast<OverlayContainer*>(
			OverlayManager::getSingleton().createOverlayElement("Panel", getId()+"_DeltaContainer"));
		
		mDeltaContainer->setMetricsMode(Ogre::GMM_RELATIVE);
		mDeltaContainer->setPosition(0, 0);
		mDeltaContainer->setDimensions(1, 1);


		mOverlayContainer = static_cast<OverlayContainer*>(
			OverlayManager::getSingleton().createOverlayElement(type, getId()+"_Container"));
		
		mOverlayContainer->setMetricsMode(Ogre::GMM_RELATIVE);
		mOverlayContainer->setPosition(0, 0);
		mOverlayContainer->setDimensions(1, 1);
		mDeltaContainer->addChild(mOverlayContainer);

		//mOverlayContainer->setMaterialName("Faces/Window");
		mOverlay->show();
		mOverlay->add2D(mDeltaContainer);


		mDeltaContainer->show();
		setDelta(Ogre::Vector2(0,0));
		mOverlayOverwritten = false;

	}
Ejemplo n.º 4
0
// reject the last asynchronous step and restore the history
// of solutions to the last major step
void e_trsolver::rejectstep_async(void)
{
    // restore the solution (node voltages and branch currents) from
    // the previously stored solution
    copySolution (lastsolution, solution);

    // Restore the circuit histories to their previous states
    truncateHistory (lastasynctime);

    // Restore the time deltas
    inputState (dState, lastdeltas);

    for (int i = 0; i < 8; i++)
    {
        deltas[i] = lastdeltas[i];
    }

    delta = lastdelta;

    // copy the deltas to all the circuit elements
    setDelta ();

    // reset the corrector and predictor coefficients
    calcCorrectorCoeff (corrType, corrOrder, corrCoeff, deltas);
    calcPredictorCoeff (predType, predOrder, predCoeff, deltas);
}
Ejemplo n.º 5
0
/*!

  Constructor.

  Call init() to initialise the Hinkley's test and set \f$\alpha\f$
  and \f$\delta\f$ to default values.

  By default \f$ \delta = 0.2 \f$ and \f$ \alpha = 0.2\f$. Use
  setDelta() and setAlpha() to modify these values.

*/
vpHinkley::vpHinkley()
{
  init();

  setAlpha(0.2);
  setDelta(0.2);
}
Ejemplo n.º 6
0
vpHinkley::vpHinkley(double alpha, double delta)
{
  init();

  setAlpha(alpha);
  setDelta(delta);
}
Ejemplo n.º 7
0
/*!

  Call init() to initialise the Hinkley's test and set \f$\alpha\f$
  and \f$\delta\f$ thresholds.

  \param alpha_val : \f$\alpha\f$ is a predefined threshold.

  \param delta_val : \f$\delta\f$ denotes the jump minimal magnitude that
  we want to detect.

  \sa setAlpha(), setDelta()

*/
void
vpHinkley::init(double alpha_val, double delta_val)
{
  init();

  setAlpha(alpha_val);
  setDelta(delta_val);
}
Ejemplo n.º 8
0
 void BlackScholesGreeks::setValues(double premium, double delta, double gamma, double theta, double vega, double rho)
 {
     setPremium(premium);
     setDelta(delta); 
     setGamma(gamma);
     setTheta(theta);
     setVega(vega); 
     setRho(rho); 
 }
void MenuContentActivator::clear()
{
    qDeleteAll(d->m_content);
    d->m_content.clear();

    setDelta(0);
    d->m_timer->stop();

    Q_EMIT contentChanged();
}
void MenuContentActivator::onTimeout()
{
    bool finished = false;
    int tempDelta = d->findNextInactiveDelta(&finished);
    if (!finished) {
        setMenuContentState(d->m_baseIndex + tempDelta, true);
        setDelta(tempDelta);
    }

    if (finished) {
        d->m_timer->stop();
    }
}
void MenuContentActivator::restart()
{
    // when we start, make sure we have the base index in the list.
    setMenuContentState(d->m_baseIndex, true);
    setDelta(0);

    // check if we've finished before starting the timer.
    bool finished = false;
    d->findNextInactiveDelta(&finished);
    if (!finished) {
        d->m_timer->start();
    } else {
        d->m_timer->stop();
    }

    if (!d->m_running) {
        d->m_running = true;
        Q_EMIT runningChanged(true);
    }
}
Ejemplo n.º 12
0
std::shared_ptr<storage::Store> Loader::shortcuts::loadMainDelta(const std::string& mainfilepath,
                                                                 const std::string& deltafilepath,
                                                                 Loader::params p) {
  std::vector<std::string> filenames;
  filenames.push_back(mainfilepath);
  filenames.push_back(deltafilepath);
  std::vector<std::shared_ptr<storage::AbstractTable>> tables;

  for (int i = 0; i < 2; ++i) {
    CSVInput input(filenames[i]);
    CSVHeader header(filenames[i]);

    p.setInput(input);
    p.setHeader(header);
    p.setReturnsMutableVerticalTable(true);
    std::shared_ptr<storage::AbstractTable> table = load(p);
    tables.push_back(table);
  }
  auto s = std::make_shared<storage::Store>(tables[0]);
  s->setDelta(tables[1]);
  return s;
};
Ejemplo n.º 13
0
void MusicSearchEngine::watchForChanges()
{
	qDebug() << Q_FUNC_INFO;

	// Gather all folders registered on music locations
	QFileInfoList dirs;
	for (QString musicPath : SettingsPrivate::instance()->musicLocations()) {
		QFileInfo location(musicPath);
		QDirIterator it(location.absoluteFilePath(), QDir::Dirs | QDir::Hidden | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
		while (it.hasNext()) {
			QString entry = it.next();
			QFileInfo qFileInfo(entry);
			dirs << qFileInfo;
		}
	}

	SqlDatabase db;
	db.open();
	db.exec("PRAGMA journal_mode = MEMORY");
	db.exec("PRAGMA synchronous = OFF");
	db.exec("PRAGMA temp_store = 2");
	db.exec("PRAGMA foreign_keys = 1");

	QStringList newFoldersToAddInLibrary;
	// Add folders that were not found first
	for (QFileInfo f : dirs) {
		QSqlQuery query(db);
		query.setForwardOnly(true);
		query.prepare("SELECT * FROM filesystem WHERE path = ?");
		query.addBindValue(f.absoluteFilePath());
		if (query.exec() && !query.next()) {
			newFoldersToAddInLibrary << f.absoluteFilePath();
			QSqlQuery prepared(db);
			prepared.setForwardOnly(true);
			prepared.prepare("INSERT INTO filesystem (path, lastModified) VALUES (?, ?)");
			prepared.addBindValue(f.absoluteFilePath());
			prepared.addBindValue(f.lastModified().toTime_t());
			prepared.exec();
		}
	}

	if (!newFoldersToAddInLibrary.isEmpty()) {
		_delta = newFoldersToAddInLibrary;
		this->doSearch();
	}

	// Process in reverse mode to clean cache: from database file and check if entry exists in database
	QSqlQuery cache("SELECT * FROM filesystem", db);
	qDebug() << Q_FUNC_INFO << "SELECT * FROM filesystem";
	cache.setForwardOnly(true);
	if (cache.exec()) {
		QStringList oldLocations;
		while (cache.next()) {
			QDir d(cache.record().value(0).toString());
			d.exists();
			QFileInfo fileInfo(cache.record().value(0).toString());
			// Remove folder in database because it couldn't be find in the filesystem
			if (!fileInfo.exists()) {
				QSqlQuery deleteFromFilesystem(db);
				deleteFromFilesystem.prepare("DELETE FROM filesystem WHERE path = ?");
				deleteFromFilesystem.addBindValue(fileInfo.absoluteFilePath());
				qDebug() << Q_FUNC_INFO << "DELETE FROM filesystem WHERE path = ?";

				if (deleteFromFilesystem.exec()) {
					oldLocations << fileInfo.absoluteFilePath();
				}
			}
		}
		qDebug() << Q_FUNC_INFO << oldLocations;
		if (!oldLocations.isEmpty()) {
			//db.rebuildFomLocations(oldLocations, QStringList());
			setDelta(oldLocations);
			db.rebuild();
		}
	}
}
Ejemplo n.º 14
0
void ld::BaseMenu::offsetDelta(const float d)
{
    setDelta(m_delta + d);
}
Ejemplo n.º 15
0
/* Goes through the list of circuit objects and runs its initTR()
   function. */
void e_trsolver::initETR (nr_double_t start, nr_double_t firstdelta, int mode)
{
    const char * const IMethod = getPropertyString ("IntegrationMethod");
    //nr_double_t start = getPropertyDouble ("Start");
    //nr_double_t stop = start + firstdelta;
    //nr_double_t points = 1.0;

    // fetch corrector integration method and determine predicor method
    corrMaxOrder = getPropertyInteger ("Order");
    corrType = CMethod = correctorType (IMethod, corrMaxOrder);
    predType = PMethod = predictorType (CMethod, corrMaxOrder, predMaxOrder);
    corrOrder = corrMaxOrder;
    predOrder = predMaxOrder;

    // initialize step values
    if (mode == ETR_MODE_ASYNC){
        delta = getPropertyDouble ("InitialStep");
        deltaMin = getPropertyDouble ("MinStep");
        deltaMax = getPropertyDouble ("MaxStep");
        if (deltaMax == 0.0)
            deltaMax = firstdelta; // MIN ((stop - start) / (points - 1), stop / 200);
        if (deltaMin == 0.0)
            deltaMin = NR_TINY * 10 * deltaMax;
        if (delta == 0.0)
            delta = firstdelta; // MIN (stop / 200, deltaMax) / 10;
        if (delta < deltaMin) delta = deltaMin;
        if (delta > deltaMax) delta = deltaMax;
    }
    else if (mode == ETR_MODE_SYNC)
    {
        delta = firstdelta;
        deltaMin = NR_TINY * 10;
        deltaMax =  std::numeric_limits<nr_double_t>::max() / 10;
    }

    // initialize step history
    setStates (2);
    initStates ();
    // initialise the history of states, setting them all to 'delta'
    fillState (dState, delta);

    // copy the initialised states to the 'deltas' array
    saveState (dState, deltas);
    // copy the deltas to all the circuits
    setDelta ();
    // set the initial corrector and predictor coefficients
    calcCorrectorCoeff (corrType, corrOrder, corrCoeff, deltas);
    calcPredictorCoeff (predType, predOrder, predCoeff, deltas);

    // initialize history of solution vectors (solutions)
    for (int i = 0; i < 8; i++)
    {
        // solution contains the last sets of node voltages and branch
        // currents at each of the last 8 'deltas'.
        // Note for convenience the definition:
        //   #define SOL(state) (solution[(int) getState (sState, (state))])
        // is provided and used elsewhere to update the solutions
        solution[i] = new tvector<nr_double_t>;
        setState (sState, (nr_double_t) i, i);
        lastsolution[i] = new tvector<nr_double_t>;
    }

    // Initialise history tracking for asynchronous solvers
    // See acceptstep_async and rejectstep_async for more
    // information
    lastasynctime = start;
    saveState (dState, lastdeltas);
    lastdelta = delta;

    // tell circuit elements about the transient analysis
    circuit *c, * root = subnet->getRoot ();
    for (c = root; c != NULL; c = (circuit *) c->getNext ())
        initCircuitTR (c);
    // also initialize the created circuit elements
    for (c = root; c != NULL; c = (circuit *) c->getPrev ())
        initCircuitTR (c);
}
Ejemplo n.º 16
0
void VrmlScene::render(Viewer *viewer)
{
  //
  if (d_newView)
    {
      viewer->resetUserNavigation();
      d_newView = false;
    }
      
  // Default viewpoint parameters
  float position[3] = { 0.0, 0.0, 10.0 };
  float orientation[4] = { 0.0, 0.0, 1.0, 0.0 };
  float field = 0.785398;
  float avatarSize = 0.25;
  float visibilityLimit = 0.0;

  VrmlNodeViewpoint *vp = bindableViewpointTop();
  if (vp)
    {
      position[0] = vp->positionX();
      position[1] = vp->positionY();
      position[2] = vp->positionZ();
      orientation[0] = vp->orientationX();
      orientation[1] = vp->orientationY();
      orientation[2] = vp->orientationZ();
      orientation[3] = vp->orientationR();
      field = vp->fieldOfView();

      vp->inverseTransform(viewer);
    }

  VrmlNodeNavigationInfo *ni = bindableNavigationInfoTop();
  if (ni)
    {
      avatarSize = ni->avatarSize()[0];
      visibilityLimit = ni->visibilityLimit();
    }

  viewer->setViewpoint( position, orientation, field,
			avatarSize, visibilityLimit);

  // Set background.
  VrmlNodeBackground *bg = bindableBackgroundTop();
  if (bg)
    { // Should be transformed by the accumulated rotations above ...
      bg->renderBindable(viewer);
    }
  else
    viewer->insertBackground();	// Default background

  // Fog
  VrmlNodeFog *f = bindableFogTop();
  if (f)
    {
      viewer->setFog(f->color(), f->visibilityRange(), f->fogType());
    }

  // Activate the headlight.
  // ambient is supposed to be 0 according to the spec...
  if ( headlightOn() )
  {
    float rgb[3] = { 1.0, 1.0, 1.0 };
    float xyz[3] = { 0.0, 0.0, -1.0 };
    float ambient = 0.3;

    viewer->insertDirLight( ambient, 1.0, rgb, xyz );
  }

  // Top level object
  viewer->beginObject(0);

  // Do the scene-level lights (Points and Spots)
  VrmlNodeList::iterator li, end = d_scopedLights->end();
  for (li = d_scopedLights->begin(); li != end; ++li)
    {
      VrmlNodeLight* x = (*li)->toLight();
      if (x) x->renderScoped( viewer );
    }

  // Render the top level group
  d_nodes.render( viewer );

  viewer->endObject();

  // This is actually one frame late...
  d_frameRate = viewer->getFrameRate();

  clearModified();

  // If any events were generated during render (ugly...) do an update
  if (eventsPending())
    setDelta( 0.0 );
    
}
Ejemplo n.º 17
0
TArray<Object>::TArray(unsigned int delta):
  internalCount(0), Count(0), items(NULL)
{
  setDelta(delta);
}
Ejemplo n.º 18
0
int main(int argc, char **argv) 
{
	rtsNr = 0;
	validFuCnt = 0;
	invalidFuCnt = 0;

	char *docname;
	int nextOption;

	// Opciones validas, formato corto
	const char *shortOpts = "vhu:d:l:";
	// Opciones en formato largo
	const struct option longOpts[] = {
		{"verbose", 0, NULL, 'v'}, 
		{"help", 0, NULL, 'h'}, 
		{"fu", 1, NULL, 'u'}, 
		{"delta", 1, NULL, 'd'},
		{"limit", 1, NULL, 'l'}, 
		{NULL, 0, NULL, 0}
	};

	progName = argv[0];

	if (argc <= 1) {
		printUsage(stderr, EXIT_FAILURE);
	}

	delta = DFLT_DELTA;
	verbose = 0;
	cont = 0;

	do {
		nextOption = getopt_long(argc, argv, shortOpts, longOpts, NULL);

		switch (nextOption) {
			case 'v': // -s o --verbose
				verbose = 1;
				break;
			case 'h': // -h o --help
				printUsage(stdout, EXIT_SUCCESS);
			case 'u': // -u o --fu
				setGlobalExpFu(atof(optarg));
				break;
			case 'd': // -d o --delta
				setDelta(atof(optarg));
				break;
			case 'l': // -l o --limit
				setLimit(atoi(optarg));
				break;
			case '?': // opcion invalida
				printUsage(stderr, EXIT_FAILURE);
			case -1: // no ha más opciones
				break;
			default: // inesperado
				abort();
		}
	} while (nextOption != -1);

	docname = argv[optind];

	xmlTextReaderPtr reader = getDoc(docname);
	getSetInfo(reader);
	streamRtsFile(reader);

	free(fuArray);
	xmlFreeTextReader(reader);

	return(EXIT_SUCCESS);
}