powerio_dist/dss/
defaults.rs1pub mod line {
15 pub const R1: f64 = 0.058;
18 pub const X1: f64 = 0.1206;
19 pub const R0: f64 = 0.1784;
20 pub const X0: f64 = 0.4047;
21 pub const C1_NF: f64 = 3.4;
22 pub const C0_NF: f64 = 1.6;
23 pub const LENGTH: f64 = 1.0;
24 pub const PHASES: usize = 3;
25 pub const NORMAMPS: f64 = 400.0;
26 pub const EMERGAMPS: f64 = 600.0;
27}
28
29pub mod linecode {
30 pub const NPHASES: usize = 3;
31}
32
33pub mod load {
34 pub const PHASES: usize = 3;
35 pub const KV: f64 = 12.47;
36 pub const KW: f64 = 10.0;
37 pub const PF: f64 = 0.88;
38 pub const MODEL: i64 = 1;
40}
41
42pub mod transformer {
43 pub const PHASES: usize = 3;
44 pub const WINDINGS: usize = 2;
45 pub const KV: f64 = 12.47;
46 pub const KVA: f64 = 1000.0;
47 pub const TAP: f64 = 1.0;
48 pub const PCT_R: f64 = 0.2;
49 pub const XHL: f64 = 7.0;
50 pub const XHT: f64 = 35.0;
51 pub const XLT: f64 = 30.0;
52}
53
54pub mod vsource {
55 pub const BASEKV: f64 = 115.0;
56 pub const PU: f64 = 1.0;
57 pub const ANGLE_DEG: f64 = 0.0;
58 pub const PHASES: usize = 3;
59 pub const BUS1: &str = "sourcebus";
60}
61
62pub mod capacitor {
63 pub const PHASES: usize = 3;
64 pub const KVAR: f64 = 1200.0;
65 pub const KV: f64 = 12.47;
66}
67
68pub mod reactor {
69 pub const PHASES: usize = 3;
73 pub const KVAR: f64 = 100.0;
74 pub const KV: f64 = 12.47;
75}
76
77pub mod generator {
78 pub const PHASES: usize = 3;
79 pub const KV: f64 = 12.47;
80 pub const KW: f64 = 1000.0;
81 pub const KVAR: f64 = 60.0;
82 pub const PF: f64 = 0.88;
84}
85
86pub const BASE_FREQUENCY: f64 = 60.0;
88
89pub fn unit_to_meters(code: &str) -> Option<f64> {
93 let two: String = code
94 .chars()
95 .take(2)
96 .map(|c| c.to_ascii_lowercase())
97 .collect();
98 Some(match two.as_str() {
99 "mi" => 1609.344,
100 "kf" => 304.8,
101 "km" => 1000.0,
102 "m" | "me" => 1.0,
103 "ft" => 0.3048,
104 "in" => 0.0254,
105 "cm" => 0.01,
106 "mm" => 0.001,
107 _ => return None,
108 })
109}