public void VerifyAllEnums() { var acceleration = new Acceleration(1, AccelerationUnit.BaseUnit); var angle = new Angle(1, AngleUnit.BaseUnit); var angularAcceleration = new AngularAcceleration(1, AngularAccelerationUnit.BaseUnit); var area = new Area(1, AreaUnit.BaseUnit); var density = new MassDensity(1, MassDensityUnit.BaseUnit); var electricCurrent = new ElectricCurrent(1, ElectricCurrentUnit.BaseUnit); var electricResistance = new ElectricResistance(1, ElectricResistanceUnit.BaseUnit); var electricVoltage = new ElectricPotential(1, ElectricPotentialUnit.BaseUnit); var energy = new Energy(1, EnergyUnit.BaseUnit); var force = new Force(1, ForceUnit.BaseUnit); var frequency = new Frequency(1, FrequencyUnit.BaseUnit); var jerk = new Jerk(1, JerkUnit.BaseUnit); var length = new Length(1, LengthUnit.BaseUnit); var mass = new Mass(1, MassUnit.BaseUnit); var massFlowRate = new MassFlowRate(1, MassFlowRateUnit.BaseUnit); var momentum = new Momentum(1, MomentumUnit.BaseUnit); var numeric = new Numeric(1, NumericUnit.BaseUnit); var power = new Power(1, PowerUnit.BaseUnit); var pressure = new Pressure(1, PressureUnit.BaseUnit); var speed = new Speed(1, SpeedUnit.BaseUnit); var temperature = new Temperature(1, TemperatureUnit.BaseUnit); var time = new Time(1, TimeUnit.BaseUnit); var torque = new Torque(1, TorqueUnit.BaseUnit); var volume = new Volume(1, VolumeUnit.BaseUnit); var volumetricFlowRate = new VolumetricFlowRate(1, VolumetricFlowRateUnit.BaseUnit); }
public void OpAddition() { var force1 = new Force(9.81, ForceUnit.Newtons); var force2 = new Force(1, ForceUnit.KilogramForce); var expected = new Force(19.62, ForceUnit.Newtons); (force1 + force2).ShouldEqual(expected); (force2 + force1).ShouldEqual(expected); }
// Use this for initialization void Start () { // gets the force forceObj = GameObject.Find("Force"); theForce = forceObj.GetComponent("Force") as Force; // gets the player controller playerController = this.GetComponent("ThirdPersonController") as ThirdPersonController; }
public void OpDivision() { var force1 = new Force(19.62, ForceUnit.Newtons); var force2 = new Force(2, ForceUnit.KilogramForce); (force1 / force2).ShouldBeWithinEpsilonOf(1); (force2 / force1).ShouldBeWithinEpsilonOf(1); (force1 / 2).ShouldEqual(new Force(9.81, ForceUnit.Newtons)); (force2 / 2).ShouldEqual(new Force(1, ForceUnit.KilogramForce)); }
public void OpGreaterThanOrEqual() { var force1 = new Force(9.81, ForceUnit.Newtons); var force2 = new Force(1, ForceUnit.KilogramForce); var force3 = new Force(2, ForceUnit.KilogramForce); (force1 >= force3).ShouldBeFalse(); (force3 >= force1).ShouldBeTrue(); (force1 >= force2).ShouldBeTrue(); (force2 >= force1).ShouldBeTrue(); }
public void OpInverseEquals() { var force1 = new Force(9.81, ForceUnit.Newtons); var force2 = new Force(1, ForceUnit.KilogramForce); var force3 = new Force(2, ForceUnit.KilogramForce); (force1 != force2).ShouldBeFalse(); (force2 != force1).ShouldBeFalse(); (force1 != force3).ShouldBeTrue(); (force3 != force1).ShouldBeTrue(); }
public void OpEquals() { var force1 = new Force(9.81, ForceUnit.Newtons); var force2 = new Force(1, ForceUnit.KilogramForce); var force3 = new Force(2, ForceUnit.KilogramForce); (force1 == force2).ShouldBeTrue(); (force2 == force1).ShouldBeTrue(); (force1 == force3).ShouldBeFalse(); (force3 == force1).ShouldBeFalse(); force1.Equals(force2) .ShouldBeTrue(); force1.Equals((object)force2) .ShouldBeTrue(); force2.Equals(force1) .ShouldBeTrue(); force2.Equals((object)force1) .ShouldBeTrue(); }
private void button1_Click(object sender, EventArgs e) { DataReady = false; Kinematics k = new Kinematics(); dataGridView1.DataSource = null; Force PIDCorrection = new Force(); k.Forces.Add(PIDCorrection); PIDLoop pid = new PIDLoop(k); Force Disturbance = new Force(); k.Forces.Add(Disturbance); k.mass = 1; Data.Clear(); Double RunningTime = 0; k.XPosition = 0; k.XVelocity = -20; for (int i = 0; i < 10000; i++)//sim loop { RunningTime+= k.time; if (i > 50 && i< 3000) { Disturbance.X = -100; PIDCorrection.X = pid.calculateCorrection(50); } else if (i >= 3000) { PIDCorrection.X = pid.calculateCorrection(25); } k.CalculateKinematics(); DataRow newRow = Data.NewRow(); newRow["time"] = RunningTime; newRow["position"] = k.XPosition; Data.Rows.Add(newRow); } DataReady = true; dataGridView1.DataSource = Data; this.Invalidate(); }
public bool Calc( Vector3 cur, Vector3 birdDir, Collider cld, out Force force ) { var pointOnBounds = MathTools.CalcPointOnBounds( cld, cur ); var revDir = cur - pointOnBounds; var dist = revDir.magnitude; if( dist <= MathTools.epsilon ) { //Let's setup the direction to outside of colider revDir = (pointOnBounds - cld.transform.position).normalized; //and distance to N percent of OptDistance dist = 0.1f * optDistance; } else revDir /= dist; //Force depends on direction of bird: no need to turn a bird if it is flying in opposite direction force.dir = revDir * ( CalcImpl(dist) * MathTools.AngleToFactor(revDir, birdDir) ); force.pos = pointOnBounds; return true; }
/* * private void SetIsoLocation(double xi) * { * SetIsoLocation(new double[] { xi, 0, 0 }); * } * * private void SetIsoLocation(double xi, double eta) * { * SetIsoLocation(new double[] { xi, eta, 0 }); * } * * private void SetIsoLocation(double xi, double eta, double gamma) * { * SetIsoLocation(new double[] { xi, eta, gamma }); * } */ #endregion #region Deserialization Constructor protected ConcentratedLoad(SerializationInfo info, StreamingContext context) : base(info, context) { _forceIsoLocation = (IsoPoint)info.GetValue("_forceIsoLocation", typeof(IsoPoint)); _force = (Force)info.GetValue("_force", typeof(Force)); _coordinationSystem = (CoordinationSystem)(int)info.GetValue("_coordinationSystem", typeof(int)); }
// Module defining this command // Optional custom code for this activity /// <summary> /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// </summary> /// <param name="context">The NativeActivityContext for the currently running activity.</param> /// <returns>A populated instance of System.Management.Automation.PowerShell</returns> /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks> protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context) { System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create(); System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName); // Initialize the arguments if (Path.Expression != null) { targetCommand.AddParameter("Path", Path.Get(context)); } if (LiteralPath.Expression != null) { targetCommand.AddParameter("LiteralPath", LiteralPath.Get(context)); } if (Name.Expression != null) { targetCommand.AddParameter("Name", Name.Get(context)); } if (NewName.Expression != null) { targetCommand.AddParameter("NewName", NewName.Get(context)); } if (PassThru.Expression != null) { targetCommand.AddParameter("PassThru", PassThru.Get(context)); } if (Force.Expression != null) { targetCommand.AddParameter("Force", Force.Get(context)); } if (Filter.Expression != null) { targetCommand.AddParameter("Filter", Filter.Get(context)); } if (Include.Expression != null) { targetCommand.AddParameter("Include", Include.Get(context)); } if (Exclude.Expression != null) { targetCommand.AddParameter("Exclude", Exclude.Get(context)); } if (Credential.Expression != null) { targetCommand.AddParameter("Credential", Credential.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }
public GeneralTrusses(double x, double y, double tension_compression) { //two types--- 0 tension_compression is unknown this.x = x; this.y = y; this.tension_compression = tension_compression; this.alpha = Math.Atan(y / x); if (tension_compression != 0) { this._known_unknown = true; this._ResultantForce = new Force(tension_compression * Math.Cos(this.alpha), tension_compression * Math.Sin(this.alpha)); } else { this._known_unknown = false; //if postive //doesn't handle zeros; if term is non zero, use this method. //if it is zero, ignore? this._ResultantForce = new Force(SignSelector(x,Math.Cos(alpha)), SignSelector(y,Math.Sin(alpha))); } }
/// <summary> /// Add a force /// </summary> static internal void Remove(Force force) { forces.Remove(force); }
/// <summary> /// Remove an existing force. If force is not currently being applied then this method /// returns false. /// </summary> /// <param name="force">Force to remove.</param> /// <returns>True if force was being applied.</returns> public bool RemoveForce(Force force) { for (int i = 0; i < Count; i++) if (_forces[i] == force) { _TeardownForce(i); return true; } return false; }
public void OpMultiplicationScaler() { var force = new Force(1, ForceUnit.KilogramForce); var expected = new Force(2, ForceUnit.KilogramForce); (force * 2).ShouldEqual(expected); (2 * force).ShouldEqual(expected); }
void InitSwaps() { Angry.setPosition(new Position(Level.Excluded, Circle.Green)); Blessing.setPosition(new Position(Level.Excluded, Circle.Purple)); Child.setPosition(new Position(Level.Excluded, Circle.Red)); Curse.setPosition(new Position(Level.Excluded, Circle.Cyan)); Heaven.setPosition(new Position(Level.Tertiary, Circle.GreenPurpleRed)); Happiness.setPosition(new Position(Level.Tertiary, Circle.GreenRedCyan)); Dragon.setPosition(new Position(Level.Tertiary, Circle.RedCyanPurple)); Dream.setPosition(new Position(Level.Secondary, Circle.CyanRed)); Energy.setPosition(new Position(Level.Secondary, Circle.GreenRed)); Female.setPosition(new Position(Level.Secondary, Circle.CyanPurple)); Force.setPosition(new Position(Level.Quaternary, Circle.GreenRedCyanPurple)); Forest.setPosition(new Position(Level.Excluded, Circle.Purple)); Friend.setPosition(new Position(Level.Secondary, Circle.GreenPurple)); Hate.setPosition(new Position(Level.Secondary, Circle.GreenPurple)); Hope.setPosition(new Position(Level.Excluded, Circle.Green)); Kindness.setPosition(new Position(Level.Tertiary, Circle.CyanPurpleGreen)); Longevity.setPosition(new Position(Level.Secondary, Circle.CyanPurple)); Love.setPosition(new Position(Level.Secondary, Circle.CyanPurple)); Loyal.setPosition(new Position(Level.Secondary, Circle.GreenRed)); Spirit.setPosition(new Position(Level.Secondary, Circle.CyanRed)); Male.setPosition(new Position(Level.Quaternary, Circle.GreenRedCyanPurple)); Mountain.setPosition(new Position(Level.Secondary, Circle.GreenRed)); Night.setPosition(new Position(Level.Excluded, Circle.Red)); Pure.setPosition(new Position(Level.Secondary, Circle.GreenPurple)); Heart.setPosition(new Position(Level.Secondary, Circle.CyanRed)); River.setPosition(new Position(Level.Excluded, Circle.Cyan)); Emotion.setPosition(new Position(Level.Excluded, Circle.Cyan)); Soul.setPosition(new Position(Level.Excluded, Circle.Purple)); Urgency.setPosition(new Position(Level.Excluded, Circle.Red)); Wind.setPosition(new Position(Level.Excluded, Circle.Green)); Debug.LogFormat("[Dragon Energy #{0}] Before swapping, the displayed words are:", _moduleId); for (int i = 0; i < displayed.Length; i++) { Debug.LogFormat("[Dragon Energy #{0}] {1} = {2}", _moduleId, displayed[i].getWord(), displayed[i].getPosition().getCircle().ToReadable()); } char[] letters = info.GetSerialNumberLetters().ToArray(); int vowelCount = 0; foreach (char letter in letters) { if (letter == 'A' || letter == 'E' || letter == 'I' || letter == 'O' || letter == 'U') { vowelCount++; } } if (info.GetBatteryCount() > 10 && (info.GetSerialNumberNumbers().ToArray()[info.GetSerialNumberNumbers().ToArray().Length - 1] == 5 || info.GetSerialNumberNumbers().ToArray()[info.GetSerialNumberNumbers().ToArray().Length - 1] == 7)) { Swaps(1); } else if (info.GetPortPlateCount() > info.GetBatteryHolderCount() && (modules.Contains("Morse War") || modules.Contains("Double Color"))) { Swaps(2); } else if ((info.IsIndicatorOn(KMBombInfoExtensions.KnownIndicatorLabel.SIG) && info.IsIndicatorOn(KMBombInfoExtensions.KnownIndicatorLabel.FRK)) || (info.GetOffIndicators().Count() == 3)) { Swaps(3); } else if (info.GetModuleNames().Count() > 8) { Swaps(4); } else if (vowelCount >= 2) { Swaps(5); } else if (info.GetSolvedModuleNames().Count() == 0) { Swaps(6); dependsOnSolvedModules = true; } else { Swaps(7); } Debug.LogFormat("[Dragon Energy #{0}] After swapping, the displayed words are:", _moduleId); for (int i = 0; i < displayed.Length; i++) { Debug.LogFormat("[Dragon Energy #{0}] {1} = {2}", _moduleId, displayed[i].getWord(), displayed[i].getPosition().getCircle().ToReadable()); } }
private void Form1_Load(object sender, EventArgs e) { bExVisible = false; tmrFlash.Enabled = true; SetVisibilityOfLabels(); InitializeSysVars(); pbGalaxy.Dock = DockStyle.Fill; pbGalaxy.BackColor = Color.Black; pbGalaxy.Paint += new System.Windows.Forms.PaintEventHandler(this.pbGalaxy_Paint); int iDiam = 235; Ball bTmp = new Ball(new double[2] { 0,0}, new double[2] { 0, 0 }, new double[2] { 0, 0 },mySysVars.fEarthMass, iDiam, Color.Green, Color.Green, false, false, new Timer(), 0); Force fTmp = new Force(new double[2] { 0, 0 }, new double[2] { 0, 0 }, new double[2] { 0, 0 }, new double[2] { 0, 0 }, new double[2] { 0, 0 },0); Control cTmp = new Control(); ComBall Earth = new ComBall(bTmp, fTmp, cTmp); myBalls.Add(Earth); LoadEarthImage(); LoadMushImage(); tmrDraw.Enabled = true; }
public MagneticFieldStrength(Force f, ElectricCharge c, Time t, Length l) { _teslas = f.TotalNewtons * t.TotalSeconds / (c.TotalCoulombs * l.TotalMeters); }
public static void Check(Model model, LoadCase lc) { if (model.Elements.Any(i => !(i is FrameElement2Node))) { throw new Exception(); } if (model.RigidElements.Any()) { throw new Exception(); } var elms = model.Elements.Cast <FrameElement2Node>().ToArray(); var cmb = new LoadCombination(); cmb[lc] = 1.0; var l = new Func <FrameElement2Node, double>(e => (e.StartNode.Location - e.EndNode.Location).Length); model.Solve(); Console.WriteLine("Checking for force equilibrium on every node!"); var maxF = new Vector(); var maxM = new Vector(); for (var idx = 0; idx < elms.Length; idx++) { var elm = elms[idx]; var f1 = elm.GetInternalForceAt(0, cmb); var f2 = elm.GetInternalForceAt(l(elm), cmb); var efs = new Force[2]; foreach (var ld in elm.Loads) { if (ld.Case != lc) { continue; } var tg = elm.GetGlobalEquivalentNodalLoads(ld); var f1l = elm.TransformGlobalToLocal(tg[0]); var f2l = elm.TransformGlobalToLocal(tg[1]); efs[0] += f1l; efs[1] += f2l; } var ft1 = efs[0] - f1; var ft2 = efs[1] - f2; var eq = ft1 - ft2.Move(new Vector(-l(elm), 0, 0)); Console.WriteLine("Total loads on element # {0}: Force: {1}, Moment: {2}", idx, eq.Forces, eq.Moments); //Console.WriteLine("========================================"); if (eq.Forces.Length > 1 || eq.Moments.Length > 1) { Console.WriteLine("total forces on "); } if (eq.Forces.Length > maxF.Length) { maxF = eq.Forces; } if (eq.Moments.Length > maxM.Length) { maxM = eq.Moments; } } Console.WriteLine(""); Console.WriteLine("======================================== Summary"); Console.WriteLine("Maximum non equilibrated force: {0}", maxF); Console.WriteLine("Maximum non equilibrated moment: {0}", maxM); }
public MagneticFieldStrength(Force f, ElectricCurrent a, Length l) { _teslas = f.TotalNewtons / (a.TotalAmperes * l.TotalMeters); }
public void LengthTimesForceEqualsTorque() { Torque torque = Length.FromMeters(3) * Force.FromNewtons(1); Assert.AreEqual(torque, Torque.FromNewtonMeters(3)); }
public void ForceTimesLengthEqualsTorque() { Torque torque = Force.FromNewtons(1) * Length.FromMeters(3); Assert.AreEqual(torque, Torque.FromNewtonMeters(3)); }
public IEnumerable <Tuple <DoF, double> > GetLoadInternalForceAt(Element targetElement, ElementalLoad load, double[] isoLocation) { var buff = new List <Tuple <DoF, double> >(); //var buf = new FlatShellStressTensor(); var tr = targetElement.GetTransformationManager(); var br = targetElement as BarElement; var endForces = GetLocalEquivalentNodalLoads(targetElement, load); var n = targetElement.Nodes.Length; for (var i = 0; i < n; i++) { endForces[i] = -endForces[i]; } #region 2,1 (due to inverse of equivalent nodal loads) Force ends;//internal force in x=0 due to inverse of equivalent nodal loads will store in this variable, { var xi_s = new double[br.Nodes.Length]; //xi loc of each force var x_s = new double[br.Nodes.Length]; //x loc of each force for (var i = 0; i < xi_s.Length; i++) { var x_i = targetElement.Nodes[i].Location - targetElement.Nodes[0].Location; var xi_i = br.LocalCoordsToIsoCoords(x_i.Length)[0]; xi_s[i] = xi_i; x_s[i] = x_i.X; } ends = new Force();//sum of moved end forces to destination for (var i = 0; i < n; i++) { if (xi_s[i] < isoLocation[0]) { var frc_i = endForces[i];// new Force(); ends += frc_i.Move(new Point(x_s[i], 0, 0), Point.Origins); } } } #endregion if (load is UniformLoad || load is PartialNonUniformLoad) { return(new List <Tuple <DoF, double> >()); } #region concentrated if (load is ConcentratedLoad) { var cns = load as ConcentratedLoad; var xi = isoLocation[0]; var targetX = br.IsoCoordsToLocalCoords(xi)[0]; var frc = Force.Zero; if (cns.ForceIsoLocation.Xi < xi) { frc = cns.Force; } if (cns.CoordinationSystem == CoordinationSystem.Global) { frc = tr.TransformGlobalToLocal(frc); } var frcX = br.IsoCoordsToLocalCoords(cns.ForceIsoLocation.Xi)[0]; frc = frc.Move(new Point(frcX, 0, 0), new Point(0, 0, 0)); if (br.StartReleaseCondition.RX == DofConstraint.Released) { frc.Mx = 0; } frc = frc.Move(new Point(0, 0, 0), new Point(targetX, 0, 0)); var movedEnds = ends.Move(new Point(0, 0, 0), new Point(targetX, 0, 0)); var f2 = frc + movedEnds; //f2 *= -1; buff.Add(Tuple.Create(DoF.Rx, f2.Mx)); return(buff); } #endregion throw new NotImplementedException(); }
public override void UpdateCalc() { // Initiating Model, Nodes and Members model = new Model(); double spt = _spacingTop.Value / 2; double spb = _spacingBottom.Value / 2; double spv = _spacingVertical.Value; var n1a = new BriefFiniteElementNet.Node(-spt, 0, spv) { Label = "1a" }; var n1b = new BriefFiniteElementNet.Node(spt, 0, spv) { Label = "1b" }; var n2a = new BriefFiniteElementNet.Node(0, -spb, 0) { Label = "2a" }; var n2b = new BriefFiniteElementNet.Node(0, spb, 0) { Label = "2b" }; var e1 = new TrussElement2Node(n1a, n2a) { Label = "e1" }; var e2 = new TrussElement2Node(n1a, n2b) { Label = "e2" }; var e3 = new TrussElement2Node(n1b, n2a) { Label = "e3" }; var e4 = new TrussElement2Node(n1b, n2b) { Label = "e4" }; var e5 = new TrussElement2Node(n1a, n1b) { Label = "e5" }; var e6 = new TrussElement2Node(n2a, n2b) { Label = "e6" }; //Note: labels for all members should be unique, //else you will receive InvalidLabelException when adding it to model e1.A = e2.A = e3.A = e4.A = e5.A = e6.A = 0.009; e1.E = e2.E = e3.E = e4.E = e5.E = e6.E = 210e9; model.Nodes.Add(n1a, n1b, n2a, n2b); model.Elements.Add(e1, e2, e3, e4, e5, e6); //Applying restraints n1a.Constraints = Constraint.FromString("100111"); n1b.Constraints = Constraint.FromString("000111"); n2a.Constraints = Constraint.FromString("111111"); n2b.Constraints = Constraint.FromString("101111"); //Applying load var forceA = new Force(0, 0, -_loadA.Value / 2, 0, 0, 0); var forceB = new Force(0, 0, -_loadA.Value / 2, 0, 0, 0); var loadCase = new LoadCase("test", LoadType.Live); n1a.Loads.Add(new NodalLoad(forceA, loadCase)); n1b.Loads.Add(new NodalLoad(forceB, loadCase)); var loadComb = new LoadCombination(); loadComb.Add(loadCase, 1); //Adds a NodalLoad with Default LoadCase try { model.Solve(); var rA = n2a.GetSupportReaction(loadCase); var rB = n2b.GetSupportReaction(loadCase); var T = e6.GetInternalForceAt(0.5, loadComb); var F1 = e1.GetInternalForceAt(0.5, loadComb); var F2 = e3.GetInternalForceAt(0.5, loadComb); var Fresolved = F1 + F2; _reactionA.Value = rA.Forces.Z; _reactionB.Value = rB.Forces.Z; _strutResolvedForce.Value = Fresolved.Forces.Length; _tieForce.Value = T.Forces.Length; } catch (Exception) { _reactionA.Value = double.NaN; _reactionB.Value = double.NaN; } }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Force obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; }
// Module defining this command // Optional custom code for this activity /// <summary> /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// </summary> /// <param name="context">The NativeActivityContext for the currently running activity.</param> /// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns> /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks> protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context) { System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create(); System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName); // Initialize the arguments if (ProcessorArchitecture.Expression != null) { targetCommand.AddParameter("ProcessorArchitecture", ProcessorArchitecture.Get(context)); } if (SessionType.Expression != null) { targetCommand.AddParameter("SessionType", SessionType.Get(context)); } if (Name.Expression != null) { targetCommand.AddParameter("Name", Name.Get(context)); } if (AssemblyName.Expression != null) { targetCommand.AddParameter("AssemblyName", AssemblyName.Get(context)); } if (ApplicationBase.Expression != null) { targetCommand.AddParameter("ApplicationBase", ApplicationBase.Get(context)); } if (ConfigurationTypeName.Expression != null) { targetCommand.AddParameter("ConfigurationTypeName", ConfigurationTypeName.Get(context)); } if (RunAsCredential.Expression != null) { targetCommand.AddParameter("RunAsCredential", RunAsCredential.Get(context)); } if (ThreadApartmentState.Expression != null) { targetCommand.AddParameter("ThreadApartmentState", ThreadApartmentState.Get(context)); } if (ThreadOptions.Expression != null) { targetCommand.AddParameter("ThreadOptions", ThreadOptions.Get(context)); } if (AccessMode.Expression != null) { targetCommand.AddParameter("AccessMode", AccessMode.Get(context)); } if (UseSharedProcess.Expression != null) { targetCommand.AddParameter("UseSharedProcess", UseSharedProcess.Get(context)); } if (StartupScript.Expression != null) { targetCommand.AddParameter("StartupScript", StartupScript.Get(context)); } if (MaximumReceivedDataSizePerCommandMB.Expression != null) { targetCommand.AddParameter("MaximumReceivedDataSizePerCommandMB", MaximumReceivedDataSizePerCommandMB.Get(context)); } if (MaximumReceivedObjectSizeMB.Expression != null) { targetCommand.AddParameter("MaximumReceivedObjectSizeMB", MaximumReceivedObjectSizeMB.Get(context)); } if (SecurityDescriptorSddl.Expression != null) { targetCommand.AddParameter("SecurityDescriptorSddl", SecurityDescriptorSddl.Get(context)); } if (ShowSecurityDescriptorUI.Expression != null) { targetCommand.AddParameter("ShowSecurityDescriptorUI", ShowSecurityDescriptorUI.Get(context)); } if (Force.Expression != null) { targetCommand.AddParameter("Force", Force.Get(context)); } if (NoServiceRestart.Expression != null) { targetCommand.AddParameter("NoServiceRestart", NoServiceRestart.Get(context)); } if (PSVersion.Expression != null) { targetCommand.AddParameter("PSVersion", PSVersion.Get(context)); } if (SessionTypeOption.Expression != null) { targetCommand.AddParameter("SessionTypeOption", SessionTypeOption.Get(context)); } if (TransportOption.Expression != null) { targetCommand.AddParameter("TransportOption", TransportOption.Get(context)); } if (ModulesToImport.Expression != null) { targetCommand.AddParameter("ModulesToImport", ModulesToImport.Get(context)); } if (Path.Expression != null) { targetCommand.AddParameter("Path", Path.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }
public ComBall(Ball b, Force f, Control c) { this.b = b; this.f = f; this.c = c; }
public static void Run() { // Two span beam of 20m overall length with elements of 1m length // Vertical 'springs' are used at supports List <Node> nodeList = new List <Node>(); List <BarElement> elementList = new List <BarElement>(); LoadCase loadCase1 = new LoadCase("test", LoadType.Other);// LoadCase.DefaultLoadCase; // new LoadCase("L1", LoadType.Dead); var model = new BriefFiniteElementNet.Model(); for (double n = 0; n <= 20; n = n + 1) { nodeList.Add(new Node(x: n, y: 0.0, z: 0.0) { Label = "N" + n }); } nodeList.Add(new Node(x: 0, y: 0.0, z: -2.0) { Label = "N21" }); nodeList.Add(new Node(x: 10, y: 0.0, z: -2.0) { Label = "N22" }); nodeList.Add(new Node(x: 20, y: 0.0, z: -2.0) { Label = "N23" }); //var load1 = new BriefFiniteElementNet.Loads.UniformLoad(loadCase1, new Vector(0, 0, 1), 0, CoordinationSystem.Global); // Load in N/m (UDL = 0 N/m) var a = 0.1; // m² var iy = 0.008333 ; // m4 var iz = 8.333e-5; // m4 var j = 0.1 * 0.1 * 0.1 * 1 / 12.0; // m4 var e = 205e9; // N/m² var nu = 0.3; // Poisson's ratio var secAA = new BriefFiniteElementNet.Sections.UniformParametric1DSection(a, iy, iz, j); var mat = BriefFiniteElementNet.Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(e, nu); for (int m = 0; m <= 19; m++) { BarElement el = new BarElement(nodeList[m], nodeList[m + 1]); el.Section = secAA; el.Material = mat; //el.Loads.Add(load1); elementList.Add(el); } BarElement el2 = new BarElement(nodeList[0], nodeList[21]); el2.Section = secAA; el2.Material = mat; elementList.Add(el2); BarElement el3 = new BarElement(nodeList[10], nodeList[22]); el3.Section = secAA; el3.Material = mat; elementList.Add(el3); BarElement el4 = new BarElement(nodeList[20], nodeList[23]); el4.Section = secAA; el4.Material = mat; elementList.Add(el4); nodeList[21].Constraints = Constraints.MovementFixed & Constraints.FixedRX; // Constraints.FixedDX & Constraints.FixedDY & Constraints.FixedDZ & Constraints.FixedRY & Constraints.FixedRZ; nodeList[22].Constraints = Constraints.FixedDZ & Constraints.FixedDY & Constraints.FixedRX; // z = vertical nodeList[23].Constraints = Constraints.FixedDZ & Constraints.FixedDY & Constraints.FixedRX; // z = vertical nodeList[22].Settlements.Add(new Settlement(loadCase1, new Displacement(0, 0, -0.010, 0, 0, 0))); // -10mm settlement model.Elements.Add(elementList.ToArray()); model.Nodes.AddRange(nodeList); model.Solve_MPC(loadCase1);//or model.Solve(); var disp = nodeList[10].GetNodalDisplacement(loadCase1); Console.WriteLine("Node 10 displacement in Z direction is {0:0.000} m", disp.DZ); Console.WriteLine("Node 10 rotation in YY direction is {0:0.000} rads\n", disp.RY); foreach (BarElement elem in elementList) { Force f1 = elem.GetExactInternalForceAt(-0.999999, loadCase1); // -1 = start, 0 = mid, 1 = end, exact solver takes UDL on member into account, doesn't then accept -1 or 1 Console.WriteLine("Element BMyy is {0:0.000} kNm at start, SFz is {1:0.000} kN at start", f1.My / 1000, f1.Fz / 1000); Force f2 = elem.GetExactInternalForceAt(0.999999, loadCase1); Console.WriteLine("Element BMyy is {0:0.000} kNm at end, SFz is {1:0.000} kN at start", f2.My / 1000, f2.Fz / 1000); } Console.WriteLine("Node 21 vertical reaction {0:0.000} kN", model.Nodes[21].GetSupportReaction(loadCase1).Fz / 1000); // gives 51.171 kN CORRECT Console.WriteLine("Node 22 vertical reaction {0:0.000} kN", model.Nodes[22].GetSupportReaction(loadCase1).Fz / 1000); // gives 102397.658 kN INCORRECT (EXPECT -102.342 kN) Console.WriteLine("Node 23 vertical reaction {0:0.000} kN", model.Nodes[23].GetSupportReaction(loadCase1).Fz / 1000); // gives 51.171 kN CORRECT Console.ReadKey(); }
void JumpDone(Force f) { Force jumpMomentum = GetForce("JumpMomentum"); IsJumping = false; RemoveForce("Jump"); RemoveForce("JumpMomentum"); if ((!HasGround || !CurrentGround.IsTouching) && jumpMomentum != null) { AddForce("FallMomentum", jumpMomentum.From, Vector3.zero, 1f); } }
// Module defining this command // Optional custom code for this activity /// <summary> /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// </summary> /// <param name="context">The NativeActivityContext for the currently running activity.</param> /// <returns>A populated instance of System.Management.Automation.PowerShell</returns> /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks> protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context) { System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create(); System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName); // Initialize the arguments if (Job.Expression != null) { targetCommand.AddParameter("Job", Job.Get(context)); } if (Location.Expression != null) { targetCommand.AddParameter("Location", Location.Get(context)); } if (Session.Expression != null) { targetCommand.AddParameter("Session", Session.Get(context)); } if (Keep.Expression != null) { targetCommand.AddParameter("Keep", Keep.Get(context)); } if (NoRecurse.Expression != null) { targetCommand.AddParameter("NoRecurse", NoRecurse.Get(context)); } if (Force.Expression != null) { targetCommand.AddParameter("Force", Force.Get(context)); } if (Wait.Expression != null) { targetCommand.AddParameter("Wait", Wait.Get(context)); } if (AutoRemoveJob.Expression != null) { targetCommand.AddParameter("AutoRemoveJob", AutoRemoveJob.Get(context)); } if (WriteEvents.Expression != null) { targetCommand.AddParameter("WriteEvents", WriteEvents.Get(context)); } if (WriteJobInResults.Expression != null) { targetCommand.AddParameter("WriteJobInResults", WriteJobInResults.Get(context)); } if (Name.Expression != null) { targetCommand.AddParameter("Name", Name.Get(context)); } if (InstanceId.Expression != null) { targetCommand.AddParameter("InstanceId", InstanceId.Get(context)); } if (JobId.Expression != null) { targetCommand.AddParameter("Id", JobId.Get(context)); } if (GetIsComputerNameSpecified(context) && (PSRemotingBehavior.Get(context) == RemotingBehavior.Custom)) { targetCommand.AddParameter("ComputerName", PSComputerName.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }
/// <summary> /// Get strength of given force, scaled between Force.MinStrength and Force.MaxStrength. /// </summary> /// <param name="force">Force to query.</param> /// <returns>Raw strength of force.</returns> public float GetRawForceStrength(Force force) { for (int i = 0; i < Count; i++) if (_forces[i] == force) return GetRawForceStrength(i); return 0.0f; }
public void MassByAccelerationEqualsForce() { Force force = Force.FromMassByAcceleration(Mass.FromKilograms(85), Acceleration.FromMeterPerSecondSquared(-4)); Assert.Equal(force, Force.FromNewtons(-340)); }
public void SaveForcesLocal(Force forces) { this.forcesService.SaveForces(forces); }
public void SpeedTimesForceEqualsPower() { Power power = Speed.FromMetersPerSecond(10.0) * Force.FromNewtons(27.0); Assert.Equal(power, Power.FromWatts(270)); }
/// <summary> /// Print the object's XML to the XmlWriter. /// </summary> /// <param name="objWriter">XmlTextWriter to write with.</param> /// <param name="objCulture">Culture in which to print numbers.</param> /// <param name="strLanguageToPrint">Language in which to print.</param> public void Print(XmlTextWriter objWriter, CultureInfo objCulture, string strLanguageToPrint) { // Translate the Critter name if applicable. string strName = Name; XmlNode objXmlCritterNode = GetNode(strLanguageToPrint); if (strLanguageToPrint != GlobalOptions.DefaultLanguage) { strName = objXmlCritterNode?["translate"]?.InnerText ?? Name; } objWriter.WriteStartElement("spirit"); objWriter.WriteElementString("name", strName); objWriter.WriteElementString("name_english", Name); objWriter.WriteElementString("crittername", CritterName); objWriter.WriteElementString("fettered", Fettered.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("bound", Bound.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("services", ServicesOwed.ToString(objCulture)); objWriter.WriteElementString("force", Force.ToString(objCulture)); if (objXmlCritterNode != null) { //Attributes for spirits, named differently as to not confuse <attribtue> Dictionary <string, int> dicAttributes = new Dictionary <string, int>(); objWriter.WriteStartElement("spiritattributes"); foreach (string strAttribute in new[] { "bod", "agi", "rea", "str", "cha", "int", "wil", "log", "ini" }) { string strInner = string.Empty; if (objXmlCritterNode.TryGetStringFieldQuickly(strAttribute, ref strInner)) { int intValue; try { intValue = Convert.ToInt32(CommonFunctions.EvaluateInvariantXPath(strInner.Replace("F", _intForce.ToString()))); } catch (XPathException) { if (!int.TryParse(strInner, out intValue)) { intValue = _intForce; //if failed to parse, default to force } } catch (OverflowException) { if (!int.TryParse(strInner, out intValue)) { intValue = _intForce; //if failed to parse, default to force } } catch (FormatException) { if (!int.TryParse(strInner, out intValue)) { intValue = _intForce; //if failed to parse, default to force } } intValue = Math.Max(intValue, 1); //Min value is 1 objWriter.WriteElementString(strAttribute, intValue.ToString(objCulture)); dicAttributes[strAttribute] = intValue; } } objWriter.WriteEndElement(); //Dump skills, (optional)powers if present to output XmlDocument objXmlPowersDocument = XmlManager.Load("spiritpowers.xml", strLanguageToPrint); XmlNode xmlPowersNode = objXmlCritterNode["powers"]; if (xmlPowersNode != null) { objWriter.WriteStartElement("powers"); foreach (XmlNode objXmlPowerNode in xmlPowersNode.ChildNodes) { PrintPowerInfo(objWriter, objXmlPowersDocument, objXmlPowerNode.InnerText, GlobalOptions.Language); } objWriter.WriteEndElement(); } xmlPowersNode = objXmlCritterNode["optionalpowers"]; if (xmlPowersNode != null) { objWriter.WriteStartElement("optionalpowers"); foreach (XmlNode objXmlPowerNode in xmlPowersNode.ChildNodes) { PrintPowerInfo(objWriter, objXmlPowersDocument, objXmlPowerNode.InnerText, GlobalOptions.Language); } objWriter.WriteEndElement(); } xmlPowersNode = objXmlCritterNode["skills"]; if (xmlPowersNode != null) { objWriter.WriteStartElement("skills"); foreach (XmlNode xmlSkillNode in xmlPowersNode.ChildNodes) { string strAttrName = xmlSkillNode.Attributes?["attr"]?.Value ?? string.Empty; if (!dicAttributes.TryGetValue(strAttrName, out int intAttrValue)) { intAttrValue = _intForce; } int intDicepool = intAttrValue + _intForce; objWriter.WriteStartElement("skill"); objWriter.WriteElementString("name", xmlSkillNode.InnerText); objWriter.WriteElementString("attr", strAttrName); objWriter.WriteElementString("pool", intDicepool.ToString(objCulture)); objWriter.WriteEndElement(); } objWriter.WriteEndElement(); } xmlPowersNode = objXmlCritterNode["weaknesses"]; if (xmlPowersNode != null) { objWriter.WriteStartElement("weaknesses"); foreach (XmlNode objXmlPowerNode in xmlPowersNode.ChildNodes) { PrintPowerInfo(objWriter, objXmlPowersDocument, objXmlPowerNode.InnerText, GlobalOptions.Language); } objWriter.WriteEndElement(); } //Page in book for reference string strSource = string.Empty; string strPage = string.Empty; if (objXmlCritterNode.TryGetStringFieldQuickly("source", ref strSource)) { objWriter.WriteElementString("source", CommonFunctions.LanguageBookShort(strSource, strLanguageToPrint)); } if (objXmlCritterNode.TryGetStringFieldQuickly("altpage", ref strPage) || objXmlCritterNode.TryGetStringFieldQuickly("page", ref strPage)) { objWriter.WriteElementString("page", strPage); } } objWriter.WriteElementString("bound", Bound.ToString()); objWriter.WriteElementString("type", EntityType.ToString()); if (_objCharacter.Options.PrintNotes) { objWriter.WriteElementString("notes", Notes); } PrintMugshots(objWriter); objWriter.WriteEndElement(); }
public void ForceDividedByAreaEqualsPressure() { Pressure pressure = Force.FromNewtons(90) / Area.FromSquareMeters(9); Assert.Equal(pressure, Pressure.FromNewtonsPerSquareMeter(10)); }
public ConcentratedLoad(Force force, IsoPoint forceIsoLocation, CoordinationSystem coordinationSystem) { Force = force; ForceIsoLocation = forceIsoLocation; CoordinationSystem = coordinationSystem; }
public void PressureByAreaEqualsForceUsingArea() { Force force = Force.FromPressureByArea(Pressure.FromNewtonsPerSquareMeter(5), Area.FromSquareMeters(7)); Assert.Equal(force, Force.FromNewtons(35)); }
private void internal_add_force(Vector2D force, int index) { Force my_force = new Force(); my_force._force = force; my_force._index = index; _add_forces.Enqueue(my_force); }
public void PressureByAreaEqualsForceUsingLength2D() { var force = Force.FromPressureByArea(Pressure.FromNewtonsPerSquareMeter(6), Length2d.FromMeters(5, 2)); Assert.Equal(force, Force.FromNewtons(60)); }
protected void _SetupForce(Force force, ref ForceInstance fi) { Assert.Fatal(SceneObject != null, "Cannot set up force before adding to scene"); SceneObject.RegisterInterface(this, fi._strength); fi._strength.Value = force.InitialStrength; if (force.LinkName != null && force.LinkName != String.Empty) { fi._linkPosition = SceneObject.Components.GetInterface<ValueInterface<Vector2>>("vector2", force.LinkName); fi._linkRotation = SceneObject.Components.GetInterface<ValueInterface<float>>("float", force.LinkName); } }
public void ForceDividedByMassEqualsAcceleration() { Acceleration acceleration = Force.FromNewtons(27) / Mass.FromKilograms(9); Assert.Equal(acceleration, Acceleration.FromMeterPerSecondSquared(3)); }
public bool Equals(Force obj) { if (obj == null) return false; return (obj.swigCPtr.Handle == this.swigCPtr.Handle); }
public void ForceDividedByAccelerationEqualsMass() { Mass acceleration = Force.FromNewtons(200) / Acceleration.FromMeterPerSecondSquared(50); Assert.Equal(acceleration, Mass.FromKilograms(4)); }
private void pbGalaxy_Click(object sender, EventArgs e) { int iDiam = 20; Point screenCoordinates = this.PointToScreen(new Point(0, 0)); Timer tmr = new Timer(); tmr.Interval = 4000; tmr.Tick += new System.EventHandler(this.tmrBeforeDelete_Tick); Ball bTmp = new Ball(new double[2] { ((MousePosition.X - screenCoordinates.X) - ((pbGalaxy.Width) / 2)), ((screenCoordinates.Y - MousePosition.Y) + (pbGalaxy.Height / 2))}, new double[2] { 0, 0 }, new double[2] { 0, 0 }, 1, iDiam, Color.White, Color.White, false, false, tmr, 0); Force fTmp = new Force(new double[2] { 0, 0 }, new double[2] { 0, 0 }, new double[2] { 0, 0 }, new double[2] { 0, 0 }, new double[2] { 0, 0 }, 0); Control cTmp = new Control(System.DateTime.Now, System.DateTime.Now, 0, 0, 0, false, false, false); ComBall moon = new ComBall(bTmp, fTmp, cTmp); myBalls.Add(moon); }
public void ForceDividedByLengthEqualsForcePerLength() { ForcePerLength forcePerLength = Force.FromNewtons(200) / Length.FromMeters(50); Assert.Equal(forcePerLength, ForcePerLength.FromNewtonsPerMeter(4)); }
protected void _GetForceData(Force force, ForceInstance fi, out Vector2 offset, out Vector2 direction) { offset = SceneObject.GetWorldLinkPosition(fi._linkPosition, fi._linkRotation, force.Offset) - SceneObject.Position; float dirRot; if (force.UseLinkDirection) { dirRot = SceneObject.GetWorldLinkRotation(fi._linkRotation, force.RotationOffset); } else { dirRot = force.ConstantDirection; if (!force.ConstantDirectionIsWorldSpace) dirRot += SceneObject.Rotation; dirRot = (dirRot + force.RotationOffset) % 360.0f; } direction = T2DVectorUtil.VectorFromAngle(dirRot); }
public void OpLessThan() { var force1 = new Force(9.81, ForceUnit.Newtons); var force2 = new Force(1, ForceUnit.KilogramForce); var force3 = new Force(2, ForceUnit.KilogramForce); (force1 < force3).ShouldBeTrue(); (force3 < force1).ShouldBeFalse(); (force1 < force2).ShouldBeFalse(); (force2 < force1).ShouldBeFalse(); }
public void AddForce(string name, Vector3 from, Vector3 to, float time, Action<Force> onDone) { if (!String.IsNullOrEmpty(name)) { forces[name] = new Force { From = from, To = to, Time = time, Elapsed = 0, OnDone = onDone }; // We need to remove any pending expires on this force expiredForces.Remove(name); } }
protected void SetScalarValue(DependencyProperty property, Force? quantity) { // we set this flag to prevent from setting scalar value changing quantity values. this.isUpdatingScalarValue = true; var value = quantity != null ? this.Unit.GetScalarValue(quantity.Value) : (double?)null; this.SetCurrentValue(property, value); this.isUpdatingScalarValue = false; }
/// <summary> /// Determine whether a given force is being applied to this object. /// </summary> /// <param name="force">Force to test.</param> /// <returns>True if force is being applied.</returns> public bool HasForce(Force force) { for (int i = 0; i < Count; i++) if (_forces[i] == force) return true; return false; }
public void EqualsReturnsFalseOnNull() { Force newton = Force.FromNewtons(1); Assert.IsFalse(newton.Equals(null)); }
public void OpSubtraction() { var force1 = new Force(19.62, ForceUnit.Newtons); var force2 = new Force(1, ForceUnit.KilogramForce); (force1 - force2).ShouldEqual(new Force(9.81, ForceUnit.Newtons)); (force2 - force1).ShouldEqual(new Force(-1, ForceUnit.KilogramForce)); }
/// <summary> /// Add a force /// </summary> static internal void Add(Force force) { forces.Add(force); }
public double Magnitude(Force a) { return Math.Sqrt(i * i + j * j); }
/// <summary> /// Add an instantaneous force /// </summary> static internal void AddInstantaneous(Force force) { instantaneousForces.Add(force); }
public void MassByAccelerationEqualsForceUsingDouble() { var force = Force.FromMassByAcceleration(Mass.FromKilograms(9), 3); Assert.Equal(force, Force.FromNewtons(27)); }
/// <summary> /// Add a new force to this object. Force will continue to be applied until RemoveForce /// is called for the force. /// </summary> /// <param name="force">Force to applye.</param> public void AddForce(Force force) { _forces.Add(force); ForceInstance fi = new ForceInstance(); fi._strength = new ValueInPlaceInterface<float>(); if (SceneObject != null) _SetupForce(force, ref fi); _forceInstances.Add(fi); }
public void EqualsReturnsFalseOnTypeMismatch() { Force newton = Force.FromNewtons(1); Assert.IsFalse(newton.Equals(new object())); }
protected virtual void OnMaxValueChanged(Force? oldValue, Force? newValue) { this.SetScalarValue(ScalarMaxValueProperty, newValue); }