Showing the changes to Source/Libraries/GSF.EMAX/ControlFileStructures.cs (1 of 30 files). Show all
Unified · Split
| @@ -66,6 +66,7 @@ namespace GSF.EMAX · 65 unmodified lines | ||
| 66 | 66 | SEQUENCE_CHANNELS = 0x0051, |
| 67 | 67 | TPwrRcd = 0x0052, |
| 68 | 68 | BoardAnalogEventChannels = 0x0060, |
| 69 | + BREAKER_TRIP_TIMES = 0x0061, | |
| 69 | 70 | Unknown = 0xFFFF |
| 70 | 71 | } |
| 71 | 72 | |
| @@ -73,13 +74,13 @@ namespace GSF.EMAX · 1 unmodified line | ||
| 73 | 74 | { |
| 74 | 75 | public UInt24 id; // System ID |
| 75 | 76 | public uint time; // Time of CTL file creation |
| 76 | − public int num_of_structs; // Number of Structures in CTL file (not really) | |
| 77 | + public ushort sp_offset; // System parameters offset | |
| 77 | 78 | |
| 78 | 79 | public CTL_HEADER(BinaryReader reader) |
| 79 | 80 | { |
| 80 | 81 | id = BigEndian.ToUInt24(reader.ReadBytes(3), 0); |
| 81 | 82 | time = BigEndian.ToUInt32(reader.ReadBytes(4), 0); |
| 82 | − num_of_structs = (int)BinaryCodedDecimal.Decode((uint)BigEndian.ToUInt16(reader.ReadBytes(2), 0)); | |
| 83 | + sp_offset = BigEndian.ToUInt16(reader.ReadBytes(2), 0); | |
| 83 | 84 | |
| 84 | 85 | // Skip padding |
| 85 | 86 | reader.ReadBytes(2); |
| @@ -112,12 +113,10 @@ namespace GSF.EMAX · 26 unmodified lines | ||
| 112 | 113 | |
| 113 | 114 | offset = reader.ReadUInt32() >> 8; |
| 114 | 115 | |
| 115 | − //Debug.WriteLine("{0} [0x{1}] => Offset = 0x{2} [{3}]", | |
| 116 | + //Debug.WriteLine("{0} [0x{1}] => Offset = 0x{2}", | |
| 116 | 117 | // type, |
| 117 | 118 | // ushortValue.ToString("X").PadLeft(4, '0'), |
| 118 | − // offset.ToString("X").PadLeft(8, '0'), | |
| 119 | − // offset < length && offset > 0 ? "Valid" : "Invalid" | |
| 120 | − // ); | |
| 119 | + // offset.ToString("X").PadLeft(8, '0')); | |
| 121 | 120 | } |
| 122 | 121 | } |
| 123 | 122 | |
| @@ -457,6 +456,35 @@ namespace GSF.EMAX · 333 unmodified lines | ||
| 457 | 456 | public string value; |
| 458 | 457 | } |
| 459 | 458 | |
| 459 | + // Since this structure includes dynamically sized arrays, we manually parse structure | |
| 460 | + public struct BREAKER_TRIP_TIMES | |
| 461 | + { | |
| 462 | + public float[] breaker_trip_time; | |
| 463 | + public float[] accumulated_breaker_trip_time; | |
| 464 | + public float[] zero_trip_percent; | |
| 465 | + public float[] zero_trip_time; | |
| 466 | + | |
| 467 | + public BREAKER_TRIP_TIMES(BinaryReader reader, int channels, int analogGroups) | |
| 468 | + { | |
| 469 | + breaker_trip_time = ReadArray(reader, channels, analogGroups); | |
| 470 | + accumulated_breaker_trip_time = ReadArray(reader, channels, analogGroups); | |
| 471 | + zero_trip_percent = ReadArray(reader, channels, analogGroups); | |
| 472 | + zero_trip_time = ReadArray(reader, channels, analogGroups); | |
| 473 | + } | |
| 474 | + | |
| 475 | + private static float[] ReadArray(BinaryReader reader, int channels, int analogGroups) | |
| 476 | + { | |
| 477 | + float[] floats = new float[channels * analogGroups]; | |
| 478 | + | |
| 479 | + for (int i = 0; i < floats.Length; i++) | |
| 480 | + { | |
| 481 | + floats[i] = reader.ReadSingle(); | |
| 482 | + } | |
| 483 | + | |
| 484 | + return floats; | |
| 485 | + } | |
| 486 | + } | |
| 487 | + | |
| 460 | 488 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] |
| 461 | 489 | public struct ANLG_CHNL_NEW |
| 462 | 490 | { |