<commit_before>package edu.stanford.lcls.modelmanager.dbmodel;

import xal.sim.scenario.Scenario;

/* TODO OPENXAL Implement/port, version in SLAC library depends on XAL */
public class RunModel2 {

	public RunModel2(int modelMode) {
		// TODO Auto-generated constructor stub
	}

	public void setEmitNode(String refID) {
		// TODO Auto-generated method stub
		
	}

	public void useDesignRef(boolean refMode) {
		// TODO Auto-generated method stub
		
	}

	public Object getAccelerator() {
		// TODO Auto-generated method stub
		return null;
	}

	public void setRunMode(String syncModeDesign) {
		// TODO Auto-generated method stub
		
	}

	public void run() {
		// TODO Auto-generated method stub
		
	}

	public Scenario getScenario() {
		// TODO Auto-generated method stub
		return null;
	}
	
}<commit_msg>OXAL-458 basic runmodel implementation<commit_after>package edu.stanford.lcls.modelmanager.dbmodel;

import xal.model.IAlgorithm;
import xal.model.ModelException;
import xal.sim.scenario.AlgorithmFactory;
import xal.sim.scenario.ProbeFactory;
import xal.sim.scenario.Scenario;
import xal.smf.Accelerator;
import xal.smf.data.XMLDataManager;

/* TODO OPENXAL Implement/port, version in SLAC library depends on XAL */
public class RunModel2 {
	private int modelMode;
	private String emitNode;
	private boolean refMode;
	private String runMode;
	
	private Accelerator accelerator;
	private Scenario scenario;
	
	public RunModel2(int modelMode) {
		this.modelMode = modelMode;
	}

	public void setEmitNode(String refID) {
		this.emitNode = refID;
	}

	public void useDesignRef(boolean refMode) {
		this.refMode = refMode;
	}

	public void setRunMode(String syncModeDesign) {
		this.runMode = syncModeDesign;
		
	}

	public void run() {
		try {
			accelerator = XMLDataManager.loadDefaultAccelerator();
			scenario = Scenario.newScenarioFor(accelerator);//, elementMapping);	
			IAlgorithm tracker = AlgorithmFactory.createEnvTrackerAdapt( accelerator );
		
			scenario.setProbe(ProbeFactory.getEnvelopeProbe( accelerator.getSequence("mebt"), tracker ));
							
			scenario.setSynchronizationMode(Scenario.SYNC_MODE_DESIGN);					
			scenario.resync();
			scenario.run();
		} catch (InstantiationException|ModelException e) {
			e.printStackTrace();
		}
	}

	public Accelerator getAccelerator() {
		return accelerator;
	}

	public Scenario getScenario() {
		return scenario;
	}
	
}
{'fraction_non_alphanumeric': 0.09155816883662327, 'fraction_numerical': 0.0029399412011759767, 'mean_word_length': 4.189542483660131, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3399298', 'n_tokens_mistral': 836, 'n_tokens_neox': 749, 'n_words': 179}