Esempio n. 1
0
    void Update_Sim()
    {
        if (simulation_Running)//Check if simulation is paused
        {
            Agx_Simulation.StepForward();
            //Check if a button has been pressed
            //CheckInputs();

            if (simulationTime >= 2)                          //Wait for robot to settle on terrain
            {
                if (!Dynamics.Control(robot, simulationTime)) //Movement
                {
                    Debug.Log("wrong command");
                }
            }

            robot.Update();

            if (Visualization.enabled)
            {
                Update_Vis();
            }

            simulationTime += Time.deltaTime;
        }
        //Else:
        //Start the canvas overlay to modify and create new modules
    }
    public virtual void Calc_dynamics(AirPlane ap, double dt)
    {
        ac = pp.p.Sub(ap.inp.cg);
        vd = Dynamics.VWithRot(ap.pMotion.vc, ap.pMotion.omega, ac);
        v0 = pp.v.NmlVec().DotProd(vd);
        h  = ap.pMotion.wpos.y;

        enginePower0 = Calc_engine_power(pp.throttle, h, ap);
        enginePower.Update(enginePower0, dt);

        if (v0 < 0.5D)
        {
            thrust = Calc_T0(enginePower.Value(), ap.atmos.rho);
        }
        else if (v0 < 2.6D)
        {
            thrust = Jp.Maker1.Sim.Tools.Tool.Hokan(0.5D, Calc_T0(enginePower.Value(), ap.atmos.rho), 2.6D, Calc_T(enginePower.Value(), ap.atmos.rho, 2.6D), v0);
        }
        else
        {
            thrust = Calc_T(enginePower.Value(), ap.atmos.rho, v0);
        }

        fv = pp.v.NmlVec().SclProd(thrust);
        tv.SetVec(0.0D, 0.0D, 0.0D);

        Calc_wash(ap);
    }
Esempio n. 3
0
        public static string ToString(this Dynamics dynamic)
        {
            switch (dynamic)
            {
            case Pianissimo:
                return("pp");

            case Piano:
                return("p");

            case MezzoPiano:
                return("mp");

            case MezzoForte:
                return("mf");

            case Forte:
                return("f");

            case Fortissimo:
                return("ff");

            default:
                return(string.Empty);
            }
        }
        public void DiasF_T(DataGridView controlView)
        {
            using (PLMContext db = new PLMContext())
            {
                Dbd = new Dynamics();
                try
                {
                    var datosP = Dbd.Reporte2().ToList();
                    var datos  = (from x in db.DiasFeriados select x).ToList();

                    List <ProveedoressTemp> consulta = new List <ProveedoressTemp>();
                    string nombre = "";
                    foreach (var item in datos)
                    {
                        nombre = datosP.Where(x => x.Clave == item.Proveedor).Select(x => x.Nombre).FirstOrDefault();
                        consulta.Add(new ProveedoressTemp {
                            Clave = item.Proveedor, Nombre = nombre, id = item.id, Fecha = item.DiasF
                        });
                    }

                    controlView.DataSource            = consulta;
                    controlView.Columns[0].Visible    = false;
                    controlView.Columns[1].HeaderText = "CLAVE PROVEEDOR";
                    controlView.Columns[2].HeaderText = "NOMBRE PROVEEDOR";
                    controlView.Columns[3].HeaderText = "DIAS FERIADOS E INAHBILES";
                    controlView.Columns[1].Width      = 150;
                    controlView.Columns[2].Width      = 400;
                    controlView.Columns[3].Width      = 364;
                }
                catch (Exception ex)
                {
                    Dialogs.Show(ex.Message, DialogsType.Error);
                }
            }
        }
Esempio n. 5
0
        public void ConstructDynamicsDefaultValues()
        {
            Dynamics dynamics = new Dynamics();

            Assert.AreEqual(0, dynamics.Damping);
            Assert.AreEqual(0, dynamics.Friction);
        }
Esempio n. 6
0
        public static HttpClient GetHttpClient(Dynamics settings)
        {
            string resourceUrl    = settings.ResourceUrl;
            string authContextUrl = settings.AuthContextUrl;

            //HRCMS
            string clientId     = settings.ClientId;
            string clientSecret = settings.ClientSecret;
            string tenantId     = settings.TenantId;
            string apiVersion   = settings.ApiVersion;
            string webApiUrl    = $"{resourceUrl}/api/data/v{apiVersion}/";

            try
            {
                HttpMessageHandler messageHandler;


                messageHandler = new OAuthMessageHandler(resourceUrl, clientId, clientSecret, tenantId, authContextUrl,
                                                         new HttpClientHandler());


                HttpClient httpClient = new HttpClient(messageHandler)
                {
                    BaseAddress = new Uri(webApiUrl),
                    Timeout     = new TimeSpan(0, 2, 0) //2 minutes
                };

                return(httpClient);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 7
0
    internal void Calc_dynamics(int lr, AirPlane ap, Vector3D dv)
    {
        fv.SetVec(0.0D, 0.0D, 0.0D);
        tv.SetVec(0.0D, 0.0D, 0.0D);
        if (flag == 0)
        {
            return;
        }

        ac = AirPlane.Get_point(ac_base, lr).Sub(ap.inp.cg);
        vd = Dynamics.VWithRot(ap.pMotion.vc, ap.pMotion.omega, ac);
        vd = vd.Add(dv);
        v  = vd.Length();
        q  = (0.5D * v * v * ap.atmos.rho);
        Bearing3 br = new Bearing3(ap.pMotion.vc.R2l());

        angle = br.pitch.GetValue();

        sfus = (s_pi * Math.Cos(angle) + s_side * Math.Sin(angle));

        d  = (q * cd_s / s_pi * sfus);
        du = vd.SclProd(-1.0D).NmlVec();
        fv = du.SclProd(d);

        mfus = (q * vfus * Math.Sin(-2.0D * angle));

        tv.SetVec(0.0D, mfus, 0.0D);
        Matrix44 mat = new Matrix44();

        mat.SetRxMat(-br.roll.GetValue());
        tv = tv.MultMat(mat);
    }
Esempio n. 8
0
 public override void RevertChanges()
 {
     Filter.RevertChanges();
     Phaser.RevertChanges();
     Flanger.RevertChanges();
     Synth.RevertChanges();
     LoFi.RevertChanges();
     RingModulator.RevertChanges();
     GuitarToBass.RevertChanges();
     SlowGear.RevertChanges();
     Transpose.RevertChanges();
     PitchBend.RevertChanges();
     Robot.RevertChanges();
     VocalDist.RevertChanges();
     Dynamics.RevertChanges();
     Eq.RevertChanges();
     Isolator.RevertChanges();
     Octave.RevertChanges();
     Pan.RevertChanges();
     Tremolo.RevertChanges();
     Slicer.RevertChanges();
     Delay.RevertChanges();
     PanningDelay.RevertChanges();
     TapeEcho.RevertChanges();
     GranularDelay.RevertChanges();
     Roll.RevertChanges();
     Chorus.RevertChanges();
     Reverb.RevertChanges();
 }
Esempio n. 9
0
        private void AddFakeFigure(Stock stock, Type figureType, Currency currency)
        {
            var figure = Dynamics.CreateFigure(stock, figureType, new DayPeriod(DateTime.UtcNow), currency);

            var requiredProperties = figureType.GetProperties()
                                     // will be set by EF when saving figure
                                     .Where(p => p.Name != "Id")
                                     // set by "CreateFigure" already
                                     .Where(p => p.Name != "Period" && p.Name != "RawPeriod" && p.Name != "Currency" && p.Name != "Company" && p.Name != "Stock")
                                     // updated automatically
                                     .Where(p => p.Name != "Timestamp")
                                     .Where(p => p.GetCustomAttributes(typeof(RequiredAttribute), true).Any());

            foreach (var prop in requiredProperties)
            {
                if (prop.PropertyType == typeof(double) || prop.PropertyType == typeof(double?))
                {
                    prop.SetValue(figure, 42d);
                }
                else if (prop.PropertyType == typeof(string))
                {
                    prop.SetValue(figure, "dummy");
                }
                else
                {
                    throw new NotSupportedException("Don't know how to set required property: " + prop.Name);
                }
            }

            // add to relationship
            var figures = ( IList )Dynamics.GetRelationship(stock, figureType);

            figures.Add(figure);
        }
Esempio n. 10
0
 /* Movement commands for the robot: */
 void CheckInputs()
 {
     if (Input.GetButtonUp("Turn"))
     {
         Dynamics.SetMovement("Turn", 0, Math.Sign(Input.GetAxis("Turn")));
     }
     if (Input.GetButtonUp("Forward"))
     {
         Dynamics.SetMovement("Forward", Math.Sign(Input.GetAxis("Forward")), 0);
     }
     if (Input.GetButtonUp("Reset"))
     {
         Dynamics.SetMovement("Reset", 0, 0);
     }
     if (Input.GetButtonUp("Idle"))
     {
         Dynamics.SetMovement("Idle", 0, 0);
     }
     if (Input.GetButtonUp("Custom"))
     {
         Dynamics.SetMovement("Custom", 0, 0);
     }
     if (Input.GetButtonUp("Speed"))
     {
         Dynamics.ChangeSpeed((float)Math.Sign(Input.GetAxis("Speed")));
     }
 }
        public TwitterMessageAttachmentModel(dynamic msg)
        {
            this.SenderId    = msg.direct_message_events[0].message_create.sender_id;
            this.RecipientId = msg.direct_message_events[0].message_create.target.recipient_id;

            double d = double.Parse(msg.direct_message_events[0].created_timestamp.ToString());

            this.Time = new System.DateTime(1970, 1, 1, 0, 0, 0, 0).AddMilliseconds(d);

            this.MessageId = msg.direct_message_events[0].id.ToString();

            var mdata = msg.direct_message_events[0].message_create.message_data;

            if (Dynamics.HasProperty(mdata, "attachment"))
            {
                this.Url = mdata.attachment.media.media_url;

                var    provider = new FileExtensionContentTypeProvider();
                string contentType;
                if (!provider.TryGetContentType(this.Url, out contentType))
                {
                    contentType = "application/octet-stream";
                }

                this.ContentType = contentType;

                string ext = System.IO.Path.GetExtension(this.Url);

                this.FileName = this.MessageId + ext;
            }

            this.PartitionKey = this.SenderId;

            this.RowKey = this.Time.Ticks.ToString();
        }
Esempio n. 12
0
 void Awake()
 {
     dyn = new Dynamics
     {
         rb2D = GetComponent <Rigidbody2D>()
     };
 }
Esempio n. 13
0
        public void ConstructDynamicsFrictionOnly()
        {
            double   friction = 1;
            Dynamics dynamics = new Dynamics(friction: friction);

            Assert.AreEqual(0, dynamics.Damping);
            Assert.AreEqual(friction, dynamics.Friction);
        }
Esempio n. 14
0
    public void Reset(Transform snapToTransform = null)
    {
        Dynamics.Reset(snapToTransform);

        if (Camera != null)
        {
            Camera.transform.position = transform.position;
        }
    }
Esempio n. 15
0
        //### Information
        public void PrintNoteInformation()
        {
            //Print Note Information to Console
            Console.WriteLine("Onset: " + Onset.ToString() +
                              " Duration: " + Duration.ToString() +
                              " Dynamics: " + Dynamics.ToString());

            EulerPoint.PrintEulerPointInformation();
        }
Esempio n. 16
0
        public void ConstructDynamics()
        {
            double   damping  = 1;
            double   friction = 2;
            Dynamics dynamics = new Dynamics(damping, friction);

            Assert.AreEqual(damping, dynamics.Damping);
            Assert.AreEqual(friction, dynamics.Friction);
        }
Esempio n. 17
0
    void Start()                        // Use this for initialization
    {
        Physics.autoSimulation = false; //Turn off Unity Physics
        Main_Initialization();

        Dynamics.SetMovement("Turn", 1, 1);

        //Main_Initialization();
    }
        public TwitterMessageModel(dynamic msg)
        {
            this.SenderId = "";
            this.Time     = DateTime.Now;
            this.Content  = Newtonsoft.Json.JsonConvert.SerializeObject(msg);

            if (Dynamics.HasProperty(msg, "follow_events"))
            {
                if (msg.follow_events[0].type == "follow")
                {
                    this.MessageType = "follow";

                    this.SenderId    = msg.follow_events[0].source.id;
                    this.RecipientId = msg.follow_events[0].target.id;


                    double d = double.Parse(msg.follow_events[0].created_timestamp.ToString());
                    this.Time = new System.DateTime(1970, 1, 1, 0, 0, 0, 0).AddMilliseconds(d);
                }
            }

            if (Dynamics.HasProperty(msg, "direct_message_events"))
            {
                this.MessageType = "dm";

                this.SenderId    = msg.direct_message_events[0].message_create.sender_id;
                this.RecipientId = msg.direct_message_events[0].message_create.target.recipient_id;
                this.Text        = msg.direct_message_events[0].message_create.message_data.text;

                double d = double.Parse(msg.direct_message_events[0].created_timestamp.ToString());
                this.Time = new System.DateTime(1970, 1, 1, 0, 0, 0, 0).AddMilliseconds(d);

                this.MessageId = msg.direct_message_events[0].id.ToString();

                var mdata = msg.direct_message_events[0].message_create.message_data;

                if (Dynamics.HasProperty(mdata, "quick_reply_response"))
                {
                    this.Payload = mdata.quick_reply_response.metadata;
                }

                if (Dynamics.HasProperty(mdata, "attachment"))
                {
                    this.Attachments = new List <TwitterMessageAttachmentModel>();
                    TwitterMessageAttachmentModel a = new TwitterMessageAttachmentModel(msg);
                    this.Attachments.Add(a);
                }
            }


            this.PartitionKey = this.SenderId;

            this.RowKey = this.Time.Ticks.ToString();

            this.SenderProfile = new TwitterProfileModel(this.SenderId, msg);
        }
Esempio n. 19
0
        public void GetRelationship_Price_NotNull()
        {
            var stock = new Stock {
                Company = new Company()
            };

            var refs = Dynamics.GetRelationship(stock, typeof(Price));

            Assert.That(refs, Is.Not.Null);
        }
Esempio n. 20
0
        public void ParseDynamicsMalformed()
        {
            string xml = String.Format("<dynamics/>");

            this.xmlDoc.Load(XmlReader.Create(new StringReader(xml)));
            Dynamics dynamics = this.parser.Parse(this.xmlDoc.DocumentElement);

            Assert.AreEqual(0, dynamics.Damping);
            Assert.AreEqual(0, dynamics.Friction);
        }
Esempio n. 21
0
        public void GetRelationship_ForFigure_NotNull(Type figureType)
        {
            var stock = new Stock {
                Company = new Company()
            };

            var refs = Dynamics.GetRelationship(stock, figureType);

            Assert.That(refs, Is.Not.Null);
        }
Esempio n. 22
0
        public void ParseDynamicsFrictionOnly()
        {
            double friction = 2;
            string xml      = String.Format("<dynamics friction='{0}'/>", friction);

            this.xmlDoc.Load(XmlReader.Create(new StringReader(xml)));
            Dynamics dynamics = this.parser.Parse(this.xmlDoc.DocumentElement);

            Assert.AreEqual(0, dynamics.Damping);
            Assert.AreEqual(friction, dynamics.Friction);
        }
 private void FillDataByIndex(int index)
 {
     foreach (var typeSetuPair in _dataContainer)
     {
         var type = typeSetuPair.Key;
         foreach (var inputDataName in typeSetuPair.Value.Keys)
         {
             Dynamics.FillDataByType(type, inputDataName, index, typeSetuPair.Value);
         }
     }
 }
        protected IFigure CreateEntity(Stock stock, IPeriod period, object value)
        {
            var currency = GetCurrency();

            var figure = Dynamics.CreateFigure(stock, EntityType, period, currency);

            figure.Source = Source;
            figure.Value  = (double)value;

            return(figure);
        }
Esempio n. 25
0
        public void ConstructDynamicsDampingOnly()
        {
            double   damping          = 1;
            Dynamics dynamics         = new Dynamics(damping);
            Dynamics dynamicsNamedArg = new Dynamics(damping: damping);

            Assert.AreEqual(damping, dynamics.Damping);
            Assert.AreEqual(0, dynamics.Friction);
            Assert.AreEqual(damping, dynamicsNamedArg.Damping);
            Assert.AreEqual(0, dynamicsNamedArg.Friction);
        }
Esempio n. 26
0
 private void LoadDynamics()
 {
     foreach (ObjectsNode node in dynamicList)
     {
         Type    t = Type.GetType(node.ObjectType);
         Vector2 position;
         position.X = node.Position.X;
         position.Y = node.Position.Y;
         var obj = Activator.CreateInstance(t, position);
         Dynamics.Add((IDynamic)obj);
     }
 }
Esempio n. 27
0
        //public static GameObject CreateBasePickup(string name)
        //{
        //	GameObject selection = new GameObject(name);
        //	ConvertToPickup(selection);

        //	selection.CreateChildStatePlaceholders();
        //	return selection;
        //}

        //[MenuItem("GameObject/Simple/Convert To/Pickup : Item", false, -100)]
        public static void ConvertToItemPickup(GameObject selection, Space_XD space, Dynamics dynamics)
        {
            selection = ConvertToPickup(selection, space, dynamics);

            selection.EnsureComponentExists <InventoryContactReactors>();

            var sst = selection.EnsureComponentExists <SyncSpawnTimer>();

            sst.despawnEnable = false;

            Selection.activeGameObject = selection;
        }
Esempio n. 28
0
 private void LoadDynamics()
 {
     dynamicList = XMLUtility.XMLReader <ObjectsNode>(StringConsts.DynamicsFile);
     foreach (ObjectsNode node in dynamicList)
     {
         Type    t = Type.GetType(node.ObjectType);
         Vector2 position;
         position.X = node.Position.X;
         position.Y = node.Position.Y;
         var obj = Activator.CreateInstance(t, position);
         Dynamics.Add((IDynamic)obj);
     }
 }
Esempio n. 29
0
        /// <summary>
        /// 创建动态类
        /// </summary>
        /// <param name="key">字典Key</param>
        /// <param name="propertys">Key:属性名称;Value:属性类型</param>
        /// <param name="parentType">继承的父类类型</param>
        /// <param name="constructors">构造函数参数</param>
        private static Type CreateClass(int key, List <PropertyInfo> propertys, Type[] constructors = null, Type parentType = null)
        {
            lock (LockObject)
            {
                if (DicCreateClassList.ContainsKey(key))
                {
                    return(DicCreateClassList[key]);
                }

                //缓存中没有找到,新建一个构造函数的委托
                return(DicCreateClassList[key] = Dynamics.CreateClassType(propertys, constructors, parentType));
            }
        }
Esempio n. 30
0
        /// <summary>
        /// 创建动态类
        /// </summary>
        /// <param name="key">字典Key</param>
        /// <param name="propertys">Key:属性名称;Value:属性类型</param>
        /// <param name="parentType">继承的父类类型</param>
        private static Type CreateClass(int key, Dictionary <string, Type> propertys, Type parentType = null)
        {
            lock (LockObject)
            {
                if (DicCreateClassList.ContainsKey(key))
                {
                    return(DicCreateClassList[key]);
                }

                //缓存中没有找到,新建一个构造函数的委托
                return(DicCreateClassList[key] = Dynamics.CreateClassType(propertys, parentType));
            }
        }
Esempio n. 31
0
        protected override void PostSolve(Dynamics.Contacts.Contact contact, Dynamics.Contacts.ContactVelocityConstraint impulse)
        {
            int i = 0;

            base.PostSolve(contact, impulse);
        }