Skip to content

Commit

Permalink
Merge pull request #4 from nvlinhvn/linh-dev
Browse files Browse the repository at this point in the history
Modify readme in example
  • Loading branch information
nvlinhvn authored May 9, 2024
2 parents e7763b4 + 39d8ceb commit 5d7fa7b
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,29 @@ or
## 5. Example

Here’s an example of how to use HS Transform to analyze a signal with voltage disturbance and power system fault:

```
from hstransform import HyperbolicSTransform as HSTransform
# Create input signal (for example: Voltage signal)
t = np.linspace(0, 10, 100) # timeseries
V_m = 220*np.sqrt(2) # peak voltage
f_V = 50 # frequency
phi_V = 0 # phase
V_clean = V_m * np.sin(2 * np.pi * f_V * t + phi_V)
# Create voltage sag/dip (80% of the nominal voltage for 0.15 second)
V_sag = np.where((t >= 2) & (t <= 3.5), 0.5 * V_clean, V_clean)
# Create an instance of HSTransform
hs = HSTransform()
# Perform the transform
S = hs.fit_transform(time_values, input_signal)
# Plot the result
hs.plot(S)
signal = V_sag
S_transformed = st.fit_transform(t, signal)
```

![alt text](./img/power_quality_disturbance.png)
![alt text](./img/power_quality_disturbance_trajectory.png)
![alt text](./img/fault_current.png)
Expand Down

0 comments on commit 5d7fa7b

Please sign in to comment.