// Initialize a distribution meter, return 1 on success int meter::init(OBJECT *parent) { if(power_market != 0){ price_prop = gl_get_property(power_market, "current_market.clearing_price"); if(price_prop == 0){ GL_THROW("meter::power_market object \'%s\' does not publish \'current_market.clearing_price\'", (power_market->name ? power_market->name : "(anon)")); } } // Count the number of phases...for use with meter_power_consumption if (meter_power_consumption != complex(0,0)) { no_phases = 0; if (has_phase(PHASE_A)) no_phases += 1; if (has_phase(PHASE_B)) no_phases += 1; if (has_phase(PHASE_C)) no_phases += 1; } check_prices(); last_t = dt = 0; return node::init(parent); }
// Initialize a distribution triplex_meter, return 1 on success int triplex_meter::init(OBJECT *parent) { #ifdef SUPPORT_OUTAGES sustained_count=0; //reliability sustained event counter momentary_count=0; //reliability momentary event counter total_count=0; //reliability total event counter s_flag=0; t_flag=0; pre_load=0; #endif if(power_market != 0){ price_prop = gl_get_property(power_market, market_price_name); if(price_prop == 0){ GL_THROW("triplex_meter::power_market object \'%s\' does not publish \'%s\'", (power_market->name ? power_market->name : "(anon)"), (const char*)market_price_name); } } check_prices(); return triplex_node::init(parent); }
// Initialize a distribution meter, return 1 on success int meter::init(OBJECT *parent) { char temp_buff[128]; if(power_market != 0){ price_prop = gl_get_property(power_market, "current_market.clearing_price"); if(price_prop == 0){ GL_THROW("meter::power_market object \'%s\' does not publish \'current_market.clearing_price\'", (power_market->name ? power_market->name : "(anon)")); } } // Count the number of phases...for use with meter_power_consumption if (meter_power_consumption != complex(0,0)) { no_phases = 0; if (has_phase(PHASE_A)) no_phases += 1; if (has_phase(PHASE_B)) no_phases += 1; if (has_phase(PHASE_C)) no_phases += 1; } check_prices(); last_t = dt = 0; //Update tracking flag //Get server mode variable gl_global_getvar("multirun_mode",temp_buff,sizeof(temp_buff)); //See if we're not in standalone if (strcmp(temp_buff,"STANDALONE")) //strcmp returns a 0 if they are the same { if ((solver_method == SM_NR) && (bustype == SWING)) { meter_NR_servered = true; //Set this flag for later use //Allocate the storage vector prev_voltage_value = (complex *)gl_malloc(3*sizeof(complex)); //Check it if (prev_voltage_value==NULL) { GL_THROW("Failure to allocate memory for voltage tracking array"); /* TROUBLESHOOT While attempting to allocate memory for the voltage tracking array used by the master/slave functionality, an error occurred. Please try again. If the error persists, please submit your code and a bug report via the trac website. */ } //Populate it with zeros for now, just cause - init sets voltages in node prev_voltage_value[0] = complex(0.0,0.0); prev_voltage_value[1] = complex(0.0,0.0); prev_voltage_value[2] = complex(0.0,0.0); } } return node::init(parent); }