|
| 1 | +package ca.wise.api.input; |
| 2 | + |
| 3 | +import lombok.AllArgsConstructor; |
| 4 | +import lombok.Builder; |
| 5 | +import lombok.Getter; |
| 6 | +import lombok.NoArgsConstructor; |
| 7 | +import lombok.Setter; |
| 8 | + |
| 9 | +/** |
| 10 | + * Options that define how and if wind gusting is applied to a scenario. |
| 11 | + */ |
| 12 | +@Builder |
| 13 | +@AllArgsConstructor |
| 14 | +@NoArgsConstructor |
| 15 | +public class GustingOptions { |
| 16 | + |
| 17 | + @Getter @Setter |
| 18 | + private Gusting gusting; |
| 19 | + |
| 20 | + /** |
| 21 | + * Must be available for time derived gusting. |
| 22 | + */ |
| 23 | + @Getter @Setter |
| 24 | + private Integer gustsPerHour; |
| 25 | + |
| 26 | + /** |
| 27 | + * Must be available for average, time derived, and ROS derived gusting. |
| 28 | + * For average gusting this is a weighted averaging of wind speed and gusting. ws = ((100-percentGusting)*ws + percentGusting*gust)/100. |
| 29 | + * For time derived gusting gusts will occur for (3600/gustPerHour*(percentGusting*100)) seconds per gust. |
| 30 | + * For ROS derived gusting gusts will occur for (3600*(percentGusting/100)) seconds per hour. |
| 31 | + */ |
| 32 | + @Getter @Setter |
| 33 | + private Double percentGusting; |
| 34 | + |
| 35 | + /** |
| 36 | + * Must be present for time and ROS derived gusting. Middle is not valid for ROS derived gusting. |
| 37 | + */ |
| 38 | + @Getter @Setter |
| 39 | + private GustBias gustBias; |
| 40 | + |
| 41 | + public enum Gusting { |
| 42 | + NO_GUSTING(0), |
| 43 | + AVERAGE_GUSTING(1), |
| 44 | + TIME_DERIVED_GUSTING(2), |
| 45 | + ROS_DERIVED_GUSTING(3); |
| 46 | + |
| 47 | + public final int value; |
| 48 | + |
| 49 | + Gusting(int value) { |
| 50 | + this.value = value; |
| 51 | + } |
| 52 | + |
| 53 | + public static Gusting fromInt(int value) { |
| 54 | + Gusting[] gusts = values(); |
| 55 | + for (int i = 0; i < gusts.length; i++) { |
| 56 | + if (gusts[i].value == value) |
| 57 | + return gusts[i]; |
| 58 | + } |
| 59 | + return NO_GUSTING; |
| 60 | + } |
| 61 | + } |
| 62 | + |
| 63 | + public enum GustBias{ |
| 64 | + MIDDLE(0), |
| 65 | + START(1), |
| 66 | + END(2); |
| 67 | + |
| 68 | + public final int value; |
| 69 | + |
| 70 | + GustBias(int value) { |
| 71 | + this.value = value; |
| 72 | + } |
| 73 | + |
| 74 | + public static GustBias fromInt(int value) { |
| 75 | + GustBias[] gusts = values(); |
| 76 | + for (int i = 0; i < gusts.length; i++) { |
| 77 | + if (gusts[i].value == value) |
| 78 | + return gusts[i]; |
| 79 | + } |
| 80 | + return START; |
| 81 | + } |
| 82 | + } |
| 83 | +} |
0 commit comments