Exemple #1
0
void	stdc::ControllerImpl::active(CORBA::Long _l){
	_in_active = _l;
	if(_in_debug) printf("active: %d\n", (int)_l);
	if (_l){
	    circleItem = _in_items.begin();
	    viewItem = _in_items.begin();    
	    circleIsolIter = _in_items.begin();
	    circleIn(1);
	}
}	
Exemple #2
0
void	stdc::ControllerImpl::circleIsolNext(){
	char ak[10];
	snprintf(ak, sizeof(ak),"ak%s", circleIsolIter->second->ak );	    
	uart->uns4i_Isol( uart->getUns4Ak(ak), 0 );
	uart->off(ak, atol(circleIsolIter->second->side) );
	circleIsolIter++;
	if (circleIsolIter == _in_items.end()){
	    circleIsolIter = _in_items.begin();
	    circleIsolIn( 0 );
	    circleIn( 1 );
	}
	circleIsolOnItem();    	    
}
Exemple #3
0
/*---------------------------------- Циклические телеизмерения ИЗОЛЯЦИИ ---------------------------------*/
void	stdc::ControllerImpl::circleIsolIn(CORBA::Long _l){
	_in_circleIsolIn = _l;
	if(_l){
	    if (_in_debug) printf("Analog:: Циклические телеизмерения изоляции Включены.\n");
	    circleIn(0); //выключаем циклические измерения напряжений
	    circleIsolIter = _in_items.begin();
	    circleIsolOnItem();    
	}
	else{
	    if (_in_debug) printf("Analog:: Циклические телеизмерения изоляции ВЫключены.\n");
	    if ( crtc::ItemImpl *cid = find__("stdc_circleIsol") ){
		cid->setAttr__("stop",  "1");
		char ak[10];
		snprintf(ak, sizeof(ak),"ak%s", circleIsolIter->second->ak );	    
		uart->off(ak, atol(circleIsolIter->second->side) );
	    }
	}
}
float interpolateScalar(float p1, float p2, float fraction, interpolation_t* inter)
{
	if (!inter)
		return linear(fraction, p1, p2 - p1);
	switch (inter->function)
	{
		case IF_LINEAR: return linear(fraction, p1, p2 - p1);
	case IF_QUAD_IN: return quadIn(fraction, p1, p2 - p1, inter->slope);
	case IF_QUAD_OUT: return quadOut(fraction, p1, p2 - p1, inter->slope);
	case IF_QUAD_IN_OUT: return quadInOut(fraction, p1, p2 - p1, inter->slope);
	case IF_CUBIC_IN: return cubicIn(fraction, p1, p2 - p1, inter->slope);
	case IF_CUBIC_OUT: return cubicOut(fraction, p1, p2 - p1, inter->slope);
	case IF_CUBIC_IN_OUT: return cubicInOut(fraction, p1, p2 - p1, inter->slope);
	case IF_QUART_IN: return quartIn(fraction, p1, p2 - p1, inter->slope);
	case IF_QUART_OUT: return quartOut(fraction, p1, p2 - p1, inter->slope);
	case IF_QUART_IN_OUT: return quartInOut(fraction, p1, p2 - p1, inter->slope);
	case IF_QUINT_IN: return quintIn(fraction, p1, p2 - p1, inter->slope);
	case IF_QUINT_OUT: return quintOut(fraction, p1, p2 - p1, inter->slope);
	case IF_QUINT_IN_OUT: return quintInOut(fraction, p1, p2 - p1, inter->slope);
	case IF_CIRCLE_IN: return circleIn(fraction, p1, p2 - p1, inter->slope);
	case IF_CIRCLE_OUT: return circleOut(fraction, p1, p2 - p1, inter->slope);
	case IF_CIRCLE_IN_OUT: return circleInOut(fraction, p1, p2 - p1, inter->slope);
		case IF_EXPONENTIAL_IN: return exponentialIn(fraction, p1, p2 - p1);
		case IF_EXPONENTIAL_OUT: return exponentialOut(fraction, p1, p2 - p1);
		case IF_EXPONENTIAL_IN_OUT: return exponentialInOut(fraction, p1, p2 - p1);
		case IF_SINE_IN: return sineIn(fraction, p1, p2 - p1);
		case IF_SINE_OUT: return sineOut(fraction, p1, p2 - p1);
		case IF_SINE_IN_OUT: return sineInOut(fraction, p1, p2 - p1);
		case IF_ELASTIC_IN: return elasticIn(fraction, p1, p2 - p1, inter->amplitude, inter->bounces, inter->damping);
		case IF_ELASTIC_OUT: return elasticOut(fraction, p1, p2 - p1, inter->amplitude, inter->bounces, inter->damping);
		case IF_ELASTIC_IN_OUT: return elasticInOut(fraction, p1, p2 - p1, inter->amplitude, inter->bounces, inter->damping);
		case IF_BACK_IN: return backIn(fraction, p1, p2 - p1, inter->speed);
		case IF_BACK_OUT: return backOut(fraction, p1, p2 - p1, inter->speed);
		case IF_BACK_IN_OUT: return backInOut(fraction, p1, p2 - p1, inter->speed);
		case IF_BOUNCE_IN: return bounceIn(fraction, p1, p2 - p1, inter->bounces, inter->growth, inter->damping);
		case IF_BOUNCE_OUT: return bounceOut(fraction, p1, p2 - p1, inter->bounces, inter->growth, inter->damping);
		case IF_BOUNCE_IN_OUT: return bounceInOut(fraction, p1, p2 - p1, inter->bounces, inter->growth, inter->damping);
		case IF_FAST_BOUNCE_IN: return fastBounceIn(fraction, p1, p2 - p1, inter->bounces, inter->growth, inter->damping);
		case IF_FAST_BOUNCE_OUT: return fastBounceOut(fraction, p1, p2 - p1, inter->bounces, inter->growth, inter->damping);
		case IF_FAST_BOUNCE_IN_OUT: return fastBounceInOut(fraction, p1, p2 - p1, inter->bounces, inter->growth, inter->damping);
		default: return linear(fraction, p1, p2 - p1);
	}
}
Exemple #5
0
void    stdc::ControllerImpl::applyAttrs(){
	crtc::ItemNode::applyAttrs();
	// stage two activation ( after dom tree building done )
    //Находим УАРТ который рулит модулями
	if( uart = static_cast<stdc::UartImpl*>( find__("uart")) ){
	    ;
	}
	else{
	    crtcLog<<"stdc::Controller !! Ошибка адаптации не найден УАРТ (stdc:Uart)\n";
	    crtcEXIT("Критическая ошибка");
	}
    //Найдем объект с порогами на значения
	limits = dynamic_cast<stdc::Ilimits*>(find__("stdc_limits"));
	if (!limits)
	    crtcLog<<"stdc::Controller !! Не найден компонент с пороговыми значениями (<stdc:Limits id='stdc_limits' ... >)\n";
    //Создаем список объектов ТИ
    //Подписываем себя на события от SectionProxy
	std::list<crtc::ItemImpl*> iis;
	long rc = _cntx_->registry()->getItems( "*",  iis );
	std::list<crtc::ItemImpl*>::iterator beg = iis.begin();
	std::list<crtc::ItemImpl*>::iterator end = iis.end();
	while (beg != end ){
	    std::string _repo = static_cast<crtc::ItemImpl*>(*beg)->getRepo__();
	    if (_repo == "IDL:stdc/SectionProxy:1.0" ){
		crtc::ItemImpl *ss = 0;
		ss =find__( (*beg)->getId__() );	
		if (ss){
		    ss -> subs__("popup", this);
		    //Создаем список объектов телеизмерений
		    crtc::ItemNode* sectProxy = 0;
		    sectProxy = ss;
		    const char* _sectionId;
		    if (sectProxy->hasAttribute("sectionId"))
			_sectionId = sectProxy->getAttributeText("sectionId");
		    else{
			crtcLog<<"stdc::Controller::Error отсутствует аттрибут sectionId\n";
			crtcEXIT("Критическая ошибка");
		    }	
		    if (sectProxy){
			crtc::ItemNode *points = sectProxy->firstChild;
			while (points ){
			    const char *unit, *ak, *side, *key, *mode, *fasa, *subtitle, *label, *source;
			    if (points->hasAttribute("unit")){
				unit = points->getAttributeText("unit");

				if (points->hasAttribute("ak"))
				    ak = points->getAttributeText("ak");
				else{
			    	    crtcLog<<"stdc::SectionProxy::Error в потомке "<<_sectionId<<" отсутвует аттрибут ak="". Номер модуля АК\n";
				    crtcEXIT("Критическая ошибка");
				}	
				if (points->hasAttribute("side"))
				    side = points->getAttributeText("side");
				else{
				    crtcLog<<"stdc::SectionProxy::Error в потомке "<<_sectionId<<" отсутвует аттрибут side="". Сторона мадуля АК.\n";
				    crtcEXIT("Критическая ошибка");
				}	
				if (points->hasAttribute("key"))
				    key = points->getAttributeText("key");
				else{
				    crtcLog<<"stdc::SectionProxy::Error в потомке "<<_sectionId<<" отсутвует аттрибут key="". Номер ключа\n";
				    crtcEXIT("Критическая ошибка");
				}	
				if (points->hasAttribute("mode"))
				    mode = points->getAttributeText("mode");
				else{
				    crtcLog<<"stdc::SectionProxy::Error в потомке "<<_sectionId<<" отсутвует аттрибут mode="". Режим работы ключа\n";
				    crtcEXIT("Критическая ошибка");
				}	
				if (points->hasAttribute("subtitle"))
				    subtitle = points->getAttributeText("subtitle");
				else{
				    crtcLog<<"stdc::SectionProxy::Error в потомке "<<_sectionId<<" отсутвует аттрибут subtite="". Название точки подключения.\n";
				    crtcEXIT("Критическая ошибка");
				}	
			    //необязательные атрибуты
				if (points->hasAttribute("Phdop"))
				    fasa = points->getAttributeText("Phdop");
				else    
				    fasa ="";
				    
				if (points->hasAttribute("source"))
				    source = points->getAttributeText("source");
				else    
				    source ="VAC";
			    //создаем элемент в таблице объектов измерения
				char buff[200];
				if (std::string(ss->getId__()).find("Section") != std::string::npos )    
				    snprintf(buff, sizeof(buff), "%sСП %s", _sectionId, subtitle);
				else if (std::string(ss->getId__()).find("Way") != std::string::npos )    
				    snprintf(buff, sizeof(buff), "%sП %s", _sectionId, subtitle);
				else 
				    snprintf(buff, sizeof(buff), "%s %s", _sectionId, subtitle);
				//выясняем есть ли по этому объекту измерение изоляции
				bool isIsol=0;
				char ak_name[7];
			    	snprintf(ak_name, sizeof(ak_name),"ak%s", ak );	    
				if (strcmp("none", uart->getIon4Ak( ak_name )))
    				    isIsol = 1;
				_in_items[std::string(unit) ] = new stdItem(ak, side, key, mode, unit, fasa, buff, ss, isIsol, source );
			    }			    
			points = points->nextSibling;
			}
		    }
		}
	    }
	    beg++;
	}
//check...    
	if (_in_items.size() == 0 )
	    crtcEXIT ("Мега ошибка. Нету объектов измерения.\n Проверте: 1. Адаптацию 2. Собраны ли модули stdc::SectionProxy или stdc::IsolUnit");
//for test
	if (_in_debug){
	    std::cout<<"Известные объекты телеизмерений _in_items:\n";
	    StdItems::iterator begin = _in_items.begin();	
	    StdItems::iterator end1 = _in_items.end();
	    while(begin!=end1){
		std::cout<<begin->first.c_str();
		std::cout<<" ak="<<begin->second->ak<<" side="<<begin->second->side<<" key="<<begin->second->key<<" mode="<<begin->second->mode;
		std::cout<<" unit='"<<begin->second->unit<<"' fasa="<<begin->second->fasa<<" title='"<<begin->second->label.c_str()<<"' isIsol= '"<<begin->second->isIsol<<"'\n";
		begin++;
    	    }
	}
//Подготовка для циклических измерений.
	if (_in_voltMeasureDelay < 3)
	    _in_voltMeasureDelay == 3;
	registerForPoll__(_in_voltMeasureDelay);
	registerForStep__();    
	circleItem = _in_items.begin();
	viewItem = _in_items.begin();    
	circleIsolIter = _in_items.begin();
	createTZK();
	readData();
//for syncAnalogData
	if ( _in_syncPort ) prepareSync();
//start circle diment
	circleIn(1);

	
}