def get_message(LOAD): global Q_inv global B_inv global A global mp global mq global voltage global P_inv global PMPPT global Final_power global Xq global Aq transfer = MessageCommonData() for k in range(0, 12): if voltage[k, 0] < 250.08: Q_inv[k, 0] = 0.0001 if voltage[k, 0] >= 250.08: if voltage[k, 0] < 252.0: Q_inv[k, 0] = 1438.0 * (voltage[k][0] - 250.08) if voltage[k, 0] >= 252.0: Q_inv[k, 0] = 2761.0 P_inv[k, 0] = PMPPT for i, n in enumerate(HOUSES): s_inv = complex(P_inv[i, 0], Q_inv[i, 0]) transfer.add_param( CommonParam(name=n, param='constant_power_A', value=s_inv)) return transfer
def get_message(LOAD, time): global B_inv global A global Final_power global flag transfer = MessageCommonData() for k in range(0, 12): if voltage[k, 0] > 250 or flag[k] == 1: #if voltage[k,0]>(240*1.05) and flag[k] == 0: flag[k] = 1 A[k, 0] = m * voltage[k, 0] - m * V_cri[k, 0] - Pcurtail[ k, 0] + flag[k] * q * (Pnet[k][time]) else: A[k, 0] = 0 X = B_inv * A X = X / 5 Final_power = [] for i, n in enumerate(HOUSES): inverter_power = change_power(X[i, 0], i) Final_power.append(inverter_power) transfer.add_param( CommonParam(name=n, param='constant_power_A', value=(inverter_power + LOAD[i]))) return transfer
def get_message(Load): global B_inv global A global Final_Power global vcri global voltage global Pcurtail transfer = MessageCommonData() for k in range(0,12): if voltage[k,0]>vcri*240: A[k,0] = m*voltage[k,0] - m*V_cri[k,0] - Pcurtail[k,0] else: A[k,0] = 0 X = B_inv*A X = X/5 Final_Power = [] for id, h in enumerate(HOUSES): inverter_power = change_power(X[id,0],id) Final_Power.append(inverter_power) transfer.add_param(CommonParam(name = h,param = 'constant_power_A',value = (inverter_power+Load[id]))) return transfer
def get_message_final(Load): global Final_Power transfer = MessageCommonData() for i,h in enumerate(HOUSES): transfer.add_param(CommonParam(name = h, param = 'constant_power_A', value = (Final_Power[i]+Load[i]))) return transfer
def get_message_final(LOAD): global Final_power global Display transfer = MessageCommonData() for i,n in enumerate(HOUSES): transfer.add_param(CommonParam(name=n,param='constant_power_A',value=(Final_power[i]+LOAD[i]))) return transfer
def message_gld_input(): ''' Randomly assigns a kW power rating to the GridLAB-D house load. ''' NAME = 'example_climate' PARAM = 'temperature' transfer = MessageCommonData() transfer.add_param( CommonParam(name=NAME, param=PARAM, value=abs(random.normal(80.0, 10.0)))) return transfer
def get_message(LOAD): global Q_inv global B_inv global A global mp global mq global voltage global P_inv global PMPPT global Final_power global Xq global Aq matqmax = np.full((12,1),Qmax) addp = sensitivity_q*matqmax transfer = MessageCommonData() for k in range(0,12): if voltage[k,0]<244.8: #Q_inv[k,0] = 0.0001 Aq[k,0]=0 if voltage[k,0]>=244.8: if voltage[k,0]<250.08: #Q_inv[k,0] = 1438.0*(voltage[k][0]-250.08) Aq[k,0]=mq*voltage[k,0]-mq*V_criq[k,0]-Qabsorb[k,0] if voltage[k,0]>=250.08: A[k,0]=mp*voltage[k,0]-mp*V_cri[k,0]-Pcurtail[k,0]-mp*(addp[k,0])/10000 #Q_inv[k,0] = 2761.0 #Aq[k,0]=mq*voltage[k,0]-mq*V_criq[k,0]-Qabsorb[k,0] Aq[k,0] = 0 else: A[k,0] = 0 X=B_inv*A Xq = Bq_inv*Aq X=X/5 Xq = Xq/5 Final_power=[] for i,n in enumerate(HOUSES): inverter_power = change_power(X[i,0],i) inverter_re_power = change_repower(Xq[i,0],i) #s_inv = complex(PMPPT+LOAD[i],inverter_re_power) s_inv = complex(inverter_power,inverter_re_power) Final_power.append(s_inv) transfer.add_param(CommonParam(name=n,param='constant_power_A',value = s_inv+LOAD[i])) return transfer
def get_message(LOAD): global B_inv global A global Final_power transfer = MessageCommonData() for k in range(0, 12): if voltage[k, 0] > 252: A[k, 0] = m * voltage[k, 0] - m * V_cri[k, 0] - Pcurtail[k, 0] else: A[k, 0] = 0 X = B_inv * A X = X / 5 Final_power = [] for i, n in enumerate(HOUSES): inverter_power = change_power(X[i, 0], i) Final_power.append(inverter_power) transfer.add_param( CommonParam(name=n, param='constant_power_A', value=(inverter_power + LOAD[i]))) return transfer