• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ OBJECTHDR函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中OBJECTHDR函数的典型用法代码示例。如果您正苦于以下问题:C++ OBJECTHDR函数的具体用法?C++ OBJECTHDR怎么用?C++ OBJECTHDR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: OBJECTHDR

int generator::init(node *parent)
{
	// check sanity of initial state
	if (parent->type==PQ && !Qcontrolled)
	{
		OBJECT *obj = OBJECTHDR(this);
		gl_error("generator:%d is Qcontrolled but is not connected to a PQ bus", obj->id);
		return 0;
	}
	else if (parent->type!=PQ && Qcontrolled)
	{
		OBJECT *obj = OBJECTHDR(this);
		gl_error("generator:%d is not Qcontrolled but is connected to a PQ bus", obj->id);
		return 0;
	}
	else if (Qcontrolled && Qdesired_MVAR<Qmin_MVAR && Qdesired_MVAR>Qmax_MVAR)
	{
		OBJECT *obj = OBJECTHDR(this);
		gl_error("generator:%d Qdesired is out of Qmin/Qmax limits", obj->id);
		return 0;
	}
	else if (parent->type!=SWING && Pdesired_MW>Pmax_MW)
	{
		OBJECT *obj = OBJECTHDR(this);
		gl_error("generator:%d Pdesired exceeds Pmax", obj->id);
		return 0;
	}
	return 1;
}
开发者ID:SanjayaDeSilva,项目名称:GridLAB-D,代码行数:29,代码来源:generator.cpp


示例2: OBJECTHDR

int motor::init(OBJECT *parent)
{
	int result = node::init();

	OBJECT *obj = OBJECTHDR(this);
	return result;
}
开发者ID:GridOPTICS,项目名称:FNCS-gridlab-d,代码行数:7,代码来源:motor.cpp


示例3: OBJECTHDR

int residential_enduse::init(OBJECT *parent)
{
	OBJECT *hdr = OBJECTHDR(this);
	hdr->flags |= OF_SKIPSAFE;
	ATTACHFUNCTION attach = 0;

	//	pull parent attach_enduse and attach the enduseload
	if(parent)
		attach = (ATTACHFUNCTION)(gl_get_function(parent, "attach_enduse"));
	if(parent && attach)
		pCircuit = (*attach)(parent, &load, load.breaker_amps, (load.config&EUC_IS220)!=0);
	else if (parent)
		gl_warning("%s (%s:%d) parent %s (%s:%d) does not export attach_enduse function so voltage response cannot be modeled", hdr->name?hdr->name:"(unnamed)", hdr->oclass->name, hdr->id, parent->name?parent->name:"(unnamed)", parent->oclass->name, parent->id);
		/* TROUBLESHOOT
			Enduses must have a voltage source from a parent object that exports an attach_enduse function.  
			The residential_enduse object references a parent object that does not conform with this requirement.
			Fix the parent reference and try again.
		 */

	if (load.shape!=NULL) {
		if (load.shape->schedule==NULL)
		{
			gl_verbose("%s (%s:%d) schedule is not specified so the load may be inactive", hdr->name?hdr->name:"(unnamed)", hdr->oclass->name, hdr->id);
			/* TROUBLESHOOT
				The residential_enduse object requires a schedule that defines how
				the load behaves.  Omitting this schedule effectively shuts the enduse
				load off and this is not typically intended.
			 */
		}
	}

	return 1;
}
开发者ID:mikesligo,项目名称:gridlab-d,代码行数:33,代码来源:residential_enduse.cpp


示例4: complex

int dishwasher::create() 
{
	int res = residential_enduse::create();

	// name of enduse
	load.name = oclass->name;

	load.power = load.admittance = load.current = load.total = complex(0,0,J);
	load.voltage_factor = 1.0;
	load.power_factor = 0.95;
	load.power_fraction = 1;
	is_240 = true;

	state = dishwasher_STOPPED;
	
	energy_used = 0;
	
	coil_power[0] = -1;
	motor_on_off = motor_coil_on_off = both_coils_on_off = 0;

	last_t = 0;
	

	gl_warning("explicit %s model is experimental and has not been validated", OBJECTHDR(this)->oclass->name);
	/* TROUBLESHOOT
		The dishwasher explicit model has some serious issues and should be considered for complete
		removal.  It is highly suggested that this model NOT be used.
	*/

	return res;
}
开发者ID:GridOPTICS,项目名称:FNCS-gridlab-d,代码行数:31,代码来源:dishwasher.cpp


示例5: OBJECTHDR

void range::wrong_model(enumeration msg)
{
	char *errtxt[] = {"model is not one-zone","model is not two-zone"};
	OBJECT *obj = OBJECTHDR(this);
	gl_warning("%s (range:%d): %s", obj->name?obj->name:"(anonymous object)", obj->id, errtxt[msg]);
	throw msg; // this must be caught by the range code, not by the core
}
开发者ID:brennane,项目名称:gridpot,代码行数:7,代码来源:range.cpp


示例6: complex

int dryer::create() 
{
	int res = residential_enduse::create();

	// name of enduse
	load.name = oclass->name;

	load.power = load.admittance = load.current = load.total = complex(0,0,J);
	load.voltage_factor = 1.0;
	load.power_factor = 0.95;
	load.power_fraction = 1;
	is_240 = true;

	coil_power[0] = -1;

	state = DRYER_STOPPED;
	
	energy_used = 0;	
	
	last_t = 0;	

	gl_warning("explicit %s model is experimental", OBJECTHDR(this)->oclass->name);

	return res;
}
开发者ID:SanjayaDeSilva,项目名称:GridLAB-D,代码行数:25,代码来源:dryer.cpp


示例7: OBJECTHDR

int transmissioncom::init(OBJECT *parent)
{
	OBJECT *hdr = OBJECTHDR(this);
	

	// input validation checks
	// * parent is a controller
	if(0 == parent){
		gl_error("init(): no parent object");
		return 0;
	}

	if(!gl_object_isa(parent, "substation", "powerflow") && !gl_object_isa(parent, "meter", "powerflow")){
		gl_error("init(): parent is not a powerflow:substation or a powerflow:meter.");
		return 0;
	}

	//TODO: datafromgld=gl_get_property.....
	datafromgld = get_complex(parent, power_property);
	datatogld = get_complex(parent, voltage_property);
	if(gl_object_isa(parent, "substation", "powerflow")){
		powerdiff = get_double(parent,"power_convergence_value");
	} else {
		default_powerdiff = 1; //default is 1 VA
		powerdiff = &default_powerdiff;
	}
	myinterface=Integrator::getCommInterface(hdr->name);
	printf("MY INTEFRACE is mull %d\n",myinterface==NULL);
}
开发者ID:GridOPTICS,项目名称:FNCS-gridlab-d,代码行数:29,代码来源:transmission_interface.cpp


示例8: memory_open_collector

/*******************************************************************
 * collectors 
 */
int memory_open_collector(struct collector *my, char *fname, char *flags)
{
	time_t now=time(NULL);
	OBJECT *obj=OBJECTHDR(my);

	my->memory = (MEMORY*)malloc(sizeof(MEMORY));
	if (my->memory==NULL)
	{
		gl_error("memory_open_collector(struct recorder *my={...}, char *fname='%s', char *flags='%s'): %s", fname, flags, strerror(errno));
		my->status = TS_DONE;
		return 0;
	}
	my->memory->buffer = gl_global_find(fname);
	if (my->memory->buffer==NULL)
	{
		gl_error("memory_open_collector(struct recorder *my={...}, char *fname='%s', char *flags='%s'): global '%s' not found", fname, flags, fname);
		my->status = TS_DONE;
		return 0;
	}
	my->memory->index = 0;
	my->type = FT_MEMORY;
	my->last.ts = TS_ZERO;
	my->status=TS_OPEN;
	my->samples=0;
	return 1;

}
开发者ID:GridOPTICS,项目名称:FNCS-gridlab-d,代码行数:30,代码来源:memory.c


示例9: file_open_recorder

/*******************************************************************
 * recorders 
 */
int file_open_recorder(struct recorder *my, char *fname, char *flags)
{
	time_t now=time(NULL);
	OBJECT *obj=OBJECTHDR(my);
	
	my->fp = (strcmp(fname,"-")==0?stdout:fopen(fname,flags));
	if (my->fp==NULL)
	{
		gl_error("recorder file %s: %s", fname, strerror(errno));
		my->status = TS_DONE;
		return 0;
	}
	my->type = FT_FILE;
	my->last.ts = TS_ZERO;
	my->status=TS_OPEN;
	my->samples=0;

	/* put useful header information in file first */
	fprintf(my->fp,"# file...... %s\n", my->file);
	fprintf(my->fp,"# date...... %s", asctime(localtime(&now)));
#ifdef WIN32
	fprintf(my->fp,"# user...... %s\n", getenv("USERNAME"));
	fprintf(my->fp,"# host...... %s\n", getenv("MACHINENAME"));
#else
	fprintf(my->fp,"# user...... %s\n", getenv("USER"));
	fprintf(my->fp,"# host...... %s\n", getenv("HOST"));
#endif
	fprintf(my->fp,"# target.... %s %d\n", obj->parent->oclass->name, obj->parent->id);
	fprintf(my->fp,"# trigger... %s\n", my->trigger[0]=='\0'?"(none)":my->trigger);
	fprintf(my->fp,"# interval.. %d\n", my->interval);
	fprintf(my->fp,"# limit..... %d\n", my->limit);
	fprintf(my->fp,"# timestamp,%s\n", my->property);

	return 1;
}
开发者ID:devendrashelar7,项目名称:gridnetd,代码行数:38,代码来源:file.c


示例10: OBJECTHDR

//Module-level deltamode call
SIMULATIONMODE switch_object::inter_deltaupdate_switch(unsigned int64 delta_time, unsigned long dt, unsigned int iteration_count_val,bool interupdate_pos)
{
	OBJECT *hdr = OBJECTHDR(this);
	TIMESTAMP t0_val, t2_val;
	unsigned char work_phases_pre, work_phases_post;

	//Initialize - just set to random values, not used here
	t0_val = TS_NEVER;
	t2_val = TS_NEVER;

	if (interupdate_pos == false)	//Before powerflow call
	{
		//Link presync stuff
		NR_link_presync_fxn();

		//Switch sync item - pre-items
		BOTH_switch_sync_pre(&work_phases_pre,&work_phases_post);

		//Switch sync item - post items
		NR_switch_sync_post(&work_phases_pre,&work_phases_post,hdr,&t0_val,&t2_val);
		
		return SM_DELTA;	//Just return something other than SM_ERROR for this call
	}
	else	//After the call
	{
		//Call postsync
		BOTH_link_postsync_fxn();
		
		return SM_EVENT;	//Links always just want out
	}
}//End module deltamode
开发者ID:ryuever,项目名称:sgrid,代码行数:32,代码来源:switch_object.cpp


示例11: OBJECTHDR

double waterheater::actual_kW(void)
{
	OBJECT *obj = OBJECTHDR(this);
	const double nominal_voltage = 240.0; //@TODO:  Determine if this should be published or how we want to obtain this from the equipment/network
    static int trip_counter = 0;

	// calculate rated heat capacity adjusted for the current line voltage
	if (heat_needed && re_override != OV_OFF)
    {
		if(heat_mode == GASHEAT){
			return heating_element_capacity; /* gas heating is voltage independent. */
		}
		const double actual_voltage = pCircuit ? pCircuit->pV->Mag() : nominal_voltage;
        if (actual_voltage > 2.0*nominal_voltage)
        {
            if (trip_counter++ > 10)
				GL_THROW("Water heater line voltage for waterheater:%d is too high, exceeds twice nominal voltage.",obj->id);
			/*	TROUBLESHOOT
				The waterheater is receiving twice the nominal voltage consistantly, or about 480V on what
				should be a 240V circuit.  Please sanity check your powerflow model as it feeds to the
				meter and to the house.
			*/
            else
                return 0.0;         // @TODO:  This condition should trip the breaker with a counter
        }
		double test = heating_element_capacity * (actual_voltage*actual_voltage) / (nominal_voltage*nominal_voltage);
		return test;
    }
	else
		return 0.0;
}
开发者ID:mafoti,项目名称:StrategicConsumersFullCode,代码行数:31,代码来源:waterheater.cpp


示例12: OBJECTHDR

TIMESTAMP refrigerator::presync(TIMESTAMP t0, TIMESTAMP t1){
	OBJECT *hdr = OBJECTHDR(this);
	double t = 0.0, dt = 0.0;
	double nHours = (gl_tohours(t1)- gl_tohours(t0))/TS_SECOND;

	Tout = *pTout;

	if(nHours > 0 && t0 > 0){ /* skip this on TS_INIT */
		const double COP = COPcoef*((-3.5/45)*(Tout-70)+4.5); /* come from ??? */

		if(t1 == next_time){
			/* lazy skip-ahead */
			load.heatgain = (-((Tair - Tout) * exp(-(UAr+UAf)/Cf) + Tout - Tair) * Cf + Qr * COP) * KWPBTUPH;
			Tair = Tevent;
		} else {
			/* run calculations */
			const double C1 = Cf/(UAr+UAf);
			const double C2 = Tout - Qr/UAr;
			load.heatgain = (-((Tair - Tout) * exp(-(UAr+UAf)/Cf) + Tout - Tair) * Cf  + Qr * COP) * KWPBTUPH;;
			Tair = (Tair-C2)*exp(-nHours/C1)+C2;
		}
		if (Tair < 32 || Tair > 55)
			throw "refrigerator air temperature out of control";
		last_time = t1;
	}

	return TS_NEVER;
}
开发者ID:gelliravi,项目名称:gridspice.simulator,代码行数:28,代码来源:refrigerator.cpp


示例13: OBJECTHDR

double house::get_Tsolar(int hour, int month, double Tair, double Tout)
{
	// Wood frame wall CLTD values from ASHRAE 1989 (for sunlighted walls in the north latitude)
	static double CLTD[] = {4.25, 2.75, 1.63, 0.50, -0.50, 3.50, 11.25, 17.88, 22.50, 25.88, 27.88, 29.25, 31.63, 35.13, 38.50, 40.38, 36.88, 28.00, 19.00, 14.00, 11.13, 8.63, 6.25};

	static double LM[4][24] =	{	
		{-1.33, -1.44, -0.89, -1.00, -0.67, -0.44, -0.67, -1.00, -0.89, -1.44, -1.33, -1.22},  // latitude 24
		{-2.89, -1.89, -0.78, -0.44, -0.11, -0.11, -0.11, -0.44, -0.78, -1.89, -2.89, -4.67},  // latitude 32
		{-5.44, -3.22, -1.11, -0.11, 0.22, 0.67, 0.22, -0.11, -1.11, -3.22, -5.44, -6.33},  // latitude 40
		{-7.56, -5.11, -1.78, -0.11, 1.33, 2.00, 1.33, -0.11, -1.78, -5.11, -7.56} // latitude 48
	};

	static double ColorSurface = 0.75;
	static double DR = 15.0;
	double solarTemp = Tair;
	double LMnow = 0.0;
	int LMcol = month-1;

	OBJECT *hdr = OBJECTHDR(this);

	if (hdr->latitude <= 24.0)
		LMnow = LM[0][LMcol];
	else if (hdr->latitude <= 32.)
		LMnow = LM[0][LMcol] + ((LM[1][LMcol]-LM[0][LMcol])*(hdr->latitude-24.0)/12.0);
	else if (hdr->latitude <= 40.)
		LMnow = LM[1][LMcol] + ((LM[2][LMcol]-LM[1][LMcol])*(hdr->latitude-32.0)/12.0);
	else if (hdr->latitude <= 48.)
		LMnow = LM[2][LMcol] + ((LM[3][LMcol]-LM[2][LMcol])*(hdr->latitude-40.0)/12.0);
	else // if (hdr->latitude > 48.0)
		LMnow = LM[3][LMcol];

	solarTemp += (CLTD[hour] + LMnow)*ColorSurface + (78. - Tair) + ((*pTout) - DR/2. - 85.);

	return solarTemp;
}
开发者ID:brennane,项目名称:gridpot,代码行数:35,代码来源:house_a.cpp


示例14: OBJECTHDR

int schedule::init(OBJECT *parent)
{
	OBJECT *hdr = OBJECTHDR(this);
	int rv = 1;

	currval = default_value;
	if(filename[0] == 0){
		rv = parse_schedule();
	} else {
		rv = open_sched_file();
	}
	
	if(rv == 0){
		state = TS_ERROR;
		strcpy(errmsg, "Error reading & parsing schedule input source");
	}
	/* group rules together here */

	/* ...or not (yet). */

	if(state == TS_INIT){
		state = TS_OPEN;
	} else if(state == TS_ERROR){
		gl_error("unable to open schedule");
		state = TS_DONE;
	}

	return 1;
}
开发者ID:devendrashelar7,项目名称:gridnetd,代码行数:29,代码来源:schedule.cpp


示例15: init

/* Object initialization is called once after all object have been created */
int stubauction::init(OBJECT *parent)
{
	OBJECT *obj=OBJECTHDR(this);
	market_id = 0;
	if(period == 0) period = 300;
	clearat = nextclear();
	return 1; /* return 1 on success, 0 on failure */
}
开发者ID:AMFIRNAS,项目名称:wso2-gridlabd,代码行数:9,代码来源:stubauction.cpp


示例16: gl_verbose

/** Initialize water heater model properties - randomized defaults for all published variables
 **/
int virtual_battery::init(OBJECT *parent)
{
	
	parent2=parent;
	first_time=0;
	first_time2=0;
	actual=0;
	temp_capacity=0;
	if(parent != NULL){
		if((parent->flags & OF_INIT) != OF_INIT){
			char objname[256];
			gl_verbose("virtual_battery::init(): deferring initialization on %s", gl_name(parent, objname, 255));
			return 2; // defer
		}
	}
	OBJECT *hdr = OBJECTHDR(this);
	hdr->flags |= OF_SKIPSAFE;

		///////////////////////////////find auction object/////////////////////////////////////
				 static FINDLIST *xt1=NULL;
				 xt1=gl_find_objects(FL_NEW,FT_CLASS,SAME,"auction",FT_END);
				 OBJECT *firstt1= gl_find_next(xt1,NULL);
				 OBJECT *it1;
				 for(it1=firstt1;it1!=NULL;it1=it1->next)
				 {
				
					 if(gl_object_isa(it1,"auction"))
				     {

						
						 auction_object=it1;
						
					 }

				 }
       /////////////////////////////////////////////////////////////////////////////////////////
       /////////////////////////////find climate object ///////////////////////////////////////

		FINDLIST *climates = NULL; 
		OBJECT *obj;
		climates = gl_find_objects(FL_NEW,FT_CLASS,SAME,"climate",FT_END);
		obj = gl_find_next(climates,NULL);

		if (gl_object_isa(obj,"climate"))
		{
			climate_object=obj;
		}





      ///////////////////////////////////////////////////////////////////////////////////////	
	// check the load configuration before initializing the parent class
	
	return 1;
	
}
开发者ID:project-hephaestus,项目名称:Agricultural,代码行数:60,代码来源:virtual_battery.cpp


示例17: exp

double node::get_obs_probability(void) const
{
	if (r2<0)
		return 1;
	double pr = exp(-0.5*r2); /// @todo there should be a 1/sqrt(2*pi) coeff on the observability probability, yet it works. (network, low priority)
	if (pr>1)
		gl_warning("node:%d observation probability exceeds 1!", OBJECTHDR(this)->id);
	return pr;
}
开发者ID:SanjayaDeSilva,项目名称:GridLAB-D,代码行数:9,代码来源:node.cpp


示例18: OBJECTHDR

//////////////////////////////////////////////////////////////////////////
// IMPLEMENTATION OF DELTA MODE
//////////////////////////////////////////////////////////////////////////
//Module-level call
SIMULATIONMODE triplex_node::inter_deltaupdate_triplex_node(unsigned int64 delta_time, unsigned long dt, unsigned int iteration_count_val,bool interupdate_pos)
{
	//unsigned char pass_mod;
	OBJECT *hdr = OBJECTHDR(this);

	if (interupdate_pos == false)	//Before powerflow call
	{
		//Call triplex-specific call
		BOTH_triplex_node_presync_fxn();

		//Call node presync-equivalent items
		NR_node_presync_fxn();

		//Call sync-equivalent of triplex portion first
		BOTH_triplex_node_sync_fxn();

		//Call node sync-equivalent items (solver occurs at end of sync)
		NR_node_sync_fxn(hdr);

		return SM_DELTA;	//Just return something other than SM_ERROR for this call
	}
	else	//After the call
	{
		//No triplex-specific postsync for node

		//Perform node postsync-like updates on the values
		BOTH_node_postsync_fxn(hdr);

		//No control required at this time - powerflow defers to the whims of other modules
		//Code below implements predictor/corrector-type logic, even though it effectively does nothing
		return SM_EVENT;

		////Do deltamode-related logic
		//if (bustype==SWING)	//We're the SWING bus, control our destiny (which is really controlled elsewhere)
		//{
		//	//See what we're on
		//	pass_mod = iteration_count_val - ((iteration_count_val >> 1) << 1);

		//	//Check pass
		//	if (pass_mod==0)	//Predictor pass
		//	{
		//		return SM_DELTA_ITER;	//Reiterate - to get us to corrector pass
		//	}
		//	else	//Corrector pass
		//	{
		//		//As of right now, we're always ready to leave
		//		//Other objects will dictate if we stay (powerflow is indifferent)
		//		return SM_EVENT;
		//	}//End corrector pass
		//}//End SWING bus handling
		//else	//Normal bus
		//{
		//	return SM_EVENT;	//Normal nodes want event mode all the time here - SWING bus will
		//						//control the reiteration process for pred/corr steps
		//}
	}
}
开发者ID:mafoti,项目名称:StrategicConsumersFullCode,代码行数:61,代码来源:triplex_node.cpp


示例19: OBJECTHDR

//Perform post-event analysis (update computations, write event file if necessary) - no secondary count
void metrics::event_ended(OBJECT *event_obj, OBJECT *fault_obj, OBJECT *faulting_obj, TIMESTAMP event_start_time, TIMESTAMP event_end_time, char *fault_type, char *impl_fault, int number_customers_int)
{
	DATETIME start_dt, end_dt;
	TIMESTAMP outage_length;
	OBJECT *hdr = OBJECTHDR(this);
	int returnval;
	FILE *FPVal;

	//Determine the actual outage length (may be off due to iterations and such)
	outage_length = event_end_time - event_start_time;

	//Perform the calculation
	returnval = ((int (*)(OBJECT *, OBJECT *, int, int, TIMESTAMP, TIMESTAMP))(*compute_metrics))(hdr,module_metrics_obj,number_customers_int,CustomerCount,outage_length,metric_interval);

	//Make sure it worked
	if (returnval != 1)
	{
		GL_THROW("Metrics:%s failed to perform a post-event metric update",hdr->name);
		/*  TROUBLESHOOT
		While attempting to provide a post-fault update of relevant metrics, the metrics
		object encountered an error.  Please try your code again.  If the error persists,
		please submit your code and a bug report using the trac website.
		*/
	}

	//Increment the counters
	metric_interval_event_count++;
	annual_interval_event_count++;

	//Now that that's done, let's see if we need to write a file output
	if (report_event_log == true)
	{
		//Convert the times
		gl_localtime(event_start_time,&start_dt);
		gl_localtime(event_end_time,&end_dt);

		//Open the file handle
		FPVal = fopen(report_file,"at");

		//Print the name of the "safety" device?
		if (faulting_obj==NULL)
		{
		//Print the details out
			fprintf(FPVal,"%d,%d,%04d-%02d-%02d %02d:%02d:%02d,%04d-%02d-%02d %02d:%02d:%02d,%s,%s,%s,N/A,%s,%s,%d\n",annual_interval_event_count,metric_interval_event_count,start_dt.year,start_dt.month,start_dt.day,start_dt.hour,start_dt.minute,start_dt.second,end_dt.year,end_dt.month,end_dt.day,end_dt.hour,end_dt.minute,end_dt.second,fault_obj->oclass->name,fault_obj->name,event_obj->name,fault_type,impl_fault,number_customers_int);
		}
		else
		{
			//Print the details out
			fprintf(FPVal,"%d,%d,%04d-%02d-%02d %02d:%02d:%02d,%04d-%02d-%02d %02d:%02d:%02d,%s,%s,%s,%s,%s,%s,%d\n",annual_interval_event_count,metric_interval_event_count,start_dt.year,start_dt.month,start_dt.day,start_dt.hour,start_dt.minute,start_dt.second,end_dt.year,end_dt.month,end_dt.day,end_dt.hour,end_dt.minute,end_dt.second,fault_obj->oclass->name,fault_obj->name,event_obj->name,faulting_obj->name,fault_type,impl_fault,number_customers_int);
		}

		//Close the file
		fclose(FPVal);
	}
}
开发者ID:SanjayaDeSilva,项目名称:GridLAB-D,代码行数:56,代码来源:metrics.cpp


示例20: gl_verbose

int occupantload::init(OBJECT *parent)
{
	if(parent != NULL){
		if((parent->flags & OF_INIT) != OF_INIT){
			char objname[256];
			gl_verbose("occupantload::init(): deferring initialization on %s", gl_name(parent, objname, 255));
			return 2; // defer
		}
	}
	if (number_of_occupants==0)	number_of_occupants = 4;		// defaulted to 4, but perhaps define it based on house size??
	if (heatgain_per_person==0) heatgain_per_person = 400.0;	// Based on DOE-2, includes latent and sensible heatgain

	OBJECT *hdr = OBJECTHDR(this);
	hdr->flags |= OF_SKIPSAFE;

	if (parent==NULL || (!gl_object_isa(parent,"house") && !gl_object_isa(parent,"house_e")))
	{
		gl_error("occupantload must have a parent house");
		/*	TROUBLESHOOT
			The occupantload object, being an enduse for the house model, must have a parent house
			that it is connected to.  Create a house object and set it as the parent of the
			offending occupantload object.
		*/
		return 0;
	}

	//	pull parent attach_enduse and attach the enduseload
	FUNCTIONADDR attach = 0;
	load.end_obj = hdr;
	attach = (gl_get_function(parent, "attach_enduse"));
	if(attach == NULL){
		gl_error("occupantload parent must publish attach_enduse()");
		/*	TROUBLESHOOT
			The occupantload object attempt to attach itself to its parent, which
			must implement the attach_enduse function.
		*/
		return 0;
	}
	// Needed to pass heat gain up to the house
	// "true" on 220 keeps the circuits "balanced"
	((CIRCUIT *(*)(OBJECT *, ENDUSELOAD *, double, int))(*attach))(hdr->parent, &(this->load), 20, true);

	load.heatgain = number_of_occupants * occupancy_fraction * heatgain_per_person;

	if(shape.type != MT_UNKNOWN && shape.type != MT_ANALOG){
		char outname[64];
		if(hdr->name){
			//sprintf(outname, "%s", hdr->name);
		} else {
			sprintf(outname, "occupancy_load:%i", hdr->id);
		}
		gl_warning("occupancy_load \'%s\' may not work properly with a non-analog load shape.", hdr->name ? hdr->name : outname);
	}
	return 1;
}
开发者ID:SanjayaDeSilva,项目名称:GridLAB-D,代码行数:55,代码来源:occupantload.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ OBJECT_POINTER函数代码示例发布时间:2022-05-30
下一篇:
C++ OBJECT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap