Exemplo n.º 1
0
            first_pump = 0
        if second_pump:
            second_pump = 10
        else:
            second_pump = 0
        self._watertank.set_input(0, first_pump)
        self._watertank.set_input(1, second_pump)


if __name__ == "__main__":
    from voodoo.configuration import ConfigurationManager
    from voodoo.sessions.session_id import SessionId

    cfg_manager = ConfigurationManager()
    try:
        cfg_manager.append_path("../../../launch/sample/main_machine/main_instance/experiment_fpga/server_config.py")
    except:
        cfg_manager.append_path("../launch/sample/main_machine/main_instance/experiment_fpga/server_config.py")

    experiment = UdXilinxExperiment(None, None, cfg_manager)

    lab_session_id = SessionId("my-session-id")
    experiment.do_start_experiment()

    experiment._max_use_time = 10
    print experiment.do_send_command_to_device("REPORT_USE_TIME_LEFT")
    print experiment.do_send_command_to_device("STATE")
    print experiment.do_send_command_to_device("STATE")
    print experiment.do_should_finish()
    print experiment.do_send_command_to_device("STATE")
    print experiment.do_should_finish()
Exemplo n.º 2
0
        if second_pump:
            second_pump = 10
        else:
            second_pump = 0
        self._watertank.set_input(0, first_pump)
        self._watertank.set_input(1, second_pump)


if __name__ == "__main__":
    from voodoo.configuration import ConfigurationManager
    from voodoo.sessions.session_id import SessionId

    cfg_manager = ConfigurationManager()
    try:
        cfg_manager.append_path(
            "../../../launch/sample/main_machine/main_instance/experiment_fpga/server_config.py"
        )
    except:
        cfg_manager.append_path(
            "../launch/sample/main_machine/main_instance/experiment_fpga/server_config.py"
        )

    experiment = ElevatorExperiment(None, None, cfg_manager)

    lab_session_id = SessionId('my-session-id')
    experiment.do_start_experiment()

    experiment._max_use_time = 10
    print experiment.do_send_command_to_device("REPORT_USE_TIME_LEFT")
    print experiment.do_send_command_to_device("STATE")
    print experiment.do_send_command_to_device("STATE")
Exemplo n.º 3
0
        try:
            with weblab_api(self.ups, session_id = session_id):
                return weblab.core.server.get_user_information()
        except SessionNotFoundError:
            return None

#############################################
# 
# The code below is only used for testing
# 

if __name__ == '__main__':
    from voodoo.configuration import ConfigurationManager
    from weblab.core.server import UserProcessingServer
    cfg_manager = ConfigurationManager()
    cfg_manager.append_path('test/unit/configuration.py')

    ups = UserProcessingServer(None, None, cfg_manager, dont_start = True)

    app = Flask('weblab.core.server')
    app.config['SECRET_KEY'] = os.urandom(32)
    @app.route("/site-map")
    def site_map():
        lines = []
        for rule in app.url_map.iter_rules():
            line = str(escape(repr(rule)))
            lines.append(line)

        ret = "<br>".join(lines)
        return ret
Exemplo n.º 4
0
        </dc_output>
        <dc_output channel="25V-">
          <dc_voltage value="0"/>
          <dc_current value="0.5"/>
        </dc_output>
      </dc_outputs>
    </dcpower>
  </request>
</protocol>
"""
    from voodoo.configuration import ConfigurationManager
    from voodoo.sessions.session_id import SessionId
    cfg_manager = ConfigurationManager()
    try:
        cfg_manager.append_path(
            "../../launch/sample/main_machine/main_instance/experiment_testvisir/server_config.py"
        )
    except:
        cfg_manager.append_path(
            "../launch/sample/main_machine/main_instance/experiment_testvisir/server_config.py"
        )

    experiment = VisirTestExperiment(None, None, cfg_manager)
    lab_session_id = SessionId('my-session-id')
    cookie = json.loads(
        json.loads(experiment.do_start_experiment(lab_session_id))
        ['initial_configuration'])['cookie']

    login_request = """<protocol version="1.3">
    <login cookie="%s" keepalive="1"/>
</protocol>""" % cookie
Exemplo n.º 5
0
        return None


#############################################
# 
# The code below is only used for testing
# 

if __name__ == '__main__':
    from voodoo.configuration import ConfigurationManager
    from weblab.core.server import UserProcessingServer
    from weblab.core.i18n import initialize_i18n
    from flask_debugtoolbar import DebugToolbarExtension

    cfg_manager = ConfigurationManager()
    cfg_manager.append_path('test/unit/configuration.py')

    ups = UserProcessingServer(None, None, cfg_manager, dont_start = True)

    app = Flask('weblab.core.server')
    app.config['SECRET_KEY'] = os.urandom(32)
    app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False
    app.config['DEBUG'] = True

    @app.route("/site-map")
    def site_map():
        lines = []
        for rule in app.url_map.iter_rules():
            line = str(escape(repr(rule)))
            lines.append(line)