clear all;
close all;
% create a COM server running OptiSystem
optsys = actxserver('optisystem.application');
% This pause is necessary to allow OptiSystem to be opened before
% call open the project
pause(15);
% Open the OptiSystem file defined by the path
optsys.Open(['C:\Test\Matlab Call OptiSystem.osd']);
% Specify and define the parameters that will be varied
ParameterName1 = 'Power';
SignalPower = -20:5:-10; %dBm
ParameterName2 = 'Length';
FiberLength = 5:5:15; %meters
% Specify the results that will be transfered from OptiSystem
ResultName1 = 'Max. Gain (dB)';
ResultName2 = 'Min. Noise Figure (dB)';
ResultName3 = 'Output : Max. OSNR (dB)';
Document = optsys.GetActiveDocument;
LayoutMngr = Document.GetLayoutMgr;
CurrentLyt = LayoutMngr.GetCurrentLayout;
Canvas = CurrentLyt.GetCurrentCanvas;
% Specify the components that will have the parameters (results) transfered
Component1 = Canvas.GetComponentByName('CW Laser');
Component2 = Canvas.GetComponentByName('EDFA');
Visualizer1 = Canvas.GetComponentByName('Dual Port WDM Analyzer');
% vary the parameters, run OptiSystem project and get the results
for i = 1:length(SignalPower)
for k = 1:length(FiberLength)
%Set component parameters
Component1.SetParameterValue( ParameterName1, SignalPower(i) );
Component2.SetParameterValue( ParameterName2, FiberLength(k) );
%Calculate
Document.CalculateProject( true , true);
%Acces visualizer results
Result1 = Visualizer1.GetResult( ResultName1 );
Result2 = Visualizer1.GetResult( ResultName2 );
Result3 = Visualizer1.GetResult( ResultName3 );
Gain( (i-1)*length(FiberLength) + k ) = Result1.GetValue( 1 );
NF( (i-1)*length(FiberLength) + k ) = Result2.GetValue( 1 );
OSNR( (i-1)*length(FiberLength) + k ) = Result3.GetValue( 1 );
end
end
%plot graphs
figure
subplot(3,1,1); plot(FiberLength,Gain(1:length(FiberLength)),FiberLength,Gain(length(FiberLength)+1:2*length(FiberLength)),FiberLength,Gain(2*length(FiberLength)+1:3*length(FiberLength)) )
title('Signal Gain')
xlabel('Fiber length [m]')
ylabel('Gain [dB]')
subplot(3,1,2); plot(FiberLength,NF(1:length(FiberLength)),FiberLength,NF(length(FiberLength)+1:2*length(FiberLength)),FiberLength,NF(2*length(FiberLength)+1:3*length(FiberLength)) )
title('Noise Figure')
xlabel('Fiber length [m]')
ylabel('NF [dB]')
subplot(3,1,3); plot(FiberLength,OSNR(1:length(FiberLength)),FiberLength,OSNR(length(FiberLength)+1:2*length(FiberLength)),FiberLength,OSNR(2*length(FiberLength)+1:3*length(FiberLength)) )
title('OSNR')
xlabel('Fiber length [m]')
ylabel('OSNR [dB]')
% close OptiSystem
optsys.Quit;
阿里matlab建模师
- 粉丝: 4538
- 资源: 2862
最新资源
- Java源码ssm+vue框架博客系统的设计与实现+vue-毕业设计-期末大作业.zip
- ssm-vue-汽车售票网站-源码工程-29页从零开始全套图文详解-34页参考论文-27页参考答辩ppt-全套开发环境工具、文档模板、电子教程、视频教学资源分享.zip
- ssm-vue-人力资源管理系统-源码工程-29页从零开始全套图文详解-34页参考论文-27页参考答辩ppt-全套开发环境工具、文档模板、电子教程、视频教学资源分享.zip
- ssm-vue-农家乐信息平台-源码工程-29页从零开始全套图文详解-34页参考论文-27页参考答辩ppt-全套开发环境工具、文档模板、电子教程、视频教学资源分享.zip
- 基于小程序的校医务室健康服务系统源码(小程序毕业设计完整源码).zip
- Java源码ssm+vue框架大学生兼职平台的设计与开发-毕业设计-期末大作业.zip
- Java源码ssm+vue框架单位人事管理系统-毕业设计-期末大作业.zip
- Java源码ssm+vue框架大学生奖助学金发放管理系统-毕业设计-期末大作业.zip
- 环形装配线sw18可编辑全套技术资料100%好用.zip
- Java源码ssm+vue框架电能计量与客户服务管理系统vue-毕业设计-期末大作业.zip
- ssm-vue-铁岭河医院医患管理系统-源码工程-29页从零开始全套图文详解-34页参考论文-27页参考答辩ppt-全套开发环境工具、文档模板、电子教程、视频教学资源分享.zip
- 基于小程序的校园兼职系统+node源码(小程序毕业设计完整源码).zip
- ssm-vue-小学生课外知识学习网站-源码工程-29页从零开始全套图文详解-34页参考论文-27页参考答辩ppt-全套开发环境工具、文档模板、电子教程、视频教学资源分享.zip
- ssm-vue-线上旅行信息管理系统-源码工程-29页从零开始全套图文详解-34页参考论文-27页参考答辩ppt-全套开发环境工具、文档模板、电子教程、视频教学资源分享.zip
- ssm-vue-校园教务系统-源码工程-29页从零开始全套图文详解-34页参考论文-27页参考答辩ppt-全套开发环境工具、文档模板、电子教程、视频教学资源分享.zip
- ssm-vue-校园活动管理平台-源码工程-29页从零开始全套图文详解-34页参考论文-27页参考答辩ppt-全套开发环境工具、文档模板、电子教程、视频教学资源分享.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈