Esempio n. 1
0
        public void Unsubscribe()
        {
            // Get callback channel
            IExportClient cl = OperationContext.Current.GetCallbackChannel <IExportClient>();

            lock (lockClients)
                _Clients.Remove(cl);
        }
        protected override void AfterCircle(IExportClient cl)
        {
            for (int j = 0; j < N; ++j)
            {
                var angle = j * 360 / N * Deg2Rad;

                cl.Circle(new SolverPoint(Rz * Math.Cos(angle), Rz * Math.Sin(angle)), q, 1, "output_rollers");
            }
        }
        protected override SolverPoint GetCircularPoint(int step, double angle, IExportClient cl)
        {
            var common = angle + Math.Atan2(Math.Sin(z * angle), 1 / l + Math.Cos(z * angle));

            var x = Rz * Math.Cos(angle) + e * Math.Cos(N * angle) - q * Math.Cos(common);
            var y = Rz * Math.Sin(angle) + e * Math.Sin(N * angle) - q * Math.Sin(common);

            return(new SolverPoint(x, y));
        }
Esempio n. 4
0
        protected override SolverPoint GetCircularPoint(int step, double angle, IExportClient cl)
        {
            var radius = A / NumRollers;

            var x = A * Math.Cos(angle) + radius * Math.Cos(angle * NumRollers);
            var y = A * Math.Sin(angle) + radius * Math.Sin(angle * NumRollers);

            return(new SolverPoint(x, y));
        }
Esempio n. 5
0
        public void Run(IExportClient cl)
        {
            var len = 50d;
            var p1  = new SolverPoint(0, 0);
            var p2  = new SolverPoint(len, 0);
            var p3  = new SolverPoint(len * Math.Cos(Angle * Deg2Rad), len * Math.Sin(Angle * Deg2Rad));

            cl.Line(p1, p2, 1, "base");
            cl.Line(p1, p3, 0, "base");
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="OtlpTraceExporter"/> class.
 /// </summary>
 /// <param name="options">Configuration options for the export.</param>
 /// <param name="exportClient">Client used for sending export request.</param>
 internal OtlpTraceExporter(OtlpExporterOptions options, IExportClient <OtlpCollector.ExportTraceServiceRequest> exportClient = null)
 {
     if (exportClient != null)
     {
         this.exportClient = exportClient;
     }
     else
     {
         this.exportClient = options.GetTraceExportClient();
     }
 }
Esempio n. 7
0
        protected override SolverPoint GetCircularPoint(int step, double angle, IExportClient cl)
        {
            //var Yr = Y * Deg2Rad;

            // Contact angle is calculated here
            var Yr = Math.Atan2(Math.Sin(Z1 * angle), Math.Cos(Z1 * angle) - R / (E * (Z1 + 1)));

            var x = R * Math.Cos(angle) + Rr * Math.Cos(angle + Yr) - E * Math.Cos((Z1 + 1) * angle);
            var y = R * Math.Sin(angle) + Rr * Math.Sin(angle + Yr) - E * Math.Sin((Z1 + 1) * angle);

            return(new SolverPoint(x, y));
        }
Esempio n. 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OtlpMetricExporter"/> class.
 /// </summary>
 /// <param name="options">Configuration options for the export.</param>
 /// <param name="exportClient">Client used for sending export request.</param>
 internal OtlpMetricExporter(OtlpExporterOptions options, IExportClient <OtlpCollector.ExportMetricsServiceRequest> exportClient = null)
 {
     if (exportClient != null)
     {
         this.exportClient = exportClient;
     }
     else
     {
         // TODO: this instantiation should be aligned with the protocol option (grpc or http/protobuf) when OtlpHttpMetricsExportClient will be implemented.
         this.exportClient = new OtlpGrpcMetricsExportClient(options);
     }
 }
Esempio n. 9
0
        public void Run(IExportClient cl)
        {
            double start = -100;
            double end   = 100;
            double step  = 0.1;

            var p1 = new SolverPoint(start, F(start));

            for (double x = start; x <= end; x += step)
            {
                double y  = F(x);
                var    p2 = new SolverPoint(x, y);
                cl.Line(p1, p2, 0, "base");

                p1 = p2;
            }
        }
        protected override SolverPoint GetCircularPoint(int step, double angleRads, IExportClient cl)
        {
            var v = (A - B) / B * angleRads;

            var centerX = (A - B) * Math.Cos(angleRads);
            var centerY = (A - B) * Math.Sin(angleRads);
            var x       = centerX + B * Math.Cos(v);
            var y       = centerY - B * Math.Sin(v);

            var result = new SolverPoint(x, y);


            if (step % (NumSteps / 20) == 0)
            {
                cl.Circle(new SolverPoint(centerX, centerY), B, 1, "circles");
                cl.Point(result, 5, "points");
            }


            return(result);
        }
Esempio n. 11
0
        protected override void AfterCircle(IExportClient cl)
        {
            // Tolerances

            var dgap     = deo + dR + dcs + dcp;
            var Rprofile = R - dgap;

            var dsum     = Math.Sqrt(deo * deo + dR * dR + dcs * dcs + dcp * dcp + djb * djb) + dgap;
            var backlash = 2 * dsum / (E * Z1);  // radians

            // Rollers after tolerance

            for (int i = 0; i < Z1 + 1; ++i)
            {
                var angle = 360d / (Z1 + 1) * i * Deg2Rad;

                var x = Rprofile * Math.Cos(angle) - E;
                var y = Rprofile * Math.Sin(angle);

                cl.Circle(new SolverPoint(x, y), Rr, 4, "rollers_tolerance");
            }
        }
Esempio n. 12
0
        public void Run(IExportClient cl)
        {
            mClient = cl;

            BeforeCircle(cl);

            SolverPoint last = null;

            for (int i = 0; i < NumSteps; ++i)
            {
                var angle = (MaxAngle - MinAngle) / NumSteps * i + MinAngle;
                var r     = angle * Deg2Rad;
                var p     = GetCircularPoint(i, r, cl);

                if (last != null)
                {
                    cl.Line(last, p, 0, "base");
                }
                last = p;
            }

            AfterCircle(cl);
        }
Esempio n. 13
0
 protected virtual void AfterCircle(IExportClient cl)
 {
 }
Esempio n. 14
0
 protected abstract SolverPoint GetCircularPoint(int step, double angleRads, IExportClient cl);
Esempio n. 15
0
        public void Run(IExportClient cl)
        {
            if (cl == null)
            {
                throw new Exception("null export client");
            }

            //if b > 0:
            //    p = b/n
            if (b > 0)
            {
                p = b / n;
            }

            //q=2*math.pi/float(s)
            var q = 2.0 * Math.PI / s;

            //# Find the pressure angle limit circles
            //minAngle = -1.0
            //maxAngle = -1.0
            //for i in range(0, 180):
            //        x = calcPressureAngle(p,d,n,float(i)*math.pi/180)
            //        if (x < ang) and (minAngle < 0):
            //                minAngle = float(i)
            //        if (x < -ang) and (maxAngle < 0):
            //                maxAngle = float(i-1)
            //minRadius = calcPressureLimit(p,d,e,n,minAngle*math.pi/180)
            //maxRadius = calcPressureLimit(p,d,e,n,maxAngle*math.pi/180)
            //dxf.append( sdxf.Circle(center=(-e, 0), radius=minRadius, layer="pressure") )
            //dxf.append( sdxf.Circle(center=(-e, 0), radius=maxRadius, layer="pressure") )

            var minAngle = -1.0;
            var maxAngle = -1.0;

            for (int i = 0; i < 180; ++i)
            {
                var x = CalcPressureAngle(p, d, n, i * Math.PI / 180d);
                if (x < ang && minAngle < 0)
                {
                    minAngle = (double)i;
                }
                if (x < -ang && maxAngle < 0)
                {
                    maxAngle = (double)(i - 1);
                }
            }

            var minRadius = CalcPressureLimit(p, d, e, n, minAngle * Math.PI / 180d);
            var maxRadius = CalcPressureLimit(p, d, e, n, maxAngle * Math.PI / 180d);

            cl.Circle(new SolverPoint(-e, 0), minRadius, 2, "pressure");
            cl.Circle(new SolverPoint(-e, 0), maxRadius, 2, "pressure");


            //#generate the cam profile - note: shifted in -x by eccentricicy amount
            //i=0
            //x1 = calcX(p,d,e,n,q*i)
            //y1 = calcY(p,d,e,n,q*i)
            //x1, y1 = checkLimit(x1,y1,maxRadius, minRadius, c)
            //for i in range(0, s):
            //        x2 = calcX(p,d,e,n,q*(i+1))
            //        y2 = calcY(p,d,e,n,q*(i+1))
            //        x2, y2 = checkLimit(x2,y2,maxRadius, minRadius, c)
            //    dxf.append( sdxf.Line(points=[(x1-e,y1),  (x2-e,y2)], layer="cam" ) )
            //        x1 = x2
            //        y1 = y2
            var points = new List <SolverPoint>();

            var ii  = 0;
            var x1  = CalcX(p, d, e, n, q * ii);
            var y1  = CalcY(p, d, e, n, q * ii);
            var xy1 = CheckLimit(x1, y1, maxRadius, minRadius, c);

            xy1.X -= e;
            points.Add(xy1);

            for (int j = 0; j < s; ++j)
            {
                var x2  = CalcX(p, d, e, n, q * (j + 1));
                var y2  = CalcY(p, d, e, n, q * (j + 1));
                var xy2 = CheckLimit(x2, y2, maxRadius, minRadius, c);

                xy2.X -= e;
                points.Add(xy2);
            }

            cl.Spline(points, 0, "cam");



            //#add a circle in the center of the cam
            //dxf.append( sdxf.Circle(center=(-e, 0), radius=d/2, layer="cam") )

            cl.Circle(new SolverPoint(-e, 0), ccd / 2, 0, "cam");

            //#generate the pin locations
            //for i in range(0, n+1):
            //    x = p*n*math.cos(2*math.pi/(n+1)*i)
            //    y = p*n*math.sin(2*math.pi/(n+1)*i)
            //    dxf.append( sdxf.Circle(center=(x,y), radius=d/2, layer="roller") )
            //#add a circle in the center of the pins
            //dxf.append( sdxf.Circle(center=(0, 0), radius=d/2, layer="roller") )
            for (int k = 0; k < n + 1; ++k)
            {
                var x = p * n * Math.Cos(2 * Math.PI / (n + 1) * k);
                var y = p * n * Math.Sin(2 * Math.PI / (n + 1) * k);
                cl.Circle(new SolverPoint(x, y), d / 2, 1, "roller");
            }

            cl.Circle(new SolverPoint(0, 0), csd / 2, 1, "roller");
        }
Esempio n. 16
0
 protected override SolverPoint GetCircularPoint(int step, double angleRads, IExportClient cl)
 {
     return(new SolverPoint(
                A * angleRads - B * Math.Sin(angleRads),
                A - B * Math.Cos(angleRads)));
 }
Esempio n. 17
0
        protected override void BeforeCircle(IExportClient cl)
        {
            // Constraints


            // R constraint

            var Rmin = Math.Sqrt(
                (Rr * Rr * Math.Pow(Z1 + 2, 3)) /
                (27 * Z1)
                + E * E * Math.Pow(Z1 + 1, 2));

            if (R < Rmin)
            {
                R = Rmin;
                mParams[0].Value = R;
            }


            // Rr constraint

            var Rrmax1 = R * Math.Sin(Math.PI / (Z1 + 1));
            var Rrmax2 = Math.Sqrt(
                (27 * Z1 * (R * R - E * E * (Z1 + 1) * (Z1 + 1))) /
                Math.Pow(Z1 + 2, 3));

            var Rrmax = Math.Min(Rrmax1, Rrmax2);

            if (Rr > Rrmax)
            {
                Rr = Rrmax;
                mParams[1].Value = Rr;
            }


            // Eccentricity constraint

            var Emax = Math.Sqrt(
                (27 * R * R * Z1 - Rr * Rr * Math.Pow(Z1 + 2, 3)) /
                (27 * Z1 * Math.Pow(Z1 + 1, 2)));

            if (E > Emax)
            {
                E = Emax;
                mParams[3].Value = E;
            }


            // Draw Rollers

            for (int i = 0; i < Z1 + 1; ++i)
            {
                var angle = 360d / (Z1 + 1) * i * Deg2Rad;

                var x = R * Math.Cos(angle) - E;
                var y = R * Math.Sin(angle);

                cl.Circle(new SolverPoint(x, y), Rr, 1, "rollers");
            }

            // Draw Centers

            cl.Circle(new SolverPoint(-E, 0), 2.5, 1, "rollers");
            cl.Circle(new SolverPoint(0, 0), CamDiameter / 2, 0, "base");
        }
 protected override void AfterCircle(IExportClient cl)
 {
     cl.Circle(new SolverPoint(0, 0), A, 1, "circles");
 }
Esempio n. 19
0
 protected virtual void BeforeCircle(IExportClient cl)
 {
 }