History

Initial check-in of Unix based GSF.Identity.UserInfo (not tested)

ritchiecarroll committed 12 years ago

Commit 4e2d2361 parent 85f1ce230 files · +4691 −1446Browse files

Showing the changes to Source/Libraries/GSF.EMAX/ControlFileStructures.cs (1 of 30 files). Show all

Unified · Split

Source/Libraries/GSF.EMAX/ControlFileStructures.cs+34−6
@@ -66,6 +66,7 @@ namespace GSF.EMAX · 65 unmodified lines
6666 SEQUENCE_CHANNELS = 0x0051,
6767 TPwrRcd = 0x0052,
6868 BoardAnalogEventChannels = 0x0060,
69+ BREAKER_TRIP_TIMES = 0x0061,
6970 Unknown = 0xFFFF
7071 }
7172
@@ -73,13 +74,13 @@ namespace GSF.EMAX · 1 unmodified line
7374 {
7475 public UInt24 id; // System ID
7576 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
7778
7879 public CTL_HEADER(BinaryReader reader)
7980 {
8081 id = BigEndian.ToUInt24(reader.ReadBytes(3), 0);
8182 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);
8384
8485 // Skip padding
8586 reader.ReadBytes(2);
@@ -112,12 +113,10 @@ namespace GSF.EMAX · 26 unmodified lines
112113
113114 offset = reader.ReadUInt32() >> 8;
114115
115− //Debug.WriteLine("{0} [0x{1}] => Offset = 0x{2} [{3}]",
116+ //Debug.WriteLine("{0} [0x{1}] => Offset = 0x{2}",
116117 // type,
117118 // 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'));
121120 }
122121 }
123122
@@ -457,6 +456,35 @@ namespace GSF.EMAX · 333 unmodified lines
457456 public string value;
458457 }
459458
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+
460488 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
461489 public struct ANLG_CHNL_NEW
462490 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t