예제 #1
0
static int dump_file(struct tree_state *t, char *name, char *file)
{
	struct file_state f;
	int fd;
	Elf_Scn *scn;
	GElf_Shdr shdr;

	if ((dup_mode == HIDE_DUPS) && seen(t, name))
		return 0;

	indent(t); printf("%s", name);

	if ((dup_mode == PRUNE_DUPS) && seen(t, name)) {
		printf("...\n");
		return 0;
	} else {
		printf(":\n");
	}

	see(t, name);

	f.t = t;

	fd = open(file, O_RDONLY);
	if (fd < 0) {
		unix_err("open(%s) failed", file);
		return -1;
	}

	f.e = elf_begin(fd, ELF_C_READ, NULL);
	if (!f.e) {
		elf_err("elf_begin failed on %s", file);
		return -1;
	}

	scn = find_scn(&f, SHT_STRTAB, NULL, &shdr);
	f.strtab_data = elf_getdata(scn, NULL);
	if (!f.strtab_data) {
		app_err("%s has no strtab section", file);
		return -1;
	}

	scn = NULL;
	while ((scn = find_scn(&f, SHT_DYNAMIC, scn, &shdr))) {
		dump_dynamic(&f, scn, &shdr);
	}

	elf_end(f.e);
	close(fd);

	return 0;
}
예제 #2
0
static void add_search_dirs(void)
{
	char *relpath;
	char path[PATH_MAX];

	relpath = getenv("ANDROID_PRODUCT_OUT");
	if (!relpath) {
		app_err("Warning: ANDROID_PRODUCT_OUT not set; "
		        "using current directory.\n");
		relpath = ".";
	}

	snprintf(path, PATH_MAX, "%s/%s", relpath, "system/lib");
	add_search_dir(path);
}
예제 #3
0
void do_ping(int cd)
{
	static unsigned long id = 1;
	struct ro_invoke_rq roirq;
	int status;

	roirq.op = RO_STD_OP_PING;
	roirq.version = RO_STD_VERSION_PING;
	roirq.id = id++;
	roirq.in = "Hello, this is ro_ping speaking...";
	roirq.inlen = strlen(roirq.in);
	printf("Sending ping (%lu) with %lu bytes.\n",roirq.id,roirq.inlen);
	status = ro_request(cd,&roirq,&roi);
	app_err(status,&roi);
}
예제 #4
0
/**
 * @brief Load binary into the memory
 * @param param  parameters for binary format
 * @param ex  memory map structure
 * @return 0 on success
 */
static int aout_load_binary(struct nucleos_binprm *param)
{
	struct exec *hdr;
	off_t off;
	int err = 0;

	hdr = (struct exec*)param->buf;

	/* Get text and data sizes. */
	param->ex.text_bytes = (vir_bytes) hdr->a_text;	/* text size in bytes */
	param->ex.data_bytes = (vir_bytes) hdr->a_data;	/* data size in bytes */
	param->ex.bss_bytes  = (vir_bytes) hdr->a_bss;	/* bss size in bytes */
	param->ex.tot_bytes  = hdr->a_total;		/* total bytes to allocate for prog */

	if (param->ex.tot_bytes == 0)
		return -1;

	param->ex.data_bytes += param->ex.text_bytes;
	param->ex.text_bytes = 0;

	/* entry point of process */
	param->ex.entry_point = hdr->a_entry;

	err = aout_exec_newmem(&param->stack_top, &param->load_text, &param->allow_setuid,
			       param->proc_e, &param->ex);

	if (err) {
		app_err("exec failed (err=%d)!\n", err);
		return err;
	}

	off = hdr->a_hdrlen;

	/* Read in text and data segments. */
	if (param->load_text) {
		err = aout_read_seg(param->vp, off, param->proc_e, T, param->ex.text_bytes);
	}

	off += param->ex.text_bytes;

	if (!err)
		err = aout_read_seg(param->vp, off, param->proc_e, D, param->ex.data_bytes);

	return err;
}
예제 #5
0
static int dump_needed(struct tree_state *t, char *name)
{
	struct search_dir *dir;
	char path[PATH_MAX];
	int fd;

	t->level++;

	for (dir = dirs; dir; dir = dir->next) {
		snprintf(path, PATH_MAX, "%s/%s", dir->path, name);
		fd = open(path, O_RDONLY);
		if (fd >= 0) {
			close(fd);
			dump_file(t, name, path);
			t->level--;
			return 0;
		}
	}

	app_err("Couldn't resolve dependency \"%s\".", name);
	t->level--;
	return -1;
}
예제 #6
0
static int parse_args(int argc, char *argv[])
{
	int i;

	for (i = 1; i < argc - 1; i++) {
		if (!strcmp(argv[i], "-S")) {
			dup_mode = SHOW_DUPS;
		} else if (!strcmp(argv[i], "-P")) {
			dup_mode = PRUNE_DUPS;
		} else if (!strcmp(argv[i], "-H")) {
			dup_mode = HIDE_DUPS;
		} else if (!strcmp(argv[i], "-h")) {
			usage();
			exit(0);
		} else {
			app_err("Unexpected argument \"%s\"!\n", argv[i]);
			return -1;
		}
	}

	root_name = argv[argc - 1];

	return 0;
}
예제 #7
0
/**
 * @brief Check whether it is aout format
 * @param vp[in]  pointer inode for reading exec file
 * @return 0 on success
 */
static int aout_check_binfmt(struct nucleos_binprm *param, struct vnode *vp)
{
	/* Read the header and check the magic number.  The standard MINIX header
	 * is defined in <nucleos/a.out.h>.  It consists of 8 chars followed by 6 longs.
	 * Then come 4 more longs that are not used here.
	 *	Byte 0: magic number 0x01
	 *	Byte 1: magic number 0x03
	 *	Byte 2: normal = 0x10 (not checked, 0 is OK), separate I/D = 0x20
	 *	Byte 3: CPU type, Intel 16 bit = 0x04, Intel 32 bit = 0x10,
	 *            Motorola = 0x0B, Sun SPARC = 0x17
	 *	Byte 4: Header length = 0x20
	 *	Bytes 5-7 are not used.
	 *
	 *	Now come the 6 longs
	 *	Bytes  8-11: size of text segments in bytes
	 *	Bytes 12-15: size of initialized data segment in bytes
	 *	Bytes 16-19: size of bss in bytes
	 *	Bytes 20-23: program entry point
	 *	Bytes 24-27: total memory allocated to program (text, data + stack)
	 *	Bytes 28-31: size of symbol table in bytes
	 * The longs are represented in a machine dependent order,
	 * little-endian on the 8088, big-endian on the 68000.
	 * The header is followed directly by the text and data segments, and the 
	 * symbol table (if any). The sizes are given in the header. Only the 
	 * text and data segments are copied into memory by exec. The header is 
	 * used here only. The symbol table is for the benefit of a debugger and 
	 * is ignored here.
	 */
	off_t pos;
	int err;
	u64_t new_pos;
	unsigned int cum_io_incr;
	struct exec hdr;

	/* Read from the start of the file */
	pos = 0;

	/* Issue request */
	err = req_readwrite(vp->v_fs_e, vp->v_inode_nr, cvul64(pos), READING, 
			  VFS_PROC_NR, (char*)&hdr, sizeof(struct exec), &new_pos, &cum_io_incr);

	if (err) {
		app_err("Can't read the file header\n");
		return -1;
	}

	/* Interpreted script? */
	if (((char*)&hdr)[0] == '#' && ((char*)&hdr)[1] == '!' && vp->v_size >= 2) {
		return ESCRIPT;
	}

	if (vp->v_size < A_MINHDR)
		return -1;

	if (BADMAG(hdr))
		return -1;

#ifdef CONFIG_X86_32
	if (hdr.a_cpu != A_I8086 && hdr.a_cpu != A_I80386)
		return -1;
#endif

	if ((hdr.a_flags & ~(A_NSYM | A_EXEC)) != 0)
		return -1;

	memcpy(param->buf, &hdr, hdr.a_hdrlen);
	param->vp = vp;

	return BINFMT_AOUT;
}
예제 #8
0
파일: WPS_Sub.c 프로젝트: MasonXQY/OPSP
void app_out_ex_set(int nID,double var)
{
	if (nID<0||nID>EX_LEN)
		app_err(WPS_EXIT_PARAERROR,"参数错误");
	ex[nID-1]=var;
}
예제 #9
0
파일: WPS_Sub.c 프로젝트: MasonXQY/OPSP
//统计风电预测误差。本软件中统计误差均是预测-实际,正数表示预测高了,需要正备用,否则需要负备用。
void app_out_wind_fpower_stat_month( app* me, mtx* pmWindPower[WPS_SIMULATION_TIMES],\
																mtx* pmWindfPower[WPS_SIMULATION_TIMES],int nStartDate, int nEndDate)
{
	int i,j,nCount,k,l,nWindFarm,nCount2;
	int nDate,nmonth;
	unit *pUnit;
	unit_para *pUnitPara;
	wind_para* pWindPara;
	double *dapower;
	double *dapowerall;
	double *davariation;//里面存各风电场总体variation
	double *davariationall;//里面存所有风电场总体variation
	int* napowerall;
	double var[POINTS_PER_DAY]={0};
	int nBeginYear=0,nEndYear=0;
	double daPos[WPS_DISTRIBUTION_INTERVAL]={0};
	double daNeg[WPS_DISTRIBUTION_INTERVAL]={0};
	double daParameter[6]={0};//里面是6个备用关键参数,分别是正调峰、反调峰以及平均情形下峰荷正备用以及谷荷负备用的值。
	double dPowerMax,dPowerMaxall,dmaxoutputSigma;
	double *daLoad;
	load* pLoad;
	unit_power* pUnitPower;
	double dLoadMax;

	dapower=(double*)malloc(sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	dapowerall=(double*)malloc(sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	davariation=(double*)malloc(sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	davariationall=(double*)malloc(sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	daLoad=(double*)malloc(sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	napowerall=(int*)malloc(sizeof(int)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);

	//由于CDF和PDF都需要通过var输出,所以这里规定其长度不能大于var
	if (WPS_DISTRIBUTION_INTERVAL>POINTS_PER_DAY-4)
	{
		app_err(WPS_EXIT_PARAERROR,"输入参数有误");
	}

	nmonth= idate_month_idx_of_year(nStartDate);
	nDate=nStartDate;

	dPowerMaxall=0;dmaxoutputSigma=0;
	memset(dapower,0,sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	memset(dapowerall,0,sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	memset(davariation,0,sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	memset(davariationall,0,sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	memset(daLoad,0,sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	memset(napowerall,0,sizeof(int)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	nWindFarm=0;
	for(i=0;i<me->aUnits.n;i++)
	{
		memset(dapower,0,sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
		pUnit=(unit*)(me->aUnits.buf[i]);
		pUnitPara=app_cur_unit_para(pUnit,nDate);
		if (pUnitPara==NULL) continue;
		if(pUnitPara->nUnitTypeIn!=11)continue;		
		pWindPara=app_cur_wind_para(pUnit,nDate);
		if (pWindPara==NULL) continue;	
		nCount=0;
		dPowerMax=pUnitPara->dPowerMax;
		nWindFarm++;
		for (l=0;l<WPS_SIMULATION_TIMES;l++)
		{
			for (k=1;k<= pmWindPower[l]->n;k++)
			{
				dapower[nCount]=mtx_get_element(pmWindfPower[l],nWindFarm,k);
				dapowerall[nCount]+=mtx_get_element(pmWindfPower[l],nWindFarm,k);
				davariation[nCount]=mtx_get_element(pmWindfPower[l],nWindFarm,k)-mtx_get_element(pmWindPower[l],nWindFarm,k);
				davariationall[nCount]+=mtx_get_element(pmWindfPower[l],nWindFarm,k)-mtx_get_element(pmWindPower[l],nWindFarm,k);
				napowerall[nCount]=1;
				nCount++;
			}
		}
		if (nCount>0)
		{
			dPowerMaxall+=dPowerMax;
		}
	}
	memset(dapower,0,sizeof(double)*POINTS_PER_DAY*DAYS_PER_YEAR);
	for(j=0;j<nCount;j++)	
	{
		if (napowerall[j]==1)
		{
			dapower[j]=dapowerall[j];
			davariation[j]=davariationall[j];
		}
	}
	dLoadMax=0;
	if (nCount>0)
	{
		//准备各种参数
		memset(daPos,0,sizeof(double)*WPS_DISTRIBUTION_INTERVAL);
		memset(daNeg,0,sizeof(double)*WPS_DISTRIBUTION_INTERVAL);
		memset(daParameter,0,sizeof(double)*6);
		memset(daLoad,0,sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
		nCount2=0;
		for (l=0;l<WPS_SIMULATION_TIMES;l++)
		{
			for (nDate=nStartDate;nDate<nEndDate;nDate=idate_next_day(nDate))
			{
				pLoad=app_cur_load(me,nDate);
				for(j=0;j<POINTS_PER_DAY;j++)	
				{
					daLoad[nCount2+j]=pLoad->dLoad[j];
				}
				for(i=0;i<me->aUnits.n;i++)
				{
					pUnit=(unit*)(me->aUnits.buf[i]);
					pUnitPara=app_cur_unit_para(pUnit,nDate);
					if (pUnitPara!=NULL&&pUnitPara->nUnitTypeIn==11) continue;	
					pUnitPower=app_cur_unit_power(pUnit,nDate);
					if (pUnitPower==NULL) continue;	
					for(j=0;j<POINTS_PER_DAY;j++)	
					{
						if (pUnitPower->dPower[j]<0)
						{
							daLoad[nCount2+j]-=pUnitPower->dPower[j];
						}
					}
				}
				nCount2+=POINTS_PER_DAY;
			}
		}
		for (l=0;l<nCount;l++)
		{
			if (dLoadMax<daLoad[l])
				dLoadMax=daLoad[l];
		}
		//输出风电场总体统计参数
		app_stat_wind_variation(dapower,davariation,daLoad,nCount,dPowerMaxall,daPos,daNeg,daParameter);
		//输出计算结果
		app_out_ex_clear();
		app_out_ex_set(1,me->nTimes);
		app_out_ex_set(2,dPowerMaxall);
		app_out_ex_set(3,0);
		app_out_ex_set(4,0);
		app_out_ex_set(5,nmonth);
		memset(var,0,sizeof(double)*POINTS_PER_DAY);
		var[0]=daParameter[0];var[2]=daParameter[1];
		var[1]=daParameter[0]/dLoadMax;var[3]=daParameter[1]/dLoadMax;
		app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_RESERVE_TYPICAL,nStartDate,nEndDate,var,0);
		app_out_ex_clear();
		app_out_ex_set(1,me->nTimes);
		app_out_ex_set(2,dPowerMaxall);
		app_out_ex_set(3,0);
		app_out_ex_set(4,3);
		app_out_ex_set(5,nmonth);
		memset(var,0,sizeof(double)*POINTS_PER_DAY);
		var[0]=daParameter[2];var[2]=daParameter[3];
		var[1]=daParameter[2]/dLoadMax;var[3]=daParameter[3]/dLoadMax;
		app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_RESERVE_TYPICAL,nStartDate,nEndDate,var,0);
		app_out_ex_clear();
		app_out_ex_set(1,me->nTimes);
		app_out_ex_set(2,dPowerMaxall);
		app_out_ex_set(3,0);
		app_out_ex_set(4,2);
		app_out_ex_set(5,nmonth);
		memset(var,0,sizeof(double)*POINTS_PER_DAY);
		var[0]=daParameter[4];var[2]=daParameter[5];
		var[1]=daParameter[4]/dLoadMax;var[3]=daParameter[5]/dLoadMax;
		app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_RESERVE_TYPICAL,nStartDate,nEndDate,var,0);
		app_out_ex_clear();
		app_out_ex_set(1,me->nTimes);
		app_out_ex_set(2,dPowerMaxall);
		app_out_ex_set(3,0);
		app_out_ex_set(4,10);
		app_out_ex_set(5,nmonth);
		memset(var,0,sizeof(double)*POINTS_PER_DAY);
		memcpy(var,daPos,sizeof(double)*WPS_DISTRIBUTION_INTERVAL);
		app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_RESERVE,nStartDate,nEndDate,var,0);
		app_out_ex_clear();
		app_out_ex_set(1,me->nTimes);
		app_out_ex_set(2,dPowerMaxall);
		app_out_ex_set(3,0);
		app_out_ex_set(4,11);
		app_out_ex_set(5,nmonth);
		memset(var,0,sizeof(double)*POINTS_PER_DAY);
		memcpy(var,daNeg,sizeof(double)*WPS_DISTRIBUTION_INTERVAL);
		app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_RESERVE,nStartDate,nEndDate,var,0);
	}

	free(dapower);
	free(dapowerall);
	free(davariation);
	free(davariationall);
	free(daLoad);
	free(napowerall);
}
예제 #10
0
파일: WPS_Sub.c 프로젝트: MasonXQY/OPSP
//该函数与app_out_wind_power_stat相同,只是按月统计输出,需要在mtx结构体里读取,模拟无效的mtx也计入统计中。
void app_out_wind_power_stat_month( app* me, mtx* pmWindPower[WPS_SIMULATION_TIMES],int nStartDate, int nEndDate) 
{
	int i,j,nCount=0,k,l,nWindFarm,nCount2;
	int nDate,nmonth;
	unit *pUnit;
	unit_para *pUnitPara;
	wind_para* pWindPara;
	double *dapower;
	double *dapowerall;
	int *napowerall;
	double var[POINTS_PER_DAY]={0};
	int nBeginYear=0,nEndYear=0;
	double daPDF[WPS_DISTRIBUTION_INTERVAL]={0};
	double daCDF[WPS_DISTRIBUTION_INTERVAL]={0};
	double dminoutput,dmaxoutput,dmeanoutput,dPowerMax,dPowerMaxall,dmaxoutputSigma;
	double dPosRegulation[POINTS_PER_DAY]={0};
	double dNegRegulation[POINTS_PER_DAY]={0};
	double dFlatRegulation[POINTS_PER_DAY]={0};
	double dAverageLoad[POINTS_PER_DAY]={0};
	double dMaxHourlyOutput[POINTS_PER_DAY]={0};
	double dMinHourlyOutput[POINTS_PER_DAY]={0};
	double dAverageHourlyOutput[POINTS_PER_DAY]={0};
	double *daLoad;
	double dPosRegulationPro,dNegRegulationPro,dFlatRegulationPro;
	load* pLoad;
	unit_power* pUnitPower;
	regulation * pRegulationPro;

	daLoad=(double*)malloc(sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	dapower=(double*)malloc(sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	dapowerall=(double*)malloc(sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	napowerall=(int*)malloc(sizeof(int)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);

	//由于CDF和PDF都需要通过var输出,所以这里规定其长度不能大于var
	if (WPS_DISTRIBUTION_INTERVAL>POINTS_PER_DAY-4)
	{
		app_err(WPS_EXIT_PARAERROR,"输入参数有误");
	}

	nmonth= idate_month_idx_of_year(nStartDate);
	nDate=nStartDate;

	dPowerMaxall=0;dmaxoutputSigma=0;
	memset(dapowerall,0,sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	memset(napowerall,0,sizeof(int)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	nWindFarm=0;
	for(i=0;i<me->aUnits.n;i++)
	{
		memset(dapower,0,sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
		pUnit=(unit*)(me->aUnits.buf[i]);
		pUnitPara=app_cur_unit_para(pUnit,nDate);
		if (pUnitPara==NULL) continue;
		if(pUnitPara->nUnitTypeIn!=11)continue;		
		pWindPara=app_cur_wind_para(pUnit,nDate);
		if (pWindPara==NULL) continue;	
		nCount=0;
		dPowerMax=pUnitPara->dPowerMax;
		nWindFarm++;
		for (l=0;l<WPS_SIMULATION_TIMES;l++)
		{
			for (k=1;k<= pmWindPower[l]->n;k++)
			{
				dapower[nCount]=mtx_get_element(pmWindPower[l],nWindFarm,k);
				dapowerall[nCount]+=mtx_get_element(pmWindPower[l],nWindFarm,k);
				napowerall[nCount]=1;
				nCount++;
			}
		}
		//开始统计风电特性
		if (nCount>0)
		{
			dPowerMaxall+=dPowerMax;
			app_stat_wind_power(dapower,nCount, dPowerMax,daPDF,daCDF,&dminoutput,&dmaxoutput,&dmeanoutput,WPS_MIN_OUTPUT_CONFIDENCE,WPS_MAX_OUTPUT_CONFIDENCE);
			dmaxoutputSigma+=dmaxoutput;
			app_out_ex_clear();
			app_out_ex_set(1,me->nTimes);
			app_out_ex_set(2,dPowerMax);
			app_out_ex_set(3,pUnitPara->nNodeId);
			app_out_ex_set(4,pWindPara->nWindZone);
			app_out_ex_set(5,nmonth);
			memset(var,0,sizeof(double)*POINTS_PER_DAY);
			var[POINTS_PER_DAY-3]=dminoutput;
			var[POINTS_PER_DAY-2]=dmaxoutput;
			var[POINTS_PER_DAY-1]=dmeanoutput;
			memcpy(var,daPDF,sizeof(double)*WPS_DISTRIBUTION_INTERVAL);
			app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_STAT_PDF,nStartDate,nEndDate,var,0);
			memcpy(var,daCDF,sizeof(double)*WPS_DISTRIBUTION_INTERVAL);
			app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_STAT_CDF,nStartDate,nEndDate,var,0);
		}
	}
	
	memset(dapower,0,sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
	for(j=0;j<nCount;j++)	
	{
		if (napowerall[j]==1)
		{
			dapower[j]=dapowerall[j];
		}
	}
	if (nCount>0)
	{
		//输出风电场总体统计参数
		app_stat_wind_power(dapower,nCount, dPowerMaxall,daPDF,daCDF,&dminoutput,&dmaxoutput,&dmeanoutput,WPS_MIN_OUTPUT_CONFIDENCE,WPS_MAX_OUTPUT_CONFIDENCE);
		app_out_ex_clear();
		app_out_ex_set(1,me->nTimes);
		app_out_ex_set(2,dPowerMaxall);
		app_out_ex_set(5,nmonth);
		memset(var,0,sizeof(double)*POINTS_PER_DAY);
		var[POINTS_PER_DAY-4]=dmaxoutput/dmaxoutputSigma;
		var[POINTS_PER_DAY-3]=dminoutput;
		var[POINTS_PER_DAY-2]=dmaxoutput;
		var[POINTS_PER_DAY-1]=dmeanoutput;
		memcpy(var,daPDF,sizeof(double)*WPS_DISTRIBUTION_INTERVAL);
		app_out_array(me,me->nPJID,0,RT_WIND_ALL_STAT_PDF,nStartDate,nEndDate,var,0);
		memcpy(var,daCDF,sizeof(double)*WPS_DISTRIBUTION_INTERVAL);
		app_out_array(me,me->nPJID,0,RT_WIND_ALL_STAT_CDF,nStartDate,nEndDate,var,0);
		//输出风电场典型出力
		memset(dPosRegulation,0,sizeof(double)*POINTS_PER_DAY);
		memset(dNegRegulation,0,sizeof(double)*POINTS_PER_DAY);
		memset(dFlatRegulation,0,sizeof(double)*POINTS_PER_DAY);
		memset(dAverageLoad,0,sizeof(double)*POINTS_PER_DAY);
		memset(dMaxHourlyOutput,0,sizeof(double)*POINTS_PER_DAY);
		memset(dMinHourlyOutput,0,sizeof(double)*POINTS_PER_DAY);
		memset(dAverageHourlyOutput,0,sizeof(double)*POINTS_PER_DAY);
		memset(daLoad,0,sizeof(double)*POINTS_PER_DAY*31*WPS_SIMULATION_TIMES);
		nCount2=0;
		for (l=0;l<WPS_SIMULATION_TIMES;l++)
		{
			for (nDate=nStartDate;nDate<nEndDate;nDate=idate_next_day(nDate))
			{
				pLoad=app_cur_load(me,nDate);
				for(j=0;j<POINTS_PER_DAY;j++)	
				{
					daLoad[nCount2+j]=pLoad->dLoad[j];
					dAverageLoad[j]+=pLoad->dLoad[j]/nCount*POINTS_PER_DAY;
				}
				for(i=0;i<me->aUnits.n;i++)
				{
					pUnit=(unit*)(me->aUnits.buf[i]);
					pUnitPara=app_cur_unit_para(pUnit,nDate);
					if (pUnitPara!=NULL&&pUnitPara->nUnitTypeIn==11) continue;	
					pUnitPower=app_cur_unit_power(pUnit,nDate);
					if (pUnitPower==NULL) continue;	
					for(j=0;j<POINTS_PER_DAY;j++)	
					{
						if (pUnitPower->dPower[j]<0)
						{
							daLoad[nCount2+j]-=pUnitPower->dPower[j];
							dAverageLoad[j]-=pUnitPower->dPower[j]/nCount*POINTS_PER_DAY;
						}
					}
				}
				nCount2+=POINTS_PER_DAY;
			}
		}

		dPosRegulationPro=0;dNegRegulationPro=0;dFlatRegulationPro=0;
		pRegulationPro=app_cur_regulationpro(me,nStartDate);
		app_stat_wind_typical_curve(me, daLoad,dapower,nCount,dPosRegulation,dNegRegulation,dFlatRegulation,&dPosRegulationPro,&dNegRegulationPro,&dFlatRegulationPro);
		pRegulationPro->nPosRegulationdays[nmonth-1]=idate_days_between(nStartDate,nEndDate);
		pRegulationPro->nFlatRegulationdays[nmonth-1]=idate_days_between(nStartDate,nEndDate);
		pRegulationPro->nNegRegulationdays[nmonth-1]=idate_days_between(nStartDate,nEndDate);
		pRegulationPro->dPosRegulationPro[nmonth-1]=dPosRegulationPro;
		pRegulationPro->dFlatRegulationPro[nmonth-1]=dFlatRegulationPro;
		pRegulationPro->dNegRegulationPro[nmonth-1]=dNegRegulationPro;
		//printf("测试\n");
		//输出模拟典型出力
		app_out_ex_clear();
		app_out_ex_set(1,me->nTimes);
		app_out_ex_set(2,dPowerMaxall);
		app_out_ex_set(3,dPosRegulationPro);
		app_out_ex_set(4,0);
		app_out_ex_set(5,nmonth);
		memset(var,0,sizeof(double)*POINTS_PER_DAY);
		memcpy(var,dPosRegulation,sizeof(double)*POINTS_PER_DAY);
		app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_TYPICAL_SIMULATE,nStartDate,nEndDate,var,0);
		app_out_ex_clear();
		app_out_ex_set(1,me->nTimes);
		app_out_ex_set(2,dPowerMaxall);
		app_out_ex_set(3,dFlatRegulationPro);
		app_out_ex_set(4,1);
		app_out_ex_set(5,nmonth);
		memset(var,0,sizeof(double)*POINTS_PER_DAY);
		memcpy(var,dFlatRegulation,sizeof(double)*POINTS_PER_DAY);
		app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_TYPICAL_SIMULATE,nStartDate,nEndDate,var,0);
		app_out_ex_clear();
		app_out_ex_set(1,me->nTimes);
		app_out_ex_set(2,dPowerMaxall);
		app_out_ex_set(3,dNegRegulationPro);
		app_out_ex_set(4,2);
		app_out_ex_set(5,nmonth);
		memset(var,0,sizeof(double)*POINTS_PER_DAY);
		memcpy(var,dNegRegulation,sizeof(double)*POINTS_PER_DAY);
		app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_TYPICAL_SIMULATE,nStartDate,nEndDate,var,0);
		//输出理论典型出力
		app_stat_wind_daily_curve(me, dAverageLoad,dapower,nCount,dPowerMaxall,dPosRegulation,dNegRegulation,dMaxHourlyOutput,dMinHourlyOutput,dAverageHourlyOutput);
		app_out_ex_clear();
		app_out_ex_set(1,me->nTimes);
		app_out_ex_set(2,dPowerMaxall);
		app_out_ex_set(3,dPosRegulationPro);
		app_out_ex_set(4,0);
		app_out_ex_set(5,nmonth);
		memset(var,0,sizeof(double)*POINTS_PER_DAY);
		memcpy(var,dPosRegulation,sizeof(double)*POINTS_PER_DAY);
		app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_TYPICAL_THEORETICAL,nStartDate,nEndDate,var,0);
		app_out_ex_clear();
		app_out_ex_set(1,me->nTimes);
		app_out_ex_set(2,dPowerMaxall);
		app_out_ex_set(3,dFlatRegulationPro);
		app_out_ex_set(4,1);
		app_out_ex_set(5,nmonth);
		memset(var,0,sizeof(double)*POINTS_PER_DAY);
		memcpy(var,dAverageHourlyOutput,sizeof(double)*POINTS_PER_DAY);
		app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_TYPICAL_THEORETICAL,nStartDate,nEndDate,var,0);
		app_out_ex_clear();
		app_out_ex_set(1,me->nTimes);
		app_out_ex_set(2,dPowerMaxall);
		app_out_ex_set(3,dNegRegulationPro);
		app_out_ex_set(4,2);
		app_out_ex_set(5,nmonth);
		memset(var,0,sizeof(double)*POINTS_PER_DAY);
		memcpy(var,dNegRegulation,sizeof(double)*POINTS_PER_DAY);
		app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_TYPICAL_THEORETICAL,nStartDate,nEndDate,var,0);
	}
	
	free(daLoad);
	free(dapower);
	free(dapowerall);
	free(napowerall);
}
예제 #11
0
파일: WPS_Sub.c 프로젝트: MasonXQY/OPSP
void app_out_wind_power_stat( app* me ) 
{
	int i,j,nCount,nCount2;
	int nDate,nYear,ntemp;
	int nPosDay=0,nFlatDay=0,nNegDay=0;
	unit *pUnit;
	unit_para *pUnitPara,*pUnitParatemp;
	wind_para* pWindPara,*pWindParatemp;
	unit_power* pUnitPower;
	double dapower[POINTS_PER_DAY*DAYS_PER_YEAR]={0};
	double dapowerall[POINTS_PER_DAY*DAYS_PER_YEAR]={0};
	int napowerall[POINTS_PER_DAY*DAYS_PER_YEAR]={0};
	double var[POINTS_PER_DAY]={0};
	int nBeginYear=0,nEndYear=0;
	double daPDF[WPS_DISTRIBUTION_INTERVAL]={0};
	double daCDF[WPS_DISTRIBUTION_INTERVAL]={0};
	double dminoutput,dmaxoutput,dmeanoutput,dPowerMax,dPowerMaxall,dmaxoutputSigma;
	double dPosRegulation[POINTS_PER_DAY]={0};
	double dNegRegulation[POINTS_PER_DAY]={0};
	double dFlatRegulation[POINTS_PER_DAY]={0};
	double dAverageLoad[POINTS_PER_DAY]={0};
	double dMaxHourlyOutput[POINTS_PER_DAY]={0};
	double dMinHourlyOutput[POINTS_PER_DAY]={0};
	double dAverageHourlyOutput[POINTS_PER_DAY]={0};
	double *daLoad;
	double dPosRegulationPro,dNegRegulationPro,dFlatRegulationPro;
	load* pLoad;
	regulation *pRegulationPro;
	daLoad=(double*)malloc(sizeof(double)*POINTS_PER_DAY*DAYS_PER_YEAR);


	//由于CDF和PDF都需要通过var输出,所以这里规定其长度不能大于var
	if (WPS_DISTRIBUTION_INTERVAL>POINTS_PER_DAY-4)
	{
		app_err(WPS_EXIT_PARAERROR,"输入参数有误");
	}

	nBeginYear=(me->nStartDate/10000);
	if (me->nEndDate==idate_first_day_of_year(me->nEndDate))
	{
		nEndYear=(me->nEndDate/10000)-1;
	}
	else
	{
		nEndYear=(me->nEndDate/10000);
	}
	for (nYear=nBeginYear;nYear<=nEndYear;nYear++)
	{
		dPowerMaxall=0;dmaxoutputSigma=0;
		memset(dapowerall,0,sizeof(double)*POINTS_PER_DAY*DAYS_PER_YEAR);
		memset(napowerall,0,sizeof(int)*POINTS_PER_DAY*DAYS_PER_YEAR);

		//输出风电场典型出力
		memset(dPosRegulation,0,sizeof(double)*POINTS_PER_DAY);
		memset(dNegRegulation,0,sizeof(double)*POINTS_PER_DAY);
		memset(dFlatRegulation,0,sizeof(double)*POINTS_PER_DAY);
		memset(dAverageLoad,0,sizeof(double)*POINTS_PER_DAY);
		memset(daLoad,0,sizeof(double)*POINTS_PER_DAY*DAYS_PER_YEAR);

		for(i=0;i<me->aUnits.n;i++)
		{
			memset(dapower,0,sizeof(double)*POINTS_PER_DAY*DAYS_PER_YEAR);
			pUnit=(unit*)(me->aUnits.buf[i]);
			nCount=0;dPowerMax=0;
			for (nDate=nYear*10000+101;nDate<nYear*10000+10101;nDate=idate_next_day(nDate))
			{
				if (nDate<me->nStartDate||nDate>=me->nEndDate) continue;
				pUnitPara=app_cur_unit_para(pUnit,nDate);
				if(pUnitPara==NULL) continue;
				if(pUnitPara->nUnitTypeIn!=11) continue;		
				pWindPara=app_cur_wind_para(pUnit,nDate);
				if (pWindPara==NULL) continue;	
				if (dPowerMax<pUnitPara->dPowerMax)
				{
					dPowerMax=pUnitPara->dPowerMax;
				}
				pUnitParatemp=pUnitPara;pWindParatemp=pWindPara;
				pUnitPower=app_cur_unit_power(pUnit,nDate);
				if (pUnitPower==NULL) continue;	
				ntemp=idate_day_idx_of_year(nDate);
				for(j=0;j<POINTS_PER_DAY;j++)	
				{
					dapower[nCount]=pUnitPower->dPower[j];
					nCount++;
					dapowerall[(ntemp-1)*POINTS_PER_DAY+j]+=pUnitPower->dPower[j];
					napowerall[(ntemp-1)*POINTS_PER_DAY+j]=1;
				}
			}
			//开始统计风电特性
			if (nCount>0)
			{
				dPowerMaxall+=dPowerMax;
				app_stat_wind_power(dapower,nCount, dPowerMax,daPDF,daCDF,&dminoutput,&dmaxoutput,&dmeanoutput,WPS_MIN_OUTPUT_CONFIDENCE,WPS_MAX_OUTPUT_CONFIDENCE);
				dmaxoutputSigma+=dmaxoutput;
				app_out_ex_clear();
				app_out_ex_set(1,me->nTimes);
				app_out_ex_set(2,dPowerMax);
				app_out_ex_set(3,pUnitParatemp->nNodeId);
				app_out_ex_set(4,pWindParatemp->nWindZone);
				memset(var,0,sizeof(double)*POINTS_PER_DAY);
				var[POINTS_PER_DAY-3]=dminoutput;
				var[POINTS_PER_DAY-2]=dmaxoutput;
				var[POINTS_PER_DAY-1]=dmeanoutput;
				memcpy(var,daPDF,sizeof(double)*WPS_DISTRIBUTION_INTERVAL);
				app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_STAT_PDF,nYear*10000+101,nYear*10000+10101,var,0);
				memcpy(var,daCDF,sizeof(double)*WPS_DISTRIBUTION_INTERVAL);
				app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_STAT_CDF,nYear*10000+101,nYear*10000+10101,var,0);
			}
		}
		nCount=0;
		memset(dapower,0,sizeof(double)*POINTS_PER_DAY*DAYS_PER_YEAR);
		for(j=0;j<POINTS_PER_DAY*DAYS_PER_YEAR;j++)	
		{
			if (napowerall[j]==1)
			{
				dapower[nCount]=dapowerall[j];
				nCount++;
			}
		}
		if (nCount>0)
		{
			app_stat_wind_power(dapower,nCount, dPowerMaxall,daPDF,daCDF,&dminoutput,&dmaxoutput,&dmeanoutput,WPS_MIN_OUTPUT_CONFIDENCE,WPS_MAX_OUTPUT_CONFIDENCE);
			app_out_ex_clear();
			app_out_ex_set(1,me->nTimes);
			app_out_ex_set(2,dPowerMaxall);
			memset(var,0,sizeof(double)*POINTS_PER_DAY);
			var[POINTS_PER_DAY-4]=dmaxoutput/dmaxoutputSigma;
			var[POINTS_PER_DAY-3]=dminoutput;
			var[POINTS_PER_DAY-2]=dmaxoutput;
			var[POINTS_PER_DAY-1]=dmeanoutput;
			memcpy(var,daPDF,sizeof(double)*WPS_DISTRIBUTION_INTERVAL);
			app_out_array(me,me->nPJID,0,RT_WIND_ALL_STAT_PDF,nYear*10000+101,nYear*10000+10101,var,0);
			memcpy(var,daCDF,sizeof(double)*WPS_DISTRIBUTION_INTERVAL);
			app_out_array(me,me->nPJID,0,RT_WIND_ALL_STAT_CDF,nYear*10000+101,nYear*10000+10101,var,0);
			//输出风电场典型出力
			memset(dPosRegulation,0,sizeof(double)*POINTS_PER_DAY);
			memset(dNegRegulation,0,sizeof(double)*POINTS_PER_DAY);
			memset(dFlatRegulation,0,sizeof(double)*POINTS_PER_DAY);
			memset(dAverageLoad,0,sizeof(double)*POINTS_PER_DAY);
			memset(dMaxHourlyOutput,0,sizeof(double)*POINTS_PER_DAY);
			memset(dMinHourlyOutput,0,sizeof(double)*POINTS_PER_DAY);
			memset(dAverageHourlyOutput,0,sizeof(double)*POINTS_PER_DAY);
			memset(daLoad,0,sizeof(double)*POINTS_PER_DAY*DAYS_PER_YEAR);
			nCount2=0;
			for (nDate=nYear*10000+101;nDate<nYear*10000+10101;nDate=idate_next_day(nDate))
			{
				pLoad=app_cur_load(me,nDate);
				for(j=0;j<POINTS_PER_DAY;j++)	
				{
					daLoad[nCount2+j]=pLoad->dLoad[j];
					dAverageLoad[j]+=pLoad->dLoad[j]/nCount*POINTS_PER_DAY;
				}
				for(i=0;i<me->aUnits.n;i++)
				{
					pUnit=(unit*)(me->aUnits.buf[i]);
					pUnitPara=app_cur_unit_para(pUnit,nDate);
					if (pUnitPara!=NULL&&pUnitPara->nUnitTypeIn==11) continue;	
					pUnitPower=app_cur_unit_power(pUnit,nDate);
					if (pUnitPower==NULL) continue;	
					for(j=0;j<POINTS_PER_DAY;j++)	
					{
						if (pUnitPower->dPower[j]<0)
						{
							daLoad[nCount2+j]-=pUnitPower->dPower[j];
							dAverageLoad[j]-=pUnitPower->dPower[j]/nCount*POINTS_PER_DAY;
						}
					}
				}
				nCount2+=POINTS_PER_DAY;
			}

			dPosRegulationPro=0;dNegRegulationPro=0;dFlatRegulationPro=0;
			pRegulationPro=app_cur_regulationpro(me,nYear*10000+101);
			app_stat_wind_typical_curve(me, daLoad,dapower,nCount,dPosRegulation,dNegRegulation,dFlatRegulation,&dPosRegulationPro,&dNegRegulationPro,&dFlatRegulationPro);
			dPosRegulationPro=0;
			dNegRegulationPro=0;
			dFlatRegulationPro=0;
			for(i=0;i<12;i++)
			{
				nPosDay+=pRegulationPro->nPosRegulationdays[i];
				nFlatDay+=pRegulationPro->nFlatRegulationdays[i];
				nNegDay+=pRegulationPro->nNegRegulationdays[i];
				dPosRegulationPro+=pRegulationPro->nPosRegulationdays[i]*pRegulationPro->dPosRegulationPro[i];
				dFlatRegulationPro+=pRegulationPro->nFlatRegulationdays[i]*pRegulationPro->dFlatRegulationPro[i];
				dNegRegulationPro+=pRegulationPro->nNegRegulationdays[i]*pRegulationPro->dNegRegulationPro[i];
			}
			dPosRegulationPro/=(nPosDay+TINY);
			dFlatRegulationPro/=(nFlatDay+TINY);
			dNegRegulationPro/=(nNegDay+TINY);
			//输出模拟典型出力
			app_out_ex_clear();
			app_out_ex_set(1,me->nTimes);
			app_out_ex_set(2,dPowerMaxall);
			app_out_ex_set(3,dPosRegulationPro);
			app_out_ex_set(4,0);
			memset(var,0,sizeof(double)*POINTS_PER_DAY);
			memcpy(var,dPosRegulation,sizeof(double)*POINTS_PER_DAY);
			app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_TYPICAL_SIMULATE,nYear*10000+101,nYear*10000+10101,var,0);
			app_out_ex_clear();
			app_out_ex_set(1,me->nTimes);
			app_out_ex_set(2,dPowerMaxall);
			app_out_ex_set(3,dFlatRegulationPro);
			app_out_ex_set(4,1);
			memset(var,0,sizeof(double)*POINTS_PER_DAY);
			memcpy(var,dFlatRegulation,sizeof(double)*POINTS_PER_DAY);
			app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_TYPICAL_SIMULATE,nYear*10000+101,nYear*10000+10101,var,0);
			app_out_ex_clear();
			app_out_ex_set(1,me->nTimes);
			app_out_ex_set(2,dPowerMaxall);
			app_out_ex_set(3,dNegRegulationPro);
			app_out_ex_set(4,2);
			memset(var,0,sizeof(double)*POINTS_PER_DAY);
			memcpy(var,dNegRegulation,sizeof(double)*POINTS_PER_DAY);
			app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_TYPICAL_SIMULATE,nYear*10000+101,nYear*10000+10101,var,0);
			//输出理论典型出力
			app_stat_wind_daily_curve(me, dAverageLoad,dapower,nCount,dPowerMaxall,dPosRegulation,dNegRegulation,dMaxHourlyOutput,dMinHourlyOutput,dAverageHourlyOutput);
			app_out_ex_clear();
			app_out_ex_set(1,me->nTimes);
			app_out_ex_set(2,dPowerMaxall);
			app_out_ex_set(3,dPosRegulationPro);
			app_out_ex_set(4,0);
			memset(var,0,sizeof(double)*POINTS_PER_DAY);
			memcpy(var,dPosRegulation,sizeof(double)*POINTS_PER_DAY);
			app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_TYPICAL_THEORETICAL,nYear*10000+101,nYear*10000+10101,var,0);
			app_out_ex_clear();
			app_out_ex_set(1,me->nTimes);
			app_out_ex_set(2,dPowerMaxall);
			app_out_ex_set(3,dFlatRegulationPro);
			app_out_ex_set(4,1);
			memset(var,0,sizeof(double)*POINTS_PER_DAY);
			memcpy(var,dAverageHourlyOutput,sizeof(double)*POINTS_PER_DAY);
			app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_TYPICAL_THEORETICAL,nYear*10000+101,nYear*10000+10101,var,0);
			app_out_ex_clear();
			app_out_ex_set(1,me->nTimes);
			app_out_ex_set(2,dPowerMaxall);
			app_out_ex_set(3,dNegRegulationPro);
			app_out_ex_set(4,2);
			memset(var,0,sizeof(double)*POINTS_PER_DAY);
			memcpy(var,dNegRegulation,sizeof(double)*POINTS_PER_DAY);
			app_out_array(me,me->nPJID,pUnit->nId,RT_WIND_ALL_TYPICAL_THEORETICAL,nYear*10000+101,nYear*10000+10101,var,0);
		}
	}
	free(daLoad);
}
예제 #12
0
int main(int argc, char *argv[])
{
#ifndef BS2000
	extern char *optarg;
#endif
	int c;
	int cd;
	int status;
	char remote_provider[16], remote_service[16];
	int port = DEFAULT_PORT;
	struct ro_connect_rq rocrq;
	char event_buffer[EVENTBUFFERSIZE];
	struct ro_event *roe = (struct ro_event *) event_buffer;

	strncpy(remote_provider,REMOTE_PROVIDER,15);
	strncpy(remote_service,REMOTE_SERVICE,15);
	remote_provider[15] = remote_service[15] = '\0';

#ifndef BS2000
	while((c = getopt(argc, argv, "p:h:s:")) != -1)
	{
		switch(c)
		{
			case 'p':
				port = atoi(optarg);
				break;
			case 'h':
				strncpy(remote_provider,optarg,15);
				break;
			case 's':
				strncpy(remote_service,optarg,15);
				break;
			case '?':
				usage();
				exit(1);
		}
	}
#endif

	status = ro_init("roping.log",10,port,&roi);
	app_err(status,&roi);

	strncpy(rocrq.myhostname,MYHOSTNAME,15);
	strncpy(rocrq.myservicename,MYSERVICENAME,15);
	rocrq.level = RO_ADMIN_LEVEL;
	rocrq.roc.mode = RO_MODE_TRANSPARENT;
	rocrq.roc.escape = RO_DEFAULT_ESC;
	rocrq.id = 1;
dprintf(1,"ro_ping: Connecting...\n");
	status = ro_connect(remote_provider,remote_service,&rocrq,&cd,&roi);
	app_err(status,&roi);

dprintf(1,"ro_ping: Waiting...\n");
	while((status = ro_wait_event(-1, -1, sizeof(event_buffer),
						(struct ro_event *) event_buffer, &roi)) == RO_OK)
	{
		if(status != RO_OK)
		{
			app_err(status,&roi);
			break;
		}
		switch(roe->event_typ)
		{
			case RO_CONNECT_CONFIRMATION:
				cd = roe->cd;
				do_ping(cd);
				break;
			case RO_CONNECT_REJECT:
				puts("ro_ping: Connection rejected, exiting...");
				exit(1);
				break;
			case RO_INVOKE_RESULT:
				printf("Pong (%lu) with %lu bytes received.\n",
					   roe->event.roirs.id, roe->event.roirs.resultlen);
				sleep(1);
				do_ping(cd);
				break;
			case RO_INVOKE_REJECT:
				puts("ro_ping: Invocation rejected, exiting...");
				exit(1);
				break;
			default:
				dprintf(2,"Unhandled event received (%d), ignoring...\n",
				       roe->event_typ);
				break;
		}
	}
	ro_release(&roi);
	return 0;
}