public MolecularModel Build()
        {
            var model = new MolecularModel();

            model.DesiredVelocity = _configuration.MinMoleculesSpeed + _temperature * (_configuration.MaxMoleculesSpeed - _configuration.MinMoleculesSpeed);
            var totalMoleculesCount = _configuration.MinMoleculesCount +
                                      (_configuration.MaxMoleculesCount - _configuration.MinMoleculesCount) *
                                      (1.0f - _temperature);

            model.Population = new Dictionary <SupportedMolecules, int>();
            for (int i = 0; i < _configuration.GasConsistence.Count; i++)
            {
                var molecule = _configuration.GasConsistence[i];
                model.Population[molecule.Type] = (int)(totalMoleculesCount * molecule.Rate);
            }

            return(model);
        }
예제 #2
0
 public void ModelChanged(MolecularModel model)
 {
     _desiredVelocity = model.DesiredVelocity;
     _model           = model;
 }