Example #1
0
        public static SnapshotContext CreatContext()
        {
            SnapshotContext context = new SnapshotContext();
            IApplicationContext appContext = new MockAppContext();
            UMTSUIParam UIParam = new UMTSUIParam();
            UIParam.Rc = 3840000f;


            List<ISimCellBase> m_UMTSSimCellBaseList = new List<ISimCellBase>();
            List<ISimCellBase> m_GSMSimCellBaseList = new List<ISimCellBase>();
            List<ISimCellBase> m_TDSimCellBaseList = new List<ISimCellBase>();
            List<User> m_UserList = new List<User>();
            User user1 = MockUser.CreatUser_CS();
            User user2 = MockUser.CreatUser_PS();
            m_UserList.Add(user1);
            m_UserList.Add(user2);
            context.AddKey(ContextKeys.AppContext, appContext);
            context.AddKey(ContextKeys.IGetLinkloss, new MockGetLinkloss());
            context.AddKey(ContextKeys.IIterfCalc, new MockInterfCalc());
            context.AddKey(ContextKeys.IGetFastFading,new MockGetFastFading());
            context.AddKey(ContextKeys.UMTSUIParam, UIParam);
            context.AddKey(ContextKeys.IACellList, MockIACellList.CreatIACellList());
            context.AddKey(ContextKeys.UMTSSimCellBase, m_UMTSSimCellBaseList);
            context.AddKey(ContextKeys.PreAccessUsers, m_UserList);
            context.AddKey(ContextKeys.GSMSimCellBase, m_GSMSimCellBaseList);
            context.AddKey(ContextKeys.TDSimCellBase, m_TDSimCellBaseList);
            return context;
        }
Example #2
0
        public void MyTestInit()
        {
            m_Context = MockContext.CreatContext();
            m_Param = new R99_CommonParam(m_Context);
            m_CellList = new List<UMTSSimCell>();

            UMTSSimCell R99Cell = MockCell.CreatUMTSSimCell(0, 0);
            UMTSSimUser ulUser = MockUser.CreatUMTSCSUser();
            ulUser.IsPolyModelUser = true;
            UMTSSimUser ulUser2 = MockUser.CreatUMTSCSUser();
            UMTSSimCell umtsCell = MockCell.CreatUMTSSimCell(0, 50);
            LinkParam linkParam = new LinkParam(umtsCell);
            ulUser2.ServedLinkSet.Add(1, linkParam);
            UMTSSimUser dlUser = MockUser.CreatUMTSCSUser();
            dlUser.LinkType = LinkType.Downlink;
            UMTSSimUser dlUser2 = MockUser.CreatUMTSCSUser();
            dlUser2.ServedLinkSet.Add(1, linkParam);
            R99Cell.ServerdR99User.Add(ulUser);
            R99Cell.ServerdR99User.Add(dlUser);
            R99Cell.ServerdR99User.Add(dlUser2);

            UMTSSimCell R99andDPACell1 = MockCell.CreatUMTSSimCell(0, 100);
            R99andDPACell1.CellType = CarrierTypeOfUMTS.R99AndHSDPA;
            UMTSSimCell R99andDPACell2 = MockCell.CreatUMTSSimCell(50, 100);
            R99andDPACell2.NECell.DynHSDPAPower = true;
            R99andDPACell2.HSDPA_UsedHsscchPower = 30f;
            R99andDPACell2.CellType = CarrierTypeOfUMTS.R99AndHSDPA;
            m_CellList.Add(R99Cell);
            m_CellList.Add(R99andDPACell1);
            m_CellList.Add(R99andDPACell2);
            m_Param.CellList = m_CellList;


        }
Example #3
0
 /// <summary>
 /// 快照初始化
 /// </summary>
 /// <param name="context"></param>
 public void InitCells(SnapshotContext context)
 {
     //封装网元
     List<IACell> allCells = context.Lookup<List<IACell>>(ContextKeys.IACellList);
     m_GSMSimTRXs = new List<GSMSimTRX>();
     //m_GSMCells = new List<ISimCellBase>();
     m_GSMCells = context.Lookup<List<ISimCellBase>>(ContextKeys.GSMSimCellBase);
     foreach(IACell cell in allCells)
     {
         if (cell.NetType == NetWorkType.GSM)
         {
             GSMSimTRX trx = new GSMSimTRX(cell);
             m_GSMSimTRXs.Add(trx);
             if (trx.NeTRX.TRXType == TRXType.BCCH)
             {
                 m_GsmBcchTrx.Add(trx);
             }
             m_GSMCells.Add((ISimCellBase)trx);
         }
     }
     //context.AddKey(ContextKeys.GSMSimCellBase, m_GSMCells);
     m_GSMContext.AddKey(GsmContextkey.GSMSimTRXs, m_GSMSimTRXs);
     m_GSMContext.AddKey(GsmContextkey.GSMBcchTrxs, m_GsmBcchTrx);
     SnapshotInit(context);
 }
Example #4
0
 public void Init()
 {
     cellList = new List<UMTSSimCell>();
     access = new HSUPA_Access();
     context = MockContext.CreatContext();
     commonParam = new HSUPA_CommonParam(context);
     bearerSelector = new HSUPA_BearerSelector(commonParam);
     UMTSSimCell cell = MockCell.CreatUMTSSimCell(0, 0);
     UMTSSimCell cell2 = MockCell.CreatUMTSSimCell(100, 100);
     List<UMTSSimUser> userList = new List<UMTSSimUser>();
     UMTSSimUser user1 = MockUser.CreatUMTSPSUser();
     UMTSSimUser user2 = MockUser.CreatUMTSPSUser();
     UMTSSimUser user3 = MockUser.CreatUMTSPSUser();
     user1.IsAccess = true;
     user2.ServedLinkSet.Add(0, new LinkParam(cell));
     user2.ServedLinkSet.Add(1, new LinkParam(cell2));
     user2.AveTrafficRate = 500;
     
     userList.Add(user1);
     userList.Add(user2);
     userList.Add(user3);
     cell.ServerdHSUPAUser = userList;
    
     cellList.Add(cell);
     commonParam.CellList = cellList;
     commonParam.UserCol.PreAccessedUser.AddRange(userList);
     access.CommonParam = commonParam;
     CalcSource.GetBear += bearerSelector.GetBearByRate;
     
 }
Example #5
0
        protected override async Task Context()
        {
            await base.Context();

            _snapshot = await sut.MapToSnapshot(_individual);

            _project = new PKSimProject();

            _snapshotContext = new SnapshotContext(_project, ProjectVersions.V11);

            _snapshot.Name        = "New individual";
            _snapshot.Description = "The description that will be deserialized";

            //clear enzyme before mapping them again
            _individual.RemoveExpressionProfile(_expressionProfile1);
            _individual.RemoveExpressionProfile(_expressionProfile2);

            //reset parameter
            _parameterKidney.ResetToDefault();

            _project.AddBuildingBlock(_expressionProfile1);
            _project.AddBuildingBlock(_expressionProfile2);

            _newOriginData = new Model.OriginData();
            A.CallTo(() => _originDataMapper.MapToModel(_snapshot.OriginData, A <SnapshotContext> ._)).Returns(_newOriginData);

            A.CallTo(() => _individualFactory.CreateAndOptimizeFor(_newOriginData, _snapshot.Seed))
            .Returns(_individual);
        }
Example #6
0
        public static ClusterInstance NewClusterInstance(InstanceId id, URI uri, Monitors monitors, ClusterConfiguration configuration, int maxSurvivableFailedMembers, LogProvider logging)
        {
            MultiPaxosServerFactory factory = new MultiPaxosServerFactory(configuration, logging, monitors.NewMonitor(typeof(StateMachines.Monitor)));

            ClusterInstanceInput  input  = new ClusterInstanceInput();
            ClusterInstanceOutput output = new ClusterInstanceOutput(uri);

            ObjectStreamFactory objStreamFactory = new ObjectStreamFactory();

            ProverTimeouts timeouts = new ProverTimeouts(uri);

            InMemoryAcceptorInstanceStore acceptorInstances = new InMemoryAcceptorInstanceStore();

            Config config = mock(typeof(Config));

            when(config.Get(ClusterSettings.max_acceptors)).thenReturn(maxSurvivableFailedMembers);

            DelayedDirectExecutor executor = new DelayedDirectExecutor(logging);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.cluster.protocol.atomicbroadcast.multipaxos.context.MultiPaxosContext context = new org.neo4j.cluster.protocol.atomicbroadcast.multipaxos.context.MultiPaxosContext(id, org.neo4j.helpers.collection.Iterables.iterable(new org.neo4j.cluster.protocol.election.ElectionRole(org.neo4j.cluster.protocol.cluster.ClusterConfiguration.COORDINATOR)), new org.neo4j.cluster.protocol.cluster.ClusterConfiguration(configuration.getName(), logging, configuration.getMemberURIs()), executor, logging, objStreamFactory, objStreamFactory, acceptorInstances, timeouts, new org.neo4j.kernel.ha.cluster.DefaultElectionCredentialsProvider(id, new StateVerifierLastTxIdGetter(), new MemberInfoProvider()), config);
            MultiPaxosContext context = new MultiPaxosContext(id, Iterables.iterable(new ElectionRole(ClusterConfiguration.COORDINATOR)), new ClusterConfiguration(configuration.Name, logging, configuration.MemberURIs), executor, logging, objStreamFactory, objStreamFactory, acceptorInstances, timeouts, new DefaultElectionCredentialsProvider(id, new StateVerifierLastTxIdGetter(), new MemberInfoProvider()), config);

            context.ClusterContext.BoundAt = uri;

            SnapshotContext snapshotContext = new SnapshotContext(context.ClusterContext, context.LearnerContext);

            DelayedDirectExecutor taskExecutor = new DelayedDirectExecutor(logging);
            ProtocolServer        ps           = factory.NewProtocolServer(id, input, output, DirectExecutor, taskExecutor, timeouts, context, snapshotContext);

            return(new ClusterInstance(DirectExecutor, logging, factory, ps, context, acceptorInstances, timeouts, input, output, uri));
        }
Example #7
0
        protected override Task Context()
        {
            _executionContext     = A.Fake <IExecutionContext>();
            _classificationMapper = A.Fake <ClassificationMapper>();
            _snapshotMapper       = A.Fake <ISnapshotMapper>();
            sut = new ClassificationSnapshotTask(_classificationMapper);

            _classifications = new List <Classification>();

            _modelClassification    = new Classification().WithName("classification");
            _subModelClassification = new Classification().WithName("subModelClassification");
            _modelClassification.ClassificationType    = ClassificationType.ObservedData;
            _subModelClassification.ClassificationType = ClassificationType.ObservedData;
            _snapshotClassification = new Snapshots.Classification().WithName("classification");
            _snapshotClassification.Classifiables = new[] { "subject" };
            _subClassification = new Snapshots.Classification().WithName("subClassification");
            _snapshotClassification.Classifications = new[] { _subClassification };

            _classifications.Add(_modelClassification);
            A.CallTo(() => _classificationMapper.MapToSnapshot(_modelClassification, A <ClassificationContext> ._)).Returns(_snapshotClassification);
            A.CallTo(() => _classificationMapper.MapToModel(_snapshotClassification, A <ClassificationSnapshotContext> .That.Matches(x => x.ClassificationType == ClassificationType.ObservedData)))
            .Returns(_modelClassification);

            A.CallTo(() => _classificationMapper.MapToModel(_subClassification, A <ClassificationSnapshotContext> .That.Matches(x => x.ClassificationType == ClassificationType.ObservedData)))
            .Returns(_subModelClassification);

            A.CallTo(() => _executionContext.Resolve <ISnapshotMapper>()).Returns(_snapshotMapper);

            _project = new PKSimProject();

            _snapshotContext = new SnapshotContext(_project, ProjectVersions.V10);
            return(_completed);
        }
Example #8
0
 private void AddDataIntoContext(SnapshotContext context) 
 {
     if (context.TryLookup<UMTSLoadStatus>(ContextKeys.UMTSLoadStatus, out m_LoadStatus))
         return;
     m_LoadStatus = new UMTSLoadStatus((ICommonParam)m_CommonParams, m_CommonParams.CellCol.UMTSCellList);
     context.AddKey(ContextKeys.UMTSLoadStatus, m_LoadStatus);
 }
Example #9
0
 public void MyTestInitialize()
 {
     m_Context = MockContext.CreatContext();
     m_Param = new R99_CommonParam(m_Context);
     m_UlUser = MockUser.CreatUMTSCSUser();
     m_DlUser = MockUser.CreatUMTSCSUser();
     m_DlUser.LinkType = LinkType.Downlink;
 }
Example #10
0
 public void Init()
 {
     context = MockContext.CreatContext();
     commonParam = new HSUPA_CommonParam(context);
     bearerSelector = new HSUPA_BearerSelector(commonParam);
     user = MockUser.CreatUMTSPSUser();
     user.HSUPABearer = bearerSelector.GetBearByRate(100000, 0.002f);
 }
        protected override Task Context()
        {
            _logger = A.Fake <IOSPSuiteLogger>();
            sut     = new QualificationStepMapper(_logger);

            _project         = new PKSimProject();
            _snapshotContext = new SnapshotContext(_project, ProjectVersions.Current);
            return(_completed);
        }
Example #12
0
 public void Init(SnapshotContext context)
 {
     m_Standard = context.Lookup<GSMUIParam>(GsmContextkey.GSMUIParam).Convergence;
     m_ServerUsers = context.Lookup<List<GSMSimUser>>(GsmContextkey.GSMServedUsers);
     m_Rate = context.Lookup<GSMUIParam>(GsmContextkey.GSMUIParam).ConvergeProbility;
     m_PowerError = context.Lookup<GSMUIParam>(GsmContextkey.GSMUIParam).PowerError;
     m_ThrghtptError = context.Lookup<GSMUIParam>(GsmContextkey.GSMUIParam).ThrghtptError;
     m_TRXList = context.Lookup<List<GSMSimTRX>>(GsmContextkey.GSMSimTRXs);
 }
Example #13
0
 public static SnapshotContext CreateContext()
 {
     SnapshotContext context = new SnapshotContext();
     context.AddKey(GsmContextkey.GSMGetLinkloss, new MockIGetLinkloss());
     context.AddKey(GsmContextkey.GSMIInterfCalc, new MockIInterfCalc());
     //context.AddKey(GsmContextkey.GSMServedUsers, MockGsmSimUserList());
     context.AddKey(GsmContextkey.GSMUIParam, new GSMUIParam());
     context.AddKey(GsmContextkey.GSMIInterfParam, new InterfCalcPara());
     return context;
 }
        public OnNewPredictionCreateSnapshot(Contexts contexts) : base(contexts.gameState)
        {
            _gameContext      = contexts.game;
            _actorContext     = contexts.actor;
            _snapshotContext  = contexts.snapshot;
            _gameStateContext = contexts.gameState;

            _activeActors   = contexts.actor.GetGroup(ActorMatcher.Id);
            _activeEntities = contexts.game.GetGroup(GameMatcher.LocalId);
        }
        private async Task RunEntity(EventSourcedInit init, IEventSourcedStatefulService statefulService,
                                     MessageStreamingContext <EventSourcedStreamIn, EventSourcedStreamOut> stream)
        {
            var entityId      = init.EntityId;
            var entityHandler = statefulService.CreateEntityHandler(
                new EventSourcedContext(entityId, new AbstractContext(RootContext))
                );

            var startingSequenceNumber = 0L;
            var any = init?.Snapshot?.Snapshot;

            if (any != null)
            {
                var snapshotSequence = init.Snapshot.SnapshotSequence;
                var snapshotContext  = new SnapshotContext(
                    entityId,
                    snapshotSequence,
                    RootContext.ServiceCallFactory
                    );
                entityHandler.HandleSnapshot(
                    any,
                    snapshotContext
                    );
                startingSequenceNumber = snapshotSequence;
            }

            async Task ProcessStream(long sequence, EventSourcedStreamIn message)
            {
                switch (message.MessageCase)
                {
                case MessageOneofCase.Command:
                    await HandleCommand(statefulService, stream, message, entityId, sequence, entityHandler);

                    break;

                case MessageOneofCase.Event:
                    var eventContext = new EventContext(entityId, message.Event.Sequence, new AbstractContext(RootContext));
                    entityHandler.HandleEvent(message.Event.Payload, eventContext);
                    await stream.Response.WriteAsync(new EventSourcedStreamOut());

                    break;

                case MessageOneofCase.Init:
                    throw new InvalidOperationException($"Entity [{entityId}] already initialized");

                case MessageOneofCase.None:
                    throw new InvalidOperationException($"Missing message");

                default:
                    throw new NotImplementedException("Unknown message case");
                }
            }

            await stream.Request.SelectAsync(startingSequenceNumber, ProcessStream);
        }
        protected override Task Context()
        {
            _individualSimulationComparisonMapper = A.Fake <IndividualSimulationComparisonMapper>();
            _populationAnalysisChartMapper        = A.Fake <PopulationAnalysisChartMapper>();
            _objectBaseFactory = A.Fake <IObjectBaseFactory>();
            sut = new SimulationComparisonMapper(_individualSimulationComparisonMapper, _populationAnalysisChartMapper, _objectBaseFactory);

            _individualSimulation1 = new IndividualSimulation().WithName("IndS1").WithId("IndS1");
            _individualSimulation2 = new IndividualSimulation().WithName("IndS2").WithId("IndS2");

            _individualSimulationComparison = new IndividualSimulationComparison
            {
                Name        = "IndividualComparison",
                Description = "IndividualComparison Description",
            };

            _individualSimulationComparison.AddSimulation(_individualSimulation1);
            _individualSimulationComparison.AddSimulation(_individualSimulation2);


            _populationSimulation1 = new PopulationSimulation().WithName("PopS1").WithId("PopS1");
            _populationSimulation2 = new PopulationSimulation().WithName("PopS2").WithId("PopS2");
            _referenceSimulation   = new PopulationSimulation().WithName("PopS3").WithId("PopS3");

            _populationSimulationComparison = new PopulationSimulationComparison
            {
                Name        = "PopulationComparison",
                Description = "PopulationComparison Description",
            };

            _populationSimulationAnalysis = new BoxWhiskerAnalysisChart();
            _populationSimulationComparison.AddSimulation(_populationSimulation1);
            _populationSimulationComparison.AddSimulation(_populationSimulation2);
            _populationSimulationComparison.AddAnalysis(_populationSimulationAnalysis);

            _populationSimulationComparison.ReferenceGroupingItem = new GroupingItem();
            _populationSimulationComparison.ReferenceSimulation   = _referenceSimulation;

            _curveChart = new CurveChart();
            A.CallTo(() => _individualSimulationComparisonMapper.MapToSnapshot(_individualSimulationComparison)).Returns(_curveChart);

            _populationAnalysisChartSnapshot = new Snapshots.PopulationAnalysisChart();
            A.CallTo(() => _populationAnalysisChartMapper.MapToSnapshot(_populationSimulationAnalysis)).Returns(_populationAnalysisChartSnapshot);


            _project = new PKSimProject();
            _project.AddBuildingBlock(_individualSimulation1);
            _project.AddBuildingBlock(_individualSimulation2);
            _project.AddBuildingBlock(_populationSimulation1);
            _project.AddBuildingBlock(_populationSimulation2);
            _project.AddBuildingBlock(_referenceSimulation);

            _snapshotContext = new SnapshotContext(_project, ProjectVersions.V10);
            return(_completed);
        }
        public void Throws_when_proxies_are_used_with_snapshot_tracking()
        {
            using var context = new SnapshotContext();

            Assert.Equal(
                CoreStrings.FullChangeTrackingRequired(
                    nameof(ChangeValueEntity), nameof(ChangeTrackingStrategy.Snapshot),
                    nameof(ChangeTrackingStrategy.ChangingAndChangedNotifications),
                    nameof(ChangeTrackingStrategy.ChangingAndChangedNotificationsWithOriginalValues)),
                Assert.Throws <InvalidOperationException>(() => _ = context.Model).Message);
        }
Example #18
0
        public UMTSTrafficMgr(SnapshotContext context)
        {
            IApplicationContext appContext = context.Lookup<IApplicationContext>(ContextKeys.AppContext);
            ITrafficService trafficSvc = ServiceHelper.Lookup<ITrafficService>(appContext);
            m_R99Mgr = (UMTSR99BearerManagement)trafficSvc.LookupManager(typeof(UMTSR99BearerManagement));
            m_DpaMgr = (HSDPABearerManagement)trafficSvc.LookupManager(typeof(HSDPABearerManagement));
            trafficAdaptor = TrafficAdaptorAssist.Instance;
            m_UpaModelList = trafficAdaptor.UMTSHSUPABearerList;

            m_UpaMgr = (HSUPABearerManagement)trafficSvc.LookupManager(typeof(HSUPABearerManagement));
        }
Example #19
0
 /// <summary>
 /// 封装用户
 /// </summary>
 /// <param name="context">快照参数类</param>
 /// <returns></returns>
 public List<UMTSSimUser> EncapsulateUsers(SnapshotContext context)
 {
     List<UMTSSimUser> umtsUserList = new List<UMTSSimUser>();
     List<User> trafficUserList = context.Lookup<List<User>>(ContextKeys.PreAccessUsers);
     foreach (User user in trafficUserList)
     {
         UMTSSimUser simUser = new UMTSSimUser(user);
         umtsUserList.Add(simUser);
     }
     return umtsUserList;
 }
 public void MyTestInitialize()
 {
     m_Context = MockContext.CreatContext();
     m_Param = new R99_CommonParam(m_Context);
     UMTSSimCell umtsSimCell = MockCell.CreatUMTSSimCell(0, 0);
     umtsSimCell.CurTxPower = 99f;
     umtsSimCell.LastTxPower = 100f;
     umtsSimCell.CurRxPower = 70f;
     umtsSimCell.LastRxPower = 100f;
     m_Param.CellList.Add(umtsSimCell);
 }
 public void Init()
 {
     serviceCHType = new HSUPA_ConfirmServiceAcceptedCHType();
     context = MockContext.CreatContext();
     commonParam = new HSUPA_CommonParam(context);
     user = MockUser.CreatUMTSPSUser();
     user2 = MockUser.CreatUMTSCSUser();
     commonParam.UserCol.PreAccessedUser.Add(user2);
     commonParam.UserCol.PreAccessedUser.Add(user);
     serviceCHType.CommonParam = commonParam;
 }
Example #22
0
        public World(Contexts contexts, IServiceContainer services, IEnumerable <byte> actorIds,
                     Feature logicFeature)
        {
            _actorContext     = contexts.actor;
            _gameContext      = contexts.game;
            _gameStateContext = contexts.gameState;
            _snapshotContext  = contexts.snapshot;

            _timeMachineService = services.GetService <ITimeMachineService>();
            _systems            = new WorldSystems(contexts, services, logicFeature);
        }
Example #23
0
 /// <summary>
 /// 初始化成员变量
 /// </summary>
 /// <param name="context"></param>
 public void Init(SnapshotContext context)
 {
     m_InterfParam = context.Lookup<IInterfCalc>(GsmContextkey.GSMIInterfCalc);
     m_ServerdUsers = context.Lookup<List<GSMSimUser>>(GsmContextkey.GSMServedUsers);
     m_GetLinkLoss = context.Lookup<IGetLinkloss>(GsmContextkey.GSMGetLinkloss);
     m_InterfPara = context.Lookup<InterfCalcPara>(GsmContextkey.GSMIInterfParam);
     m_TchCir = new TCHCIR(m_GetLinkLoss, m_InterfPara, m_InterfParam);
     m_IsPowerCtrl = context.Lookup<GSMUIParam>(GsmContextkey.GSMUIParam).IspowerCtrl;
     m_PowerError = context.Lookup<GSMUIParam>(GsmContextkey.GSMUIParam).PowerError;
     m_Alpha = context.Lookup<GSMUIParam>(GsmContextkey.GSMUIParam).Alpha;
     m_Beta = context.Lookup<GSMUIParam>(GsmContextkey.GSMUIParam).Beta;
 }
Example #24
0
 public void Init(SnapshotContext gsmSnapshot)
 {
     m_ConvergenceResult = gsmSnapshot.Lookup<ConvergenceResult>(GsmContextkey.GSMConvergenceResult);
     m_SimTrxs = gsmSnapshot.Lookup<List<GSMSimTRX>>(GsmContextkey.GSMSimTRXs);
     m_ServedUsers = gsmSnapshot.Lookup<List<GSMSimUser>>(GsmContextkey.GSMServedUsers);
     m_AllUsers = gsmSnapshot.Lookup<List<GSMSimUser>>(GsmContextkey.AllUsers);
     m_AccessFailUsers = gsmSnapshot.Lookup<List<GSMSimUser>>(GsmContextkey.GSMAccessFails);
     m_ForAccessAgain = gsmSnapshot.Lookup<List<GSMSimUser>>(GsmContextkey.GSMForAccessAgain);
     m_LinkLossGet = gsmSnapshot.Lookup<IGetLinkloss>(GsmContextkey.GSMGetLinkloss);
     m_MaxIterNum = gsmSnapshot.Lookup<GSMUIParam>(GsmContextkey.GSMUIParam).MaxIterNum;
     m_ConvergenceJudge.Init(gsmSnapshot);
 }
Example #25
0
 /// <summary>
 /// 封装小区
 /// </summary>
 /// <param name="context">快照参数类</param>
 /// <returns></returns>
 public List<ISimCellBase> EncapsulateCells(SnapshotContext context)
 {
     List<ISimCellBase> umtsCellBase;
     List<IACell> IACellList = context.Lookup<List<IACell>>(ContextKeys.IACellList);
     context.TryLookup<List<ISimCellBase>>(ContextKeys.UMTSSimCellBase, out umtsCellBase);
     if (umtsCellBase.Count==0)
     {
         //umtsCellBase = new List<ISimCellBase>();
         GenerateUMTSCells(IACellList, umtsCellBase);                
         //context.AddKey(ContextKeys.UMTSSimCellBase, umtsCellBase);
     }
     return umtsCellBase;
 }
Example #26
0
        /// <summary>
        /// Creates the snapshot contexts.
        /// </summary>
        protected void createSnapshotContexts()
        {
            foreach (Snapshot sourceSnapshot in sourceSnapshots)
            {
                SnapshotContext context = new SnapshotContext(sourceSnapshot);
                context.SourceStructure    = sourceSnapshot.Structure.Readonly;
                context.SourceData         = sourceSnapshot.CurrentData.Readonly;
                context.CallLevel          = sourceSnapshot.CallLevel;
                context.ChangedIndexesTree = new MemoryIndexTree();

                snapshotContexts.Add(context);
            }
        }
Example #27
0
        public void OnNext(SnapshotContext <BrokerQueuesSnapshot> value)
        {
            string path = $"{Directory.GetCurrentDirectory()}/snapshots";

            if (!File.Exists(path))
            {
                var directory = Directory.CreateDirectory(path);

                if (directory.Exists)
                {
                    File.WriteAllText($"{path}/snapshot_{value.Identifier}.json", value.ToJsonString(Deserializer.Options));
                }
            }
        }
Example #28
0
        public void Init(SnapshotContext context)
        {
            m_GetLinkLoss = context.Lookup<IGetLinkloss>(GsmContextkey.GSMGetLinkloss);
            m_InterfCalc = context.Lookup<IInterfCalc>(GsmContextkey.GSMIInterfCalc);
            m_InterfPara = context.Lookup<InterfCalcPara>(GsmContextkey.GSMIInterfParam);
            m_ForAccessAgain = context.Lookup<List<GSMSimUser>>(GsmContextkey.GSMForAccessAgain);
            m_ServerUser = context.Lookup<List<GSMSimUser>>(GsmContextkey.GSMServedUsers);

            m_TchCir = new TCHCIR(m_GetLinkLoss, m_InterfPara, m_InterfCalc);
            m_ThrptCalc = new ThroughputCalculate();
            context.AddKey(GsmContextkey.KickedUsers, m_KickedUsers);
            m_CsTable = context.Lookup<CodeSchemeTable>(GsmContextkey.CodeSchemeTable);
            
        }
        public EntitasWorld(IServiceContainer services, object contextsObj, object logicFeatureObj)
        {
            var contexts     = contextsObj as Contexts;
            var logicFeature = logicFeatureObj as Feature;

            _context          = contexts;
            _actorContext     = contexts.actor;
            _gameContext      = contexts.game;
            _gameStateContext = contexts.gameState;
            _snapshotContext  = contexts.snapshot;

            _timeMachineService = services.GetService <ITimeMachineService>();
            _systems            = new WorldSystems(contexts, services, logicFeature);
        }
Example #30
0
        protected override async Task Context()
        {
            await base.Context();

            _snapshot = await sut.MapToSnapshot(_parameterIdentification);

            A.CallTo(() => _outputMappingMapper.MapToModel(_snapshotOutputMapping, A <ParameterIdentificationContext> ._)).Returns(_outputMapping);
            A.CallTo(() => _identificationParameterMapper.MapToModel(_snapshotIdentificationParameter, A <ParameterIdentificationContext> ._)).Returns(_identificationParameter);
            A.CallTo(() => _parameterIdentificationAnalysisMapper.MapToModel(_snapshotParameterIdentificationAnalysis, A <ParameterIdentificationContext> ._)).Returns(_parameterIdentificationAnalysis);

            A.CallTo(() => _objectBaseFactory.Create <ModelParameterIdentification>()).Returns(new ModelParameterIdentification());

            _context = new SnapshotContext(_project, 1);
        }
Example #31
0
        protected override Task Context()
        {
            _parameterIdentificationConfigurationMapper = A.Fake <ParameterIdentificationConfigurationMapper>();
            _outputMappingMapper                   = A.Fake <OutputMappingMapper>();
            _identificationParameterMapper         = A.Fake <IdentificationParameterMapper>();
            _parameterIdentificationAnalysisMapper = A.Fake <ParameterIdentificationAnalysisMapper>();
            _objectBaseFactory = A.Fake <IObjectBaseFactory>();
            _logger            = A.Fake <IOSPSuiteLogger>();

            _project         = new PKSimProject();
            _snapshotContext = new SnapshotContext(_project, ProjectVersions.Current);
            _simulation      = new IndividualSimulation().WithName("S1");
            _project.AddBuildingBlock(_simulation);

            _parameterIdentification = new ModelParameterIdentification();
            _snapshotParameterIndentificationConfiguration = new ParameterIdentificationConfiguration();
            _snapshotOutputMapping = new Snapshots.OutputMapping();
            _outputMapping         = new OutputMapping();
            _parameterIdentification.AddSimulation(_simulation);
            _parameterIdentification.AddOutputMapping(_outputMapping);

            _identificationParameter = new IdentificationParameter {
                Name = "IP"
            };
            _parameterIdentification.AddIdentificationParameter(_identificationParameter);

            _snapshotIdentificationParameter         = new Snapshots.IdentificationParameter();
            _snapshotParameterIdentificationAnalysis = new ParameterIdentificationAnalysis();
            _parameterIdentificationAnalysis         = A.Fake <ISimulationAnalysis>();
            _parameterIdentification.AddAnalysis(_parameterIdentificationAnalysis);


            sut = new ParameterIdentificationMapper(
                _parameterIdentificationConfigurationMapper,
                _outputMappingMapper,
                _identificationParameterMapper,
                _parameterIdentificationAnalysisMapper,
                _objectBaseFactory,
                _logger
                );


            A.CallTo(() => _parameterIdentificationConfigurationMapper.MapToSnapshot(_parameterIdentification.Configuration)).Returns(_snapshotParameterIndentificationConfiguration);
            A.CallTo(() => _outputMappingMapper.MapToSnapshot(_outputMapping)).Returns(_snapshotOutputMapping);
            A.CallTo(() => _identificationParameterMapper.MapToSnapshot(_identificationParameter)).Returns(_snapshotIdentificationParameter);
            A.CallTo(() => _parameterIdentificationAnalysisMapper.MapToSnapshot(_parameterIdentificationAnalysis)).Returns(_snapshotParameterIdentificationAnalysis);

            return(_completed);
        }
Example #32
0
        private async Task <IEnumerable <T> > loadModelsFromSnapshotsAsync <T>(IEnumerable <object> snapshots)
        {
            if (snapshots == null)
            {
                return(Enumerable.Empty <T>());
            }

            //This method is typically called when loading a building block snapshot directly (e.g exported as dev).
            //In this case, we are not supporting any project conversion and we just create one with the current version
            var snapshotContext = new SnapshotContext(_projectRetriever.Current, ProjectVersions.Current);
            var tasks           = snapshots.Select(x => _snapshotMapper.MapToModel(x, snapshotContext));
            var models          = await Task.WhenAll(tasks);

            return(models.OfType <T>());
        }
Example #33
0
        public void InitOthers(SnapshotContext context)
        {
            m_CommonParams.CellCol.GSMCellList = m_CommonParams.Context.Lookup<List<ISimCellBase>>(ContextKeys.GSMSimCellBase);
            m_CommonParams.CellCol.TDCellList = m_CommonParams.Context.Lookup<List<ISimCellBase>>(ContextKeys.TDSimCellBase);
            foreach (UMTSSimCell cell in m_CommonParams.CellList)
            {
                cell.UMTSInterfCells = m_FindAdjacentCells.GetNeighbourCells(cell, m_CommonParams.CellCol.UMTSCellList, 21);
                cell.TDInterfCells = m_FindAdjacentCells.GetNeighbourCells(cell, m_CommonParams.CellCol.TDCellList, 21);
                cell.GSMInterfCells = m_FindAdjacentCells.GetNeighbourCells(cell, m_CommonParams.CellCol.GSMCellList, 21);
            }
            AddDataIntoContext(context);

            m_UIParams = m_CommonParams.UMTSUIParam;
                    
        }
Example #34
0
 public void InitCells(SnapshotContext context)
 {
     m_CommonParams = new HSDPA_CommonParam(context);
     m_CommonParams.CellCol.UMTSCellList = m_SimEncapsulate.EncapsulateCells(context);
     foreach (UMTSSimCell cell in m_CommonParams.CellCol.UMTSCellList)
     {
         bool flag = (cell.CellType == CarrierTypeOfUMTS.HSDPA || cell.CellType == CarrierTypeOfUMTS.R99AndHSDPA);
         if (flag)
         {
             m_CommonParams.CellList.Add(cell);
         }               
     }
     
     m_SimCellList = m_CommonParams.CellList;
 }
Example #35
0
        private StateMachine SnapshotStateMachine(LogProvider logProvider, MultiPaxosContext snapshotCtx, StateMachine stateMachine)
        {
            // This is done this way because all the state machines are sharing one piece of global state
            // (MultiPaxosContext), which is snapshotted as one coherent component. This means the state machines
            // cannot snapshot themselves, an external service needs to snapshot the full shared state and then create
            // new state machines sharing that state.

            object ctx;
            Type   msgType = stateMachine.MessageType;

            if (msgType == typeof(AtomicBroadcastMessage))
            {
                ctx = snapshotCtx.AtomicBroadcastContext;
            }
            else if (msgType == typeof(AcceptorMessage))
            {
                ctx = snapshotCtx.AcceptorContext;
            }
            else if (msgType == typeof(ProposerMessage))
            {
                ctx = snapshotCtx.ProposerContext;
            }
            else if (msgType == typeof(LearnerMessage))
            {
                ctx = snapshotCtx.LearnerContext;
            }
            else if (msgType == typeof(HeartbeatMessage))
            {
                ctx = snapshotCtx.HeartbeatContext;
            }
            else if (msgType == typeof(ElectionMessage))
            {
                ctx = snapshotCtx.ElectionContext;
            }
            else if (msgType == typeof(SnapshotMessage))
            {
                ctx = new SnapshotContext(snapshotCtx.ClusterContext, snapshotCtx.LearnerContext);
            }
            else if (msgType == typeof(ClusterMessage))
            {
                ctx = snapshotCtx.ClusterContext;
            }
            else
            {
                throw new System.ArgumentException("I don't know how to snapshot this state machine: " + stateMachine);
            }
            return(new StateMachine(ctx, stateMachine.MessageType, stateMachine.State, logProvider));
        }
Example #36
0
        //#region 用户结果统计时获得
        //private List<UMTSSimCell> m_AllR99Cells;
        ///// <summary>
        ///// 全部R99小区
        ///// </summary>
        //public List<UMTSSimCell> AllR99Cells
        //{
        //    get { return m_AllR99Cells; }
        //}

        //private List<UMTSSimUser> m_AllR99Users;
        ///// <summary>
        ///// 全部R99用户
        ///// </summary>
        //public List<UMTSSimUser> AllR99Users
        //{
        //    get { return m_AllR99Users; }
        //}

        //#endregion
       
        #region ISnapshot 成员
        /// <summary>
        /// 网元封装,从Context中取得UMTSSimCell,再从中找出R99CellList
        /// </summary>
        /// <param name="context"></param>
        public void InitCells(SnapshotContext context)
        {
            m_CommonParam = new R99_CommonParam(context);
            m_CommonParam.CellCol.UMTSCellList = m_SimEncapsulate.EncapsulateCells(context);
            foreach (UMTSSimCell cell in m_CommonParam.CellCol.UMTSCellList)
            {
                bool flag = cell.CellType != CarrierTypeOfUMTS.HSDPA && cell.CellType != CarrierTypeOfUMTS.HSUPA && cell.NECell.Active;
                if (!flag)
                {
                    continue;
                }
                m_CommonParam.CellList.Add(cell);
                cell.DlPower = m_CommonParam.CommonMethod.AddPowerTodBm(cell.NECell.PilotPower, cell.NECell.CCHPower);
                cell.ULSimUsers.Clear();
            }
        }
Example #37
0
 public void Init()
 {
     assignCell = new HSUPA_AssignCell();
     context = MockContext.CreatContext();
     commonParam = new HSUPA_CommonParam(context);
     userList = new List<UMTSSimUser>();
     cellList = new List<UMTSSimCell>();
     UMTSSimCell cell = MockCell.CreatUMTSSimCell(0, 0);
     UMTSSimUser user = MockUser.CreatUMTSPSUser();
     user.ServiceAcceptedCH = ServiveAcceptedCH.E_DPDCH;
     user.UserHandOff = true;
     userList.Add(user);
     commonParam.UserCol.PreAccessedUser = userList;
     cellList.Add(cell);
     commonParam.CellList = cellList;
     assignCell.CommonParam = commonParam;
 }
        protected override async Task Context()
        {
            await base.Context();

            _project         = new PKSimProject();
            _snapshotContext = new SnapshotContext(_project, ProjectVersions.Current);

            _randomPopulation      = CreateRandomPopulation();
            _newPopulationSettings = new RandomPopulationSettings();
            _snapshot = await sut.MapToSnapshot(_randomPopulation);

            A.CallTo(() => _randomPopulationSettingsMapper.MapToModel(_snapshot.Settings, _snapshotContext)).Returns(_newPopulationSettings);
            var mappedPopulation = A.Fake <RandomPopulation>();

            mappedPopulation.SetAdvancedParameters(new AdvancedParameterCollection());
            A.CallTo(() => _randomPopulationFactory.CreateFor(_newPopulationSettings, CancellationToken.None, _snapshot.Seed, false)).Returns(mappedPopulation);
        }
        protected override Task Context()
        {
            _qualificationStepMapper = A.Fake <QualificationStepMapper>();
            _objectBaseFactory       = A.Fake <IObjectBaseFactory>();
            sut = new QualificationPlanMapper(_qualificationStepMapper, _objectBaseFactory);

            _qualificationStep = A.Fake <IQualificationStep>();
            _qualificationPlan = new QualificationPlan {
                _qualificationStep
            }.WithName("QP");
            _qualificationStepSnapshot = new QualificationStep();

            A.CallTo(() => _qualificationStepMapper.MapToSnapshot(_qualificationStep)).Returns(_qualificationStepSnapshot);

            _project         = new PKSimProject();
            _snapshotContext = new SnapshotContext(_project, ProjectVersions.Current);
            return(_completed);
        }
        public void OnNext(SnapshotContext <ClusterSnapshot> value)
        {
            Console.WriteLine($"Cluster Name: {value.Snapshot.ClusterName}");
            Console.WriteLine();

            for (int i = 0; i < value.Snapshot.Nodes.Count; i++)
            {
                Console.WriteLine($"Node: {value.Snapshot.Nodes[i].Identifier}");
                Console.WriteLine();
                Console.WriteLine("*************Memory*************");
                Console.WriteLine($"Limit: {value.Snapshot.Nodes[i].Memory.Limit}");
                Console.WriteLine($"Used: {value.Snapshot.Nodes[i].Memory.Used}");
                Console.WriteLine($"UsageRate: {value.Snapshot.Nodes[i].Memory.UsageRate}");
                Console.WriteLine($"AlarmInEffect: {value.Snapshot.Nodes[i].Memory.AlarmInEffect}");
                Console.WriteLine();
                Console.WriteLine("*************Disk*************");
                Console.WriteLine($"Limit: {value.Snapshot.Nodes[i].Disk.Limit}");
                Console.WriteLine($"Available: {value.Snapshot.Nodes[i].Disk.Capacity.Available}");
                Console.WriteLine($"Rate: {value.Snapshot.Nodes[i].Disk.Capacity.Rate}");
                Console.WriteLine($"AlarmInEffect: {value.Snapshot.Nodes[i].Disk.AlarmInEffect}");
                Console.WriteLine();
                Console.WriteLine("*************IO*************");
                Console.WriteLine($"Disk Reads: {value.Snapshot.Nodes[i].Disk.IO.Reads.Total}");
                Console.WriteLine($"Bytes Read: {value.Snapshot.Nodes[i].Disk.IO.Reads.Bytes.Total.ToByteString()}");
                Console.WriteLine($"Disk Read Rate: {value.Snapshot.Nodes[i].Disk.IO.Reads.Rate}");
                Console.WriteLine();
                Console.WriteLine("*************OS*************");
                Console.WriteLine($"ProcessId: {value.Snapshot.Nodes[i].OS.ProcessId}");
                Console.WriteLine($"Available: {value.Snapshot.Nodes[i].OS.FileDescriptors.Available}");
                Console.WriteLine($"Used: {value.Snapshot.Nodes[i].OS.FileDescriptors.Used}");
                Console.WriteLine($"UsageRate: {value.Snapshot.Nodes[i].OS.FileDescriptors.UsageRate}");
                Console.WriteLine($"OpenAttempts: {value.Snapshot.Nodes[i].OS.FileDescriptors.OpenAttempts}");
                Console.WriteLine($"OpenAttemptRate: {value.Snapshot.Nodes[i].OS.FileDescriptors.OpenAttemptRate}");
                Console.WriteLine($"AvgTimePerOpenAttempt: {value.Snapshot.Nodes[i].OS.FileDescriptors.AvgTimePerOpenAttempt}");
                Console.WriteLine($"AvgTimeRatePerOpenAttempt: {value.Snapshot.Nodes[i].OS.FileDescriptors.AvgTimeRatePerOpenAttempt}");
                Console.WriteLine();
                Console.WriteLine("*************Erlang Runtime*************");
                Console.WriteLine($"Identifier: {value.Snapshot.Nodes[i].Runtime.Identifier}");
                Console.WriteLine($"Version: {value.Snapshot.Nodes[i].Runtime.Version}");
                Console.WriteLine($"Processes.Limit: {value.Snapshot.Nodes[i].Runtime.Processes.Limit}");
                Console.WriteLine($"Processes.Used: {value.Snapshot.Nodes[i].Runtime.Processes.Used}");
                Console.WriteLine($"Processes.UsageRate: {value.Snapshot.Nodes[i].Runtime.Processes.UsageRate}");
            }
        }
Example #41
0
        protected override Task Context()
        {
            _parameterIdentificationAnalysisChartMapper = A.Fake <ParameterIdentificationAnalysisChartMapper>();
            _dataRepositoryMapper = A.Fake <DataRepositoryMapper>();
            _idGenerator          = A.Fake <IIdGenerator>();
            sut = new ParameterIdentificationAnalysisMapper(_parameterIdentificationAnalysisChartMapper, _dataRepositoryMapper, _idGenerator);

            _parameterIdentificationAnalysis = new T().WithName("Chart");
            _chartSnapshot           = new CurveChart();
            _localRepository         = DomainHelperForSpecs.ObservedData();
            _snapshotLocalRepository = new Snapshots.DataRepository();
            A.CallTo(() => _dataRepositoryMapper.MapToSnapshot(_localRepository)).Returns(_snapshotLocalRepository);

            _parameterIdentification = new ParameterIdentification();
            _project     = new PKSimProject();
            _baseContext = new SnapshotContext(_project, ProjectVersions.V10);
            _parameterIdentificationContext = new ParameterIdentificationContext(_parameterIdentification, _baseContext);
            return(_completed);
        }
Example #42
0
        public static void Main(string[] args)
        {
            // Linux Environment:
            // please note that it is necessary to set the environment varible "TERM" to "xterm"

            List <Coin> snapshot;

            try
            {
                snapshot = Selenium.Scraper.CompileSnapshot();

                Console.WriteLine("Scraped " + snapshot.Count + " coins\n");
                foreach (var coinObject in snapshot)
                {
                    Console.Write(coinObject.Name);
                }

                Selenium.Scraper.QuitWebDriver();
            }
            catch (Exception e)
            {
                Selenium.Scraper.QuitWebDriver();
                Console.WriteLine(e);
                throw;
            }

            using (var db = new SnapshotContext())
            {
                // build dbContext object from the list of coin objects procured via selenium
                var marketSnapshot = new MarketSnapshot
                {
                    Coins    = snapshot,
                    SnapTime = DateTime.Now
                };

                // append to database
                db.MarketSnapshots.Add(marketSnapshot);
                db.SaveChanges();
            }

            Console.ReadKey();
            Environment.Exit(0);
        }
Example #43
0
        protected override Task Context()
        {
            _parameterMapper = A.Fake <ParameterMapper>();
            _identificationParameterFactory = A.Fake <IIdentificationParameterFactory>();
            _logger = A.Fake <IOSPSuiteLogger>();
            _identificationParameterTask = A.Fake <IIdentificationParameterTask>();
            sut = new IdentificationParameterMapper(_parameterMapper, _identificationParameterFactory, _identificationParameterTask, _logger);

            _identificationParameter = new IdentificationParameter
            {
                IsFixed     = true,
                UseAsFactor = true,
                Scaling     = Scalings.Linear
            };


            _startValueParameter = DomainHelperForSpecs.ConstantParameterWithValue().WithName(Constants.Parameters.START_VALUE);

            _identificationParameter.Add(_startValueParameter);
            _identificationParameter.Name = "PARAM";
            _parameter1            = DomainHelperForSpecs.ConstantParameterWithValue().WithName("P1");
            _parameter2            = DomainHelperForSpecs.ConstantParameterWithValue().WithName("P2");
            _simulation            = A.Fake <Simulation>().WithName("S");
            _simulation.Model.Root = new Container {
                _parameter1, _parameter2
            };

            _identificationParameter.Scaling = Scalings.Linear;
            _parameterSelection1             = new ParameterSelection(_simulation, _parameter1.Name);
            _parameterSelection2             = new ParameterSelection(_simulation, _parameter2.Name);
            _identificationParameter.AddLinkedParameter(_parameterSelection1);
            _identificationParameter.AddLinkedParameter(_parameterSelection2);

            _snapshotStartValueParameter = new Parameter();
            A.CallTo(() => _parameterMapper.MapToSnapshot(_startValueParameter)).Returns(_snapshotStartValueParameter);

            _project = new PKSimProject();
            _project.AddBuildingBlock(_simulation);
            _snapshotContext                = new SnapshotContext(_project, ProjectVersions.Current);
            _parameterIdentification        = new ParameterIdentification();
            _parameterIdentificationContext = new ParameterIdentificationContext(_parameterIdentification, _snapshotContext);
            return(_completed);
        }
        public void OnNext(SnapshotContext <BrokerQueuesSnapshot> value)
        {
//            Console.WriteLine($"");

            foreach (var queue in value.Snapshot.Queues)
            {
                Console.WriteLine($"Queue: {queue.Identifier}");
                Console.WriteLine($"VHost: {queue.VirtualHost}");
                Console.WriteLine($"Node: {queue.Node}");
                Console.WriteLine("Churn Metrics");
                Console.WriteLine($"\tReady: {queue.Messages?.Ready?.Total ?? 0} | {queue.Messages?.Ready?.Rate ?? 0} msg/s");
                Console.WriteLine($"\tAcknowledged: {queue.Messages?.Acknowledged?.Total ?? 0} | {queue.Messages?.Acknowledged?.Rate ?? 0} msg/s");
                Console.WriteLine($"\tUnacknowledged: {queue.Messages?.Unacknowledged?.Total ?? 0} | {queue.Messages?.Unacknowledged?.Rate ?? 0} msg/s");
                Console.WriteLine($"\tDelivered: {queue.Messages.Delivered.Total} | {queue.Messages?.Delivered?.Rate ?? 0} msg/s");
                Console.WriteLine($"Target Count in RAM: {queue.Internals?.TargetCountOfMessagesAllowedInRAM ?? 0}");
//                Console.WriteLine($"");
            }

//            Console.WriteLine();
        }
Example #45
0
    public Contexts()
    {
        actor     = new ActorContext();
        config    = new ConfigContext();
        debug     = new DebugContext();
        game      = new GameContext();
        gameState = new GameStateContext();
        input     = new InputContext();
        snapshot  = new SnapshotContext();

        var postConstructors = System.Linq.Enumerable.Where(
            GetType().GetMethods(),
            method => System.Attribute.IsDefined(method, typeof(Entitas.CodeGeneration.Attributes.PostConstructorAttribute))
            );

        foreach (var postConstructor in postConstructors)
        {
            postConstructor.Invoke(this, null);
        }
    }
Example #46
0
        public void InitCells_Test()
        {
            HSDPASimulization simulization = new HSDPASimulization();
            SnapshotContext context = new SnapshotContext();
            List<Transceiver> trans = new List<Transceiver>();
            TDSimCellCollection cellCollection = new TDSimCellCollection();

            TDSimCell cell1;
            cell1 = MockTDSimCell.CreatTDSimCell();
            TDSimCell cell2;
            cell2 = MockTDSimCell.CreatTDSimCell();

            cellCollection.TDCells.Add(cell1);
            cellCollection.TDCells.Add(cell2);

            context.AddKey(ContextKeys.TranceiverList, trans);
            context.AddKey(ContextKeys.TDSimCellCollection, cellCollection);

            simulization.InitCells(context);
            Assert.AreEqual(cell1.BackNoise_DB, 3.0f);
        }
Example #47
0
        public void Init()
        {
            calcIo = new HSUPA_CalcIo();
            context = MockContext.CreatContext();
            commonParam = new HSUPA_CommonParam(context);
            interfCalc = new MockInterfCalc();
            getLinkLoss = new MockGetLinkloss();
            bearerSelector = new HSUPA_BearerSelector(commonParam);
            calcIo.UMTSInterfCalc = new UMTSInterfCalc(interfCalc, getLinkLoss);
            cell = MockCell.CreatUMTSSimCell(0, 0);
            cell.CellType = CarrierTypeOfUMTS.HSUPA;

            user1 = MockUser.CreatUMTSPSUser();
            user1.MaxRSCPCell = cell;
            user1.MaxRSCPCell.UMTSInterfCells = new List<ISimCellBase>();
            user1.MaxRSCPCell.HSUPA_CurRxPower = 10;
            user1.MaxRSCPCell.HSUPA_UsedRxPower = 10;
            user1.IsScheduledInTTI = true;


            calcIo.CommonParams = commonParam;
        }
Example #48
0
        public void MyTestInitialize()
        {
            m_Context = MockContext.CreatContext();
            m_Param = new R99_CommonParam(m_Context);

            m_UlUser = MockUser.CreatUMTSCSUser();
            m_UlUser.UserState = UserState.Serving;
            m_UlUser.ServedLinkSet[0].ServeSet.CurRxPower = 50000f;
            m_UlUser.ServedLinkSet[0].ULCIR = 0.0001f;
            LinkParam linkParam = new LinkParam(MockCell.CreatUMTSSimCell(50, 50));
            linkParam.ServeSet.CurRxPower = 40000f;
            linkParam.ULCIR = 0.00001f;
            m_UlUser.ServedLinkSet.Add(1, linkParam);

            m_DlUser = MockUser.CreatUMTSCSUser();
            m_DlUser.UserState = UserState.Serving;
            m_DlUser.LinkType = LinkType.Downlink;
            m_DlUser.ServedLinkSet[0].DLTrafTxPower = 100f;

            m_Param.UserCol.AccessedUser.Add(m_UlUser);
            m_Param.UserCol.AccessedUser.Add(m_DlUser);
        }
Example #49
0
        protected override async Task Context()
        {
            await base.Context();

            _newIndividual   = new Individual();
            _project         = new PKSimProject();
            _snapshotContext = new SnapshotContext(_project, ProjectVersions.Current);
            _snapshot        = await sut.MapToSnapshot(_randomPopulationSettings);

            _snapshot.ProportionOfFemales = null;
            A.CallTo(() => _individualMapper.MapToModel(_snapshotIndividual, _snapshotContext)).Returns(_newIndividual);

            _mappedSettings = new RandomPopulationSettings();
            A.CallTo(() => _populationSettingsMapper.MapFrom(_newIndividual)).Returns(_mappedSettings);
            _unknownGender = new GenderRatio
            {
                Gender = new Gender {
                    Id = "Gender"
                },
                Ratio = 100
            };
            _mappedSettings.AddGenderRatio(_unknownGender);
        }
Example #50
0
 public void Init()
 {
     scheduler = new HSUPA_Scheduler();
     context = MockContext.CreatContext();
     commonParam = new HSUPA_CommonParam(context);
     commonParam.NewSimTTIStart(commonParam.TTILength);
     rateCtrl = new HSUPA_UserScheduleRateCtrl();
     calcIo = new HSUPA_CalcIo();
     interfCalc = new MockInterfCalc();
     getLinkLoss = new MockGetLinkloss();
     bearerSelector = new HSUPA_BearerSelector(commonParam);
     rateCtrl.CommonParams = commonParam;
     scheduler.CommonParams = commonParam;
     calcIo.CommonParams = commonParam;
     calcIo.UMTSInterfCalc = new UMTSInterfCalc(interfCalc, getLinkLoss);
     scheduler.HSUPA_CalcIo = calcIo;
     scheduler.RateCtrl = rateCtrl;
     cell = MockCell.CreatUMTSSimCell(0,0);
     user = MockUser.CreatUMTSPSUser();
     user.MaxRSCPCell = cell;
     rateCtrl.BearerSelector = bearerSelector;
     scheduler.HSUPA_BearerSelector = bearerSelector;
 }
        protected override Task Context()
        {
            _calculationMethodCacheMapper = A.Fake <CalculationMethodCacheMapper>();
            _processMappingMapper         = A.Fake <ProcessMappingMapper>();
            _logger                    = A.Fake <IOSPSuiteLogger>();
            _project                   = new PKSimProject();
            _baseSnapshotContext       = new SnapshotContext(_project, ProjectVersions.Current);
            _calculationMethodSnapshot = new CalculationMethodCache();
            sut = new CompoundPropertiesMapper(_calculationMethodCacheMapper, _processMappingMapper, _logger);

            _compoundGroupSelectionOneAlternative = new CompoundGroupSelection
            {
                AlternativeName = "ALT1",
                GroupName       = "ALTERNATIVE_GROUP_1"
            };

            _compoundGroupSelectionTwoAlternatives = new CompoundGroupSelection
            {
                AlternativeName = "ALT2",
                GroupName       = "ALTERNATIVE_GROUP_2"
            };

            _compound = new Compound
            {
                Name = "COMP",
            };

            _protocol = new SimpleProtocol
            {
                Name = "PROTOCOL"
            };

            _parameterAlternativeGroupWithOneAlternative = new ParameterAlternativeGroup {
                Name = _compoundGroupSelectionOneAlternative.GroupName
            };
            _parameterAlternativeGroupWithTwoAlternatives = new ParameterAlternativeGroup {
                Name = _compoundGroupSelectionTwoAlternatives.GroupName
            };

            _parameterAlternativeGroupWithTwoAlternatives.AddAlternative(new ParameterAlternative {
                Name = "ALT1"
            });
            _parameterAlternativeGroupWithTwoAlternatives.AddAlternative(new ParameterAlternative {
                Name = "ALT2"
            });

            _compound.AddParameterAlternativeGroup(_parameterAlternativeGroupWithOneAlternative);
            _compound.AddParameterAlternativeGroup(_parameterAlternativeGroupWithTwoAlternatives);

            _compoundProperties = new Model.CompoundProperties();

            _compoundProperties.AddCompoundGroupSelection(_compoundGroupSelectionOneAlternative);
            _compoundProperties.AddCompoundGroupSelection(_compoundGroupSelectionTwoAlternatives);
            _compoundProperties.Compound = _compound;
            _enzymaticProcess            = new EnzymaticProcess {
                Name = "EnzymaticProcess"
            };
            _anotherEnzymaticProcess = new EnzymaticProcess {
                Name = "AnotherEnzymaticProcess", MoleculeName = "CYP3A4"
            };
            _specificBindingProcess = new SpecificBindingPartialProcess {
                Name = "SpecificBinding"
            };
            _gfrTransportProcess = new SystemicProcess {
                Name = "Transport", SystemicProcessType = SystemicProcessTypes.GFR
            };
            _hepaticEnzymaticProcess = new SystemicProcess {
                Name = "Plasma Clearance", SystemicProcessType = SystemicProcessTypes.Hepatic
            };
            _compound.AddProcess(_enzymaticProcess);
            _compound.AddProcess(_specificBindingProcess);
            _compound.AddProcess(_gfrTransportProcess);
            _compound.AddProcess(_hepaticEnzymaticProcess);

            _enzymaticPartialProcessSelection = new EnzymaticProcessSelection {
                ProcessName = _enzymaticProcess.Name
            };
            _noEnzymaticSystemicProcessSelection = new SystemicProcessSelection {
                ProcessType = SystemicProcessTypes.Hepatic
            };
            _specificBindingPartialProcessSelection = new ProcessSelection {
                ProcessName = _specificBindingProcess.Name
            };
            _transportSystemicProcessSelection = new SystemicProcessSelection {
                ProcessName = _gfrTransportProcess.Name, ProcessType = _gfrTransportProcess.SystemicProcessType,
            };
            _noEnzymaticPartialProcessSelection = new EnzymaticProcessSelection {
                MoleculeName = _anotherEnzymaticProcess.MoleculeName
            };
            _compoundProperties.Processes.MetabolizationSelection.AddPartialProcessSelection(_enzymaticPartialProcessSelection);
            _compoundProperties.Processes.MetabolizationSelection.AddPartialProcessSelection(_noEnzymaticPartialProcessSelection);
            _compoundProperties.Processes.MetabolizationSelection.AddSystemicProcessSelection(_noEnzymaticSystemicProcessSelection);
            _compoundProperties.Processes.SpecificBindingSelection.AddPartialProcessSelection(_specificBindingPartialProcessSelection);
            _compoundProperties.Processes.TransportAndExcretionSelection.AddSystemicProcessSelection(_transportSystemicProcessSelection);

            _snapshotProcess1 = new CompoundProcessSelection {
                Name = _enzymaticPartialProcessSelection.ProcessName
            };
            _snapshotProcess2 = new CompoundProcessSelection {
                Name = _specificBindingPartialProcessSelection.ProcessName
            };
            _snapshotProcess3 = new CompoundProcessSelection {
                Name = _transportSystemicProcessSelection.ProcessName
            };
            _snapshotProcess4 = new CompoundProcessSelection {
                SystemicProcessType = _noEnzymaticSystemicProcessSelection.ProcessType.SystemicProcessTypeId.ToString()
            };
            _snapshotProcess5 = new CompoundProcessSelection {
                MoleculeName = _noEnzymaticPartialProcessSelection.MoleculeName
            };

            _formulation = new Formulation
            {
                Id = "123456"
            };
            _compoundProperties.ProtocolProperties.Protocol = _protocol;
            _compoundProperties.ProtocolProperties.AddFormulationMapping(new FormulationMapping
            {
                FormulationKey        = "F1",
                TemplateFormulationId = _formulation.Id
            });

            _project.AddBuildingBlock(_formulation);
            A.CallTo(() => _calculationMethodCacheMapper.MapToSnapshot(_compoundProperties.CalculationMethodCache)).Returns(_calculationMethodSnapshot);
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_enzymaticPartialProcessSelection)).Returns(_snapshotProcess1);
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_specificBindingPartialProcessSelection)).Returns(_snapshotProcess2);
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_transportSystemicProcessSelection)).Returns(_snapshotProcess3);
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_noEnzymaticSystemicProcessSelection)).Returns(_snapshotProcess4);
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_noEnzymaticPartialProcessSelection)).Returns(_snapshotProcess5);

            A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess1, A <CompoundProcessSnapshotContext> .That.Matches(x => x.Process == _enzymaticProcess))).Returns(_enzymaticPartialProcessSelection);
            A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess2, A <CompoundProcessSnapshotContext> .That.Matches(x => x.Process == _specificBindingProcess))).Returns(_specificBindingPartialProcessSelection);
            A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess3, A <CompoundProcessSnapshotContext> .That.Matches(x => x.Process == _gfrTransportProcess))).Returns(_transportSystemicProcessSelection);
            A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess4, A <CompoundProcessSnapshotContext> .That.Matches(x => x.Process.IsAnImplementationOf <NotSelectedSystemicProcess>()))).Returns(_noEnzymaticSystemicProcessSelection);
            A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess5, A <CompoundProcessSnapshotContext> .That.Matches(x => x.Process.IsAnImplementationOf <EnzymaticProcess>()))).Returns(_noEnzymaticPartialProcessSelection);

            return(_completed);
        }
Example #52
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="load">负载查询字典</param>
 /// <param name="p_SnapshotContext">快照上下文</param>
 /// <param name="type">分配用户策略</param>
 public AllocateUser(List<NetWorkType> types, Dictionary<NetWorkType, ILoadStatus> load, SnapshotContext p_SnapshotContext, AllocateUserType type, Dictionary<NetVersion, NetWorkType> NetVersionToTypeDic)
 {
     m_Types = types;
     m_Load = load;
     m_SnapShotContext = p_SnapshotContext;
     m_Type = type;
     InitUserDic();
     m_NetVersionToTypeDic = NetVersionToTypeDic;
 }
Example #53
0
        protected override Task Context()
        {
            _individualMapper         = A.Fake <IndividualMapper>();
            _parameterRangeMapper     = A.Fake <ParameterRangeMapper>();
            _genderRepository         = A.Fake <IGenderRepository>();
            _populationSettingsMapper = A.Fake <IIndividualToPopulationSettingsMapper>();
            _logger = A.Fake <IOSPSuiteLogger>();
            sut     = new RandomPopulationSettingsMapper(_parameterRangeMapper, _individualMapper, _populationSettingsMapper, _genderRepository, _logger);

            _ageParameterRange = new ConstrainedParameterRange {
                ParameterName = CoreConstants.Parameters.AGE
            };
            _weightParameterRange = new ParameterRange {
                ParameterName = CoreConstants.Parameters.MEAN_WEIGHT
            };

            A.CallTo(() => _parameterRangeMapper.MapToSnapshot(null)).Returns((Snapshots.ParameterRange)null);
            _ageRangeSnapshot = new Snapshots.ParameterRange();
            A.CallTo(() => _parameterRangeMapper.MapToSnapshot(_ageParameterRange)).Returns(_ageRangeSnapshot);

            _weightRangeSnapshot = new Snapshots.ParameterRange();
            A.CallTo(() => _parameterRangeMapper.MapToSnapshot(_weightParameterRange)).Returns(_weightRangeSnapshot);


            _baseIndividual = new Individual
            {
                OriginData = new OriginData()
            };
            _diseaseStateParameter = new OriginDataParameter(10, "mg/kg", "DIS_STATE_PARAM");
            _baseIndividual.OriginData.AddDiseaseStateParameter(_diseaseStateParameter);

            _diseaseStateParameterRangeSnapshot = new Snapshots.ParameterRange();
            _diseaseStateParameterRange         = new ConstrainedParameterRange {
                ParameterName = _diseaseStateParameter.Name
            };
            A.CallTo(() => _parameterRangeMapper.MapToSnapshot(_diseaseStateParameterRange)).Returns(_diseaseStateParameterRangeSnapshot);


            _snapshotIndividual = new Snapshots.Individual();
            A.CallTo(() => _individualMapper.MapToSnapshot(_baseIndividual)).Returns(_snapshotIndividual);

            _randomPopulationSettings = new RandomPopulationSettings
            {
                NumberOfIndividuals = 10,
                BaseIndividual      = _baseIndividual
            };

            _randomPopulationSettings.AddParameterRange(_weightParameterRange);
            _randomPopulationSettings.AddParameterRange(_ageParameterRange);
            _randomPopulationSettings.AddParameterRange(_diseaseStateParameterRange);

            A.CallTo(() => _genderRepository.Female).Returns(new Gender {
                Id = "Female", Name = "Female"
            });
            A.CallTo(() => _genderRepository.Male).Returns(new Gender {
                Id = "Male", Name = "Male"
            });

            _project         = new PKSimProject();
            _snapshotContext = new SnapshotContext(_project, ProjectVersions.Current);
            return(Task.FromResult(true));
        }
Example #54
0
 public void InitOthers(SnapshotContext context)
 {
     throw new NotImplementedException();
 }
Example #55
0
 private void InitConstruct()
 {
     m_SnapshotDic = new Dictionary<NetWorkType, List<ISnapshot>>();
     m_LoadStatusDic = new Dictionary<NetWorkType, ILoadStatus>();
     m_Users = new List<User>();
     m_SnapshotContext = new SnapshotContext();
 }
Example #56
0
 public HSDPA_CommonParam(SnapshotContext context)
 {
     m_Context = context;
     m_UMTSUIParam = context.Lookup<UMTSUIParam>(ContextKeys.UMTSUIParam);
     m_UMTSServiceProvide = new UMTSServiceProvider(context);
     m_CellCol = new CellCollection();
     m_UserCol = new UserCollection();
     m_HSDPABearerList = m_UMTSServiceProvide.TrafficMgr.HSDPABearerList;
     m_SingleModeUserList = new List<UMTSSimUser>();
 }        
Example #57
0
 public static SnapshotEntity GetEntityWithTick(this SnapshotContext context, uint value)
 {
     return(((Entitas.PrimaryEntityIndex <SnapshotEntity, uint>)context.GetEntityIndex(Contexts.Tick)).GetEntity(value));
 }
Example #58
0
        /// <summary>
        /// 初始化邻小区列表集合
        /// </summary>
        /// <param name="context"></param>
        public void InitOthers(SnapshotContext context)
        {
            SimuRelatedCell src = new SimuRelatedCell();
            List<ISimCellBase> umtsCell = context.Lookup<List<ISimCellBase>>(ContextKeys.UMTSSimCellBase);
            List<ISimCellBase> tdCell = context.Lookup<List<ISimCellBase>>(ContextKeys.TDSimCellBase);
            foreach (ISimCellBase cellBase in m_GSMCells)
            {
                ((GSMSimTRX)cellBase).TDInterCell = src.GetNeighbourCells(cellBase, tdCell, 23);
                ((GSMSimTRX)cellBase).UMTSInterCell = src.GetNeighbourCells(cellBase, umtsCell, 23);
                ((GSMSimTRX)cellBase).GSMInterCell = src.GetNeighbourCells(cellBase, m_GSMCells, 23);

            }
 
        }
Example #59
0
 public SnapshotContextWithSimulation(Model.Simulation simulation, SnapshotContext baseContext) : base(baseContext)
 {
     Simulation = simulation;
 }
        public void OnNext(SnapshotContext <BrokerConnectivitySnapshot> value)
        {
            var snapshot = value.Select(x => x.Snapshot);

            if (snapshot.IsNull())
            {
                return;
            }

            Console.WriteLine("Summary");

            if (!snapshot.ConnectionsCreated.IsNull() && snapshot.ConnectionsClosed.IsNull())
            {
                Console.WriteLine("Connections => {0} created | {1:0.0}/s, {2} closed | {3:0.0}/s",
                                  snapshot.ConnectionsCreated.Total,
                                  snapshot.ConnectionsCreated.Rate,
                                  snapshot.ConnectionsClosed.Total,
                                  snapshot.ConnectionsClosed.Rate);
            }

            var connections = snapshot.Select(x => x.Connections);

            if (connections.IsNull())
            {
                return;
            }

            for (int i = 0; i < connections.Count; i++)
            {
                if (connections[i].IsNull())
                {
                    continue;
                }

                Console.WriteLine("Connection => {0}", connections[0].Identifier);
                Console.WriteLine("Channel Limit => {0}", connections[i].OpenChannelsLimit);
                Console.WriteLine("Channels => {0}", connections[i].Channels.Count);

                Console.WriteLine("Network Traffic");

                if (!connections[i].NetworkTraffic.IsNull())
                {
                    if (!connections[i].NetworkTraffic.Sent.IsNull())
                    {
                        Console.WriteLine("\tSent: {0} packets | {1} | {2} msg/s",
                                          connections[i].NetworkTraffic.Sent.Total,
                                          $"{connections[i].NetworkTraffic.Sent.Bytes} bytes ({connections[i].NetworkTraffic.Sent.Bytes.ToByteString()})",
                                          connections[i].NetworkTraffic.Sent.Rate);
                    }

                    if (!connections[i].NetworkTraffic.Received.IsNull())
                    {
                        Console.WriteLine("\tReceived: {0} packets | {1} | {2} msg/s",
                                          connections[i].NetworkTraffic.Received.Total,
                                          $"{connections[i].NetworkTraffic.Received.Bytes} bytes ({connections[i].NetworkTraffic.Received.Bytes.ToByteString()})",
                                          connections[i].NetworkTraffic.Received.Rate);
                    }
                }

                Console.WriteLine("Channels");
                for (int j = 0; j < connections[i].Channels.Count; j++)
                {
                    if (connections[i].Channels[j].IsNull())
                    {
                        continue;
                    }

                    Console.WriteLine("\tChannel => {0}, Consumers => {1}",
                                      connections[i].Channels[j].Identifier,
                                      connections[i].Channels[j].Consumers);
                }

                Console.WriteLine("****************************");
                Console.WriteLine();
            }
        }