if (step<scaleSteps){constpc=Math.round(100-(scaleSteps-step)/scaleSteps*90);scaleVer.$fill.style.width=pc+"%";setTimeout(elapseVer,200,step+1,up);return;}
if (step<scaleSteps){constpc=Math.round((scaleSteps-step)/scaleSteps*90);scaleVer.$fill.style.width=pc+"%";setTimeout(elapseVer,20,step+1,up);return;}
constbuf=scaleVer._max;
scaleVer.max(buf*10);
scaleVer.min(buf/10);
scaleVer.step(buf/100);
}
else{
if (step<scaleSteps){constpc=Math.round(step/scaleSteps*10);scaleVer.$fill.style.width=pc+"%";setTimeout(elapseVer,200,step+1,up);return;}
if (step<scaleSteps){constpc=Math.round(step/scaleSteps*10);scaleVer.$fill.style.width=pc+"%";setTimeout(elapseVer,20,step+1,up);return;}
if (localStorage.getItem('reference'+simulator+'hor')!=null)refHor=logScaleHor?Math.sign(referencehor[i])*Math.log10(1+Math.abs(referencehor[i]*Math.LN10)):referencehor[i];
if (localStorage.getItem('reference'+simulator+'ver')!=null)refVer=logScaleVer?Math.sign(referencever[i])*Math.log10(1+Math.abs(referencever[i]*Math.LN10)):referencever[i];
// if (i<20) console.log('i', i, 'pos',pos, 'dir', compData[facility].dir[i], 'facility', facility, beta, Math.cos(beta), Math.sin(beta));
if (localStorage.getItem('reference'+simulator+'hor')!=null)$('#'+facility+"_simulatorreferencehor").attr('d',referenceDataHor.join('')+(lattice[facility].sections[0].chamber?' Z':''));
if (localStorage.getItem('reference'+simulator+'ver')!=null)$('#'+facility+"_simulatorreferencever").attr('d',referenceDataVer.join('')+(lattice[facility].sections[0].chamber?' Z':''));