public void UploadTrackOut() { new Task(new Action(() => { postInfo.type = PostType.TrackOut; SetCimResult[(int)postInfo.type]("Trackout上报中...", false); CIM.LoadList(CIM.LotNum); ShowState("当前卡塞统计账料数:" + CIM.GetChipIDCnt().ToString()); if (CIM.ChipIDCount != CIM.LotNum) { ShowAlarm("统计账料数与LotNum不符,无法过账,请重新确认"); SendCIMResult(postInfo.type, NG); return; } //string returnValue = PostHelper.PostTrackOut(CIM.GetList(), PostParams.P_I.StrModelNo, out string key); string returnValue = PostHelper.PostTrackOut( CIM.GetList(), PostParams.P_I.StrModelNo, xmlCreater, out string key); if (returnValue == CIM.ReturnOK) { SetCimResult[(int)postInfo.type]("Trackout上报成功", false); postInfo.correlationID = key; Task.Factory.StartNew(FindReception, postInfo); } else { SetTrackOutResult(returnValue + "-Trackout上报失败", true); //TODO 通知plc? SendCIMResult(postInfo.type, NG); } })).Start(); }
void ConnectCIM() { try { if (ModelParams.IfCimOn) { ShowState(string.Format("导入ChipID数量:{0}", CIM.ChipIDCount)); CIM.LoadList(CIM.ChipIDCount); if (CIM.C_I.Init()) { // Task.Factory.StartNew(ReceiveHelper.Monitor); MonitorTask = Task.Factory.StartNew(ReceiveHelper.Monitor, xmlParser); SetCimStatus("CIM连接成功", false); } else { SetCimStatus("CIM连接失败", true); } } else { SetCimStatus("CIM屏蔽", true); } } catch (Exception ex) { Log.L_I.WriteError(NameClass, ex); } }
/// <summary> /// 查询对应的cim返回结果 /// </summary> /// <param name="param"></param> public void FindReception(object param) { try { //TODO PostInfo info = (PostInfo)param; ShowState("开始读取CIM返回结果"); CIM.AddIDToList(info.correlationID); ShowState("读取过账结果"); int cnt = 0; while (cnt < PostParams.P_I.iCycTimes) { Thread.Sleep(150); if (CheckCimResult(info)) { break; } cnt++; } if (cnt == PostParams.P_I.iCycTimes) { SendCIMResult(info.type, NG); SetCimResult[(int)info.type]("获取" + info.type.ToString() + "返回结果超时", true); } } catch (Exception ex) { Log.L_I.WriteError("CIM", ex); } }
/// <summary> /// 手动加账功能 /// </summary> void AddAccount_event(string code) { try { if (code != string.Empty) { RegeditMain.R_I.CodeArm = code; } if (RegeditMain.R_I.CodeArm == string.Empty || RegeditMain.R_I.CodeArm == "FAILED") { ShowAlarm("当前Arm持有ChipID为空,加账失败"); return; } if (!CIM.AppendChipIDList(RegeditMain.R_I.CodeArm)) { ShowAlarm("重复二维码:" + RegeditMain.R_I.CodeArm); return; } ShowState("加账成功:" + RegeditMain.R_I.CodeArm); ShowState("目前账料总数:" + CIM.GetChipIDCnt().ToString()); } catch (Exception ex) { Log.L_I.WriteError(NameClass, ex); } }
private void generateDERMember_Click(object sender, System.EventArgs e) { foreach (Control c in this.DerMemberPanel.Controls) { if (c.GetType() == typeof(System.Windows.Forms.TextBox) && c.Text.Length < 1) { c.Text = CIM.getUUID(); } } Control.ControlCollection controls = this.DerMemberPanel.Controls; }
/// <summary> /// 插栏完成,的时候把fork上的chipid加到list当中保存 /// </summary> public void TriggerAppend() { try { ShowState("插栏成功:" + RegeditMain.R_I.CodeFork); CIM.AppendChipIDList(RegeditMain.R_I.CodeFork); ShowState("当前卡塞账料数:" + CIM.ChipIDCount.ToString()); } catch (Exception ex) { Log.L_I.WriteError(NameClass, ex); } }
/// <summary> /// 保留触发13 /// </summary> /// <param name="trrigerSource_e"></param> /// <param name="i"></param> void LogicPLC_Inst_Reserve13_event(TriggerSource_enum trrigerSource_e, int i) { try { ShowState("交接到下游成功:" + RegeditMain.R_I.CodeArm2); CIM.AppendChipIDList(RegeditMain.R_I.CodeArm2); ShowState("当前交接到下游账料数:" + CIM.ChipIDCount.ToString()); } catch (Exception ex) { Log.L_I.WriteError("MainWindow", ex); } }
private void Reset_Click(object sender, RoutedEventArgs e) { NTBox.Clear(); NUP.Clear(); NMP.Clear(); CIU.Clear(); CIM.Clear(); DF.Clear(); MIT.Clear(); PIM.Clear(); isMasked.IsChecked = false; Result.Items.Clear(); }
/// <summary> /// Get the resume of all transaction for a specific site. /// </summary> /// <param name="site">Site.</param> /// <param name="from">From date.</param> /// <param name="to">To date.</param> /// <param name="resp">Response, in index 0 is for successfull transactions, in index 1 is for failed transactions.</param> /// <param name="entities">Data base context.</param> private static void GetTransactionReportFromAuthorizeForSite(SiteDT site, DateTime from, DateTime to, decimal[] resp, CastleClubEntities entities) { var parameter = new Dictionary <SiteDT, List <TransactionDT> >(); var tmpList = entities.Transactions.Where(x => x.Invoice.Customer.SiteId == site.Id && x.TypeId != "REFUND" && x.SubmitDate >= from && x.SubmitDate <= to).ToList(); var tmpTransform = tmpList.Select(x => x.GetDT()); var tmpToList = tmpTransform.ToList(); parameter.Add(site, tmpToList); decimal[] report = CIM.GetTransactionRange(parameter); resp[0] = resp[0] + report[0]; resp[1] = resp[1] + report[1]; }
/// <summary> /// 在plc进行上卡塞的时候触发,重置cim相关数据,主要是上一卡塞的chipid数据 /// </summary> public void TriggerResetCimData() { try { if (File.Exists(CIM.Path_ChipIDList)) { File.Delete(CIM.Path_ChipIDList); } CIM.ClearChipID(); ShowState(string.Format("重置数据,当前卡塞记录:{0}", CIM.GetChipIDCnt())); } catch (Exception ex) { Log.L_I.WriteError(NameClass, ex); } }
/// <summary> /// fork交接成功时触发,将chipid转移到fork上,以供后续插栏 /// </summary> /// <param name="code"></param> public void TransForkCode(string code) { try { RegeditMain.R_I.CodeFork = code; if (ModelParams.IfCimOn && CIM.CheckDup(RegeditMain.R_I.CodeFork)) { ShowAlarm("交接Fork重复ChipID:" + RegeditMain.R_I.CodeFork); LogicPLC.L_I.WriteRegData1((int)DataRegister1.PCAlarm, (int)PCArarm_Enum.ChipIDError); return; } ShowState("Fork交接成功,Fork持有ChipID:" + RegeditMain.R_I.CodeFork); SetForkChipID(RegeditMain.R_I.CodeFork); } catch (Exception ex) { Log.L_I.WriteError(NameClass, ex); } }
private void generateDERName_Click(object sender, System.EventArgs e) { DERGroupText.Text = CIM.getUUID(); }
private void dispatchGoButton_Click(object sender, EventArgs e) { DERMSInterface.CIM cim = new CIM(); cim.DispatchDERGroup(dispatchDERGroupIDText.Text, 1.0,quantity.RealPower); }
/// <summary> /// 二维码读取事件处理程序 /// </summary> /// <param name="strCode"></param> void C_I_ReadData_event(string strCode) { try { //string chipid = Regex.Replace(strCode, "[^a-z0-9]", "", RegexOptions.IgnoreCase); string chipid = Regex.Match(strCode, @"[A-z0-9]+-?[A-z0-9]+").ToString(); if (chipid == "") { CIM.CodeNGCount++; RegeditMain.R_I.CodeArm = "FAILED"; ShowState("读码失败,Arm持有ChipID:" + RegeditMain.R_I.CodeArm); ShowAlarm("二维码读取失败"); if (ModelParams.IfPassCodeNG) { SendCodeResult(OK); ShowState("启用PASS读码失败,不抛料"); } else { SendCodeResult(NG); } return; } else if (chipid.Length < ModelParams.CodeLength) { CIM.CodeNGCount++; RegeditMain.R_I.CodeArm = chipid; ShowState("二维码长度与设定不符,Arm持有ChipID:" + RegeditMain.R_I.CodeArm); ShowAlarm("二维码长度与设定不符"); if (ModelParams.IfPassCodeNG) { SendCodeResult(OK); ShowState("启用PASS读码失败,不抛料"); } else { SendCodeResult(NG); } return; } else { SendCodeResult(OK); RegeditMain.R_I.CodeArm = chipid; ShowState("读码成功,Arm持有ChipID:" + RegeditMain.R_I.CodeArm); if (!PostParams.P_I.BlByPiece) { if (CIM.CheckDup(RegeditMain.R_I.CodeArm)) { ShowAlarm("读取到重复ChipID:" + RegeditMain.R_I.CodeArm); LogicPLC.L_I.WriteRegData1((int)DataRegister1.QrCodeResult, NG); return; } } } //如果软件运行模式确定要进行过账,则开线程进行chipid的上报 if (!ModelParams.DefaultChipIDOK) { Task.Factory.StartNew(new Action <object>(UploadChipid), chipid); } else { LogicPLC.L_I.WriteRegData1((int)DataRegister1.ChipIDResult, OK); ShowState("ChipID过账默认OK,通知plc过账成功"); } WriteCodeToRegister(chipid); } catch (Exception ex) { Log.L_I.WriteError(NameClass, ex); } }
/// <summary> /// Momentum equations for the u wind component - algebraic mixing lenght model /// </summary> /// <param name="IS">ADI direction for x cells</param> /// <param name="JS">ADI direction for y cells</param> /// <param name="Cmueh">Constant</param> /// <param name="VISHMIN">Minimum horizontal turbulent exchange coefficients </param> /// <param name="AREAxy">Area of a flow field cell</param> /// <param name="UG">Geostrophic wind</param> /// <param name="building_Z0">Roughness of buildings</param> /// <param name="relax">Relaxation factor</param> public static void Calculate(int IS, int JS, float Cmueh, float VISHMIN, float AREAxy, Single UG, float relax) { float DXK = Program.DXK; float DYK = Program.DYK; Vector <float> DXK_V = new Vector <float>(DXK); Vector <float> DYK_V = new Vector <float>(DYK); Vector <float> VISHMIN_V = new Vector <float>(VISHMIN); Vector <float> AREAxy_V = new Vector <float>(AREAxy); Vector <float> UG_V = new Vector <float>(UG); Parallel.For(3, Program.NII, Program.pOptions, i1 => { Span <float> PIMU = stackalloc float[Program.KADVMAX + 1]; Span <float> QIMU = stackalloc float[Program.KADVMAX + 1]; Span <float> Mask = stackalloc float[SIMD]; Span <float> Mask2 = stackalloc float[SIMD]; Span <float> AIM_A = stackalloc float[SIMD]; Span <float> BIM_A = stackalloc float[SIMD]; Span <float> CIM_A = stackalloc float[SIMD]; Span <float> DIMU_A = stackalloc float[SIMD]; Vector <float> DVDXN, DVDXS, DUDXE, DUDXW, DWDXT, DWDXB; Vector <float> DE, DW, DS, DN, DT, DB; Vector <float> FE, FW, FS, FN, FT, FB; Vector <float> PE, PW, PS, PN, PT, PB; Vector <float> BIM, CIM, AE1, AW1, AS1, AN1, AIM; Vector <float> DIM_U, windhilf; Vector <float> DDPX; Vector <float> UKSim_LV; Vector <float> VKSjm_LV, WKSim_LV, WKSimM_LV, WKSkM_LV; Vector <float> VKSimjm_LV, VKSimjp_LV, VKSjp_LV, UKip_LV, VKSim_LV; Vector <float> WKS_V, VKS_V, UKS_V, DZK_V; Vector <float> DXKDZK, DYKDZK, AP0_V, intern, intern2; Vector <float> VIS, zs, mixL; Vector <float> UK_LV, UKim_LV; Vector <float> HOKART_KKART_V; Vector <float> Mask_V = Vector <float> .Zero; Vector <float> DUDZ, DVDZ; int i = i1; if (IS == -1) { i = Program.NII - i1 + 1; } for (int j1 = 2; j1 <= Program.NJJ - 1; ++j1) { int j = j1; if (JS == -1) { j = Program.NJJ - j1 + 1; } if (Program.ADVDOM[i][j] == 1) { //inside a prognostic sub d omain int jM1 = j - 1; int jP1 = j + 1; int iM1 = i - 1; int iP1 = i + 1; Single[] UK_L = Program.UK[i][j]; Single[] UKS_L = Program.UKS[i][j]; Single[] VKS_L = Program.VKS[i][j]; Single[] WKS_L = Program.WKS[i][j]; Single[] DPMNEW_L = Program.DPMNEW[i][j]; Single[] UKim_L = Program.UK[iM1][j]; Single[] UKip_L = Program.UK[iP1][j]; Single[] UKjm_L = Program.UK[i][jM1]; Single[] UKjp_L = Program.UK[i][jP1]; Single[] UKSim_L = Program.UKS[iM1][j]; Single[] VKSim_L = Program.VKS[iM1][j]; Single[] VKSimjm_L = Program.VKS[iM1][jM1]; Single[] VKSjm_L = Program.VKS[i][jM1]; Single[] VKSimjp_L = Program.VKS[iM1][jP1]; Single[] VKSjp_L = Program.VKS[i][jP1]; Single[] WKSim_L = Program.WKS[iM1][j]; Single[] DPMNEWim_L = Program.DPMNEW[iM1][j]; Single[] VKSipjp_L = Program.VKS[iP1][jP1]; Single[] VKSipjm_L = Program.VKS[iP1][jM1]; Single[] WKSip_L = Program.WK[iP1][j]; Single[] VK_L = Program.VK[i][j]; int Vert_Index_LL = Program.VerticalIndex[i][j]; float Ustern_terrain_helpterm = Program.UsternTerrainHelpterm[i][j]; float Ustern_obstacles_helpterm = Program.UsternObstaclesHelpterm[i][j]; bool ADVDOM_JM = (Program.ADVDOM[i][jM1] < 1) || (j == 2); bool ADVDOM_JP = (Program.ADVDOM[i][jP1] < 1) || (j == Program.NJJ - 1); bool ADVDOM_IM = (Program.ADVDOM[iM1][j] < 1) || (i == 2); bool ADVDOM_IP = (Program.ADVDOM[iP1][j] < 1) || (i == Program.NII - 1); float CUTK_L = Program.CUTK[i][j]; Single[] VEG_L = Program.VEG[i][j]; Single COV_L = Program.COV[i][j]; float Z0 = Program.Z0; if (Program.AdaptiveRoughnessMax < 0.01) { //Use GRAMM Roughness with terrain or Roughness from point 1,1 without terrain int IUstern = 1; int JUstern = 1; if ((Program.Topo == 1) && (Program.LandUseAvailable == true)) { double x = i * Program.DXK + Program.GralWest; double y = j * Program.DYK + Program.GralSouth; double xsi1 = x - Program.GrammWest; double eta1 = y - Program.GrammSouth; IUstern = Math.Clamp((int)(xsi1 / Program.DDX[1]) + 1, 1, Program.NX); JUstern = Math.Clamp((int)(eta1 / Program.DDY[1]) + 1, 1, Program.NY); } Z0 = Program.Z0Gramm[IUstern][JUstern]; } else { Z0 = Program.Z0Gral[i][j]; } int KKART_LL = Program.KKART[i][j]; HOKART_KKART_V = new Vector <float>(Program.HOKART[KKART_LL]); int KSTART = 1; if (CUTK_L == 0) // building heigth == 0 m { KSTART = KKART_LL + 1; } int KKART_LL_P1 = KKART_LL + 1; int KEND = Vert_Index_LL + 1; // simpify for-loop bool end = false; // flag for the last loop int k_real = 0; for (int k = KSTART; k < KEND; k += SIMD) { // to compute the top levels - reduce k, remember k_real and set end to true k_real = k; if (k > KEND - SIMD) { k = KEND - SIMD; end = true; } int kM1 = k - 1; int kP1 = k + 1; WKS_V = new Vector <float>(WKS_L, k); VKS_V = new Vector <float>(VKS_L, k); UKS_V = new Vector <float>(UKS_L, k); DZK_V = new Vector <float>(Program.DZK, k); DXKDZK = DXK_V * DZK_V; DYKDZK = DYK_V * DZK_V; //turbulence modelling zs = new Vector <float>(Program.HOKART, k) - HOKART_KKART_V - DZK_V * Vect_05; VIS = Vector <float> .Zero; // Create Mask if KKART_LL is between k and k + SIMD bool mask_v_enable = false; if (KKART_LL_P1 >= k && KKART_LL_P1 < (k + SIMD)) { for (int ii = 0; ii < Mask.Length; ++ii) { if ((k + ii) > KKART_LL_P1) { Mask[ii] = 1; } else { Mask[ii] = 0; } } Mask_V = new Vector <float>(Mask); mask_v_enable = true; } if ((k + SIMD) > KKART_LL_P1) { //k-eps model //float VIS = (float)Math.Sqrt(TURB_L[k]) * zs * Cmueh; //mixing-length model mixL = Vector.Min(Vect_0071 * zs, Vect_100); //adapted mixing-leng th within vegetation layers if (COV_L > 0) { mixL *= (Vect_1 - Vect_099 * new Vector <float>(COV_L)); //mixL = (float)Math.Min(0.071 * Math.Max(1 - Math.Min(2 * VEG_L[kM1], 1), 0.05) * zs, 100); } intern = (new Vector <float>(UK_L, kP1) - new Vector <float>(UK_L, kM1)) / (Vect_2 * DZK_V); DUDZ = intern * intern; intern = (new Vector <float>(VK_L, kP1) - new Vector <float>(VK_L, kM1)) / (Vect_2 * DZK_V); DVDZ = intern * intern; if (mask_v_enable) { VIS = Vector.Min(mixL * mixL * Vector.SquareRoot(Vect_05 * (DUDZ + DVDZ)), Vect_15) * Mask_V; } else { VIS = Vector.Min(mixL * mixL * Vector.SquareRoot(Vect_05 * (DUDZ + DVDZ)), Vect_15); } } DE = Vector.Max(VIS, VISHMIN_V) * DYKDZK / DXK_V; DW = DE; DS = Vector.Max(VIS, VISHMIN_V) * DXKDZK / DYK_V; DN = DS; DT = Vector.Max(VIS, VISHMIN_V) * AREAxy_V / DZK_V; DB = Vector <float> .Zero; if (mask_v_enable) { DB = DT * Mask_V; } else if (k > KKART_LL_P1) // otherwise k < KKART_LL_P1 and DB=0! { DB = DT; } //BOUNDARY CONDITIONS FOR DIFFUSION TERMS if (ADVDOM_JM) { DS = Vector <float> .Zero; } if (ADVDOM_JP) { DN = Vector <float> .Zero; } if (ADVDOM_IM) { DW = Vector <float> .Zero; } if (ADVDOM_IP) { DE = Vector <float> .Zero; } //ADVECTION TERMS VKSimjp_LV = new Vector <float>(VKSimjp_L, k); VKSjp_LV = new Vector <float>(VKSjp_L, k); VKSim_LV = new Vector <float>(VKSim_L, k); VKSimjm_LV = new Vector <float>(VKSimjm_L, k); VKSjm_LV = new Vector <float>(VKSjm_L, k); WKSim_LV = new Vector <float>(WKSim_L, k); UKSim_LV = new Vector <float>(UKSim_L, k); FE = UKS_V * DYKDZK; FW = UKSim_LV * DYKDZK; FS = Vect_025 * (VKSim_LV + VKS_V + VKSimjm_LV + VKSjm_LV) * DXKDZK; FN = Vect_025 * (VKSim_LV + VKS_V + VKSimjp_LV + VKSjp_LV) * DXKDZK; FT = Vect_025 * (WKSim_LV + WKS_V + new Vector <float>(WKSim_L, kP1) + new Vector <float>(WKS_L, kP1)) * AREAxy_V; FB = Vector <float> .Zero; WKSkM_LV = new Vector <float>(WKS_L, kM1); WKSimM_LV = new Vector <float>(WKSim_L, kM1); if (mask_v_enable) { FB = Vect_025 * (WKSim_LV + WKS_V + WKSimM_LV + WKSkM_LV) * AREAxy_V * Mask_V; } else if (k > KKART_LL_P1) // otherwise k < KKART_LL_P1 and FB=0! { FB = Vect_025 * (WKSim_LV + WKS_V + WKSimM_LV + WKSkM_LV) * AREAxy_V; } //PECLET NUMBERS DE = Vector.Max(DE, Vect_0001); DB = Vector.Max(DB, Vect_0001); DW = Vector.Max(DW, Vect_0001); DS = Vector.Max(DS, Vect_0001); DN = Vector.Max(DN, Vect_0001); DT = Vector.Max(DT, Vect_0001); PE = Vector.Abs(FE / DE); PB = Vector.Abs(FB / DB); PW = Vector.Abs(FW / DW); PS = Vector.Abs(FS / DS); PN = Vector.Abs(FN / DN); PT = Vector.Abs(FT / DT); //POWER LAW ADVECTION SCHEME intern = Vect_1 - Vect_01 * PT; BIM = DT * Vector.Max(Vect_0, intern * intern * intern * intern * intern) + Vector.Max(-FT, Vect_0); intern = Vect_1 - Vect_01 * PB; CIM = DB * Vector.Max(Vect_0, intern * intern * intern * intern * intern) + Vector.Max(FB, Vect_0); intern = Vect_1 - Vect_01 * PE; AE1 = DE * Vector.Max(Vect_0, intern * intern * intern * intern * intern) + Vector.Max(-FE, Vect_0); intern = Vect_1 - Vect_01 * PW; AW1 = DW * Vector.Max(Vect_0, intern * intern * intern * intern * intern) + Vector.Max(FW, Vect_0); intern = Vect_1 - Vect_01 * PS; AS1 = DS * Vector.Max(Vect_0, intern * intern * intern * intern * intern) + Vector.Max(FS, Vect_0); intern = Vect_1 - Vect_01 * PN; AN1 = DN * Vector.Max(Vect_0, intern * intern * intern * intern * intern) + Vector.Max(-FN, Vect_0); //UPWIND SCHEME /* * double BIM = DT + Program.fl_max(-FT, 0); * double CIM = DB + Program.fl_max(FB, 0); * double AE1 = DE + Program.fl_max(-FE, 0); * double AW1 = DW + Program.fl_max(FW, 0); * double AS1 = DS + Program.fl_max(FS, 0); * double AN1 = DN + Program.fl_max(-FN, 0); */ AP0_V = new Vector <float>(PrognosticFlowfield.AP0, k); AIM = BIM + CIM + AW1 + AS1 + AE1 + AN1 + AP0_V; //SOURCE TERMS intern2 = Vect_05 * (VKSim_LV + VKS_V); intern = Vect_05 * (UKSim_LV + UKS_V); windhilf = Vector.Max(Vector.SquareRoot(intern * intern + intern2 * intern2), Vect_001); DDPX = new Vector <float>(DPMNEWim_L, k) - new Vector <float>(DPMNEW_L, k); UKim_LV = new Vector <float>(UKim_L, k); UKip_LV = new Vector <float>(UKip_L, k); UKSim_LV = new Vector <float>(UKSim_L, k); UK_LV = new Vector <float>(UK_L, k); DIM_U = AW1 * UKim_LV + AS1 * new Vector <float>(UKjm_L, k) + AE1 * UKip_LV + AN1 * new Vector <float>(UKjp_L, k) + AP0_V * Vect_05 * (UKSim_LV + UKS_V) + DDPX * DYKDZK + (Program.CorolisParam * (UG_V - UK_LV) - new Vector <float>(VEG_L, kM1) * UK_LV * windhilf) * AREAxy_V * DZK_V; //BOUNDARY CONDITION AT SURFACES (OBSTACLES AND TERRAIN) if ((k <= KKART_LL_P1) && ((k + SIMD) > KKART_LL_P1)) { Mask2.Clear(); //Array.Clear(Mask2, 0, Mask2.Length); int ii = KKART_LL_P1 - k; // 0 to SIMD - 1 Mask2[ii] = 1; // Set the mask2 at SIMD position k == KKART_LL_P1 to 1 intern = Vect_05 * (UKSim_LV + UKS_V); intern2 = Vect_05 * (VKSim_LV + VKS_V); windhilf = Vector.Max(Vector.SquareRoot(intern * intern + intern2 * intern2), Vect_01); if (CUTK_L < 1) // building heigth < 1 m { // above terrain float Ustern_Buildings = Ustern_terrain_helpterm * windhilf[ii]; if (Z0 >= DZK_V[ii] * 0.1F) { int ind = k + ii + 1; Ustern_Buildings = Ustern_terrain_helpterm * MathF.Sqrt(Program.Pow2(0.5F * ((UKSim_L[ind]) + UKS_L[ind])) + Program.Pow2(0.5F * ((VKSim_L[ind]) + VKS_L[ind]))); } Vector <float> Ustern_Buildings_V = new Vector <float>(Ustern_Buildings * Ustern_Buildings); DIM_U -= UK_LV / windhilf * Ustern_Buildings_V * AREAxy_V * new Vector <float>(Mask2); } else { //above a building float Ustern_Buildings = Ustern_obstacles_helpterm * windhilf[ii]; Vector <float> Ustern_Buildings_V = new Vector <float>(Ustern_Buildings * Ustern_Buildings); DIM_U -= UK_LV / windhilf * Ustern_Buildings_V * AREAxy_V * new Vector <float>(Mask2); } } //additional terms of the eddy-viscosity model if (k > KKART_LL_P1) { DUDXE = (UKip_LV - UK_LV) * DYKDZK; DUDXW = (UK_LV - UKim_LV) * DYKDZK; DVDXN = (Vect_05 * (new Vector <float>(VKSipjp_L, k) + VKSjp_LV) - Vect_05 * (VKSjp_LV + VKSimjp_LV)) * DXKDZK; DVDXS = (Vect_05 * (new Vector <float>(VKSipjm_L, k) + VKSjm_LV) - Vect_05 * (VKSjm_LV + VKSimjm_LV)) * DXKDZK; DWDXT = (Vect_05 * (new Vector <float>(WKSip_L, k) + WKS_V) - Vect_05 * (WKS_V + WKSim_LV)) * AREAxy_V; DWDXB = (Vect_05 * (new Vector <float>(WKSip_L, kM1) + WKSkM_LV) - Vect_05 * (WKSkM_LV + WKSimM_LV)) * AREAxy_V; if (mask_v_enable) // compute ADD_DIFF and add to DIMW { DIM_U += VIS / DXK_V * (DUDXE - DUDXW + DVDXN - DVDXS + DWDXT - DWDXB) * Mask_V; } else { DIM_U += VIS / DXK_V * (DUDXE - DUDXW + DVDXN - DVDXS + DWDXT - DWDXB); } } //RECURRENCE FORMULA int kint_s = 0; if (end) // restore original indices { kint_s = k_real - k; k_real -= kint_s; } AIM.CopyTo(AIM_A); BIM.CopyTo(BIM_A); CIM.CopyTo(CIM_A); DIM_U.CopyTo(DIMU_A); for (int kint = kint_s; kint < AIM_A.Length; ++kint) // loop over all SIMD values { int index_i = k_real + kint; if (index_i < KEND) { if (index_i > KKART_LL_P1) { float TERMP = 1 / (AIM_A[kint] - CIM_A[kint] * PIMU[index_i - 1]); PIMU[index_i] = BIM_A[kint] * TERMP; QIMU[index_i] = (DIMU_A[kint] + CIM_A[kint] * QIMU[index_i - 1]) * TERMP; } else { float TERMP = 1 / AIM_A[kint]; PIMU[index_i] = BIM_A[kint] * TERMP; QIMU[index_i] = DIMU_A[kint] * TERMP; } } } if (end) { k = KEND + 1; } } // loop over all k //OBTAIN NEW U-COMPONENTS int KKARTm_LL = Math.Max(KKART_LL, Program.KKART[i - 1][j]); lock (UK_L) { for (int k = Vert_Index_LL; k >= KSTART; --k) { if (KKARTm_LL < k) { UK_L[k] += relax * (PIMU[k] * UK_L[k + 1] + QIMU[k] - UK_L[k]); } } } } } }); }
public static void ProcessInvoices() { using (CastleClubEntities entities = new CastleClubEntities()) { if (CastleClub.BusinessLogic.Data.GlobalParameters.Procces) { int maxFailCount = CastleClub.BusinessLogic.Data.GlobalParameters.FailCount; int yearMin = CastleClub.BusinessLogic.Data.GlobalParameters.YearMin; DateTime min = new DateTime(yearMin, 1, 1); List <Invoice> list = entities.Invoices.Where(i => (i.Customer.CancelledDate == null) && (i.CreatedAt >= min) && (!i.FailCount.HasValue || i.FailCount.Value < maxFailCount) && (i.StatusId == InvoiceStatus.NEW.ToString() || i.StatusId == InvoiceStatus.BILLEDFAIL.ToString())).ToList(); foreach (Invoice invoice in list) { try { SiteDT siteDT = invoice.Customer.Site.GetDT(); InvoiceDT invoiceDT = invoice.GetDT(); CustomerDT customerDT = invoice.Customer.GetDT(false); CreditCardDT creditCardDT = invoice.Customer.CreditCards.FirstOrDefault().GetDT(); Transaction transaction = new Transaction(); transaction.InvoiceId = invoiceDT.Id; transaction.CreditCardId = creditCardDT.Id; transaction.AuthorizeTransactionId = 0; transaction.TypeId = TransactionType.SALE.ToString(); transaction.StatusId = TransactionStatus.FAILED.ToString(); transaction.SubmitDate = DateTime.Now; entities.Transactions.Add(transaction); entities.SaveChanges(); long transactionId = 0; string message = ""; string code = string.Empty; bool succesfull = CIM.CreateCustomerProfileTransactionAuthCapture(siteDT, invoiceDT, customerDT, creditCardDT, out transactionId, out message, out code); if (succesfull) { invoice.Status = InvoiceStatus.BILLED; invoice.BilledDate = DateTime.Now; transaction.Status = TransactionStatus.SUCCESFULL; transaction.AuthorizeTransactionId = transactionId; invoice.Customer.Referrer.BilledTotal++; invoice.Customer.Referrer.RevenueAmount += invoice.Amount; entities.SaveChanges(); } else { invoice.FailCount = invoice.FailCount.HasValue ? invoice.FailCount.Value + 1 : 1; transaction.Message = message + code; invoice.Status = InvoiceStatus.BILLEDFAIL; entities.SaveChanges(); if (invoice.FailCount >= maxFailCount && entities.NotificationProcess.Any()) { //To do some. //Send email for notification. string smtpAddress = CastleClub.BusinessLogic.Data.GlobalParameters.Smtp; int portNumber = 587; bool enableSSL = true; string emailFrom = CastleClub.BusinessLogic.Data.GlobalParameters.EmailAccount; string password = CastleClub.BusinessLogic.Data.GlobalParameters.EmailPassword; string subject = "Error an ocurred with invoice: " + invoiceDT.Id; string body = "Error ocurred at " + maxFailCount + " time with invoice: " + invoiceDT.Id + ", customerId: " + invoice.CustomerId + ", and with credit card: " + invoice.Customer.CreditCards.FirstOrDefault().Id; using (System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage()) { mail.From = new MailAddress(emailFrom); foreach (var emailTo in entities.NotificationProcess) { mail.To.Add(emailTo.To); } mail.Subject = subject; mail.Body = body; mail.IsBodyHtml = false; using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber)) { smtp.Credentials = new NetworkCredential(emailFrom, password); smtp.EnableSsl = enableSSL; smtp.Send(mail); } } } } } catch (Exception ex) { Utils.EventViewer.Writte("CastleClubAdmin", "PaymentTask - Process", ex.ToString(), System.Diagnostics.EventLogEntryType.Error); } } } } }
public static void ProcessInvoices(int count, bool all) { using (CastleClubEntities entities = new CastleClubEntities()) { DateTime dateMin = DateTime.Now.Date; System.Console.WriteLine("\tCount is: " + count + ", and the total is: " + entities.Invoices.Count(i => (i.StatusId == "NEW") && (i.Customer.AuthorizeProfileId != 0 || all) && i.CreatedAt > dateMin) + "."); var list = entities.Invoices.Where(i => (i.StatusId == "NEW") && (i.Customer.AuthorizeProfileId != 0 || all) && i.CreatedAt > dateMin).Take(count).ToList(); foreach (var invoice in list) { if (invoice.StatusId == "NEW" && invoice.CreatedAt > new DateTime(2014, 1, 1)) { Console.WriteLine("\tProcess invoice: " + invoice.Id); Site siteDT = invoice.Customer.Site; Invoice invoiceDT = invoice; Customer customerDT = invoice.Customer; CreditCard creditCardDT = invoice.Customer.CreditCards.FirstOrDefault(); Transaction transaction = new Transaction(); transaction.InvoiceId = invoiceDT.Id; transaction.CreditCardId = creditCardDT.Id; transaction.AuthorizeTransactionId = 0; transaction.TypeId = "SALE"; transaction.StatusId = "FAILED"; transaction.SubmitDate = DateTime.Now; entities.Transactions.Add(transaction); entities.SaveChanges(); long transactionId = 0; string message = string.Empty; bool cancel = false; bool succesfull = CIM.CreateCustomerProfileTransactionAuthCapture(siteDT, invoiceDT, customerDT, creditCardDT, out transactionId, out message, out cancel); if (succesfull) { Console.WriteLine("\tCorrect process."); invoice.StatusId = "BILLED"; invoice.BilledDate = DateTime.Now; transaction.StatusId = "SUCCESFULL"; transaction.AuthorizeTransactionId = transactionId; invoice.Customer.Referrer.BilledTotal++; invoice.Customer.Referrer.RevenueAmount += invoice.Amount; entities.SaveChanges(); } else { Console.WriteLine("\tFail process."); invoice.FailCount = invoice.FailCount.HasValue ? invoice.FailCount.Value + 1 : 1; transaction.Message = message; invoice.StatusId = "BILLEDFAIL"; /* * if (cancel) * { * invoice.Customer.CancelledDate = DateTime.Now; * invoice.Customer.StatusId = "CANCELLED"; * } */ entities.SaveChanges(); CastleClub.BusinessLogic.Utils.EventViewer.Writte("Castle Club", "Payment Task", message.ToString(), System.Diagnostics.EventLogEntryType.Error); } } } } }
/// <summary> /// Momentum equations for the w wind component - algebraic mixing lenght model /// </summary> public static void Calculate(int IS, int JS, float Cmueh, float VISHMIN, float AREAxy, float building_Z0, float relax) { Vector <float> DXK_V = new Vector <float>(Program.DXK); Vector <float> DYK_V = new Vector <float>(Program.DYK); Vector <float> VISHMIN_V = new Vector <float>(VISHMIN); Vector <float> AREAxy_V = new Vector <float>(AREAxy); Parallel.For(2, Program.NII, Program.pOptions, i1 => { int KKART_LL, Vert_Index_LL; Span <float> PIMW = stackalloc float [Program.KADVMAX + 1]; Span <float> QIMW = stackalloc float [Program.KADVMAX + 1]; Span <float> Mask = stackalloc float [SIMD]; Span <float> AIM_A = stackalloc float [SIMD]; Span <float> BIM_A = stackalloc float [SIMD]; Span <float> CIM_A = stackalloc float [SIMD]; Span <float> DIMW_A = stackalloc float [SIMD]; Vector <float> DUDZE, DUDZW, DVDZN, DVDZS, DWDZT, DWDZB; Vector <float> DE, DW, DS, DN, DT, DB; Vector <float> FE, FW, FS, FN, FT, FB; Vector <float> PE, PW, PS, PN, PT, PB; Vector <float> BIM, CIM, AE1, AW1, AS1, AN1, AIM; Vector <float> DIMW, windhilf; Vector <float> DDPZ; Vector <float> UKSim_LV, UKSimM_LV; Vector <float> VKSjm_LV, VKSjmM_LV; Vector <float> WKS_V, VKS_V, UKS_V, DZK_V; Vector <float> DXKDZK, DYKDZK, AP0_V, intern, intern2; Vector <float> VIS, zs, mixL; Vector <float> HOKART_KKART; Vector <float> Mask_V = Vector <float> .Zero; Vector <float> DUDZ, DVDZ; Vector <float> UKS_M_V, VKS_M_V, WK_LV; float Ustern_terrain_helpterm, Ustern_obstacles_helpterm; int i = i1; if (IS == -1) { i = Program.NII - i1 + 1; } for (int j1 = 2; j1 < Program.NJJ; ++j1) { int j = j1; if (JS == -1) { j = Program.NJJ - j1 + 1; } if (Program.ADVDOM[i][j] == 1) { int jM1 = j - 1; int jP1 = j + 1; int iM1 = i - 1; int iP1 = i + 1; Single[] WK_L = Program.WK[i][j]; Single[] WKim_L = Program.WK[iM1][j]; Single[] WKip_L = Program.WK[iP1][j]; Single[] WKjm_L = Program.WK[i][jM1]; Single[] WKjp_L = Program.WK[i][jP1]; Single[] UKS_L = Program.UKS[i][j]; Single[] VKS_L = Program.VKS[i][j]; Single[] WKS_L = Program.WKS[i][j]; Single[] DPMNEW_L = Program.DPMNEW[i][j]; Single[] VKim_L = Program.VK[iM1][j]; Single[] VKip_L = Program.VK[iP1][j]; Single[] VKjm_L = Program.VK[i][jM1]; Single[] VKjp_L = Program.VK[i][jP1]; Single[] UKSim_L = Program.UKS[iM1][j]; Single[] UKSip_L = Program.UKS[iP1][j]; Single[] VKSjm_L = Program.VKS[i][jM1]; Single[] VKSjp_L = Program.VKS[i][jP1]; Single[] UK_L = Program.UK[i][j]; Single[] VK_L = Program.VK[i][j]; KKART_LL = Program.KKART[i][j]; Vert_Index_LL = Program.VerticalIndex[i][j]; Ustern_terrain_helpterm = Program.UsternTerrainHelpterm[i][j]; Ustern_obstacles_helpterm = Program.UsternObstaclesHelpterm[i][j]; bool ADVDOM_JM = (Program.ADVDOM[i][jM1] < 1) || (j == 2); bool ADVDOM_JP = (Program.ADVDOM[i][jP1] < 1) || (j == Program.NJJ - 1); bool ADVDOM_IM = (Program.ADVDOM[iM1][j] < 1) || (i == 2); bool ADVDOM_IP = (Program.ADVDOM[iP1][j] < 1) || (i == Program.NII - 1); Single[] VEG_L = Program.VEG[i][j]; Single COV_L = Program.COV[i][j]; HOKART_KKART = new Vector <float>(Program.HOKART[KKART_LL]); int KSTART = 1; if (Program.CUTK[i][j] == 0) { KSTART = KKART_LL + 1; } int KKART_LL_P1 = KKART_LL + 1; int KEND = Vert_Index_LL + 1; bool end = false; // flag for the last loop int k_real = 0; for (int k = KSTART; k < KEND; k += SIMD) { // to compute the top levels - reduce k, remember k_real and set end to true k_real = k; if (k > KEND - SIMD) { k = KEND - SIMD; end = true; } int kM1 = k - 1; int kP1 = k + 1; WKS_V = new Vector <float>(WKS_L, k); VKS_V = new Vector <float>(VKS_L, k); UKS_V = new Vector <float>(UKS_L, k); DZK_V = new Vector <float>(Program.DZK, k); DXKDZK = DXK_V * DZK_V; DYKDZK = DYK_V * DZK_V; UKS_M_V = new Vector <float>(UKS_L, kM1); VKS_M_V = new Vector <float>(VKS_L, kM1); //turbulence modelling zs = new Vector <float>(Program.HOKART, k) - HOKART_KKART - DZK_V * Vect_05; VIS = Vector <float> .Zero; // Create Mask if KKART_LL is between k and k + SIMD bool mask_v_enable = false; if (KKART_LL_P1 >= k && KKART_LL_P1 < (k + SIMD)) { for (int ii = 0; ii < Mask.Length; ++ii) { if ((k + ii) > KKART_LL_P1) { Mask[ii] = 1; } else { Mask[ii] = 0; } } Mask_V = new Vector <float>(Mask); mask_v_enable = true; } if ((k + SIMD) > KKART_LL_P1) { //k-eps model //float VIS = (float)Math.Sqrt(TURB_L[k]) * zs * Cmueh; //mixing-length model mixL = Vector.Min(Vect_0071 * zs, Vect_100); //adapted mixing-leng th within vegetation layers if (COV_L > 0) { mixL *= (Vect_1 - Vect_099 * new Vector <float>(COV_L)); //mixL = (float)Math.Min(0.071 * Math.Max(1 - Math.Min(2 * VEG_L[kM1], 1), 0.05) * zs, 100); } intern = (new Vector <float>(UK_L, kP1) - new Vector <float>(UK_L, kM1)) / (Vect_2 * DZK_V); DUDZ = intern * intern; intern = (new Vector <float>(VK_L, kP1) - new Vector <float>(VK_L, kM1)) / (Vect_2 * DZK_V); DVDZ = intern * intern; if (mask_v_enable) { VIS = Vector.Min(mixL * mixL * Vector.SquareRoot(Vect_05 * (DUDZ + DVDZ)), Vect_15) * Mask_V; } else { VIS = Vector.Min(mixL * mixL * Vector.SquareRoot(Vect_05 * (DUDZ + DVDZ)), Vect_15); } } DE = Vector.Max(VIS, VISHMIN_V) * DYKDZK / DXK_V; DW = DE; DS = Vector.Max(VIS, VISHMIN_V) * DXKDZK / DYK_V; DN = DS; DT = Vector.Max(VIS, VISHMIN_V) * AREAxy_V / DZK_V; DB = Vector <float> .Zero; if (mask_v_enable) { DB = DT * Mask_V; } else if (k > KKART_LL_P1) // otherwise k < KKART_LL_P1 and DB=0! { DB = DT; } //BOUNDARY CONDITIONS FOR DIFFUSION TERMS if (ADVDOM_JM) { DS = Vector <float> .Zero; } if (ADVDOM_JP) { DN = Vector <float> .Zero; } if (ADVDOM_IM) { DW = Vector <float> .Zero; } if (ADVDOM_IP) { DE = Vector <float> .Zero; } //ADVECTION TERMS UKSim_LV = new Vector <float>(UKSim_L, k); UKSimM_LV = new Vector <float>(UKSim_L, kM1); VKSjm_LV = new Vector <float>(VKSjm_L, k); VKSjmM_LV = new Vector <float>(VKSjm_L, kM1); FE = Vect_025 * (UKS_V + new Vector <float>(UKSip_L, k) + UKS_M_V + new Vector <float>(UKSip_L, kM1)) * DYKDZK; FW = Vect_025 * (UKS_V + UKSim_LV + UKS_M_V + UKSimM_LV) * DYKDZK; FS = Vect_025 * (VKS_V + VKSjm_LV + VKS_M_V + VKSjmM_LV) * DXKDZK; FN = Vect_025 * (VKS_V + new Vector <float>(VKSjp_L, k) + VKS_M_V + new Vector <float>(VKSjp_L, kM1)) * DXKDZK; FT = WKS_V * AREAxy_V; FB = Vector <float> .Zero; if (mask_v_enable) { FB = new Vector <float>(WKS_L, kM1) * AREAxy_V * Mask_V; } else if (k > KKART_LL_P1) // otherwise k < KKART_LL_P1 and FB=0! { FB = new Vector <float>(WKS_L, kM1) * AREAxy_V; } //PECLET NUMBERS DE = Vector.Max(DE, Vect_0001); DB = Vector.Max(DB, Vect_0001); DW = Vector.Max(DW, Vect_0001); DS = Vector.Max(DS, Vect_0001); DN = Vector.Max(DN, Vect_0001); DT = Vector.Max(DT, Vect_0001); PE = Vector.Abs(FE / DE); PB = Vector.Abs(FB / DB); PW = Vector.Abs(FW / DW); PS = Vector.Abs(FS / DS); PN = Vector.Abs(FN / DN); PT = Vector.Abs(FT / DT); //POWER LAW ADVECTION SCHEME intern = Vect_1 - Vect_01 * PT; BIM = DT * Vector.Max(Vect_0, intern * intern * intern * intern * intern) + Vector.Max(-FT, Vect_0); intern = Vect_1 - Vect_01 * PB; CIM = DB * Vector.Max(Vect_0, intern * intern * intern * intern * intern) + Vector.Max(FB, Vect_0); intern = Vect_1 - Vect_01 * PE; AE1 = DE * Vector.Max(Vect_0, intern * intern * intern * intern * intern) + Vector.Max(-FE, Vect_0); intern = Vect_1 - Vect_01 * PW; AW1 = DW * Vector.Max(Vect_0, intern * intern * intern * intern * intern) + Vector.Max(FW, Vect_0); intern = Vect_1 - Vect_01 * PS; AS1 = DS * Vector.Max(Vect_0, intern * intern * intern * intern * intern) + Vector.Max(FS, Vect_0); intern = Vect_1 - Vect_01 * PN; AN1 = DN * Vector.Max(Vect_0, intern * intern * intern * intern * intern) + Vector.Max(-FN, Vect_0); //UPWIND SCHEME /* * double BIM = DT + Program.fl_max(-FT, 0); * double CIM = DB + Program.fl_max(FB, 0); * double AE1 = DE + Program.fl_max(-FE, 0); * double AW1 = DW + Program.fl_max(FW, 0); * double AS1 = DS + Program.fl_max(FS, 0); * double AN1 = DN + Program.fl_max(-FN, 0); */ AP0_V = new Vector <float>(PrognosticFlowfield.AP0, k); AIM = BIM + CIM + AW1 + AS1 + AE1 + AN1 + AP0_V; //SOURCE TERMS intern2 = Vect_05 * (VKSjm_LV + VKS_V); intern = Vect_05 * (UKSim_LV + UKS_V); windhilf = Vector.Max(Vector.SquareRoot(intern * intern + intern2 * intern2), Vect_001); DDPZ = new Vector <float>(DPMNEW_L, kM1) - new Vector <float>(DPMNEW_L, k); WK_LV = new Vector <float>(WK_L, k); DIMW = AW1 * new Vector <float>(WKim_L, k) + AS1 * new Vector <float>(WKjm_L, k) + AE1 * new Vector <float>(WKip_L, k) + AN1 * new Vector <float>(WKjp_L, k) + AP0_V * Vect_05 * (new Vector <float>(WKS_L, kM1) + WKS_V) + DDPZ * AREAxy_V - new Vector <float>(VEG_L, kM1) * WK_LV * windhilf * AREAxy_V * DZK_V; //additional terms of the eddy-viscosity model if (k > KKART_LL_P1) { DUDZE = (Vect_05 * (new Vector <float>(UKS_L, kP1) + UKS_V) - Vect_05 * (UKS_V + UKS_M_V)) * DYKDZK; DUDZW = (Vect_05 * (new Vector <float>(UKSim_L, kP1) + UKSim_LV) - Vect_05 * (UKSim_LV + UKSimM_LV)) * DYKDZK; DVDZN = (Vect_05 * (new Vector <float>(VKS_L, kP1) + VKS_V) - Vect_05 * (VKS_V + VKS_M_V)) * DXKDZK; DVDZS = (Vect_05 * (new Vector <float>(VKSjm_L, kP1) + VKSjm_LV) - Vect_05 * (VKSjm_LV + VKSjmM_LV)) * DXKDZK; DWDZT = (new Vector <float>(WK_L, kP1) - WK_LV) * AREAxy_V; DWDZB = (WK_LV - new Vector <float>(WK_L, kM1)) * AREAxy_V; if (mask_v_enable) // compute ADD_DIFF and add to DIMW { DIMW += VIS / DZK_V * (DUDZE - DUDZW + DVDZN - DVDZS + DWDZT - DWDZB) * Mask_V; } else { DIMW += VIS / DZK_V * (DUDZE - DUDZW + DVDZN - DVDZS + DWDZT - DWDZB); } } //RECURRENCE FORMULA int kint_s = 0; if (end) // restore original indices { kint_s = k_real - k; k_real -= kint_s; } AIM.CopyTo(AIM_A); BIM.CopyTo(BIM_A); CIM.CopyTo(CIM_A); DIMW.CopyTo(DIMW_A); for (int kint = kint_s; kint < AIM_A.Length; ++kint) // loop over all SIMD values { int index_i = k_real + kint; if (index_i < KEND) { if (index_i > KKART_LL_P1) { float TERMP = 1 / (AIM_A[kint] - CIM_A[kint] * PIMW[index_i - 1]); PIMW[index_i] = BIM_A[kint] * TERMP; QIMW[index_i] = (DIMW_A[kint] + CIM_A[kint] * QIMW[index_i - 1]) * TERMP; } else { float TERMP = 1 / AIM_A[kint]; PIMW[index_i] = BIM_A[kint] * TERMP; QIMW[index_i] = DIMW_A[kint] * TERMP; } } } if (end) { k = KEND + 1; } } // loop over all k //OBTAIN NEW W-COMPONENTS for (int k = Vert_Index_LL; k >= KSTART; --k) { WK_L[k] += relax * (PIMW[k] * WK_L[k + 1] + QIMW[k] - WK_L[k]); } } } }); }
private void dispatchGoButton_Click(object sender, EventArgs e) { DERMSInterface.CIM cim = new CIM(); cim.DispatchDERGroup(dispatchDERGroupIDText.Text, 1.0, quantity.RealPower); }