PneumaticsSimulator¶
- class lsst.ts.atpneumaticssimulator.PneumaticsSimulator(host: str, cmd_evt_port: int, telemetry_port: int)¶
Bases:
AtSimulator
Simulate the ATPneumatics system.
- Attributes:
Methods Summary
cmd_evt_connect_callback
(server)Callback function for when a cmd/evt client connects or disconnects.
Asynchronous function to call when data is read and dispatched.
configure
([m1_covers_close_time, ...])Set configuration.
disable
(*, sequence_id)Switch to sal_enums.State.DISABLED.
do_close_instrument_air_valve
(sequence_id)do_close_m1_cell_vents
(sequence_id)do_close_m1_cover
(sequence_id)do_close_master_air_supply
(sequence_id)do_m1_close_air_valve
(sequence_id)do_m1_open_air_valve
(sequence_id)do_m1_set_pressure
(sequence_id, pressure)do_m2_close_air_valve
(sequence_id)do_m2_open_air_valve
(sequence_id)do_m2_set_pressure
(sequence_id, pressure)do_open_instrument_air_valve
(sequence_id)do_open_m1_cell_vents
(sequence_id)do_open_m1_cover
(sequence_id)do_open_master_air_supply
(sequence_id)enable
(*, sequence_id)Switch to sal_enums.State.ENABLED.
fault
()Switch to sal_enums.State.FAULT.
Initialize events and telemetry.
Load the JSON schemas needed to validate the incoming and outgoing JSON messages.
Send detailed state events.
set_cell_vents_events
(closed, opened)Set m1VentsLimitSwitches, m1VentsPosition and cellVentsState events.
set_m1_cover_events
(closed, opened)Set m1CoverLimitSwitches and m1CoverState events.
standby
(*, sequence_id)Switch to sal_enums.State.STANDBY.
telemetry_connect_callback
(server)Callback function for when a tel client connects or disconnects.
Asynchronous function to call when data are read and dispatched.
Output telemetry and events that have changed
Output all telemetry data messages.
verify_data
(data)Verify the format and values of the data.
write_ack_response
(sequence_id)Write an
ACK
response.write_fail_response
(sequence_id)Write a
FAIL
response.write_noack_response
(sequence_id)Write a
NOACK
response.write_success_response
(sequence_id)Write a
SUCCESS
response.Methods Documentation
- async cmd_evt_connect_callback(server: OneClientServer) None ¶
Callback function for when a cmd/evt client connects or disconnects.
When a cmd/evt client connects, background tasks are started and events are sent. When the cmd/evt client disconnects, all background tasks get stopped.
- async cmd_evt_dispatch_callback(data: Any) None ¶
Asynchronous function to call when data is read and dispatched.
The received data is validated and then dispatched to the corresponding function as listed in
self.dispatch_dict
. If the data is invalid then anoack
response is sent back to the client and the data is not dispatched.- Parameters:
- data
dict`[`str
,typing.Any
] The data sent to the server.
- data
- async configure(m1_covers_close_time: float = 20.0, m1_covers_open_time: float = 20.0, cell_vents_close_time: float = 5.0, cell_vents_open_time: float = 1.0, m1_pressure: float = 5.0, m2_pressure: float = 6.0, main_pressure: float = 10.0, cell_load: float = 100.0) None ¶
Set configuration.
- Parameters:
- m1_covers_close_time
float
Time to close M1 mirror covers [sec].
- m1_covers_open_time
float
Time to open M1 mirror covers [sec].
- cell_vents_close_time
float
Time to close cell vents [sec].
- cell_vents_open_time
float
Time to open cell vents [sec].
- m1_pressure
float
Initial M1 air pressure [Pa].
- m2_pressure
float
Initial M2 air pressure [Pa].
- main_pressure
float
Initial main air pressure [Pa].
- cell_load
float
Initial cell load [kg].
- m1_covers_close_time
- async initialize() None ¶
Initialize events and telemetry.
instrumentState
m1CoverLimitSwitches
m1CoverState
m1SetPressure
m1State
cellVentsState (should be named m1VentsState)
m1VentsLimitSwitches
m1VentsPosition
m2SetPressure
m2State
mainValveState
powerStatus
- load_schemas() None ¶
Load the JSON schemas needed to validate the incoming and outgoing JSON messages.
- async send_detailed_state_events() None ¶
Send detailed state events.
This method is called when going to FAULT state. Subclasses may implement this such that the device specific behavior is mimicked.
- async set_cell_vents_events(closed: bool, opened: bool) None ¶
Set m1VentsLimitSwitches, m1VentsPosition and cellVentsState events.
Output any changes.
- async set_m1_cover_events(closed: bool, opened: bool) None ¶
Set m1CoverLimitSwitches and m1CoverState events.
Output any changes.
- async telemetry_connect_callback(server: OneClientServer) None ¶
Callback function for when a tel client connects or disconnects.
When a tel client connects, the telemetry loop is started. When the tel client disconnects, the telemetry loop is stopped.
- async telemetry_dispatch_callback(data: Any) None ¶
Asynchronous function to call when data are read and dispatched.
The received data is ignored since the telemetry server is only supposed to send data and not to receive any.
- Parameters:
- data
dict`[`str
,typing.Any
] The data sent to the server.
- data
- async telemetry_loop() None ¶
Output telemetry and events that have changed
Notes
Here are the telemetry topics that are output:
m1AirPressure
m2AirPressure
mainAirSourcePressure
loadCell
See
update_events
for the events that are output.
- async verify_data(data: dict[str, Any]) bool ¶
Verify the format and values of the data.
The format of the data is described at https://github.com/lsst-ts/ts_labview_tcp_json as well as in the JSON schemas in the schemas directory.
- async write_ack_response(sequence_id: int) None ¶
Write an
ACK
response.- Parameters:
- sequence_id
int
The command sequence id.
- sequence_id
- async write_fail_response(sequence_id: int) None ¶
Write a
FAIL
response.- Parameters:
- sequence_id
int
The command sequence id.
- sequence_id