using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DTS.Slice.PedestrianAndHeadReports { public class LWRLegTRLReport : ReportBase { public LWRLegTRLReport(PedestrianAndHeadTest parent) : base(parent) { } public override ReportTypes GetReportType() { return ReportTypes.LWRLegTRL; } public const string AccelerationChannelId = "LWRLEGTRL_ACCEL"; public const string BendingChannelId = "LWRLEGTRL_BENDANGLE"; public const string ShearingChannelId = "LWRLEGTRL_SHEARING"; public const string BendingDisplacementId = "LWRLEGTRL_BENDDISPLACEMENT"; public const string ShearingDisplacementId = "LWRLEGTRL_SHEARDISPLACEMENT"; protected override void InitializeGraphs() { base.InitializeGraphs(); AddGraph(new ReportGraph(KnownGraphs.LWR_LEG_TRL_Acceleration.ToString(), "Acceleration", new MeasurementUnit[] { MeasurementUnitList.GetMeasurementUnit("m/sec^2"), MeasurementUnitList.GetMeasurementUnit("G") }, new GraphChannel[] { new GraphChannel(AccelerationChannelId, "加速度", "ACC") }, Properties.Settings.Default.PROTECTIONREPORT_LWRTRLAccelThreshold)); AddGraph(new ReportGraph(KnownGraphs.LWR_LEG_TRL_BendingAngle.ToString(), "Bending angle", new MeasurementUnit[] { MeasurementUnitList.GetMeasurementUnit("deg") }, new GraphChannel[] { new GraphChannel(BendingChannelId, "曲げ角度", "BEND") }, Properties.Settings.Default.PROTECTIONREPORT_LWRTRLBendingThreshold)); AddGraph(new ReportGraph(KnownGraphs.LWR_LEG_TRL_ShearAngle.ToString(), "Shear displacement", new MeasurementUnit[] { MeasurementUnitList.GetMeasurementUnit("deg") }, new GraphChannel[] { new GraphChannel(ShearingChannelId, "剪断変位", "SHEAR") }, Properties.Settings.Default.PROTECTIONREPORT_LWRTRLShearThreshold)); AddGraph(new ReportGraph(KnownGraphs.LWR_LEG_TRL_BendingDisplacement.ToString(), "Bending Displacement", new MeasurementUnit[] { MeasurementUnitList.GetMeasurementUnit("mm") }, new GraphChannel[] { new BendingDisplacement(BendingDisplacementId, "Bending Displacement", "---") }, Properties.Settings.Default.PROTECTIONREPORT_LWRTRLBendingThreshold)); AddGraph(new ReportGraph(KnownGraphs.LWR_LEG_TRL_ShearDisplacement.ToString(), "Shear Displacement", new MeasurementUnit[] { MeasurementUnitList.GetMeasurementUnit("mm") }, new GraphChannel[] { new ShearingDisplacement(ShearingDisplacementId, "Shear Displacement", "---") }, Properties.Settings.Default.PROTECTIONREPORT_LWRTRLShearThreshold)); } protected override void InitializeProperties() { base.InitializeProperties(); SetPossibleValues(PedestrianAndHeadTest.Fields.ImpactorType.ToString(), new string[] { "E-PLI" }); SetValue(PedestrianAndHeadTest.Fields.FrequencyClass.ToString(), (new SensorDB.FilterClass(DTS.SensorDB.FilterClass.FilterClassType.CFC180)).ToString()); } private double DegreeToRadian(double angle) { return Math.PI * angle / 180.0; } private double RadianToDegree(double radian) { return radian*(180D/Math.PI); } public override void DrawGraph(KnownGraphs graph, C1.Win.C1Chart.C1Chart chart) { switch (graph) { case KnownGraphs.LWR_LEG_TRL_BendingAngle: { var channelX = GetChannel(KnownGraphs.LWR_LEG_TRL_BendingAngle, BendingChannelId); if (null == channelX || null == channelX.Channel) { return; } try { var x = new DTS.Calculations.ChannelData("deg"); x.FilteredEU = channelX.Channel.DataEu.ToArray(); List yValues = new List(); for (int i = 0; i < x.FilteredEU.Length; i++) { double c = x.FilteredEU[i]; yValues.Add(c + RadianToDegree(System.Math.Asin((59.5D / 43.5D) * System.Math.Sin(DegreeToRadian(c))))); } DTS.Slice.Control.Event.Module.Channel.CalculatedChannel cc = new DTS.Slice.Control.Event.Module.Channel.CalculatedChannel( "Bending Displacement", DTS.Slice.Control.Event.Module.Channel.CalculatedChannel.XUnits.msec, "mm", new double[0], yValues.ToArray(), DTS.Slice.Control.Event.Module.Channel.CalculatedChannel.Operation.ImportedCSV, 0, channelX.Channel.ParentModule); ReviewTestChannel rtc = new ReviewTestChannel(cc, channelX.ParentTest); var g = GetGraph(ReportBase.KnownGraphs.LWR_LEG_TRL_BendingDisplacement.ToString()); g.SetReviewTestChannel(BendingDisplacementId, rtc); } catch (System.Exception) { } base.DrawGraph(graph, chart); } break; case KnownGraphs.LWR_LEG_TRL_ShearAngle: { var channelX = GetChannel(KnownGraphs.LWR_LEG_TRL_ShearAngle, ShearingChannelId); if (null == channelX || null == channelX.Channel) { return; } try { var x = new DTS.Calculations.ChannelData("deg"); x.FilteredEU = channelX.Channel.DataEu.ToArray(); List yValues = new List(); for (int i = 0; i < x.FilteredEU.Length; i++) { double c = x.FilteredEU[i]; yValues.Add(27.5D * System.Math.Sin(DegreeToRadian(c))); } DTS.Slice.Control.Event.Module.Channel.CalculatedChannel cc = new DTS.Slice.Control.Event.Module.Channel.CalculatedChannel( "Shearing Displacement", DTS.Slice.Control.Event.Module.Channel.CalculatedChannel.XUnits.msec, "mm", new double[0], yValues.ToArray(), DTS.Slice.Control.Event.Module.Channel.CalculatedChannel.Operation.ImportedCSV, 0, channelX.Channel.ParentModule); ReviewTestChannel rtc = new ReviewTestChannel(cc, channelX.ParentTest); var g = GetGraph(ReportBase.KnownGraphs.LWR_LEG_TRL_ShearDisplacement.ToString()); g.SetReviewTestChannel(ShearingDisplacementId, rtc); } catch (System.Exception) { } base.DrawGraph(graph, chart); } break; default: base.DrawGraph(graph, chart); break; } } } }