|
@@ -28,10 +28,34 @@ class ScpiInstrument(object):
|
|
|
|
|
|
|
|
|
|
class InstrumentResponseMark(object):
|
|
class InstrumentResponseMark(object):
|
|
- digital_multimeter: str = "DM3068"
|
|
|
|
- digital_oscilloscope: str = "DHO1204"
|
|
|
|
- waveform_generator: str = "DG5072"
|
|
|
|
- analog_electronic_load: str = "DL3021"
|
|
|
|
|
|
+ def __init__(self):
|
|
|
|
+ self.digital_multimeter: str = "DM3068"
|
|
|
|
+ self.digital_oscilloscope: str = "DHO1204"
|
|
|
|
+ self.waveform_generator: str = "DG5072"
|
|
|
|
+ self.analog_electronic_load: str = "DL3021"
|
|
|
|
+ self.__check_env_value()
|
|
|
|
+
|
|
|
|
+ def __check_env_value(self):
|
|
|
|
+ config_digital_multimeter = self.__get_env("PLC_SIM_SERVER_DIGITAL_MULTIMETER")
|
|
|
|
+ config_digital_oscilloscope = self.__get_env("PLC_SIM_SERVER_DIGITAL_OSCILLOSCOPE")
|
|
|
|
+ config_waveform_generator = self.__get_env("PLC_SIM_SERVER_WAVEFORM_GENERATOR")
|
|
|
|
+ config_analog_electronic_load = self.__get_env("PLC_SIM_SERVER_ANALOG_ELECTRONIC_LOAD")
|
|
|
|
+ print(f"[Instrument Controller] Using config: PLC_SIM_SERVER_DIGITAL_MULTIMETER = {config_digital_multimeter}")
|
|
|
|
+ print(f"[Instrument Controller] Using config: PLC_SIM_SERVER_DIGITAL_OSCILLOSCOPE = {config_digital_oscilloscope}")
|
|
|
|
+ print(f"[Instrument Controller] Using config: PLC_SIM_SERVER_WAVEFORM_GENERATOR = {config_waveform_generator}")
|
|
|
|
+ print(f"[Instrument Controller] Using config: PLC_SIM_SERVER_ANALOG_ELECTRONIC_LOAD = {config_analog_electronic_load}")
|
|
|
|
+ if config_digital_multimeter is not None:
|
|
|
|
+ self.digital_multimeter = config_digital_multimeter
|
|
|
|
+ if config_digital_oscilloscope is not None:
|
|
|
|
+ self.digital_oscilloscope = config_digital_oscilloscope
|
|
|
|
+ if config_waveform_generator is not None:
|
|
|
|
+ self.waveform_generator = config_waveform_generator
|
|
|
|
+ if config_analog_electronic_load is not None:
|
|
|
|
+ self.analog_electronic_load = config_analog_electronic_load
|
|
|
|
+
|
|
|
|
+ @staticmethod
|
|
|
|
+ def __get_env(name: str) -> Optional[str]:
|
|
|
|
+ return os.environ.get(name, None)
|
|
|
|
|
|
|
|
|
|
class InstrumentControllerConfig(object):
|
|
class InstrumentControllerConfig(object):
|
|
@@ -137,7 +161,6 @@ class InstrumentController(object):
|
|
return None, None
|
|
return None, None
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
class FloatServer:
|
|
class FloatServer:
|
|
def __init__(self, name: Optional[str] = None):
|
|
def __init__(self, name: Optional[str] = None):
|
|
self.name: Optional[str] = name
|
|
self.name: Optional[str] = name
|
|
@@ -348,7 +371,7 @@ class DigitalOscilloscopeService(object):
|
|
self.__stream_url: Optional[str] = None
|
|
self.__stream_url: Optional[str] = None
|
|
self.__screenshot_frame = None
|
|
self.__screenshot_frame = None
|
|
self.__img_empty = np.zeros((500, 500, 3), dtype=np.uint8)
|
|
self.__img_empty = np.zeros((500, 500, 3), dtype=np.uint8)
|
|
- self.__img_empty [:, :] = [255, 255, 255] # BGR
|
|
|
|
|
|
+ self.__img_empty[:, :] = [255, 255, 255] # BGR
|
|
|
|
|
|
def keep_listening(self, realtime_terminal_output: bool = False,
|
|
def keep_listening(self, realtime_terminal_output: bool = False,
|
|
stream_port: Optional[int] = None, stream_host: str = "0.0.0.0"):
|
|
stream_port: Optional[int] = None, stream_host: str = "0.0.0.0"):
|