ac_power/reference_frames/
alpha_beta.rs

1// Copyright 2023 Enphase Energy, Inc and Universal Interoperability for
2// Grid-Forming Inverters (UNIFI) Consortium.
3//
4//    Licensed under the Apache License, Version 2.0 (the "License");
5//    you may not use this file except in compliance with the License.
6//    You may obtain a copy of the License at
7//
8//        http://www.apache.org/licenses/LICENSE-2.0
9//
10//    Unless required by applicable law or agreed to in writing, software
11//    distributed under the License is distributed on an "AS IS" BASIS,
12//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//    See the License for the specific language governing permissions and
14//    limitations under the License.
15
16/// Balanced stationary orthoganal reference frame (i.e. clarke)
17#[derive(Debug, Copy, Clone, PartialEq)]
18pub struct AlphaBeta<T> {
19    pub alpha: T,
20    pub beta: T,
21}
22
23/// Unbalanced stationary orthoganal reference frame (i.e. clarke)
24#[derive(Debug, Copy, Clone, PartialEq)]
25pub struct AlphaBeta0<T> {
26    pub alpha: T,
27    pub beta: T,
28    pub zero: T,
29}
30
31impl<T: From<f32>> AlphaBeta<T> {
32    pub fn zero() -> Self {
33        Self {
34            alpha: 0.0.into(),
35            beta: 0.0.into(),
36        }
37    }
38}
39
40impl<T: From<f32>> AlphaBeta0<T> {
41    pub fn zero() -> Self {
42        Self {
43            alpha: 0.0.into(),
44            beta: 0.0.into(),
45            zero: 0.0.into(),
46        }
47    }
48}