Skip to content

Commit 62d42e2

Browse files
committed
First commit to external GitHub page.
1 parent 074574d commit 62d42e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+23099
-0
lines changed

components/__init__.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
__init__.py file to bring in the necessary portions of each of the subsystems.
4+
5+
Loads in some utilities functions as well as specific environments components
6+
that are needed. It finally imports the processes for streaming, output, and
7+
acquisition.
8+
9+
Rattlesnake Vibration Control Software
10+
Copyright (C) 2021 National Technology & Engineering Solutions of Sandia, LLC
11+
(NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
12+
Government retains certain rights in this software.
13+
14+
This program is free software: you can redistribute it and/or modify
15+
it under the terms of the GNU General Public License as published by
16+
the Free Software Foundation, either version 3 of the License, or
17+
(at your option) any later version.
18+
19+
This program is distributed in the hope that it will be useful,
20+
but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
GNU General Public License for more details.
23+
24+
You should have received a copy of the GNU General Public License
25+
along with this program. If not, see <https://www.gnu.org/licenses/>.
26+
"""
27+
28+
from .utilities import VerboseMessageQueue
29+
30+
from .user_interface import Ui,QueueContainer
31+
32+
from .ui_utilities import ControlSelect,EnvironmentSelect
33+
34+
# Import environment processes
35+
from .environments import environment_processes as all_environment_processes
36+
from .environments import environment_UIs as all_environment_UIs
37+
from .environments import ControlTypes
38+
39+
from .acquisition import acquisition_process
40+
from .output import output_process
41+
from .streaming import streaming_process

components/abstract_control_law.py

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Abstract base law that new Random Vibration Environment control laws can inherit
4+
from.
5+
6+
Rattlesnake Vibration Control Software
7+
Copyright (C) 2021 National Technology & Engineering Solutions of Sandia, LLC
8+
(NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
9+
Government retains certain rights in this software.
10+
11+
This program is free software: you can redistribute it and/or modify
12+
it under the terms of the GNU General Public License as published by
13+
the Free Software Foundation, either version 3 of the License, or
14+
(at your option) any later version.
15+
16+
This program is distributed in the hope that it will be useful,
17+
but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
GNU General Public License for more details.
20+
21+
You should have received a copy of the GNU General Public License
22+
along with this program. If not, see <https://www.gnu.org/licenses/>.
23+
"""
24+
25+
from abc import ABC,abstractmethod
26+
import numpy as np
27+
28+
class AbstractControlClass(ABC):
29+
@abstractmethod
30+
def __init__(self,specification : np.ndarray, # The specification to control to
31+
extra_control_parameters : str, # Extra parameters specified by the controller
32+
transfer_function : np.ndarray = None, # Transfer Functions
33+
buzz_cpsd : np.ndarray = None, # Buzz test in case cross terms are to be computed
34+
last_response_cpsd : np.ndarray = None, # Last Response for Error Correction
35+
last_output_cpsd : np.ndarray = None, # Last output for Drive-based control
36+
):
37+
"""
38+
Initializes the control law
39+
40+
Note that to facilitate the updating of the control law while the test
41+
is running, the init function will take all control data. If control
42+
is not running, these will be Nones.
43+
44+
Parameters
45+
----------
46+
specification : np.ndarray
47+
A complex 3d numpy ndarray with dimensions frequency lines x control
48+
channels x control channels representing the specification defined
49+
by a CPSD matrix
50+
extra_control_parameters : str
51+
A string containing any extra parameters that might need to be
52+
passed to the control law. This should be parsed by the __init__
53+
function.
54+
transfer_function : np.ndarray, optional
55+
A complex 3d numpy ndarray with dimensions frequency lines x control
56+
channels x excitation sources representing the FRF matrix measured
57+
by the system identification process between drive voltages and
58+
control response. Will only be passed if the control is switched
59+
mid-run. The default is None.
60+
buzz_cpsd : np.ndarray, optional
61+
A complex 3d numpy ndarray with dimensions frequency lines x control
62+
channels x control channels representing the CPSD matrix measured
63+
by the system identification process. Will only be passed if the
64+
control is switched mid-run. The default is None.
65+
last_response_cpsd : np.ndarray, optional
66+
A complex 3d numpy ndarray with dimensions frequency lines x control
67+
channels x control channels representing the last CPSD matrix of
68+
control channel responses. Will only be passed if the
69+
control is switched mid-run. The default is None.
70+
last_output_cpsd : np.ndarray, optional
71+
A complex 3d numpy ndarray with dimensions frequency lines x drive
72+
channels x drive channels representing the last CPSD matrix of
73+
drive outputs. Will only be passed if the
74+
control is switched mid-run. The default is None.
75+
"""
76+
pass
77+
78+
@abstractmethod
79+
def system_id_update(self,transfer_function : np.ndarray, # The transfer function from the system identification
80+
buzz_cpsd : np.ndarray # The CPSD from the system identification
81+
):
82+
"""
83+
Updates the control law with the data from the system identification
84+
85+
Parameters
86+
----------
87+
transfer_function : np.ndarray
88+
A complex 3d numpy ndarray with dimensions frequency lines x control
89+
channels x excitation sources representing the FRF matrix measured
90+
by the system identification process between drive voltages and
91+
control response
92+
buzz_cpsd : np.ndarray
93+
A complex 3d numpy ndarray with dimensions frequency lines x control
94+
channels x control channels representing the CPSD matrix measured
95+
by the system identification process
96+
97+
"""
98+
pass
99+
100+
@abstractmethod
101+
def control(self,transfer_function : np.ndarray, # The last update of the transfer function
102+
last_response_cpsd : np.ndarray = None, # Last Response for Error Correction
103+
last_output_cpsd : np.ndarray = None # Last output for Drive-based control
104+
) -> np.ndarray:
105+
"""
106+
Perform the control operations
107+
108+
Parameters
109+
----------
110+
transfer_function : np.ndarray
111+
A complex 3d numpy ndarray with dimensions frequency lines x control
112+
channels x excitation sources representing the FRF matrix measured
113+
by the system identification process between drive voltages and
114+
control response
115+
last_response_cpsd : np.ndarray
116+
A complex 3d numpy ndarray with dimensions frequency lines x control
117+
channels x control channels representing the last CPSD matrix of
118+
control channel responses. If no previous data exists (first time
119+
through control) it will be None. The default is None.
120+
last_output_cpsd : np.ndarray
121+
A complex 3d numpy ndarray with dimensions frequency lines x drive
122+
channels x drive channels representing the last CPSD matrix of
123+
drive outputs. If no previous data exists (first time
124+
through control) it will be None. The default is None.
125+
126+
Returns
127+
-------
128+
next_output_cpsd : np.ndarray
129+
A complex 3d numpy ndarray with dimensions frequency lines x drive
130+
channels x drive channels representing the new CPSD matrix of
131+
drive outputs that should be played to the shakers.
132+
"""
133+
pass

0 commit comments

Comments
 (0)