Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
232 commits
Select commit Hold shift + click to select a range
f802122
uppgrade to netcore 9 to perpare to move to gemstone
gcsantos-gpa Jan 19, 2026
c43d721
update and addition of packages
gcsantos-gpa Jan 19, 2026
f69b8bd
bulk change of usings
gcsantos-gpa Jan 19, 2026
9db3e9d
replace connection string with gemstone settings
gcsantos-gpa Jan 19, 2026
d340d37
add alternative local library for replacing old libraries that used t…
gcsantos-gpa Jan 19, 2026
2285480
update to be compatible with netcore 9
gcsantos-gpa Jan 20, 2026
2e3701c
additional required xda model imports
gcsantos-gpa Jan 20, 2026
d851799
fix to work with core 9
gcsantos-gpa Jan 20, 2026
aa2fcbb
migrated to netcore
gcsantos-gpa Jan 20, 2026
5e33f8a
change to migrate, security is a concern for later
gcsantos-gpa Jan 20, 2026
e066516
model additions for analysis controller
gcsantos-gpa Jan 20, 2026
1c80d1a
convert to net core 9
gcsantos-gpa Jan 20, 2026
a01ed95
update to netcore 9
gcsantos-gpa Jan 20, 2026
69eda93
cleanedup imports
gcsantos-gpa Jan 20, 2026
1333508
removing because security will need to be redone and this relies on G…
gcsantos-gpa Jan 20, 2026
3ca4cd6
migrated web components to wwwroot for easier setup in startup due to…
gcsantos-gpa Jan 28, 2026
54a67c4
change to use gemstone class for reflection
gcsantos-gpa Jan 28, 2026
c2bb405
replace auth with tempauth
gcsantos-gpa Jan 28, 2026
8464c7b
changes to migrate app startup to aspnetcore
gcsantos-gpa Jan 28, 2026
a5d3355
removed webgrease bundling, is not compatable with aspnetcore
gcsantos-gpa Jan 28, 2026
b2a7593
handle errors is taken care of by startup/program
gcsantos-gpa Jan 28, 2026
3fdbba5
route registration has been migrated to useendpoints as per microsoft…
gcsantos-gpa Jan 28, 2026
7c139a5
changed to be compatable with gemstone
gcsantos-gpa Jan 28, 2026
66d4ca4
removed uneeded files
gcsantos-gpa Jan 28, 2026
b2eac6f
removed uneeded extension, added static file function for providing a…
gcsantos-gpa Jan 28, 2026
e436733
added needed iis options
gcsantos-gpa Jan 28, 2026
1c6a80a
removed, most of this is covered by gemstone.configuration
gcsantos-gpa Jan 28, 2026
c627f48
removed due to removing appmodel (is not needed by frontend)
gcsantos-gpa Jan 28, 2026
fb6ff2c
removed isAdmin
gcsantos-gpa Jan 28, 2026
d5e3e54
added systemsettings model object
gcsantos-gpa Jan 28, 2026
2c449c0
added auth attribute to home controller
gcsantos-gpa Jan 28, 2026
0e877d1
removed, replaced by SystemSettings
gcsantos-gpa Jan 28, 2026
5a8e32f
functionality moved to program/startup
gcsantos-gpa Jan 28, 2026
2b8bdf4
settings are handled by gemstone.configuration
gcsantos-gpa Jan 28, 2026
e970c9f
moved some js to npm installation
gcsantos-gpa Feb 4, 2026
525dece
Add eventStat for CSVController
gcsantos-gpa Feb 5, 2026
2e4f930
add PQDS project for CSV Download
gcsantos-gpa Feb 5, 2026
1cabe7f
replace CSV IHttpHandler with aspnetcore compatible controller
gcsantos-gpa Feb 5, 2026
2afd977
add pqds project to solution
gcsantos-gpa Feb 5, 2026
f3f815a
fix settings pull
gcsantos-gpa Feb 5, 2026
200008f
fix bug where streamwriter closing will close the output filestream, …
gcsantos-gpa Feb 5, 2026
8f1ca2e
bugfix to reset stream position
gcsantos-gpa Feb 5, 2026
0577900
bug exists where datagroup has no asset, this change also lets us cut…
gcsantos-gpa Feb 5, 2026
f96a14b
update to new uri for download
gcsantos-gpa Feb 5, 2026
2a714ba
change bootstrap to be npm loaded
gcsantos-gpa Feb 5, 2026
1134607
added to provide jquery through webpack
gcsantos-gpa Feb 5, 2026
949b969
added builddev for easier dev without doing ci everytime
gcsantos-gpa Feb 5, 2026
80b48f0
added popper to npm instead of html load
gcsantos-gpa Feb 5, 2026
f22d427
removed jquery from npm since webpack takes care of it
gcsantos-gpa Feb 5, 2026
7912d9c
we get styled from gpa-gemstone, no need to install it seperately
gcsantos-gpa Feb 5, 2026
c261634
revert accidental removal
gcsantos-gpa Feb 5, 2026
7294396
update lock
gcsantos-gpa Feb 5, 2026
8066e19
remove unneeded entry points
gcsantos-gpa Feb 5, 2026
a7968c3
remove uneeded js files from project
gcsantos-gpa Feb 5, 2026
8e2d59f
we have manually generated assembly info, no need to automate it
gcsantos-gpa Feb 5, 2026
5d8999d
added required nuget packages for project
gcsantos-gpa Feb 5, 2026
52d93b2
updated info
gcsantos-gpa Feb 6, 2026
e4a7424
replace fault specifics with controller
gcsantos-gpa Feb 6, 2026
3010e38
changed to btndropdown gemstone component
gcsantos-gpa Feb 6, 2026
2d57afe
upgraded frontend gemstone version
gcsantos-gpa Feb 6, 2026
33e5e53
fix breaking gemstone changes
gcsantos-gpa Feb 6, 2026
b560e22
added modal as a replacement to old ashx webpage
gcsantos-gpa Feb 6, 2026
8e1b46e
updated hover provider to have a state like interface
gcsantos-gpa Feb 6, 2026
5c4f825
removal of viewbag variables, they won't trigger react rerenders...
gcsantos-gpa Feb 6, 2026
c2a6c78
clean up logic imports
gcsantos-gpa Feb 6, 2026
d1575bb
update see with hover provider changes
gcsantos-gpa Feb 6, 2026
576801b
added fault specifics state
gcsantos-gpa Feb 6, 2026
415de1e
removed event slice to de-slicify and simplify see logic
gcsantos-gpa Feb 6, 2026
76a7a28
removed hoverprovider from see project
gcsantos-gpa Feb 6, 2026
e8d730d
replace event info slice with event provider
gcsantos-gpa Feb 6, 2026
36dcf8d
removing eventID from context since so many components use it and not…
gcsantos-gpa Feb 9, 2026
b4995af
fix issue where intellisense wouldn't work with children right always
gcsantos-gpa Feb 9, 2026
457c1ca
changed props to be inline with outside changes
gcsantos-gpa Feb 9, 2026
3eafd13
changed eventID to be a state pulled from querystring
gcsantos-gpa Feb 9, 2026
cc922e3
added eventprovider
gcsantos-gpa Feb 9, 2026
d1e1dba
removed var declarations
gcsantos-gpa Feb 9, 2026
6f5be4b
remove event state from store state
gcsantos-gpa Feb 9, 2026
903cdb4
removed moment formating const, unused
gcsantos-gpa Feb 9, 2026
515981c
renamed IEventData to be more consistent
gcsantos-gpa Feb 9, 2026
3250434
cleaned up logic
gcsantos-gpa Feb 9, 2026
1a440f9
changed to use context
gcsantos-gpa Feb 9, 2026
cb6d945
replace with event context
gcsantos-gpa Feb 9, 2026
2da0ddb
moved files into requests since they do not interact with the store s…
gcsantos-gpa Feb 9, 2026
34fd999
migration of query string, it has nothing to do with settings
gcsantos-gpa Feb 9, 2026
2f136a6
moved navbar to its own folder to cleave out components
gcsantos-gpa Feb 9, 2026
46fbe6d
code cleanup to make navbar easier to read
gcsantos-gpa Feb 9, 2026
70bbc21
change to non-deprecated tooltip
gcsantos-gpa Feb 9, 2026
415ad11
seperate out plottable
gcsantos-gpa Feb 9, 2026
c8a89dd
seperate navigation
gcsantos-gpa Feb 9, 2026
0f358be
seperate out component
gcsantos-gpa Feb 9, 2026
a3ec8b8
seperate widget section
gcsantos-gpa Feb 9, 2026
751b17d
cleanup navbar components
gcsantos-gpa Feb 9, 2026
7a60ad9
update project file
gcsantos-gpa Feb 9, 2026
f00efd3
move data slice function into new files
gcsantos-gpa Feb 9, 2026
c82aeee
add settimelimit function to provider
gcsantos-gpa Feb 9, 2026
66548dd
made function external to reuse later
gcsantos-gpa Feb 9, 2026
5bc4eff
moved updatecycle limits
gcsantos-gpa Feb 9, 2026
bcb7d21
added ResetZoom and SetFFT to context
gcsantos-gpa Feb 9, 2026
7e17fe8
changed to clone deep to avoid issues
gcsantos-gpa Feb 9, 2026
93e440b
added dispatch for functions, is in mutable ref to not cause rerender…
gcsantos-gpa Feb 9, 2026
16d7154
added setunits and setzoomedlimits
gcsantos-gpa Feb 10, 2026
b128803
cleanup some return typings
gcsantos-gpa Feb 10, 2026
4932110
added more things to context from slice
gcsantos-gpa Feb 10, 2026
c144eeb
migrated showFFTPlot since its dependent on datacontext state
gcsantos-gpa Feb 11, 2026
477b5a8
split context in twain to prevent functions that only use functions f…
gcsantos-gpa Feb 11, 2026
431d5e5
removed function, only used in one place and it was reliant on state …
gcsantos-gpa Feb 11, 2026
8fece2f
changed to mutate instead of clone due to some functions calling mult…
gcsantos-gpa Feb 11, 2026
d82d1a4
removed slice, replaced with context
gcsantos-gpa Feb 12, 2026
5527cd4
rework options to be simpler
gcsantos-gpa Feb 12, 2026
6442ff1
replacing of analytic slice in components
gcsantos-gpa Feb 12, 2026
a9c3b4b
changes to store and global from previous changes
gcsantos-gpa Feb 12, 2026
07fc454
remove imports that are not needed
gcsantos-gpa Feb 12, 2026
d1ca0b9
moved addplot
gcsantos-gpa Feb 12, 2026
d723b25
change to use functions over raw state due to preventing race conditions
gcsantos-gpa Feb 12, 2026
66398d7
removeplot
gcsantos-gpa Feb 13, 2026
8b0085c
removed reducer since its handled in useEffect
gcsantos-gpa Feb 13, 2026
c77ff30
finish replacing slice
gcsantos-gpa Feb 13, 2026
83aff5c
moved overlapping event logic to data
gcsantos-gpa Feb 16, 2026
059c992
finished context refactor
gcsantos-gpa Feb 16, 2026
e372708
remove eventID as props since these will now live outside of where id…
gcsantos-gpa Feb 16, 2026
227f7cc
removed duplicate state
gcsantos-gpa Feb 16, 2026
75af19a
added additional functions to git rid of circular dep
gcsantos-gpa Feb 16, 2026
1e4449d
added event id to context
gcsantos-gpa Feb 16, 2026
f69e6d7
rearranged data flow in top level to work with contexts
gcsantos-gpa Feb 16, 2026
e4661d1
updated global and store
gcsantos-gpa Feb 16, 2026
1ba874a
fix barchartbase to work with contexts
gcsantos-gpa Feb 16, 2026
fe321b3
updated line chart to use contexts
gcsantos-gpa Feb 16, 2026
67485f6
update navbar for contexts
gcsantos-gpa Feb 16, 2026
13919cc
fixed issues in widget section
gcsantos-gpa Feb 16, 2026
1c43e11
updated components with contexts
gcsantos-gpa Feb 16, 2026
749ef59
rearange and fix top level component
gcsantos-gpa Feb 16, 2026
4a18ebc
updated jquery widgets to use context
gcsantos-gpa Feb 17, 2026
a8ed4c6
fix typing
gcsantos-gpa Feb 17, 2026
7d80775
convert to use contexts
gcsantos-gpa Feb 17, 2026
ed8ded8
readded export prop
gcsantos-gpa Feb 17, 2026
e3a08c9
fix removing plotkeys from expression
gcsantos-gpa Feb 17, 2026
6640ebd
fixed plot utilities to use context instead of globals
gcsantos-gpa Feb 17, 2026
5e50da5
added lint plugin
gcsantos-gpa Feb 17, 2026
8c197c0
updated project file
gcsantos-gpa Feb 17, 2026
6df081e
readded some globals for intial data loading
gcsantos-gpa Feb 19, 2026
d11476e
updating querystring to actually work
gcsantos-gpa Feb 19, 2026
e4cef68
fixed nullish check to work on nulls
gcsantos-gpa Feb 19, 2026
e30cc23
added check for settings being undefined
gcsantos-gpa Feb 19, 2026
a87030a
fixed handles being swapped
gcsantos-gpa Feb 19, 2026
917d5ea
fixed null check
gcsantos-gpa Feb 19, 2026
c440b09
fixed checks
gcsantos-gpa Feb 19, 2026
3756009
added globals to global def
gcsantos-gpa Feb 19, 2026
ffe9da3
changed logo
gcsantos-gpa Feb 19, 2026
e677a21
cleanup
gcsantos-gpa Feb 20, 2026
6d8029e
revert change on analytic
gcsantos-gpa Feb 20, 2026
2138a7a
update components to gemstone
gcsantos-gpa Feb 20, 2026
0ea2b7c
replaced hover props with hover state, since parents really shouldn't…
gcsantos-gpa Feb 20, 2026
a6c3a06
updated dropdown
gcsantos-gpa Feb 20, 2026
f50bae7
updated project
gcsantos-gpa Feb 20, 2026
09508ce
add strictnullchecks
prestoncraw Apr 6, 2026
a165d1f
Fix all build errors related to the strictnullChecks
prestoncraw Apr 6, 2026
026f14a
Fix incorrect typings
prestoncraw Apr 7, 2026
0476065
fix typo
prestoncraw Apr 7, 2026
0c19d99
fix nre
prestoncraw Apr 7, 2026
3f6065c
typing cleanup
prestoncraw May 1, 2026
0ec09b5
Split monolithic context into seperate contexts
prestoncraw May 1, 2026
a89bbdd
Eliminate ID-string D3 selects with a ref
prestoncraw May 1, 2026
30e5b75
extract pure funcs from linechart base
prestoncraw May 7, 2026
47b870b
lint fixes
prestoncraw May 7, 2026
24e25c5
Seperate monolithic LineChartBase into seperate componets based on SR…
prestoncraw May 8, 2026
fc9daf5
Utilize gemstone components for EventInfo
prestoncraw May 8, 2026
5e6d610
Rename folder
prestoncraw May 8, 2026
9fbcc0d
cleanup deps + fix vulns
prestoncraw May 8, 2026
133c8f3
remove redundant func
prestoncraw May 8, 2026
c046fbc
Rework BarChart to take structure of LineChart + create shared utils
prestoncraw May 12, 2026
2c49a92
Split Legend up based on SRP
prestoncraw May 12, 2026
802090a
add csproj entries
prestoncraw May 12, 2026
0f75631
fix placement/evt propagation for inception/duration overlay
prestoncraw May 12, 2026
a61932b
Split SettingWindow into seperate components
prestoncraw May 12, 2026
0c112de
Fix issue with settings not persisting due to type mismatch
prestoncraw May 12, 2026
e586d80
Minor cleanup
prestoncraw May 12, 2026
967aeb7
Fix issue causing duplicate requests
prestoncraw May 12, 2026
4333583
Fix fault tbale
prestoncraw May 12, 2026
3f900fe
Add explicit query to fix dup column issue
prestoncraw May 12, 2026
bc6280b
Revert typing change
prestoncraw May 13, 2026
7dec4eb
add additional checks for defined accessor
prestoncraw May 13, 2026
e733f43
fix setter for limit settings
prestoncraw May 13, 2026
9250590
fix finnicky panning action
prestoncraw May 13, 2026
da14242
Fix logic so that rectangle zoomMode has the same effects as time zoo…
prestoncraw May 14, 2026
c491389
Fix sizing bug causing uneeded scrollbar
prestoncraw May 14, 2026
629e895
multiline plotTypes
prestoncraw May 14, 2026
db6dad1
fix plot sizing issue when drawer sizes changes
prestoncraw May 14, 2026
92187a6
Utilize grid layout for tooltip widgets and fix multiple layout issues
prestoncraw May 15, 2026
9d6373f
fix 10px hoverline mismatch
prestoncraw May 15, 2026
931b376
Fix selected line marker to use correct point
prestoncraw May 15, 2026
459da2e
OSEEE-47 -- fix disabled tooltips cleanup uneeded attributes
prestoncraw May 15, 2026
c206648
OSEE-48 -- fix timezone mismatch
prestoncraw May 15, 2026
c31fe82
OSEE-49 -- Change ordering of plots in analytics/mainPage/Settings to…
prestoncraw May 15, 2026
c8b5e55
OSEE-46 change hoverline based on zoomMode
prestoncraw May 15, 2026
21758ed
OSEE-45 -- Change Station labels to substation
prestoncraw May 15, 2026
0995c57
Revert label change
prestoncraw May 15, 2026
d4663c4
OSEE-52 Fix backwards condition
prestoncraw May 15, 2026
ccdc71a
Fix stats icon to actually show options and adjust layout in StatsWidget
prestoncraw May 15, 2026
5d37591
Add back WaveformViews settings and remove dead code
prestoncraw May 15, 2026
a5481be
Move component to better locaiton
prestoncraw May 15, 2026
52f5a21
OSEE-59 Utilize homePath for redirection
prestoncraw May 20, 2026
99dba1d
add status tracking to unhandled network requests
prestoncraw May 20, 2026
898bca0
add error alerts whenever network requests fail
prestoncraw May 20, 2026
3367e5b
Add loading icons when requests are loading
prestoncraw May 20, 2026
ea3e69f
Add logic to set SelectedOverlappingEvents from queryParams
prestoncraw May 21, 2026
e5d7fbf
OSEE-62 Add ErrorBoundaries to widgets to prevent whitescreens
prestoncraw May 21, 2026
0db9d27
increase maxHeight for logo
prestoncraw May 21, 2026
dfc4d95
OSEE-44 add equal spacing to info pills and same textOverflow styling
prestoncraw May 21, 2026
449ee68
OSEE-57 Cleanup and make the trace/tooltip/analytics labels more cons…
prestoncraw May 21, 2026
c6aee3f
Improve label
prestoncraw May 22, 2026
0ab7344
Improve start time label
prestoncraw May 22, 2026
a02c73b
OSEE-65 Fix overlapping waveform limits
prestoncraw May 22, 2026
6b7f45e
OSEE-64 Add no data alerts to widgets
prestoncraw May 22, 2026
b8850b3
OSEE-63 Ensure FFTTable has a sticky header
prestoncraw May 22, 2026
0630245
add logic to delete requests from store one completed
prestoncraw May 29, 2026
e878da3
Fix non truthy values in conditions
prestoncraw May 29, 2026
e115fa5
Reduce temporary allocations when computing plot limits
prestoncraw May 29, 2026
64f5d3d
Limit rendered line points to visible range
prestoncraw May 29, 2026
2820307
Fix hover line lag on large datasets by isolating the overlay onto it…
prestoncraw May 29, 2026
72b696c
Fix zoom window lag by rendering the zoom rect in the overlay SVG ins…
prestoncraw May 29, 2026
d23c9c4
update gemstone
prestoncraw May 29, 2026
b300609
change folder casing to match others
prestoncraw May 29, 2026
60194fe
Label adjustment
prestoncraw May 29, 2026
811975e
fix initial unit selection
prestoncraw May 29, 2026
06439d8
Add auto suffix when in unit is auto
prestoncraw May 29, 2026
fccaaa2
center icons in trace btns
prestoncraw Jun 1, 2026
5a8d63f
Add DigitalLegend for when DigitalWaveform is selected
prestoncraw Jun 1, 2026
986a70b
Adjust info alert txt
prestoncraw Jun 2, 2026
551a997
OSEE-66 Fix styling of colorpicker
prestoncraw Jun 9, 2026
9c897b5
Utilize radion button component from gemstone
prestoncraw Jun 9, 2026
6edd6a2
OSEE-51 - Fix styling/labeling on table
prestoncraw Jun 9, 2026
9afd168
Fix disconnect between state/queryStr
prestoncraw Jun 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,4 @@ readme.txt
**/src/OpenSEE/NUglify.dll
**/src/OpenSEE/web.config.backup

**/src/OpenSee/scripts/*.js
**/src/OpenSee/wwwroot/scripts/*.js
122 changes: 122 additions & 0 deletions src/Libraries/FaultAlgorithms/Conductor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
//*********************************************************************************************************************
// Conductor.cs
// Version 1.1 and subsequent releases
//
// Copyright © 2013, Grid Protection Alliance. All Rights Reserved.
//
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
// The GPA licenses this file to you under the Eclipse Public License -v 1.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a copy of the License at:
//
// http://www.opensource.org/licenses/eclipse-1.0.php
//
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
// License for the specific language governing permissions and limitations.
//
// --------------------------------------------------------------------------------------------------------------------
//
// Version 1.0
//
// Copyright 2012 ELECTRIC POWER RESEARCH INSTITUTE, INC. All rights reserved.
//
// openFLE ("this software") is licensed under BSD 3-Clause license.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// • Redistributions of source code must retain the above copyright notice, this list of conditions and
// the following disclaimer.
//
// • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
// the following disclaimer in the documentation and/or other materials provided with the distribution.
//
// • Neither the name of the Electric Power Research Institute, Inc. (“EPRI”) nor the names of its contributors
// may be used to endorse or promote products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL EPRI BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//
// This software incorporates work covered by the following copyright and permission notice:
//
// • TVA Code Library 4.0.4.3 - Tennessee Valley Authority, tvainfo@tva.gov
// No copyright is claimed pursuant to 17 USC § 105. All Other Rights Reserved.
//
// Licensed under TVA Custom License based on NASA Open Source Agreement (TVA Custom NOSA);
// you may not use TVA Code Library except in compliance with the TVA Custom NOSA. You may
// obtain a copy of the TVA Custom NOSA at http://tvacodelibrary.codeplex.com/license.
//
// TVA Code Library is provided by the copyright holders and contributors "as is" and any express
// or implied warranties, including, but not limited to, the implied warranties of merchantability
// and fitness for a particular purpose are disclaimed.
//
//*********************************************************************************************************************
//
// Code Modification History:
// -------------------------------------------------------------------------------------------------------------------
// 06/14/2012 - Stephen C. Wills, Grid Protection Alliance
// Generated original version of source code.
//
//*********************************************************************************************************************

namespace FaultAlgorithms
{
/// <summary>
/// Contains data for both the voltage
/// and current on a conductor.
/// </summary>
public class Conductor
{
#region [ Members ]

// Fields

/// <summary>
/// One cycle of voltage data.
/// </summary>
public Cycle V;

/// <summary>
/// One cycle of current data.
/// </summary>
public Cycle I;

#endregion

#region [ Constructors ]

/// <summary>
/// Creates a new instance of the <see cref="Conductor"/> class.
/// </summary>
public Conductor()
{
V = new Cycle();
I = new Cycle();
}

/// <summary>
/// Creates a new instance of the <see cref="Conductor"/> class.
/// </summary>
/// <param name="cycleIndex">The index of the cycle to be calculated.</param>
/// <param name="sampleRateDivisor">The value to divide from the sample rate to determine the starting location of the cycle.</param>
/// <param name="frequency">The frequency of the sine wave during this cycle.</param>
/// <param name="voltageData">The voltage data points.</param>
/// <param name="currentData">The current data points.</param>
public Conductor(int cycleIndex, int sampleRateDivisor, double frequency, MeasurementData voltageData, MeasurementData currentData)
{
int vStart = cycleIndex * (voltageData.SampleRate / sampleRateDivisor);
int iStart = cycleIndex * (currentData.SampleRate / sampleRateDivisor);
V = new Cycle(vStart, frequency, voltageData);
I = new Cycle(iStart, frequency, currentData);
}

#endregion
}
}
200 changes: 200 additions & 0 deletions src/Libraries/FaultAlgorithms/Cycle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
//*********************************************************************************************************************
// Cycle.cs
// Version 1.1 and subsequent releases
//
// Copyright � 2013, Grid Protection Alliance. All Rights Reserved.
//
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
// The GPA licenses this file to you under the Eclipse Public License -v 1.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a copy of the License at:
//
// http://www.opensource.org/licenses/eclipse-1.0.php
//
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
// License for the specific language governing permissions and limitations.
//
// --------------------------------------------------------------------------------------------------------------------
//
// Version 1.0
//
// Copyright 2012 ELECTRIC POWER RESEARCH INSTITUTE, INC. All rights reserved.
//
// openFLE ("this software") is licensed under BSD 3-Clause license.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// � Redistributions of source code must retain the above copyright notice, this list of conditions and
// the following disclaimer.
//
// � Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
// the following disclaimer in the documentation and/or other materials provided with the distribution.
//
// � Neither the name of the Electric Power Research Institute, Inc. (�EPRI�) nor the names of its contributors
// may be used to endorse or promote products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL EPRI BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//
// This software incorporates work covered by the following copyright and permission notice:
//
// � TVA Code Library 4.0.4.3 - Tennessee Valley Authority, tvainfo@tva.gov
// No copyright is claimed pursuant to 17 USC � 105. All Other Rights Reserved.
//
// Licensed under TVA Custom License based on NASA Open Source Agreement (TVA Custom NOSA);
// you may not use TVA Code Library except in compliance with the TVA Custom NOSA. You may
// obtain a copy of the TVA Custom NOSA at http://tvacodelibrary.codeplex.com/license.
//
// TVA Code Library is provided by the copyright holders and contributors "as is" and any express
// or implied warranties, including, but not limited to, the implied warranties of merchantability
// and fitness for a particular purpose are disclaimed.
//
//*********************************************************************************************************************
//
// Code Modification History:
// -------------------------------------------------------------------------------------------------------------------
// 05/23/2012 - J. Ritchie Carroll, Grid Protection Alliance
// Generated original version of source code.
//
//*********************************************************************************************************************

using Gemstone;
using Gemstone.Numeric;
using Gemstone.Numeric.Analysis;
using Gemstone.Units;

namespace FaultAlgorithms
{
/// <summary>
/// Represents a cycle of single phase power frequency-domain data.
/// </summary>
public class Cycle
{
#region [ Members ]

// Constants
private const double PiOverTwo = Math.PI / 2.0D;

// Fields

/// <summary>
/// The actual frequency of the cycle in hertz.
/// </summary>
public double Frequency;

/// <summary>
/// The complex number representation of the RMS phasor.
/// </summary>
public ComplexNumber Complex;

/// <summary>
/// The most extreme data point in the cycle.
/// </summary>
public double Peak;

/// <summary>
/// The error between the sine fit and the given data values.
/// </summary>
public double Error;

#endregion

#region [ Constructors ]

/// <summary>
/// Creates a new instance of the <see cref="Cycle"/> class.
/// </summary>
public Cycle()
{
}

/// <summary>
/// Creates a new instance of the <see cref="Cycle"/> class.
/// </summary>
/// <param name="startSample">The index of the start of the cycle.</param>
/// <param name="frequency">The frequency of the measured system, in Hz.</param>
/// <param name="waveFormData">The time-domain data to be used to calculate frequency-domain values.</param>
public Cycle(int startSample, double frequency, MeasurementData waveFormData)
{
long timeStart;
double[] timeInSeconds;
double[] measurements;
SineWave sineFit;

if (startSample < 0)
throw new ArgumentOutOfRangeException("startSample");

if (startSample + waveFormData.SampleRate > waveFormData.Times.Length)
throw new ArgumentOutOfRangeException("startSample");

if (startSample + waveFormData.SampleRate > waveFormData.Measurements.Length)
throw new ArgumentOutOfRangeException("startSample");

timeStart = waveFormData.Times[startSample];
timeInSeconds = new double[waveFormData.SampleRate];
measurements = new double[waveFormData.SampleRate];

for (int i = 0; i < waveFormData.SampleRate; i++)
{
timeInSeconds[i] = Ticks.ToSeconds(waveFormData.Times[i + startSample] - timeStart);
measurements[i] = waveFormData.Measurements[i + startSample];
}

sineFit = WaveFit.SineFit(measurements, timeInSeconds, frequency);

RMS = Math.Sqrt(measurements.Select(vi => vi * vi).Average());
Phase = sineFit.Phase - PiOverTwo;
Peak = sineFit.Amplitude;
Frequency = frequency;

Error = timeInSeconds
.Select(time => sineFit.CalculateY(time))
.Zip(measurements, (calc, measurement) => Math.Abs(calc - measurement))
.Sum();
}

#endregion

#region [ Properties ]

/// <summary>
/// Root-mean-square of the <see cref="MeasurementData.Measurements"/> in the cycle.
/// </summary>
public double RMS
{
get
{
return Complex.Magnitude;
}
set
{
Complex.Magnitude = value;
}
}

/// <summary>
/// Phase angle of the start of the cycle, relative to the reference angle.
/// </summary>
public Angle Phase
{
get
{
return Complex.Angle;
}
set
{
Complex.Angle = value;
}
}

#endregion
}
}
Loading