当前位置: 首页>>代码示例>>C++>>正文


C++ VariablesGrid::appendValues方法代码示例

本文整理汇总了C++中VariablesGrid::appendValues方法的典型用法代码示例。如果您正苦于以下问题:C++ VariablesGrid::appendValues方法的具体用法?C++ VariablesGrid::appendValues怎么用?C++ VariablesGrid::appendValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VariablesGrid的用法示例。


在下文中一共展示了VariablesGrid::appendValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getDelayedOutputGrid

returnValue Sensor::getDelayedOutputGrid(	const VariablesGrid& _y,
											VariablesGrid& _yDelayed
											) const
{
	// determine common time grid for delayed outputs:
	Grid delayedOutputTimeGrid = lastSignal.getTimePoints( );

	// make sure that last time instant of horizon lies within the grid
	if ( acadoIsEqual( lastSignal.getLastTime(),_y.getLastTime( ) ) == BT_FALSE )
		delayedOutputTimeGrid.addTime( _y.getLastTime( ) );

	// add grids of all delayed output components
	for( uint i=0; i<getNY( ); ++i )
		delayedOutputTimeGrid.merge( _y.getTimePoints( ).shiftTimes( deadTimes(i) ),MM_REPLACE );

	VariablesGrid tmp;

	// setup common variables grid for delayed inputs
	_yDelayed.init( );

	for( uint i=0; i<getNY( ); ++i )
	{
		tmp = lastSignal( i );
		tmp.merge( _y( i ).shiftTimes( deadTimes(i) ),MM_REPLACE,BT_FALSE );
		tmp.refineGrid( delayedOutputTimeGrid );

		_yDelayed.appendValues( tmp );
	}

	return SUCCESSFUL_RETURN;
}
开发者ID:ThomasBesselmann,项目名称:acado,代码行数:31,代码来源:sensor.cpp

示例2: getDelayedInputGrids

returnValue Actuator::getDelayedInputGrids(	const VariablesGrid& _u,
											const VariablesGrid& _p,
											VariablesGrid& _uDelayed,
											VariablesGrid& _pDelayed
											) const
{
	// determine common time grid for delayed inputs:
	Grid delayedInputTimeGrid = lastSignal.getTimePoints( );

	// make sure that last time instant of horizon lies within the grid
	if ( acadoIsEqual( lastSignal.getLastTime(),_u.getLastTime( ) ) == BT_FALSE )
		delayedInputTimeGrid.addTime( _u.getLastTime( ) );

//	delayedInputTimeGrid.print();
	
	// add grids of all delayed input components
	for( uint i=0; i<getNU( ); ++i )
		delayedInputTimeGrid = delayedInputTimeGrid & ( _u.getTimePoints( ).shiftTimes( deadTimes(i) ) );

// 	_u.getTimePoints( ).print();
// 	_u.getTimePoints( ).shiftTimes( deadTimes(0) ).print();
// 	delayedInputTimeGrid.print();
	
	if ( _p.isEmpty( ) == BT_FALSE )
	{
		for( uint i=0; i<getNP( ); ++i )
			delayedInputTimeGrid = delayedInputTimeGrid & ( _p.getTimePoints( ).shiftTimes( deadTimes(getNU()+i) ) );
	}

	VariablesGrid tmp;

	// setup common variables grid for delayed inputs
	_uDelayed.init( );
	_pDelayed.init( );

	for( uint i=0; i<getNU( ); ++i )
	{
// 		tmp.print("tmp");
		tmp = lastSignal( i );
// 		tmp.print("tmp");
		tmp.merge( _u( i ).shiftTimes( deadTimes(i) ),MM_REPLACE,BT_FALSE );
// 		tmp.print("tmp");
		tmp.refineGrid( delayedInputTimeGrid );
// 		tmp.print("tmp");
		
		_uDelayed.appendValues( tmp );
	}

	if ( _p.isEmpty( ) == BT_FALSE )
	{
		for( uint i=0; i<getNP( ); ++i )
		{
			tmp = lastSignal( getNU()+i );
			tmp.merge( _p( i ).shiftTimes( deadTimes(getNU()+i) ),MM_REPLACE,BT_FALSE );
			tmp.refineGrid( delayedInputTimeGrid );

			_pDelayed.appendValues( tmp );
		}
	}

	return SUCCESSFUL_RETURN;
}
开发者ID:ThomasBesselmann,项目名称:acado,代码行数:62,代码来源:actuator.cpp


注:本文中的VariablesGrid::appendValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。