• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java MatlabTypeConverter类的典型用法和代码示例

java 5次浏览

本文整理汇总了Java中matlabcontrol.extensions.MatlabTypeConverter的典型用法代码示例。如果您正苦于以下问题:Java MatlabTypeConverter类的具体用法?Java MatlabTypeConverter怎么用?Java MatlabTypeConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

MatlabTypeConverter类属于matlabcontrol.extensions包,在下文中一共展示了MatlabTypeConverter类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: MatConsoleCtlScriptTaskEngineMatlab

点赞 2

import matlabcontrol.extensions.MatlabTypeConverter; //导入依赖的package包/类
public MatConsoleCtlScriptTaskEngineMatlab(final MatlabProxy octaveEngine) {
    this.matlabProxy = octaveEngine;
    this.typeConverter = new MatlabTypeConverter(matlabProxy);
    this.inputs = new MatConsoleCtlScriptTaskInputsMatlab(this);
    this.results = new MatConsoleCtlScriptTaskResultsMatlab(this);
    if (IScriptTaskRunnerMatlab.LOG.isDebugEnabled()) {
        expressionEnding = ";";
    } else {
        expressionEnding = "";
    }
}
 

开发者ID:subes,
项目名称:invesdwin-context-matlab,
代码行数:12,
代码来源:MatConsoleCtlScriptTaskEngineMatlab.java

示例2: getTypeConverter

点赞 2

import matlabcontrol.extensions.MatlabTypeConverter; //导入依赖的package包/类
public MatlabTypeConverter getTypeConverter() {
    return typeConverter;
}
 

开发者ID:subes,
项目名称:invesdwin-context-matlab,
代码行数:4,
代码来源:MatConsoleCtlScriptTaskEngineMatlab.java

示例3: flowAnalysis

点赞 2

import matlabcontrol.extensions.MatlabTypeConverter; //导入依赖的package包/类
@Override
public boolean flowAnalysis(FlowNetwork net){
    logger.debug("calculating loadflow in network with Matpower");
    this.net = net;
    
    ArrayList<Node> nodes = new ArrayList<>(this.net.getNodes());
    ArrayList<Link> links = new ArrayList<>(this.net.getLinks());
    
    if(nodes.size() == 1)
        return false;
    
    busesPowerFlowInfo = this.getBuses(nodes);
    generatorsPowerFlowInfo = this.getGenerators(nodes);
    branchesPowerFlowInfo = this.getBranches(links);
    costsPowerFlowInfo = this.getGenerationCosts(nodes);
    
    try{
        // Connect to Matlab
        MatlabProxy proxy = factory.getProxy();

        // Conversion object to send and retrieve arrays to and from matlab
        MatlabTypeConverter processor = new MatlabTypeConverter(proxy);

        // Send data to matlab to create matpower struct
        proxy.eval(caseFile + ".version = '2'");
        proxy.eval(caseFile + ".baseMVA = [100]");
        processor.setNumericArray(caseFile + ".bus", new MatlabNumericArray(getBusesPowerFlowInfo(), null));
        processor.setNumericArray(caseFile + ".gen", new MatlabNumericArray(getGeneratorsPowerFlowInfo(), null));
        processor.setNumericArray(caseFile + ".branch", new MatlabNumericArray(getBranchesPowerFlowInfo(), null));
        processor.setNumericArray(caseFile + ".gencost", new MatlabNumericArray(getCostsPowerFlowInfo(), null));
        
        switch((PowerFlowType)getDomainParameters().get(PowerBackendParameter.FLOW_TYPE)){
            case AC:
                proxy.eval("result = runpf(" + caseFile + ");");
                break;
            case DC:
                proxy.eval("result = rundcpf(" + caseFile + ");");
                break;
            default:
                logger.debug("Power flow type is not recognized.");
        }
        if(((double[]) proxy.getVariable("result.success"))[0]==0.0){
            this.converged=false;
        }
        else{
            this.converged=true;
        }

        // Get results
        branchesPowerFlowInfo = processor.getNumericArray("result.branch").getRealArray2D();
        busesPowerFlowInfo = processor.getNumericArray("result.bus").getRealArray2D();
        generatorsPowerFlowInfo = processor.getNumericArray("result.gen").getRealArray2D();
        costsPowerFlowInfo = processor.getNumericArray("result.gencost").getRealArray2D();
        this.updateNodes(nodes);
        this.updateLinks(links);
        // Disconnect proxy from Matlab session
        proxy.disconnect();
    }
    catch(MatlabConnectionException mcex){
        mcex.printStackTrace();
    }
    catch(MatlabInvocationException miex){
        miex.printStackTrace();
    }
    
    return converged;
}
 

开发者ID:SFINA,
项目名称:SFINA,
代码行数:68,
代码来源:MatpowerFlowDomainAgent.java

示例4: MatlabControlImpl

点赞 2

import matlabcontrol.extensions.MatlabTypeConverter; //导入依赖的package包/类
public MatlabControlImpl(Logger logger, RegistryShutdownHub shutdownHub,
		String gpmlDir, String iterDir, int problemSize, double tol,
		double min_ei, double[] LB, double[] UB, int nBins,
		String matlabLogFile) throws MatlabConnectionException,
		MatlabInvocationException {
	this.logger = logger;

	logger.info("LB " + Arrays.toString(LB));
	logger.info("UB " + Arrays.toString(UB));

	MatlabProxyFactoryOptions.Builder builder = new MatlabProxyFactoryOptions.Builder();
	builder.setHidden(true);

	factory = new MatlabProxyFactory();
	proxy = new LoggingMatlabProxy(factory.getProxy());

	// Add shutdown hook to exit matlab once everything its over
	// Use @PostInjection
	shutdownHub.addRegistryShutdownListener(new Runnable() {
		public void run() {
			try {
				if (proxy.isConnected()) {
					proxy.exit();
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	});
	// Instantiate utils and other objects
	processor = new MatlabTypeConverter(proxy);

	// Load and setup GPML libraries
	proxy.eval(String.format("addpath ('%s');", gpmlDir));
	proxy.eval("startup;");
	// Load and setup our libraries
	proxy.eval(String.format("addpath ('%s');", iterDir));

	double[][] _LB = new double[1][];
	_LB[0] = LB;
	processor.setNumericArray("LB", new MatlabNumericArray(_LB, null));
	double[][] _UB = new double[1][];
	_UB[0] = UB;
	processor.setNumericArray("UB", new MatlabNumericArray(_UB, null));

	// NOTE THAT STRINGs mist have ''
	proxy.eval(String.format("startup_iter(%d,%f,%f,LB,UB,%d, '%s');",
			problemSize, tol, min_ei, nBins, matlabLogFile));

	lock = new Object();

	nParameters = LB.length;

	// TODO Configure me to run only id debug mode!
	// listTestExecution();

}
 

开发者ID:alessiogambi,
项目名称:iter,
代码行数:58,
代码来源:MatlabControlImpl.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)