diff --git a/simulator.php b/simulator.php
new file mode 100644
index 0000000000000000000000000000000000000000..a7251a68643e65d1052e0ff8c59cb0868044ef1b
--- /dev/null
+++ b/simulator.php
@@ -0,0 +1,70 @@
+<?php
+	if (!isset($_REQUEST['debug'])) header('Content-type: application/json; charset=utf-8');
+	$src = "srv-tango-sre-01.ecs.elettra.trieste.it:20000/sr/DIAGNOSTICS/bpmid_new";
+	$machine = empty($_REQUEST['machine'])? 'elettra': $_REQUEST['machine'];
+	if ($machine=="elettra2") $src = "srv-tango-ctrl-01:20000/sr/sim/srElettra2_9_4_beta";
+	if ($machine=="esrf") $src = "srv-tango-ctrl-01:20000/sr/sim/esrf";
+	if ($machine=="soleil") $src = "srv-tango-ctrl-01:20000/sr/sim/soleil";
+	if (isset($_REQUEST['src'])) {
+		$f = json_decode(file_get_contents("http://puma-01.elettra.eu/rchan.php?json&valueOnly&src=$src/fname"), true);
+		if ($machine=='soleil') {
+			$b = 0;
+			$comp = $buf = array();
+			foreach ($f as $k=>$v) {
+				if ($v == 'BEND') {$b++; $comp[$b] = array(); $f[$k] = $v.'_S'.$b.'_1'; continue;}
+				if ($b<1) {$buf[] = $v; continue;}
+				if (!isset($comp[$b][$v])) $comp[$b][$v] = 1; else $comp[$b][$v]++;
+				$f[$k] = $v.'_S'.$b.'_'.$comp[$b][$v];
+			}
+			foreach ($buf as $k=>$v) {
+				if (!isset($comp[$b][$v])) $comp[$b][$v] = 1; else $comp[$b][$v]++;
+				$f[$k] = $v.'_S'.$b.'_'.$comp[$b][$v];
+			}
+		}
+		die(json_encode($f));
+	}
+	if (isset($_REQUEST['spos'])) {
+		die(file_get_contents("http://puma-01.elettra.eu/rchan.php?json&valueOnly&src=$src/spos"));
+	}
+	if (isset($_REQUEST['angles'])) {
+		if ($machine=='esrf') die(json_encode(array(array_fill(0, 64, 0.0923248)+array_fill(64, 64, 0.00585))));
+		if ($machine=='soleil') {
+			$n = array();
+			for ($i=1; $i<=32; $i++) $n[] = "BEND_S$i";
+			die(json_encode(array(array_fill(0, 32, 0.196349540849362),$n)));
+		}
+	}
+	$xvar = 'x';
+	$yvar = 'y';
+	if (!empty($_REQUEST['param']) && in_array($_REQUEST['param'], array('beta', 'eta', 'mu', 'sigma'))) {$xvar = $_REQUEST['param'].'_'.$xvar; $yvar = $_REQUEST['param'].'_'.$yvar;}
+	$x = file_get_contents("http://puma-01.elettra.eu/rchan.php?json&valueOnly&src=$src/$xvar");
+	$y = file_get_contents("http://puma-01.elettra.eu/rchan.php?json&valueOnly&src=$src/$yvar");
+    // if ($yvar=='eta_y') {$valx = json_decode($x, true); foreach($valx as $i=>$v) {if ($i!=510) $valx[$i] = 0;} $x = json_encode($valx);}
+	if (isset($_REQUEST['debug'])) {echo "$xvar $yvar<br><br> $x<br><br>$y";}
+	die('{"sr":{"Hor":'.$x.',"Ver":'.$y.'}}');
+
+	$url = "http://puma-01.elettra.eu/panther/updater.php?read&filename=";
+	if (strpos($_SERVER['HTTP_HOST'], 'puma-01')!==false) $url = "/run/panther/";
+	if ($machine != 'elettra' && $machine != 'fermi') die('Error, unsupported machine');
+	if (isset($_REQUEST['src'])) {
+		$confsrc = "$url$machine.100.bpm.src";
+		list($trash, $data) = explode(':', file_get_contents($confsrc), 2);
+		$data = explode(',', $data);
+		$a = array_merge(...json_decode($data, true));
+		die(json_encode($data));
+	}
+	$data = strtr(file_get_contents("$url$machine.100.bpm"), ['null'=>'0']);
+	if (!isset($_REQUEST['debug'])) while (strlen($data)>1 && !is_numeric(substr($data, -1))) $data = substr($data, 0, strlen($data)-1); 
+	list($trash, $datasrc) = explode(':', $data,2);
+	if (isset($_REQUEST['debug'])) die("url: $url$machine.100.bpm<br><br>data:<br>$data<br><br>datasrc:<br>$datasrc<br>");
+	if (strpos($_SERVER['HTTP_HOST'], 'puma-01')!==false && $machine=='elettra') {
+		$d = explode(';', $datasrc);
+		die("{\"preinjector\":{\"Hor\":[".implode(',', array_slice($d, 0, 7)).'],"Ver":['.implode(',', array_slice($d, 7, 7))."]},\"bts\":{\"Hor\":[".implode(',', array_slice($d, 14, 10)).'],"Ver":['.implode(',', array_slice($d, 24, 10))."]},\"sr\":{\"Hor\":[".$d[34].'],"Ver":['.$d[35]."]}}");
+	}
+	if (strpos($_SERVER['HTTP_HOST'], 'puma-01')!==false && $machine=='fermi') {
+		$d = explode(';', $datasrc);
+		foreach ($d as $i=>$v) if ($v=='') $d[$i] = 'null';
+		die("{\"linac\":{\"Hor\":[".implode(',', array_slice($d, 0, 35)).'],"Ver":['.implode(',', array_slice($d, 35, 35))."]},\"fel1\":{\"Hor\":[".implode(',', array_slice($d, 70, 15)).'],"Ver":['.implode(',', array_slice($d, 85, 15))."]},\"fel2\":{\"Hor\":[".implode(',', array_slice($d, 100, 5)).'],"Ver":['.implode(',', array_slice($d, 105, 5))."]}}");
+	}
+	die(strtr(file_get_contents("$url$machine.100.bpm"), ['null'=>'0']));
+?>