Control infrastructure. In an embodiment, the infrastructure comprises a script execution module that comprises a compiler that compiles scripts, having instructions that reference device properties, into virtual-machine programs, a virtual machine that executes virtual-machine programs, and a script manager that stores scripts, retrieves scripts, and loads scripts into the compiler. In addition, the infrastructure may comprise gateway(s), communicatively connected to physical device(s). The gateway(s) may each comprise processor(s), driver(s) that each communicate with at least one physical device using a communication protocol to read and / or write device properties of the physical device, and a device manager that maps device properties referenced in the virtual-machine programs to device properties used by the driver(s).