recloser::recloser(MODULE *mod) : switch_object(mod) { if(oclass == NULL) { pclass = link_object::oclass; oclass = gl_register_class(mod,"recloser",sizeof(recloser),PC_PRETOPDOWN|PC_BOTTOMUP|PC_POSTTOPDOWN|PC_UNSAFE_OVERRIDE_OMIT|PC_AUTOLOCK); if(oclass == NULL) GL_THROW("unable to register object class implemented by %s",__FILE__); if(gl_publish_variable(oclass, PT_INHERIT, "switch", PT_double, "retry_time[s]", PADDR(retry_time), PT_DESCRIPTION, "the amount of time in seconds to wait before the recloser attempts to close", PT_double, "max_number_of_tries", PADDR(ntries), PT_DESCRIPTION, "the number of times the recloser will try to close before permanently opening", PT_double, "number_of_tries", PADDR(curr_tries), PT_DESCRIPTION, "Current number of tries recloser has attempted", NULL) < 1) GL_THROW("unable to publish properties in %s",__FILE__); if (gl_publish_function(oclass,"change_recloser_state",(FUNCTIONADDR)change_recloser_state)==NULL) GL_THROW("Unable to publish recloser state change function"); if (gl_publish_function(oclass,"recloser_reliability_operation",(FUNCTIONADDR)recloser_reliability_operation)==NULL) GL_THROW("Unable to publish recloser reliability operation function"); if (gl_publish_function(oclass, "change_recloser_faults", (FUNCTIONADDR)recloser_fault_updates)==NULL) GL_THROW("Unable to publish recloser fault correction function"); } }
power_metrics::power_metrics(MODULE *mod) : powerflow_library(mod) { if(oclass == NULL) { oclass = gl_register_class(mod,"power_metrics",sizeof(power_metrics),0x00); if(oclass == NULL) GL_THROW("unable to register object class implemented by %s",__FILE__); if(gl_publish_variable(oclass, PT_double, "SAIFI", PADDR(SAIFI), PT_double, "SAIFI_int", PADDR(SAIFI_int), PT_double, "SAIDI", PADDR(SAIDI), PT_double, "SAIDI_int", PADDR(SAIDI_int), PT_double, "CAIDI", PADDR(CAIDI), PT_double, "CAIDI_int", PADDR(CAIDI_int), PT_double, "ASAI", PADDR(ASAI), PT_double, "ASAI_int", PADDR(ASAI_int), PT_double, "MAIFI", PADDR(MAIFI), PT_double, "MAIFI_int", PADDR(MAIFI_int), PT_double, "base_time_value[s]", PADDR(stat_base_time_value), NULL) < 1) GL_THROW("unable to publish properties in %s",__FILE__); if (gl_publish_function(oclass, "calc_metrics", (FUNCTIONADDR)calc_pfmetrics)==NULL) GL_THROW("Unable to publish metrics calculation function"); if (gl_publish_function(oclass, "reset_interval_metrics", (FUNCTIONADDR)reset_pfinterval_metrics)==NULL) GL_THROW("Unable to publish interval metrics reset function"); if (gl_publish_function(oclass, "reset_annual_metrics", (FUNCTIONADDR)reset_pfannual_metrics)==NULL) GL_THROW("Unable to publish annual metrics reset function"); if (gl_publish_function(oclass, "init_reliability", (FUNCTIONADDR)init_pf_reliability_extra)==NULL) GL_THROW("Unable to publish powerflow reliability initialization function"); if (gl_publish_function(oclass, "logfile_extra", (FUNCTIONADDR)logfile_extra)==NULL) GL_THROW("Unable to publish powerflow reliability metrics extra header function"); } }
sectionalizer::sectionalizer(MODULE *mod) : switch_object(mod) { // first time init if (oclass==NULL) { // link to parent class (used by isa) pclass = link_object::oclass; // register the class definition oclass = gl_register_class(mod,"sectionalizer",sizeof(sectionalizer),PC_PRETOPDOWN|PC_BOTTOMUP|PC_POSTTOPDOWN|PC_UNSAFE_OVERRIDE_OMIT|PC_AUTOLOCK); if(oclass == NULL) GL_THROW("unable to register object class implemented by %s",__FILE__); // publish the class properties if(gl_publish_variable(oclass, PT_INHERIT, "switch", NULL) < 1) GL_THROW("unable to publish properties in %s",__FILE__); if (gl_publish_function(oclass,"change_sectionalizer_state",(FUNCTIONADDR)change_sectionalizer_state)==NULL) GL_THROW("Unable to publish sectionalizer state change function"); if (gl_publish_function(oclass,"sectionalizer_reliability_operation",(FUNCTIONADDR)sectionalizer_reliability_operation)==NULL) GL_THROW("Unable to publish sectionalizer reliability operation function"); if (gl_publish_function(oclass, "change_sectionalizer_faults", (FUNCTIONADDR)sectionalizer_fault_updates)==NULL) GL_THROW("Unable to publish sectionalizer fault correction function"); //Publish deltamode functions if (gl_publish_function(oclass, "interupdate_pwr_object", (FUNCTIONADDR)interupdate_switch)==NULL) GL_THROW("Unable to publish sectionalizer deltamode function"); } }
fuse::fuse(MODULE *mod) : link(mod) { if(oclass == NULL) { pclass = link::oclass; oclass = gl_register_class(mod,"fuse",sizeof(fuse),PC_PRETOPDOWN|PC_BOTTOMUP|PC_POSTTOPDOWN|PC_UNSAFE_OVERRIDE_OMIT); if(oclass == NULL) GL_THROW("unable to register object class implemented by %s",__FILE__); if(gl_publish_variable(oclass, PT_INHERIT, "link", PT_enumeration, "phase_A_status", PADDR(phase_A_state), PT_KEYWORD, "BLOWN", BLOWN, PT_KEYWORD, "GOOD", GOOD, PT_enumeration, "phase_B_status", PADDR(phase_B_state), PT_KEYWORD, "BLOWN", BLOWN, PT_KEYWORD, "GOOD", GOOD, PT_enumeration, "phase_C_status", PADDR(phase_C_state), PT_KEYWORD, "BLOWN", BLOWN, PT_KEYWORD, "GOOD", GOOD, PT_enumeration, "repair_dist_type", PADDR(restore_dist_type), PT_KEYWORD, "NONE", NONE, PT_KEYWORD, "EXPONENTIAL", EXPONENTIAL, PT_double, "current_limit[A]", PADDR(current_limit), PT_double, "mean_replacement_time[s]",PADDR(mean_replacement_time), //Retains compatibility with older files NULL) < 1) GL_THROW("unable to publish properties in %s",__FILE__); if (gl_publish_function(oclass,"change_fuse_state",(FUNCTIONADDR)change_fuse_state)==NULL) GL_THROW("Unable to publish fuse state change function"); if (gl_publish_function(oclass,"reliability_operation",(FUNCTIONADDR)fuse_reliability_operation)==NULL) GL_THROW("Unable to publish fuse reliability operation function"); if (gl_publish_function(oclass, "create_fault", (FUNCTIONADDR)create_fault_fuse)==NULL) GL_THROW("Unable to publish fault creation function"); if (gl_publish_function(oclass, "fix_fault", (FUNCTIONADDR)fix_fault_fuse)==NULL) GL_THROW("Unable to publish fault restoration function"); if (gl_publish_function(oclass, "change_fuse_faults", (FUNCTIONADDR)fuse_fault_updates)==NULL) GL_THROW("Unable to publish fuse fault correction function"); } }
switch_object::switch_object(MODULE *mod) : link_object(mod) { if(oclass == NULL) { pclass = link_object::oclass; oclass = gl_register_class(mod,"switch",sizeof(switch_object),PC_PRETOPDOWN|PC_BOTTOMUP|PC_POSTTOPDOWN|PC_UNSAFE_OVERRIDE_OMIT|PC_AUTOLOCK); if (oclass==NULL) throw "unable to register class switch_object"; else oclass->trl = TRL_QUALIFIED; if(gl_publish_variable(oclass, PT_INHERIT, "link", PT_enumeration, "phase_A_state", PADDR(phase_A_state),PT_DESCRIPTION,"Defines the current state of the phase A switch", PT_KEYWORD, "OPEN", (enumeration)OPEN, PT_KEYWORD, "CLOSED", (enumeration)CLOSED, PT_enumeration, "phase_B_state", PADDR(phase_B_state),PT_DESCRIPTION,"Defines the current state of the phase B switch", PT_KEYWORD, "OPEN", (enumeration)OPEN, PT_KEYWORD, "CLOSED", (enumeration)CLOSED, PT_enumeration, "phase_C_state", PADDR(phase_C_state),PT_DESCRIPTION,"Defines the current state of the phase C switch", PT_KEYWORD, "OPEN", (enumeration)OPEN, PT_KEYWORD, "CLOSED", (enumeration)CLOSED, PT_enumeration, "operating_mode", PADDR(switch_banked_mode),PT_DESCRIPTION,"Defines whether the switch operates in a banked or per-phase control mode", PT_KEYWORD, "INDIVIDUAL", (enumeration)INDIVIDUAL_SW, PT_KEYWORD, "BANKED", (enumeration)BANKED_SW, PT_double, "switch_resistance[Ohm]",PADDR(switch_resistance), PT_DESCRIPTION,"The resistance value of the switch when it is not blown.", NULL) < 1) GL_THROW("unable to publish properties in %s",__FILE__); if (gl_publish_function(oclass,"change_switch_state",(FUNCTIONADDR)change_switch_state)==NULL) GL_THROW("Unable to publish switch state change function"); if (gl_publish_function(oclass,"reliability_operation",(FUNCTIONADDR)reliability_operation)==NULL) GL_THROW("Unable to publish switch reliability operation function"); if (gl_publish_function(oclass, "create_fault", (FUNCTIONADDR)create_fault_switch)==NULL) GL_THROW("Unable to publish fault creation function"); if (gl_publish_function(oclass, "fix_fault", (FUNCTIONADDR)fix_fault_switch)==NULL) GL_THROW("Unable to publish fault restoration function"); if (gl_publish_function(oclass, "change_switch_faults", (FUNCTIONADDR)switch_fault_updates)==NULL) GL_THROW("Unable to publish switch fault correction function"); //Publish deltamode functions if (gl_publish_function(oclass, "interupdate_pwr_object", (FUNCTIONADDR)interupdate_switch)==NULL) GL_THROW("Unable to publish switch deltamode function"); //Publish restoration-related function (current update) if (gl_publish_function(oclass, "update_power_pwr_object", (FUNCTIONADDR)updatepowercalc_link)==NULL) GL_THROW("Unable to publish switch external power calculation function"); if (gl_publish_function(oclass, "check_limits_pwr_object", (FUNCTIONADDR)calculate_overlimit_link)==NULL) GL_THROW("Unable to publish switch external power limit calculation function"); } }
/** House object constructor: Registers the class and publishes the variables that can be set by the user. Sets default randomized values for published variables. **/ house::house(MODULE *mod) : residential_enduse(mod) { // first time init if (oclass==NULL) { // register the class definition oclass = gl_register_class(mod,"house_a",sizeof(house),PC_PRETOPDOWN|PC_BOTTOMUP|PC_AUTOLOCK); if (oclass==NULL) throw "unable to register class house_a"; else oclass->trl = TRL_DEMONSTRATED; // publish the class properties if (gl_publish_variable(oclass, PT_INHERIT, "residential_enduse", PT_double,"floor_area[sf]",PADDR(floor_area), PT_DESCRIPTION, "area of the house's ground floor", PT_double,"gross_wall_area[sf]",PADDR(gross_wall_area), PT_DESCRIPTION, "total exterior wall area", PT_double,"ceiling_height[ft]",PADDR(ceiling_height), PT_DESCRIPTION, "height of the house's ceiling, across all floors", PT_double,"aspect_ratio",PADDR(aspect_ratio), PT_DESCRIPTION, "ratio of the length to the width of the house's ground footprint", PT_double,"envelope_UA[Btu/degF*h]",PADDR(envelope_UA), PT_DESCRIPTION, "insulative UA value of the house, based on insulation thickness and surface area", PT_double,"window_wall_ratio",PADDR(window_wall_ratio), PT_DESCRIPTION, "ratio of exterior window area to exterior wall area", PT_double,"glazing_shgc",PADDR(glazing_shgc), PT_DESCRIPTION, "siding glazing solar heat gain coeffient", PT_double,"airchange_per_hour",PADDR(airchange_per_hour), PT_DESCRIPTION, "volume of air exchanged between the house and exterior per hour", PT_double,"solar_gain[Btu/h]",PADDR(solar_load), PT_DESCRIPTION, "thermal solar input", PT_double,"heat_cool_gain[Btu/h]",PADDR(hvac_rated_capacity), PT_DESCRIPTION, "thermal gain rate of the installed HVAC", PT_double,"thermostat_deadband[degF]",PADDR(thermostat_deadband), PT_DESCRIPTION, "", PT_double,"heating_setpoint[degF]",PADDR(heating_setpoint), PT_DESCRIPTION, "", PT_double,"cooling_setpoint[degF]",PADDR(cooling_setpoint), PT_DESCRIPTION, "", PT_double, "design_heating_capacity[Btu.h]",PADDR(design_heating_capacity), PT_DESCRIPTION, "", PT_double,"design_cooling_capacity[Btu.h]",PADDR(design_cooling_capacity), PT_DESCRIPTION, "", PT_double,"heating_COP",PADDR(heating_COP), PT_DESCRIPTION, "", PT_double,"cooling_COP",PADDR(cooling_COP), PT_DESCRIPTION, "", PT_double,"COP_coeff",PADDR(COP_coeff), PT_DESCRIPTION, "", PT_double,"air_temperature[degF]",PADDR(Tair), PT_DESCRIPTION, "", PT_double,"outside_temp[degF]",PADDR(Tout), PT_DESCRIPTION, "", PT_double,"mass_temperature[degF]",PADDR(Tmaterials), PT_DESCRIPTION, "", PT_double,"mass_heat_coeff",PADDR(house_content_heat_transfer_coeff), PT_DESCRIPTION, "", PT_double,"outdoor_temperature[degF]",PADDR(outside_temp), PT_DESCRIPTION, "", PT_double,"house_thermal_mass[Btu/degF]",PADDR(house_content_thermal_mass), PT_DESCRIPTION, "thermal mass of the house's contained mass", PT_enumeration,"heat_mode",PADDR(heat_mode), PT_DESCRIPTION, "", PT_KEYWORD,"ELECTRIC",(enumeration)ELECTRIC, PT_KEYWORD,"GASHEAT",(enumeration)GASHEAT, PT_enumeration,"hc_mode",PADDR(heat_cool_mode), PT_DESCRIPTION, "", PT_KEYWORD,"OFF",(enumeration)OFF, PT_KEYWORD,"HEAT",(enumeration)HEAT, PT_KEYWORD,"COOL",(enumeration)COOL, PT_enduse,"houseload",PADDR(tload), PT_DESCRIPTION, "", NULL)<1) GL_THROW("unable to publish properties in %s",__FILE__); gl_publish_function(oclass, "attach_enduse", (FUNCTIONADDR)&attach_enduse_house_a); } }
series_reactor::series_reactor(MODULE *mod) : link_object(mod) { if(oclass == NULL) { pclass = link_object::oclass; oclass = gl_register_class(mod,"series_reactor",sizeof(series_reactor),PC_PRETOPDOWN|PC_BOTTOMUP|PC_POSTTOPDOWN|PC_UNSAFE_OVERRIDE_OMIT|PC_AUTOLOCK); if (oclass==NULL) throw "unable to register class series_reactor"; else oclass->trl = TRL_PROVEN; if(gl_publish_variable(oclass, PT_INHERIT, "link", PT_complex, "phase_A_impedance[Ohm]",PADDR(phase_A_impedance),PT_DESCRIPTION,"Series impedance of reactor on phase A", PT_double, "phase_A_resistance[Ohm]",PADDR(phase_A_impedance.Re()),PT_DESCRIPTION,"Resistive portion of phase A's impedance", PT_double, "phase_A_reactance[Ohm]",PADDR(phase_A_impedance.Im()),PT_DESCRIPTION,"Reactive portion of phase A's impedance", PT_complex, "phase_B_impedance[Ohm]",PADDR(phase_B_impedance),PT_DESCRIPTION,"Series impedance of reactor on phase B", PT_double, "phase_B_resistance[Ohm]",PADDR(phase_B_impedance.Re()),PT_DESCRIPTION,"Resistive portion of phase B's impedance", PT_double, "phase_B_reactance[Ohm]",PADDR(phase_B_impedance.Im()),PT_DESCRIPTION,"Reactive portion of phase B's impedance", PT_complex, "phase_C_impedance[Ohm]",PADDR(phase_C_impedance),PT_DESCRIPTION,"Series impedance of reactor on phase C", PT_double, "phase_C_resistance[Ohm]",PADDR(phase_C_impedance.Re()),PT_DESCRIPTION,"Resistive portion of phase C's impedance", PT_double, "phase_C_reactance[Ohm]",PADDR(phase_C_impedance.Im()),PT_DESCRIPTION,"Reactive portion of phase C's impedance", PT_double, "rated_current_limit[A]",PADDR(rated_current_limit),PT_DESCRIPTION,"Rated current limit for the reactor", NULL) < 1) GL_THROW("unable to publish properties in %s",__FILE__); //Publish deltamode functions if (gl_publish_function(oclass, "interupdate_pwr_object", (FUNCTIONADDR)interupdate_link)==NULL) GL_THROW("Unable to publish series reactor deltamode function"); //Publish restoration-related function (current update) if (gl_publish_function(oclass, "update_power_pwr_object", (FUNCTIONADDR)updatepowercalc_link)==NULL) GL_THROW("Unable to publish series reactor external power calculation function"); if (gl_publish_function(oclass, "check_limits_pwr_object", (FUNCTIONADDR)calculate_overlimit_link)==NULL) GL_THROW("Unable to publish series reactor external power limit calculation function"); } }
fuse::fuse(MODULE *mod) : link_object(mod) { if(oclass == NULL) { pclass = link_object::oclass; oclass = gl_register_class(mod,"fuse",sizeof(fuse),PC_PRETOPDOWN|PC_BOTTOMUP|PC_POSTTOPDOWN|PC_UNSAFE_OVERRIDE_OMIT|PC_AUTOLOCK); if (oclass==NULL) throw "unable to register class fuse"; else oclass->trl = TRL_QUALIFIED; if(gl_publish_variable(oclass, PT_INHERIT, "link", PT_enumeration, "phase_A_status", PADDR(phase_A_state), PT_KEYWORD, "BLOWN", (enumeration)BLOWN, PT_KEYWORD, "GOOD", (enumeration)GOOD, PT_enumeration, "phase_B_status", PADDR(phase_B_state), PT_KEYWORD, "BLOWN", (enumeration)BLOWN, PT_KEYWORD, "GOOD", (enumeration)GOOD, PT_enumeration, "phase_C_status", PADDR(phase_C_state), PT_KEYWORD, "BLOWN", (enumeration)BLOWN, PT_KEYWORD, "GOOD", (enumeration)GOOD, PT_enumeration, "repair_dist_type", PADDR(restore_dist_type), PT_KEYWORD, "NONE", (enumeration)NONE, PT_KEYWORD, "EXPONENTIAL", (enumeration)EXPONENTIAL, PT_double, "current_limit[A]", PADDR(current_limit), PT_double, "mean_replacement_time[s]",PADDR(mean_replacement_time), //Retains compatibility with older files PT_double, "fuse_resistance[Ohm]",PADDR(fuse_resistance), PT_DESCRIPTION,"The resistance value of the fuse when it is not blown.", NULL) < 1) GL_THROW("unable to publish properties in %s",__FILE__); if (gl_publish_function(oclass,"change_fuse_state",(FUNCTIONADDR)change_fuse_state)==NULL) GL_THROW("Unable to publish fuse state change function"); if (gl_publish_function(oclass,"reliability_operation",(FUNCTIONADDR)fuse_reliability_operation)==NULL) GL_THROW("Unable to publish fuse reliability operation function"); if (gl_publish_function(oclass, "create_fault", (FUNCTIONADDR)create_fault_fuse)==NULL) GL_THROW("Unable to publish fault creation function"); if (gl_publish_function(oclass, "fix_fault", (FUNCTIONADDR)fix_fault_fuse)==NULL) GL_THROW("Unable to publish fault restoration function"); if (gl_publish_function(oclass, "change_fuse_faults", (FUNCTIONADDR)fuse_fault_updates)==NULL) GL_THROW("Unable to publish fuse fault correction function"); //Publish deltamode functions if (gl_publish_function(oclass, "interupdate_pwr_object", (FUNCTIONADDR)interupdate_link)==NULL) GL_THROW("Unable to publish fuse deltamode function"); } }
// the constructor registers the class and properties and sets the defaults meter::meter(MODULE *mod) : node(mod) { // first time init if (oclass==NULL) { // link to parent class (used by isa) pclass = node::oclass; // register the class definition oclass = gl_register_class(mod,"meter",sizeof(meter),PC_PRETOPDOWN|PC_BOTTOMUP|PC_POSTTOPDOWN|PC_UNSAFE_OVERRIDE_OMIT); if (oclass==NULL) GL_THROW("unable to register object class implemented by %s",__FILE__); // publish the class properties if (gl_publish_variable(oclass, PT_INHERIT, "node", PT_double, "measured_real_energy[Wh]", PADDR(measured_real_energy),PT_DESCRIPTION,"metered real energy consumption, cummalitive", PT_double, "measured_reactive_energy[VAh]",PADDR(measured_reactive_energy),PT_DESCRIPTION,"metered reactive energy consumption, cummalitive", PT_complex, "measured_power[VA]", PADDR(measured_power),PT_DESCRIPTION,"metered real power", PT_complex, "measured_power_A[VA]", PADDR(indiv_measured_power[0]),PT_DESCRIPTION,"metered complex power on phase A", PT_complex, "measured_power_B[VA]", PADDR(indiv_measured_power[1]),PT_DESCRIPTION,"metered complex power on phase B", PT_complex, "measured_power_C[VA]", PADDR(indiv_measured_power[2]),PT_DESCRIPTION,"metered complex power on phase C", PT_double, "measured_demand[W]", PADDR(measured_demand),PT_DESCRIPTION,"greatest metered real power during simulation", PT_double, "measured_real_power[W]", PADDR(measured_real_power),PT_DESCRIPTION,"metered real power", PT_double, "measured_reactive_power[VAr]", PADDR(measured_reactive_power),PT_DESCRIPTION,"metered reactive power", PT_complex, "meter_power_consumption[VA]", PADDR(meter_power_consumption),PT_DESCRIPTION,"metered power used for operating the meter; standby and communication losses", // added to record last voltage/current PT_complex, "measured_voltage_A[V]", PADDR(measured_voltage[0]),PT_DESCRIPTION,"measured line-to-neutral voltage on phase A", PT_complex, "measured_voltage_B[V]", PADDR(measured_voltage[1]),PT_DESCRIPTION,"measured line-to-neutral voltage on phase B", PT_complex, "measured_voltage_C[V]", PADDR(measured_voltage[2]),PT_DESCRIPTION,"measured line-to-neutral voltage on phase C", PT_complex, "measured_voltage_AB[V]", PADDR(measured_voltageD[0]),PT_DESCRIPTION,"measured line-to-line voltage on phase AB", PT_complex, "measured_voltage_BC[V]", PADDR(measured_voltageD[1]),PT_DESCRIPTION,"measured line-to-line voltage on phase BC", PT_complex, "measured_voltage_CA[V]", PADDR(measured_voltageD[2]),PT_DESCRIPTION,"measured line-to-line voltage on phase CA", PT_complex, "measured_current_A[A]", PADDR(measured_current[0]),PT_DESCRIPTION,"measured current on phase A", PT_complex, "measured_current_B[A]", PADDR(measured_current[1]),PT_DESCRIPTION,"measured current on phase B", PT_complex, "measured_current_C[A]", PADDR(measured_current[2]),PT_DESCRIPTION,"measured current on phase C", PT_bool, "customer_interrupted", PADDR(meter_interrupted),PT_DESCRIPTION,"Reliability flag - goes active if the customer is in an 'interrupted' state", PT_bool, "customer_interrupted_secondary", PADDR(meter_interrupted_secondary),PT_DESCRIPTION,"Reliability flag - goes active if the customer is in an 'secondary interrupted' state - i.e., momentary", #ifdef SUPPORT_OUTAGES PT_int16, "sustained_count", PADDR(sustained_count), //reliability sustained event counter PT_int16, "momentary_count", PADDR(momentary_count), //reliability momentary event counter PT_int16, "total_count", PADDR(total_count), //reliability total event counter PT_int16, "s_flag", PADDR(s_flag), PT_int16, "t_flag", PADDR(t_flag), PT_complex, "pre_load", PADDR(pre_load), #endif PT_double, "monthly_bill[$]", PADDR(monthly_bill),PT_DESCRIPTION,"Accumulator for the current month's bill", PT_double, "previous_monthly_bill[$]", PADDR(previous_monthly_bill),PT_DESCRIPTION,"Total monthly bill for the previous month", PT_double, "previous_monthly_energy[kWh]", PADDR(previous_monthly_energy),PT_DESCRIPTION,"Total monthly energy for the previous month", PT_double, "monthly_fee[$]", PADDR(monthly_fee),PT_DESCRIPTION,"Once a month flat fee for customer hook-up", PT_double, "monthly_energy[kWh]", PADDR(monthly_energy),PT_DESCRIPTION,"Accumulator for the current month's energy consumption", PT_enumeration, "bill_mode", PADDR(bill_mode),PT_DESCRIPTION,"Billing structure desired", PT_KEYWORD,"NONE",BM_NONE, PT_KEYWORD,"UNIFORM",BM_UNIFORM, PT_KEYWORD,"TIERED",BM_TIERED, PT_KEYWORD,"HOURLY",BM_HOURLY, PT_KEYWORD,"TIERED_RTP",BM_TIERED_RTP, PT_object, "power_market", PADDR(power_market),PT_DESCRIPTION,"Market (auction object) where the price is being received from", PT_int32, "bill_day", PADDR(bill_day),PT_DESCRIPTION,"day of month bill is to be processed (currently limited to days 1-28)", PT_double, "price[$/kWh]", PADDR(price),PT_DESCRIPTION,"current price of electricity", PT_double, "price_base[$/kWh]", PADDR(price_base), PT_DESCRIPTION, "Used only in TIERED_RTP mode to describe the price before the first tier", PT_double, "first_tier_price[$/kWh]", PADDR(tier_price[0]),PT_DESCRIPTION,"price of electricity between first tier and second tier energy usage", PT_double, "first_tier_energy[kWh]", PADDR(tier_energy[0]),PT_DESCRIPTION,"switching point between base price and first tier price", PT_double, "second_tier_price[$/kWh]", PADDR(tier_price[1]),PT_DESCRIPTION,"price of electricity between second tier and third tier energy usage", PT_double, "second_tier_energy[kWh]", PADDR(tier_energy[1]),PT_DESCRIPTION,"switching point between first tier price and second tier price", PT_double, "third_tier_price[$/kWh]", PADDR(tier_price[2]),PT_DESCRIPTION,"price of electricity when energy usage exceeds third tier energy usage", PT_double, "third_tier_energy[kWh]", PADDR(tier_energy[2]),PT_DESCRIPTION,"switching point between second tier price and third tier price", //PT_double, "measured_reactive[kVar]", PADDR(measured_reactive), has not implemented yet NULL)<1) GL_THROW("unable to publish properties in %s",__FILE__); // publish meter reset function if (gl_publish_function(oclass,"reset",(FUNCTIONADDR)meter_reset)==NULL) GL_THROW("unable to publish meter_reset function in %s",__FILE__); //Publish deltamode functions if (gl_publish_function(oclass, "delta_linkage_node", (FUNCTIONADDR)delta_linkage)==NULL) GL_THROW("Unable to publish meter delta_linkage function"); if (gl_publish_function(oclass, "interupdate_pwr_object", (FUNCTIONADDR)interupdate_node)==NULL) GL_THROW("Unable to publish meter deltamode function"); if (gl_publish_function(oclass, "delta_freq_pwr_object", (FUNCTIONADDR)delta_frequency_node)==NULL) GL_THROW("Unable to publish meter deltamode function"); } }
triplex_load::triplex_load(MODULE *mod) : triplex_node(mod) { if(oclass == NULL) { pclass = triplex_node::oclass; oclass = gl_register_class(mod,"triplex_load",sizeof(triplex_load),PC_PRETOPDOWN|PC_BOTTOMUP|PC_POSTTOPDOWN|PC_UNSAFE_OVERRIDE_OMIT|PC_AUTOLOCK); if (oclass==NULL) throw "unable to register class triplex_load"; else oclass->trl = TRL_PROVEN; if(gl_publish_variable(oclass, PT_INHERIT, "triplex_node", PT_enumeration, "load_class", PADDR(load_class),PT_DESCRIPTION,"Flag to track load type, not currently used for anything except sorting", PT_KEYWORD, "U", (enumeration)LC_UNKNOWN, PT_KEYWORD, "R", (enumeration)LC_RESIDENTIAL, PT_KEYWORD, "C", (enumeration)LC_COMMERCIAL, PT_KEYWORD, "I", (enumeration)LC_INDUSTRIAL, PT_KEYWORD, "A", (enumeration)LC_AGRICULTURAL, PT_complex, "constant_power_1[VA]", PADDR(constant_power[0]),PT_DESCRIPTION,"constant power load on split phase 1, specified as VA", PT_complex, "constant_power_2[VA]", PADDR(constant_power[1]),PT_DESCRIPTION,"constant power load on split phase 2, specified as VA", PT_complex, "constant_power_12[VA]", PADDR(constant_power[2]),PT_DESCRIPTION,"constant power load on split phase 12, specified as VA", PT_double, "constant_power_1_real[W]", PADDR(constant_power[0].Re()),PT_DESCRIPTION,"constant power load on spit phase 1, real only, specified as W", PT_double, "constant_power_2_real[W]", PADDR(constant_power[1].Re()),PT_DESCRIPTION,"constant power load on phase 2, real only, specified as W", PT_double, "constant_power_12_real[W]", PADDR(constant_power[2].Re()),PT_DESCRIPTION,"constant power load on phase 12, real only, specified as W", PT_double, "constant_power_1_reac[VAr]", PADDR(constant_power[0].Im()),PT_DESCRIPTION,"constant power load on phase 1, imaginary only, specified as VAr", PT_double, "constant_power_2_reac[VAr]", PADDR(constant_power[1].Im()),PT_DESCRIPTION,"constant power load on phase 2, imaginary only, specified as VAr", PT_double, "constant_power_12_reac[VAr]", PADDR(constant_power[2].Im()),PT_DESCRIPTION,"constant power load on phase 12, imaginary only, specified as VAr", PT_complex, "constant_current_1[A]", PADDR(constant_current[0]),PT_DESCRIPTION,"constant current load on phase 1, specified as Amps", PT_complex, "constant_current_2[A]", PADDR(constant_current[1]),PT_DESCRIPTION,"constant current load on phase 2, specified as Amps", PT_complex, "constant_current_12[A]", PADDR(constant_current[2]),PT_DESCRIPTION,"constant current load on phase 12, specified as Amps", PT_double, "constant_current_1_real[A]", PADDR(constant_current[0].Re()),PT_DESCRIPTION,"constant current load on phase 1, real only, specified as Amps", PT_double, "constant_current_2_real[A]", PADDR(constant_current[1].Re()),PT_DESCRIPTION,"constant current load on phase 2, real only, specified as Amps", PT_double, "constant_current_12_real[A]", PADDR(constant_current[2].Re()),PT_DESCRIPTION,"constant current load on phase 12, real only, specified as Amps", PT_double, "constant_current_1_reac[A]", PADDR(constant_current[0].Im()),PT_DESCRIPTION,"constant current load on phase 1, imaginary only, specified as Amps", PT_double, "constant_current_2_reac[A]", PADDR(constant_current[1].Im()),PT_DESCRIPTION,"constant current load on phase 2, imaginary only, specified as Amps", PT_double, "constant_current_12_reac[A]", PADDR(constant_current[2].Im()),PT_DESCRIPTION,"constant current load on phase 12, imaginary only, specified as Amps", PT_complex, "constant_impedance_1[Ohm]", PADDR(constant_impedance[0]),PT_DESCRIPTION,"constant impedance load on phase 1, specified as Ohms", PT_complex, "constant_impedance_2[Ohm]", PADDR(constant_impedance[1]),PT_DESCRIPTION,"constant impedance load on phase 2, specified as Ohms", PT_complex, "constant_impedance_12[Ohm]", PADDR(constant_impedance[2]),PT_DESCRIPTION,"constant impedance load on phase 12, specified as Ohms", PT_double, "constant_impedance_1_real[Ohm]", PADDR(constant_impedance[0].Re()),PT_DESCRIPTION,"constant impedance load on phase 1, real only, specified as Ohms", PT_double, "constant_impedance_2_real[Ohm]", PADDR(constant_impedance[1].Re()),PT_DESCRIPTION,"constant impedance load on phase 2, real only, specified as Ohms", PT_double, "constant_impedance_12_real[Ohm]", PADDR(constant_impedance[2].Re()),PT_DESCRIPTION,"constant impedance load on phase 12, real only, specified as Ohms", PT_double, "constant_impedance_1_reac[Ohm]", PADDR(constant_impedance[0].Im()),PT_DESCRIPTION,"constant impedance load on phase 1, imaginary only, specified as Ohms", PT_double, "constant_impedance_2_reac[Ohm]", PADDR(constant_impedance[1].Im()),PT_DESCRIPTION,"constant impedance load on phase 2, imaginary only, specified as Ohms", PT_double, "constant_impedance_12_reac[Ohm]", PADDR(constant_impedance[2].Im()),PT_DESCRIPTION,"constant impedance load on phase 12, imaginary only, specified as Ohms", PT_complex, "measured_voltage_1",PADDR(measured_voltage_1),PT_DESCRIPTION,"current measured voltage on phase 1", PT_complex, "measured_voltage_2",PADDR(measured_voltage_2),PT_DESCRIPTION,"current measured voltage on phase 2", PT_complex, "measured_voltage_12",PADDR(measured_voltage_12),PT_DESCRIPTION,"current measured voltage on phase 12", // This allows the user to set a base power on each phase, and specify the power as a function // of ZIP and pf for each phase (similar to zipload). This will override the constant values // above if specified, otherwise, constant values work as stated PT_double, "base_power_1[VA]",PADDR(base_power[0]),PT_DESCRIPTION,"in similar format as ZIPload, this represents the nominal power on phase 1 before applying ZIP fractions", PT_double, "base_power_2[VA]",PADDR(base_power[1]),PT_DESCRIPTION,"in similar format as ZIPload, this represents the nominal power on phase 2 before applying ZIP fractions", PT_double, "base_power_12[VA]",PADDR(base_power[2]),PT_DESCRIPTION,"in similar format as ZIPload, this represents the nominal power on phase 12 before applying ZIP fractions", PT_double, "power_pf_1[pu]",PADDR(power_pf[0]),PT_DESCRIPTION,"in similar format as ZIPload, this is the power factor of the phase 1 constant power portion of load", PT_double, "current_pf_1[pu]",PADDR(current_pf[0]),PT_DESCRIPTION,"in similar format as ZIPload, this is the power factor of the phase 1 constant current portion of load", PT_double, "impedance_pf_1[pu]",PADDR(impedance_pf[0]),PT_DESCRIPTION,"in similar format as ZIPload, this is the power factor of the phase 1 constant impedance portion of load", PT_double, "power_pf_2[pu]",PADDR(power_pf[1]),PT_DESCRIPTION,"in similar format as ZIPload, this is the power factor of the phase 2 constant power portion of load", PT_double, "current_pf_2[pu]",PADDR(current_pf[1]),PT_DESCRIPTION,"in similar format as ZIPload, this is the power factor of the phase 2 constant current portion of load", PT_double, "impedance_pf_2[pu]",PADDR(impedance_pf[1]),PT_DESCRIPTION,"in similar format as ZIPload, this is the power factor of the phase 2 constant impedance portion of load", PT_double, "power_pf_12[pu]",PADDR(power_pf[2]),PT_DESCRIPTION,"in similar format as ZIPload, this is the power factor of the phase 12 constant power portion of load", PT_double, "current_pf_12[pu]",PADDR(current_pf[2]),PT_DESCRIPTION,"in similar format as ZIPload, this is the power factor of the phase 12 constant current portion of load", PT_double, "impedance_pf_12[pu]",PADDR(impedance_pf[2]),PT_DESCRIPTION,"in similar format as ZIPload, this is the power factor of the phase 12 constant impedance portion of load", PT_double, "power_fraction_1[pu]",PADDR(power_fraction[0]),PT_DESCRIPTION,"this is the constant power fraction of base power on phase 1", PT_double, "current_fraction_1[pu]",PADDR(current_fraction[0]),PT_DESCRIPTION,"this is the constant current fraction of base power on phase 1", PT_double, "impedance_fraction_1[pu]",PADDR(impedance_fraction[0]),PT_DESCRIPTION,"this is the constant impedance fraction of base power on phase 1", PT_double, "power_fraction_2[pu]",PADDR(power_fraction[1]),PT_DESCRIPTION,"this is the constant power fraction of base power on phase 2", PT_double, "current_fraction_2[pu]",PADDR(current_fraction[1]),PT_DESCRIPTION,"this is the constant current fraction of base power on phase 2", PT_double, "impedance_fraction_2[pu]",PADDR(impedance_fraction[1]),PT_DESCRIPTION,"this is the constant impedance fraction of base power on phase 2", PT_double, "power_fraction_12[pu]",PADDR(power_fraction[2]),PT_DESCRIPTION,"this is the constant power fraction of base power on phase 12", PT_double, "current_fraction_12[pu]",PADDR(current_fraction[2]),PT_DESCRIPTION,"this is the constant current fraction of base power on phase 12", PT_double, "impedance_fraction_12[pu]",PADDR(impedance_fraction[2]),PT_DESCRIPTION,"this is the constant impedance fraction of base power on phase 12", NULL) < 1) GL_THROW("unable to publish properties in %s",__FILE__); //Publish deltamode functions if (gl_publish_function(oclass, "delta_linkage_node", (FUNCTIONADDR)delta_linkage)==NULL) GL_THROW("Unable to publish triplex_load delta_linkage function"); if (gl_publish_function(oclass, "interupdate_pwr_object", (FUNCTIONADDR)interupdate_triplex_load)==NULL) GL_THROW("Unable to publish triplex_load deltamode function"); if (gl_publish_function(oclass, "delta_freq_pwr_object", (FUNCTIONADDR)delta_frequency_node)==NULL) GL_THROW("Unable to publish triplex_load deltamode function"); } }
// the constructor registers the class and properties and sets the defaults triplex_meter::triplex_meter(MODULE *mod) : triplex_node(mod) { // first time init if (oclass==NULL) { // link to parent class (used by isa) pclass = triplex_node::oclass; // register the class definition oclass = gl_register_class(mod,"triplex_meter",sizeof(triplex_meter),PC_PRETOPDOWN|PC_BOTTOMUP|PC_POSTTOPDOWN|PC_UNSAFE_OVERRIDE_OMIT|PC_AUTOLOCK); if (oclass==NULL) throw "unable to register class triplex_meter"; else oclass->trl = TRL_PROVEN; // publish the class properties if (gl_publish_variable(oclass, PT_INHERIT, "triplex_node", PT_double, "measured_real_energy[Wh]", PADDR(measured_real_energy),PT_DESCRIPTION,"metered real energy consumption", PT_double, "measured_reactive_energy[VAh]",PADDR(measured_reactive_energy),PT_DESCRIPTION,"metered reactive energy consumption", PT_complex, "measured_power[VA]", PADDR(measured_power),PT_DESCRIPTION,"metered power", PT_complex, "indiv_measured_power_1[VA]", PADDR(indiv_measured_power[0]),PT_DESCRIPTION,"metered power, phase 1", PT_complex, "indiv_measured_power_2[VA]", PADDR(indiv_measured_power[1]),PT_DESCRIPTION,"metered power, phase 2", PT_complex, "indiv_measured_power_N[VA]", PADDR(indiv_measured_power[2]),PT_DESCRIPTION,"metered power, phase N", PT_double, "measured_demand[W]", PADDR(measured_demand),PT_DESCRIPTION,"metered demand (peak of power)", PT_double, "measured_real_power[W]", PADDR(measured_real_power),PT_DESCRIPTION,"metered real power", PT_double, "measured_reactive_power[VAr]", PADDR(measured_reactive_power),PT_DESCRIPTION,"metered reactive power", PT_complex, "meter_power_consumption[VA]", PADDR(tpmeter_power_consumption),PT_DESCRIPTION,"power consumed by meter operation", // added to record last voltage/current PT_complex, "measured_voltage_1[V]", PADDR(measured_voltage[0]),PT_DESCRIPTION,"measured voltage, phase 1 to ground", PT_complex, "measured_voltage_2[V]", PADDR(measured_voltage[1]),PT_DESCRIPTION,"measured voltage, phase 2 to ground", PT_complex, "measured_voltage_N[V]", PADDR(measured_voltage[2]),PT_DESCRIPTION,"measured voltage, phase N to ground", PT_complex, "measured_current_1[A]", PADDR(measured_current[0]),PT_DESCRIPTION,"measured current, phase 1", PT_complex, "measured_current_2[A]", PADDR(measured_current[1]),PT_DESCRIPTION,"measured current, phase 2", PT_complex, "measured_current_N[A]", PADDR(measured_current[2]),PT_DESCRIPTION,"measured current, phase N", PT_bool, "customer_interrupted", PADDR(tpmeter_interrupted),PT_DESCRIPTION,"Reliability flag - goes active if the customer is in an interrupted state", PT_bool, "customer_interrupted_secondary", PADDR(tpmeter_interrupted_secondary),PT_DESCRIPTION,"Reliability flag - goes active if the customer is in a secondary interrupted state - i.e., momentary", #ifdef SUPPORT_OUTAGES PT_int16, "sustained_count", PADDR(sustained_count),PT_DESCRIPTION,"reliability sustained event counter", PT_int16, "momentary_count", PADDR(momentary_count),PT_DESCRIPTION,"reliability momentary event counter", PT_int16, "total_count", PADDR(total_count),PT_DESCRIPTION,"reliability total event counter", PT_int16, "s_flag", PADDR(s_flag),PT_DESCRIPTION,"reliability flag that gets set if the meter experienced more than n sustained interruptions", PT_int16, "t_flag", PADDR(t_flag),PT_DESCRIPTION,"reliability flage that gets set if the meter experienced more than n events total", PT_complex, "pre_load", PADDR(pre_load),PT_DESCRIPTION,"the load prior to being interrupted", #endif PT_double, "monthly_bill[$]", PADDR(monthly_bill),PT_DESCRIPTION,"Accumulator for the current month's bill", PT_double, "previous_monthly_bill[$]", PADDR(previous_monthly_bill),PT_DESCRIPTION,"Total monthly bill for the previous month", PT_double, "previous_monthly_energy[kWh]", PADDR(previous_monthly_energy),PT_DESCRIPTION,"", PT_double, "monthly_fee[$]", PADDR(monthly_fee),PT_DESCRIPTION,"Total monthly energy for the previous month", PT_double, "monthly_energy[kWh]", PADDR(monthly_energy),PT_DESCRIPTION,"Accumulator for the current month's energy", PT_enumeration, "bill_mode", PADDR(bill_mode),PT_DESCRIPTION,"Designates the bill mode to be used", PT_KEYWORD,"NONE",(enumeration)BM_NONE, PT_KEYWORD,"UNIFORM",(enumeration)BM_UNIFORM, PT_KEYWORD,"TIERED",(enumeration)BM_TIERED, PT_KEYWORD,"HOURLY",(enumeration)BM_HOURLY, PT_KEYWORD,"TIERED_RTP",(enumeration)BM_TIERED_RTP, PT_object, "power_market", PADDR(power_market),PT_DESCRIPTION,"Designates the auction object where prices are read from for bill mode", PT_int32, "bill_day", PADDR(bill_day),PT_DESCRIPTION,"Day bill is to be processed (assumed to occur at midnight of that day)", PT_double, "price[$/kWh]", PADDR(price),PT_DESCRIPTION,"Standard uniform pricing", PT_double, "price_base[$/kWh]", PADDR(price_base), PT_DESCRIPTION, "Used only in TIERED_RTP mode to describe the price before the first tier", PT_double, "first_tier_price[$/kWh]", PADDR(tier_price[0]),PT_DESCRIPTION,"first tier price of energy between first and second tier energy", PT_double, "first_tier_energy[kWh]", PADDR(tier_energy[0]),PT_DESCRIPTION,"price of energy on tier above price or price base", PT_double, "second_tier_price[$/kWh]", PADDR(tier_price[1]),PT_DESCRIPTION,"first tier price of energy between second and third tier energy", PT_double, "second_tier_energy[kWh]", PADDR(tier_energy[1]),PT_DESCRIPTION,"price of energy on tier above first tier", PT_double, "third_tier_price[$/kWh]", PADDR(tier_price[2]),PT_DESCRIPTION,"first tier price of energy greater than third tier energy", PT_double, "third_tier_energy[kWh]", PADDR(tier_energy[2]),PT_DESCRIPTION,"price of energy on tier above second tier", NULL)<1) GL_THROW("unable to publish properties in %s",__FILE__); //Deltamode functions if (gl_publish_function(oclass, "delta_linkage_node", (FUNCTIONADDR)delta_linkage)==NULL) GL_THROW("Unable to publish triplex_meter delta_linkage function"); if (gl_publish_function(oclass, "interupdate_pwr_object", (FUNCTIONADDR)interupdate_triplex_meter)==NULL) GL_THROW("Unable to publish triplex_meter deltamode function"); if (gl_publish_function(oclass, "delta_freq_pwr_object", (FUNCTIONADDR)delta_frequency_node)==NULL) GL_THROW("Unable to publish triplex_meter deltamode function"); // market price name gl_global_create("powerflow::market_price_name",PT_char1024,&market_price_name,NULL); } }
triplex_node::triplex_node(MODULE *mod) : node(mod) { if(oclass == NULL) { pclass = node::oclass; oclass = gl_register_class(mod,"triplex_node",sizeof(triplex_node),PC_PRETOPDOWN|PC_BOTTOMUP|PC_POSTTOPDOWN|PC_UNSAFE_OVERRIDE_OMIT|PC_AUTOLOCK); if (oclass==NULL) throw "unable to register class triplex_node"; else oclass->trl = TRL_PROVEN; if(gl_publish_variable(oclass, PT_INHERIT, "powerflow_object", // this is critical to avoid publishing node's 3phase properties PT_enumeration, "bustype", PADDR(bustype),PT_DESCRIPTION,"defines whether the node is a PQ, PV, or SWING node", PT_KEYWORD, "PQ", (enumeration)PQ, PT_KEYWORD, "PV", (enumeration)PV, PT_KEYWORD, "SWING", (enumeration)SWING, PT_set, "busflags", PADDR(busflags),PT_DESCRIPTION,"flag indicates node has a source for voltage, i.e. connects to the swing node", PT_KEYWORD, "HASSOURCE", (set)NF_HASSOURCE, PT_object, "reference_bus", PADDR(reference_bus),PT_DESCRIPTION,"reference bus from which frequency is defined", PT_double,"maximum_voltage_error[V]",PADDR(maximum_voltage_error),PT_DESCRIPTION,"convergence voltage limit or convergence criteria", PT_complex, "voltage_1[V]", PADDR(voltage1),PT_DESCRIPTION,"bus voltage, phase 1 to ground", PT_complex, "voltage_2[V]", PADDR(voltage2),PT_DESCRIPTION,"bus voltage, phase 2 to ground", PT_complex, "voltage_N[V]", PADDR(voltageN),PT_DESCRIPTION,"bus voltage, phase N to ground", PT_complex, "voltage_12[V]", PADDR(voltage12),PT_DESCRIPTION,"bus voltage, phase 1 to 2", PT_complex, "voltage_1N[V]", PADDR(voltage1N),PT_DESCRIPTION,"bus voltage, phase 1 to N", PT_complex, "voltage_2N[V]", PADDR(voltage2N),PT_DESCRIPTION,"bus voltage, phase 2 to N", PT_complex, "current_1[A]", PADDR(current1),PT_DESCRIPTION,"constant current load on phase 1, also acts as accumulator", PT_complex, "current_2[A]", PADDR(current2),PT_DESCRIPTION,"constant current load on phase 2, also acts as accumulator", PT_complex, "current_N[A]", PADDR(currentN),PT_DESCRIPTION,"constant current load on phase N, also acts as accumulator", PT_double, "current_1_real[A]", PADDR(current1.Re()),PT_DESCRIPTION,"constant current load on phase 1, real", PT_double, "current_2_real[A]", PADDR(current2.Re()),PT_DESCRIPTION,"constant current load on phase 2, real", PT_double, "current_N_real[A]", PADDR(currentN.Re()),PT_DESCRIPTION,"constant current load on phase N, real", PT_double, "current_1_reac[A]", PADDR(current1.Im()),PT_DESCRIPTION,"constant current load on phase 1, imag", PT_double, "current_2_reac[A]", PADDR(current2.Im()),PT_DESCRIPTION,"constant current load on phase 2, imag", PT_double, "current_N_reac[A]", PADDR(currentN.Im()),PT_DESCRIPTION,"constant current load on phase N, imag", PT_complex, "current_12[A]", PADDR(current12),PT_DESCRIPTION,"constant current load on phase 1 to 2", PT_double, "current_12_real[A]", PADDR(current12.Re()),PT_DESCRIPTION,"constant current load on phase 1 to 2, real", PT_double, "current_12_reac[A]", PADDR(current12.Im()),PT_DESCRIPTION,"constant current load on phase 1 to 2, imag", PT_complex, "residential_nominal_current_1[A]", PADDR(nom_res_curr[0]),PT_DESCRIPTION,"posted current on phase 1 from a residential object, if attached", PT_complex, "residential_nominal_current_2[A]", PADDR(nom_res_curr[1]),PT_DESCRIPTION,"posted current on phase 2 from a residential object, if attached", PT_complex, "residential_nominal_current_12[A]", PADDR(nom_res_curr[2]),PT_DESCRIPTION,"posted current on phase 1 to 2 from a residential object, if attached", PT_double, "residential_nominal_current_1_real[A]", PADDR(nom_res_curr[0].Re()),PT_DESCRIPTION,"posted current on phase 1, real, from a residential object, if attached", PT_double, "residential_nominal_current_1_imag[A]", PADDR(nom_res_curr[0].Im()),PT_DESCRIPTION,"posted current on phase 1, imag, from a residential object, if attached", PT_double, "residential_nominal_current_2_real[A]", PADDR(nom_res_curr[1].Re()),PT_DESCRIPTION,"posted current on phase 2, real, from a residential object, if attached", PT_double, "residential_nominal_current_2_imag[A]", PADDR(nom_res_curr[1].Im()),PT_DESCRIPTION,"posted current on phase 2, imag, from a residential object, if attached", PT_double, "residential_nominal_current_12_real[A]", PADDR(nom_res_curr[2].Re()),PT_DESCRIPTION,"posted current on phase 1 to 2, real, from a residential object, if attached", PT_double, "residential_nominal_current_12_imag[A]", PADDR(nom_res_curr[2].Im()),PT_DESCRIPTION,"posted current on phase 1 to 2, imag, from a residential object, if attached", PT_complex, "power_1[VA]", PADDR(power1),PT_DESCRIPTION,"constant power on phase 1 (120V)", PT_complex, "power_2[VA]", PADDR(power2),PT_DESCRIPTION,"constant power on phase 2 (120V)", PT_complex, "power_12[VA]", PADDR(power12),PT_DESCRIPTION,"constant power on phase 1 to 2 (240V)", PT_double, "power_1_real[W]", PADDR(power1.Re()),PT_DESCRIPTION,"constant power on phase 1, real", PT_double, "power_2_real[W]", PADDR(power2.Re()),PT_DESCRIPTION,"constant power on phase 2, real", PT_double, "power_12_real[W]", PADDR(power12.Re()),PT_DESCRIPTION,"constant power on phase 1 to 2, real", PT_double, "power_1_reac[VAr]", PADDR(power1.Im()),PT_DESCRIPTION,"constant power on phase 1, imag", PT_double, "power_2_reac[VAr]", PADDR(power2.Im()),PT_DESCRIPTION,"constant power on phase 2, imag", PT_double, "power_12_reac[VAr]", PADDR(power12.Im()),PT_DESCRIPTION,"constant power on phase 1 to 2, imag", PT_complex, "shunt_1[S]", PADDR(pub_shunt[0]),PT_DESCRIPTION,"constant shunt impedance on phase 1", PT_complex, "shunt_2[S]", PADDR(pub_shunt[1]),PT_DESCRIPTION,"constant shunt impedance on phase 2", PT_complex, "shunt_12[S]", PADDR(pub_shunt[2]),PT_DESCRIPTION,"constant shunt impedance on phase 1 to 2", PT_complex, "impedance_1[Ohm]", PADDR(impedance[0]),PT_DESCRIPTION,"constant series impedance on phase 1", PT_complex, "impedance_2[Ohm]", PADDR(impedance[1]),PT_DESCRIPTION,"constant series impedance on phase 2", PT_complex, "impedance_12[Ohm]", PADDR(impedance[2]),PT_DESCRIPTION,"constant series impedance on phase 1 to 2", PT_double, "impedance_1_real[Ohm]", PADDR(impedance[0].Re()),PT_DESCRIPTION,"constant series impedance on phase 1, real", PT_double, "impedance_2_real[Ohm]", PADDR(impedance[1].Re()),PT_DESCRIPTION,"constant series impedance on phase 2, real", PT_double, "impedance_12_real[Ohm]", PADDR(impedance[2].Re()),PT_DESCRIPTION,"constant series impedance on phase 1 to 2, real", PT_double, "impedance_1_reac[Ohm]", PADDR(impedance[0].Im()),PT_DESCRIPTION,"constant series impedance on phase 1, imag", PT_double, "impedance_2_reac[Ohm]", PADDR(impedance[1].Im()),PT_DESCRIPTION,"constant series impedance on phase 2, imag", PT_double, "impedance_12_reac[Ohm]", PADDR(impedance[2].Im()),PT_DESCRIPTION,"constant series impedance on phase 1 to 2, imag", PT_bool, "house_present", PADDR(house_present),PT_DESCRIPTION,"boolean for detecting whether a house is attached, not an input", PT_enumeration, "service_status", PADDR(service_status),PT_DESCRIPTION,"In and out of service flag", PT_KEYWORD, "IN_SERVICE", (enumeration)ND_IN_SERVICE, PT_KEYWORD, "OUT_OF_SERVICE", (enumeration)ND_OUT_OF_SERVICE, PT_double, "service_status_double", PADDR(service_status_dbl),PT_DESCRIPTION,"In and out of service flag - type double - will indiscriminately override service_status - useful for schedules", PT_double, "previous_uptime[min]", PADDR(previous_uptime),PT_DESCRIPTION,"Previous time between disconnects of node in minutes", PT_double, "current_uptime[min]", PADDR(current_uptime),PT_DESCRIPTION,"Current time since last disconnect of node in minutes", PT_object, "topological_parent", PADDR(TopologicalParent),PT_DESCRIPTION,"topological parent as per GLM configuration", NULL) < 1) GL_THROW("unable to publish properties in %s",__FILE__); //Deltamode functions if (gl_publish_function(oclass, "delta_linkage_node", (FUNCTIONADDR)delta_linkage)==NULL) GL_THROW("Unable to publish triplex_node delta_linkage function"); if (gl_publish_function(oclass, "interupdate_pwr_object", (FUNCTIONADDR)interupdate_triplex_node)==NULL) GL_THROW("Unable to publish triplex_node deltamode function"); if (gl_publish_function(oclass, "delta_freq_pwr_object", (FUNCTIONADDR)delta_frequency_node)==NULL) GL_THROW("Unable to publish triplex_node deltamode function"); } }
climate::climate(MODULE *module) { memset(this, 0, sizeof(climate)); if (oclass==NULL) { oclass = gl_register_class(module,"climate",sizeof(climate),PC_PRETOPDOWN); if (gl_publish_variable(oclass, PT_double,"solar_elevation",PADDR(solar_elevation), //sjin: publish solar elevation variable PT_double,"solar_azimuth",PADDR(solar_azimuth), //sjin: publish solar azimuth variable PT_char32, "city", PADDR(city), PT_char1024,"tmyfile",PADDR(tmyfile), PT_double,"temperature[degF]",PADDR(temperature), PT_double,"humidity[%]",PADDR(humidity), PT_double,"solar_flux[W/sf]",PADDR(solar_flux), PT_SIZE, 9, PT_double,"solar_direct[W/sf]",PADDR(solar_direct), PT_double,"solar_diffuse[W/sf]",PADDR(solar_diffuse), PT_double,"solar_global[W/sf]",PADDR(solar_global), PT_double,"extraterrestrial_direct_normal[W/sf]",PADDR(direct_normal_extra), PT_double,"pressure[mbar]",PADDR(pressure), PT_double,"wind_speed[mph]", PADDR(wind_speed), PT_double,"wind_dir[deg]", PADDR(wind_dir), PT_double,"wind_gust[mph]", PADDR(wind_gust), PT_double,"record.low[degF]", PADDR(record.low), PT_int32,"record.low_day",PADDR(record.low_day), PT_double,"record.high[degF]", PADDR(record.high), PT_int32,"record.high_day",PADDR(record.high_day), PT_double,"record.solar[W/sf]", PADDR(record.solar), PT_double,"rainfall[in/h]",PADDR(rainfall), PT_double,"snowdepth[in]",PADDR(snowdepth), PT_enumeration,"interpolate",PADDR(interpolate),PT_DESCRIPTION,"the interpolation mode used on the climate data", PT_KEYWORD,"NONE",(enumeration)CI_NONE, PT_KEYWORD,"LINEAR",(enumeration)CI_LINEAR, PT_KEYWORD,"QUADRATIC",(enumeration)CI_QUADRATIC, PT_double,"solar_horiz",PADDR(solar_flux[CP_H]), PT_double,"solar_north",PADDR(solar_flux[CP_N]), PT_double,"solar_northeast",PADDR(solar_flux[CP_NE]), PT_double,"solar_east",PADDR(solar_flux[CP_E]), PT_double,"solar_southeast",PADDR(solar_flux[CP_SE]), PT_double,"solar_south",PADDR(solar_flux[CP_S]), PT_double,"solar_southwest",PADDR(solar_flux[CP_SW]), PT_double,"solar_west",PADDR(solar_flux[CP_W]), PT_double,"solar_northwest",PADDR(solar_flux[CP_NW]), PT_double,"solar_raw[W/sf]",PADDR(solar_raw), PT_double,"ground_reflectivity[pu]",PADDR(ground_reflectivity), PT_object,"reader",PADDR(reader), PT_char1024,"forecast",PADDR(forecast),PT_DESCRIPTION,"forecasting specifications", NULL)<1) GL_THROW("unable to publish properties in %s",__FILE__); memset(this,0,sizeof(climate)); strcpy(city,""); strcpy(tmyfile,""); temperature = 59.0; temperature_raw = 15.0; humidity = 75.0; rainfall = 0.0; snowdepth = 0.0; ground_reflectivity = 0.3; direct_normal_extra = 126.998456; //1367 W/m^2 constant in W/ft^2 pressure = 1000; //Sea level assumption //solar_flux = malloc(8 * sizeof(double)); solar_flux[0] = solar_flux[1] = solar_flux[2] = solar_flux[3] = solar_flux[4] = solar_flux[5] = solar_flux[6] = solar_flux[7] = solar_flux[8] = 0.0; // W/sf normal //solar_flux_S = solar_flux_SE = solar_flux_SW = solar_flux_E = solar_flux_W = solar_flux_NE = solar_flux_NW = solar_flux_N = 0.0; // W/sf normal tmy = NULL; sa = new SolarAngles(); defaults = this; gl_publish_function(oclass, "calculate_solar_radiation_degrees", (FUNCTIONADDR)calculate_solar_radiation_degrees); gl_publish_function(oclass, "calculate_solar_radiation_radians", (FUNCTIONADDR)calculate_solar_radiation_radians); gl_publish_function(oclass, "calculate_solar_radiation_shading_degrees", (FUNCTIONADDR)calculate_solar_radiation_shading_degrees); gl_publish_function(oclass, "calculate_solar_radiation_shading_radians", (FUNCTIONADDR)calculate_solar_radiation_shading_radians); //sjin: publish solar elevation and azimuth functions gl_publish_function(oclass, "calculate_solar_elevation", (FUNCTIONADDR)calculate_solar_elevation); gl_publish_function(oclass, "calculate_solar_azimuth", (FUNCTIONADDR)calculate_solar_azimuth); //New solar position algorithm stuff gl_publish_function(oclass, "calc_solpos_radiation_shading_degrees", (FUNCTIONADDR)calc_solar_solpos_shading_deg); gl_publish_function(oclass, "calc_solpos_radiation_shading_radians", (FUNCTIONADDR)calc_solar_solpos_shading_rad); } }
// the constructor registers the class and properties and sets the defaults meter::meter(MODULE *mod) : node(mod) { // first time init if (oclass==NULL) { // link to parent class (used by isa) pclass = node::oclass; // register the class definition oclass = gl_register_class(mod,"meter",sizeof(meter),PC_PRETOPDOWN|PC_BOTTOMUP|PC_POSTTOPDOWN|PC_UNSAFE_OVERRIDE_OMIT); if (oclass==NULL) GL_THROW("unable to register object class implemented by %s",__FILE__); // publish the class properties if (gl_publish_variable(oclass, PT_INHERIT, "node", PT_double, "measured_real_energy[Wh]", PADDR(measured_real_energy), PT_double, "measured_reactive_energy[VAh]",PADDR(measured_reactive_energy), PT_complex, "measured_power[VA]", PADDR(measured_power), PT_complex, "measured_power_A[VA]", PADDR(indiv_measured_power[0]), PT_complex, "measured_power_B[VA]", PADDR(indiv_measured_power[1]), PT_complex, "measured_power_C[VA]", PADDR(indiv_measured_power[2]), PT_double, "measured_demand[W]", PADDR(measured_demand), PT_double, "measured_real_power[W]", PADDR(measured_real_power), PT_double, "measured_reactive_power[VAr]", PADDR(measured_reactive_power), PT_complex, "meter_power_consumption[VA]", PADDR(meter_power_consumption), //Luca Meschiari - Start PT_double,"proj_power",PADDR(proj_power), PT_double, "connection_ratio", PADDR(connection_ratio), //Luca Meschiari - End // added to record last voltage/current PT_complex, "measured_voltage_A[V]", PADDR(measured_voltage[0]), PT_complex, "measured_voltage_B[V]", PADDR(measured_voltage[1]), PT_complex, "measured_voltage_C[V]", PADDR(measured_voltage[2]), PT_complex, "measured_voltage_AB[V]", PADDR(measured_voltageD[0]), PT_complex, "measured_voltage_BC[V]", PADDR(measured_voltageD[1]), PT_complex, "measured_voltage_CA[V]", PADDR(measured_voltageD[2]), PT_complex, "measured_current_A[A]", PADDR(measured_current[0]), PT_complex, "measured_current_B[A]", PADDR(measured_current[1]), PT_complex, "measured_current_C[A]", PADDR(measured_current[2]), PT_bool, "customer_interrupted", PADDR(meter_interrupted), PT_bool, "customer_interrupted_secondary", PADDR(meter_interrupted_secondary), #ifdef SUPPORT_OUTAGES PT_int16, "sustained_count", PADDR(sustained_count), //reliability sustained event counter PT_int16, "momentary_count", PADDR(momentary_count), //reliability momentary event counter PT_int16, "total_count", PADDR(total_count), //reliability total event counter PT_int16, "s_flag", PADDR(s_flag), PT_int16, "t_flag", PADDR(t_flag), PT_complex, "pre_load", PADDR(pre_load), #endif PT_double, "monthly_bill[$]", PADDR(monthly_bill), PT_double, "previous_monthly_bill[$]", PADDR(previous_monthly_bill), PT_double, "previous_monthly_energy[kWh]", PADDR(previous_monthly_energy), PT_double, "monthly_fee[$]", PADDR(monthly_fee), PT_double, "monthly_energy[kWh]", PADDR(monthly_energy), PT_enumeration, "bill_mode", PADDR(bill_mode), PT_KEYWORD,"NONE",BM_NONE, PT_KEYWORD,"UNIFORM",BM_UNIFORM, PT_KEYWORD,"TIERED",BM_TIERED, PT_KEYWORD,"HOURLY",BM_HOURLY, PT_KEYWORD,"TIERED_RTP",BM_TIERED_RTP, PT_object, "power_market", PADDR(power_market), PT_int32, "bill_day", PADDR(bill_day), PT_double, "price[$/kWh]", PADDR(price), PT_double, "price_base[$/kWh]", PADDR(price_base), PT_DESCRIPTION, "Used only in TIERED_RTP mode to describe the price before the first tier", PT_double, "first_tier_price[$/kWh]", PADDR(tier_price[0]), PT_double, "first_tier_energy[kWh]", PADDR(tier_energy[0]), PT_double, "second_tier_price[$/kWh]", PADDR(tier_price[1]), PT_double, "second_tier_energy[kWh]", PADDR(tier_energy[1]), PT_double, "third_tier_price[$/kWh]", PADDR(tier_price[2]), PT_double, "third_tier_energy[kWh]", PADDR(tier_energy[2]), //PT_double, "measured_reactive[kVar]", PADDR(measured_reactive), has not implemented yet NULL)<1) GL_THROW("unable to publish properties in %s",__FILE__); // publish meter reset function if (gl_publish_function(oclass,"reset",(FUNCTIONADDR)meter_reset)==NULL) GL_THROW("unable to publish meter_reset function in %s",__FILE__); } }