/// <summary>
        /// Well,...simulates the circuit
        /// </summary>
        void RunSim()
        {
            Informer.SendInfo("Resuming simulation");
            Informer.SendInfo("Simulation type: " + _simType.ToString());

            Informer.OnSimulationStart("started");

            if (_simType == SimulationType.RunOnce)
            {
                SIM_RunOnce();
            }

            else if (_simType == SimulationType.TransientAnalysis)
            {
                SIM_Transient();
            }

            Informer.OnSimulationEnd("Ended");
            Informer.SendInfo("Simulation ended successfully");
        }
Exemple #2
0
 public static string AdGroupCriterionSimulation(long customerId, long adGroupId, long criterionId, SimulationType type, SimulationModificationMethod modificationMethod, DateTime startDate, DateTime endDate)
 {
     return($"customers/{customerId}/adGroupCriterionSimulations/{adGroupId}~{criterionId}~{type.ToString().ToUpper()}~{modificationMethod.ToString().ToUpper()}~{startDate.ToString("yyyy-MM-dd")}~{endDate.ToString("yyyy-MM-dd")}");
 }
Exemple #3
0
 public void ProcessingUpdate(int simId, int counter, SimulationType simType, int max)
 {
     _connectionManager
     .Clients.All.SendAsync("clientListener", "ProcessingUpdate", simId, Math.Round((double)counter / max * 100, 0).ToString(), simType.ToString());
 }
        /// <summary>
        /// called from ViewComponent.
        /// </summary>
        public async Task <IViewComponentResult> InvokeAsync(List <string> paramsList)
        {
            //.Definitions();
            var orders = new List <int>();

            _orderId                   = Convert.ToInt32(value: paramsList[index: 0]);
            _schedulingState           = Convert.ToInt32(value: paramsList[index: 1]);
            _schedulingPage            = Convert.ToInt32(value: paramsList[index: 2]);
            _simulationConfigurationId = Convert.ToInt32(value: paramsList[index: 4]);
            _simulationNumber          = Convert.ToInt32(value: paramsList[index: 5]);

            var folowLinks = false;

            switch (paramsList[index : 3])
            {
            case "Decentral" :
                _simulationType = SimulationType.Decentral;
                break;

            case "BackwardPlanning":
                _simulationType = SimulationType.BackwardPlanning;
                folowLinks      = true;
                break;

            case "ForwardPlanning":
                _simulationType = SimulationType.ForwardPlanning;
                folowLinks      = true;
                break;

            default:
                _simulationType = SimulationType.Central;
                break;
            }
            // refill ViewData
            // Fill Select Fields
            var orderSelection = new SelectList(items: _context.CustomerOrders, dataValueField: "Id", dataTextField: "Name", selectedValue: _orderId);

            ViewData[index : "OrderId"] = orderSelection.AddFirstItem(firstItem : new SelectListItem {
                Value = "-1", Text = "All"
            });
            ViewData[index : "SchedulingState"]         = SchedulingState(selectedItem : _schedulingState);
            ViewData[index : "SimulationPage"]          = _schedulingPage.ToString();
            ViewData[index : "SimulationType"]          = _simulationType.ToString();
            ViewData[index : "SimulationNumber"]        = _simulationNumber.ToString();
            ViewData[index : "SimulationConfiguration"] = _simulationConfigurationId.ToString();
            // - 1 caus we start with 0
            ViewData[index : "MaxPage"] = _maxPage;

            // if no data
            if (!_resultContext.SimulationOperations.Any())
            {
                return(View(viewName: "SimulationTimeline", model: _ganttContext));;
            }


            _timeSpan = _resultContext.SimulationConfigurations.Single(predicate: x => x.Id == _simulationConfigurationId).DynamicKpiTimeSpan;
            ///// Needs some changes to Work. i.e. Reference SimulationOrder , Create SimulationOrderPart and writing it back
            // If Order is not selected.
            if (_orderId == -1)
            {   // for all Orders
                await GetSchedulesForTimeSlotListAsync(pageStart : _timeSpan *_schedulingPage, pageEnd : _timeSpan *_schedulingPage + _timeSpan, folowLinks : folowLinks);
            }
            else
            {  // for the specified Order
                // temporary fix
                var tempType = (_simulationType == SimulationType.ForwardPlanning)
                    ? SimulationType.BackwardPlanning
                    : _simulationType;

                orders = _resultContext?.SimulationOrders.Where(predicate: x => x.OriginId == _orderId &&
                                                                x.SimulationType == tempType &&
                                                                x.SimulationNumber == _simulationNumber &&
                                                                x.SimulationConfigurationId == _simulationConfigurationId)
                         .Select(selector: x => x.OriginId).ToList();
                await GetSchedulesForOrderListAsync(ordersParts : orders);

                //orders = _context?.OrderParts.Where(x => x.OrderId == _orderId).Select(x => x.Id).ToList();
            }



            _ganttContext.Tasks = _ganttContext.Tasks.OrderBy(keySelector: x => x.type).ToList();
            // return schedule
            return(View(viewName: "SimulationTimeline", model: _ganttContext));
        }