diff --git a/.gitignore b/.gitignore index f3de7319301c23eae40bdbc3ce9abfbcf8bfbbd8..71e90259ab32aad22b102276ebdb9a0f6fe0a25d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ resources Acme.prj +# XHPS stuff +simulations/Tutorial/xhps_integration + # OSX / *nix default autosave extension *.m~ diff --git a/core/AcmeSim.m b/core/AcmeSim.m index d0c9b3f1ede49b3af8af70bc5ceef8165f867b8e..21ce2b1515d4d59e57e4ac37e1a8a4fd989625c7 100644 --- a/core/AcmeSim.m +++ b/core/AcmeSim.m @@ -3,56 +3,68 @@ classdef AcmeSim % Detailed explanation goes here properties - mdl - stopTime = 1e4; - nSteps = 1e4; - freqs - tStep - fSample - t - enbw + ModelName + ModelHandle + StopTime + NumberOfSteps + Frequencies + StepSize + SampleFrequency + Time + ENBW eps0 = 8.86e-12; %F/m, vacuum permittivity kb = 1.3806e-23; %boltzmann T = 300; % K - lpsdopts + flpsdOpts % lpsd end methods - function obj = AcmeSim(mdl,varargin) + function obj = AcmeSim(varargin) %ACMESIM Construct an instance of this class % Detailed explanation goes here - obj.mdl = mdl; - if length(varargin) == 2 - obj.stopTime = varargin{1}; - obj.nSteps = varargin{2}; - end - obj.tStep = obj.stopTime/obj.nSteps; - obj.fSample = 1/obj.tStep; - obj.freqs = logspace(-log10(obj.stopTime),log10(obj.fSample/2),100); - obj.enbw = 1/obj.stopTime; - obj.t = (0:obj.tStep:(obj.stopTime-obj.tStep))'; + flpsdopts = {'fs', 1,... + 'Lmin' , 1,... + 'order', 0,... + 'olap' , 30,... + 'Kdes' , 100,... + 'Jdes' , 1000,... + 'scale', 'ASD',... + 'win' , 'hanning',... + 'LTPDAmode',false,... + }; + + p = inputParser; + p.addRequired('ModelName', @(x) ischar(x)); + p.addRequired('StopTime', @(x) isscalar(x)); + p.addRequired('NumberOfSteps',@(x) isscalar(x)); + p.addOptional('flpsdOpts', flpsdopts); + p.parse(varargin{:}); - obj.lpsdopts = {'fs',obj.fSample,... - 'Kdes', 100,... - 'olap', 30,... - 'Jdes', 1000,... - 'Lmin', 1,... - 'order', 0,... - 'scale','ASD',... - 'LTPDAmode',false,... - 'win','hanning',... - }; + obj.ModelName = p.Results.ModelName; + obj.StopTime = p.Results.StopTime; + obj.NumberOfSteps = p.Results.NumberOfSteps; + obj.flpsdOpts = p.Results.flpsdOpts; + + obj.ENBW = 1/obj.StopTime; + obj.StepSize = obj.StopTime/obj.NumberOfSteps; + obj.Time = (0:obj.StepSize:(obj.StopTime-obj.StepSize))'; + obj.SampleFrequency = 1/obj.StepSize; + obj.Frequencies = logspace(-log10(obj.StopTime),log10(obj.SampleFrequency/2),100); + obj.flpsdOpts{2} = {obj.SampleFrequency}; + % Load simulink model + obj.ModelHandle = load_system(obj.ModelName); end - function initModel(obj) - load_system(obj.mdl); + function obj = initModel(obj) + obj.ModelHandle = load_system(obj.ModelName); end - function TM = addTestMass(obj,mass,sideLength,gap,geometricFactor,block,varargin) - TM = TestMass(mass,sideLength,gap,geometricFactor); - TM = TM.setDoubleIntegrator(obj.mdl,block,varargin); - + function initModelParameters(obj) + get_param(obj.ModelHandle,'ObjectParameters'); + set_param(obj.ModelHandle,'StopTime',num2str(obj.StopTime)); + set_param(obj.ModelHandle,'MaxStep', num2str(obj.StepSize)); + % set_param(obj.ModelHandle) end end end diff --git a/core/component/TIA.slx b/core/component/TIA.slx index 55e759f63e94c7298c765ef45aca20eea4554b52..f441bd5f2d902fa529912a60d085eb579edd0542 100644 Binary files a/core/component/TIA.slx and b/core/component/TIA.slx differ diff --git a/core/component/TestMass.m b/core/component/TestMass.m new file mode 100644 index 0000000000000000000000000000000000000000..a3facac95d9e5b462dd09b4b1e7f1c42877ff5a7 --- /dev/null +++ b/core/component/TestMass.m @@ -0,0 +1,131 @@ +classdef TestMass + %TESTMASS Summary of this class goes here + % Detailed explanation goes here + + properties + mass (1,1) double + gaps (1,3) double + areas (1,3) double + sides (1,3) double + volume (1,1) double + density (1,1) double + gap = struct('x', 0, 'y', 0, 'z', 0); + l = struct('x', 0, 'y', 0, 'z', 0); + area = struct('x', 0, 'y', 0, 'z', 0); +% geometricFactor (1,1) double ... +% {mustBePositive,mustBeLessThanOrEqual(geometricFactor,1)} = 1; + attachedDoubleIntegratorBlock char + % attachedDoubleIntegratorBlocks + attachedModel char + end + + methods + function obj = TestMass(varargin) + % TESTMASS Construct an instance of this class + % Either mass or density must be defined + % Syntax + % TM = TestMass(sideLength, gap, ... + % 'mass'/'density', mass/density,... + % [geometricFactor] + % Inputs: + % sideLength - m, side of the cube, 1x1 double OR + % - m, sides of the cuboid, m, 1x3 double + % gap - m, size of the gaps (equal sizes), 1x1 double OR + % - m, sizes of gaps, 1x3 double + % mass - kg, mass of the test mass + % density - kg/m3, density of the material + % [geometricFactor] - ? + + p = inputParser; + p.addRequired('SideLength'); + p.addRequired('Gap'); + + p.addParameter('Mass', 0, @(x) isscalar(x)); + p.addParameter('Density', 0, @(x) isscalar(x)); + p.addParameter('Model', '', @(x) ischar(x)); + p.addParameter('Block', '', @(x) ischar(x)); + p.addParameter('Blocks', [''], @(x) (x)); + %p.addParameter('geometricFactor', 1); + p.parse(varargin{:}); + + gap = p.Results.Gap; + mass = p.Results.Mass; + density = p.Results.Density; + sideLength = p.Results.SideLength; + block = p.Results.Block; + % blocks = p.Results.Blocks; + model = p.Results.Model; + %geometricFactor = p.Results.geometricFactor; + + if ~xor(mass,density) + error('either mass or density has to be defined') + end + +% obj.geometricFactor = geometricFactor; + + obj = initGeometry(obj,sideLength,gap); + if mass == 0 + obj.mass = obj.volume*density; + obj.density = density; + elseif density == 0 + obj.density = mass/obj.volume; + obj.mass = mass; + end + + if ~((model=="")||(block=="")) + obj = attachBlock(obj,model,block); + obj = updateBlock(obj); + end + + end + + function obj = initGeometry(obj, sideLength,gap) + if length(sideLength) == 3 + obj.l.x = sideLength(1); + obj.l.y = sideLength(2); + obj.l.z = sideLength(3); + else + obj.l.x = sideLength; + obj.l.y = sideLength; + obj.l.z = sideLength; + end + + if length(gap) == 3 + obj.gap.x = gap(1); + obj.gap.y = gap(2); + obj.gap.z = gap(3); + else + obj.gap.x = gap; + obj.gap.y = gap; + obj.gap.z = gap; + end + obj.area.x = obj.l.y * obj.l.z; + obj.area.y = obj.l.x * obj.l.z; + obj.area.z = obj.l.x * obj.l.y; + obj.volume = obj.l.x * obj.l.y * obj.l.z; + + obj.gaps = [obj.gap.x obj.gap.y obj.gap.z ]; + obj.sides = [obj.l.x obj.l.y obj.l.z ]; + obj.areas = [obj.area.x obj.area.y obj.area.z]; + + end + + function obj = attachBlock(obj, model, block) + obj.attachedModel = model; + obj.attachedDoubleIntegratorBlock = block; + end + + function updateBlock(obj) + setDblIntTrans(obj.attachedModel, ... + obj.attachedDoubleIntegratorBlock, ... + obj.mass,obj.gap.x); % warning: 1DOF + end + + function obj = setDoubleIntegrator(obj,mdl,name,varargin) + %METHOD1 Summary of this method goes here + % Detailed explanation goes here + obj.doubleIntegratorBlock = setDblIntTrans(mdl,name,obj.mass,obj.gap.x); + end + end +end + diff --git a/core/component/capBridge.slx b/core/component/capBridge.slx index 150da5b76f81e580208b1fdb3b639fdc9c3345a5..dc77002383a704ff5c12ffee15ab166d7c542d05 100644 Binary files a/core/component/capBridge.slx and b/core/component/capBridge.slx differ diff --git a/core/component/electrode.slx b/core/component/electrode.slx index 43deb2eca6605e5960de656c18fcee8b4e2ca39f..8d882aa7e79f7bfd4b5d3cd42bc688a352f121c1 100644 Binary files a/core/component/electrode.slx and b/core/component/electrode.slx differ diff --git a/core/component/planeCapacitor.slx b/core/component/planeCapacitor.slx index c61f399ccf37c91fab3a6212d5a85340d6f609bc..834b8777a0a00ea0209b76f6e421cf5ffb862799 100644 Binary files a/core/component/planeCapacitor.slx and b/core/component/planeCapacitor.slx differ diff --git a/core/dynamics/dblIntTransFS.slx b/core/dynamics/dblIntTransFS.slx index 2e050c7244f3fd1b2c1ff98cb5c1728991884fe7..3f0f2766ef3e1dbc60c803aee1be22046dcab4a7 100644 Binary files a/core/dynamics/dblIntTransFS.slx and b/core/dynamics/dblIntTransFS.slx differ diff --git a/core/dynamics/dblIntTransVS.slx b/core/dynamics/dblIntTransVS.slx index eb855ed99ca2c3eea0afbc146eb9c916c6012d65..84128b63be86b81cf6667d3b000a78c5e1789dff 100644 Binary files a/core/dynamics/dblIntTransVS.slx and b/core/dynamics/dblIntTransVS.slx differ diff --git a/core/libAcme.slx b/core/libAcme.slx index f813d1140bd5f8d75a889447dc020e95f8899b67..a09105239979916e5447749012d8b63098b39221 100644 Binary files a/core/libAcme.slx and b/core/libAcme.slx differ diff --git a/core/sensors/diffTransformer.slx b/core/sensors/diffTransformer.slx index a899e43e806db5ccb66cca5bd12ea6f1b31640f2..f7e66eae562f80192fc28521c5bf54d05325a65e 100644 Binary files a/core/sensors/diffTransformer.slx and b/core/sensors/diffTransformer.slx differ diff --git a/core/sensors/lockIn.slx b/core/sensors/lockIn.slx index a7f9fac19abaf20f3d77bd5be6278ee05d901cc3..bb76ed6d07c438e1e8b3a54fbd5f402da15f4d1c 100644 Binary files a/core/sensors/lockIn.slx and b/core/sensors/lockIn.slx differ diff --git a/simulations/LISA_EA/GRS.slx b/simulations/LISA_EA/GRS.slx index 66f8b62f6fdd6fb35bb9f53dbffb4409f08ca962..7e29f8dc3359234358ae855e133eaae29ec6487a 100644 Binary files a/simulations/LISA_EA/GRS.slx and b/simulations/LISA_EA/GRS.slx differ diff --git a/simulations/LISA_EA/capSensor_complete.slx b/simulations/LISA_EA/capSensor_complete.slx index 7c5f95350042260ac8fa2d39b6c53e7a1242c843..35a47d1283efa7b662eef0a87e6392eca1569541 100644 Binary files a/simulations/LISA_EA/capSensor_complete.slx and b/simulations/LISA_EA/capSensor_complete.slx differ diff --git a/simulations/LISA_EA/capSensor_simplified.slx b/simulations/LISA_EA/capSensor_simplified.slx index 20f8439da5a8a59d40cbe687715761ff078a1abb..8551178f615352c6ecfd35bd5ab44eda0ddb19dd 100644 Binary files a/simulations/LISA_EA/capSensor_simplified.slx and b/simulations/LISA_EA/capSensor_simplified.slx differ diff --git a/simulations/SGRS/sgrs_acc.slx b/simulations/SGRS/sgrs_acc.slx index b8cac3d00643435a828973431f288cc4adb7880c..cee2bdf1dade0d953e57cf8fc94f917fd6173527 100644 Binary files a/simulations/SGRS/sgrs_acc.slx and b/simulations/SGRS/sgrs_acc.slx differ diff --git a/simulations/SGRS/sgrs_acc_script.m b/simulations/SGRS/sgrs_acc_script.m index df99e20bc66ff38e73fe1860b71c87e8290f0cbd..5512714a115bd8301e1aca4a6d4cc5ccb248d651 100644 --- a/simulations/SGRS/sgrs_acc_script.m +++ b/simulations/SGRS/sgrs_acc_script.m @@ -6,13 +6,16 @@ % email: arthur.reis@aei.mpg.de % last review: 29.11.2022 clear; -acme = AcmeSim('sgrs_acc'); -acme.initModel; - +acme = AcmeSim('sgrs_acc',1000,1000); %% Accelerometer Parameters -TM = acme.addTestMass(0.54,30e-3,1e-3,1,'dblInt',0.07); +TM = TestMass(30e-3,1e-3,'mass',0.54); +TM = TM.attachBlock('sgrs_acc','dblInt'); +TM.mass = .60; +TM.updateBlock; +TM.mass = 0.54; +TM.updateBlock; % If is non-drag-free: % driverGain = -20; % V_TM = 0.5; diff --git a/simulations/SGRS/sgrs_capSensor.slx b/simulations/SGRS/sgrs_capSensor.slx index 2b1f6d987869cd46aef649c438f3df9ba1df9927..e9eabe7a3875eb7cc7291317f544188ece7922e4 100644 Binary files a/simulations/SGRS/sgrs_capSensor.slx and b/simulations/SGRS/sgrs_capSensor.slx differ diff --git a/utils/SimulinkNbLite/SimulinkNb/NbLibrary.mdl b/utils/SimulinkNbLite/SimulinkNb/NbLibrary.mdl index 8d0b48a487cdb09b9cedd7e61376fce311f01eb0..1655d6c0d1b9a8a1f85174bbfaaef2f6737144db 100644 Binary files a/utils/SimulinkNbLite/SimulinkNb/NbLibrary.mdl and b/utils/SimulinkNbLite/SimulinkNb/NbLibrary.mdl differ diff --git a/utils/SimulinkNbLite/SimulinkNb/example/OLvsCL/OLvsCL.mdl b/utils/SimulinkNbLite/SimulinkNb/example/OLvsCL/OLvsCL.mdl index 707609b8f10b837ee07ed2e572fbcb66c77e109f..d8ccf24546e3321c485534041520fdf6ed576d90 100644 Binary files a/utils/SimulinkNbLite/SimulinkNb/example/OLvsCL/OLvsCL.mdl and b/utils/SimulinkNbLite/SimulinkNb/example/OLvsCL/OLvsCL.mdl differ diff --git a/utils/convert2OlderMatlab.m b/utils/convert2OlderMatlab.m index 1f652f8da95cdc580ec3d6565a7535511af90c21..17f648d5f110499f6bb263471b32d4bb725590a0 100644 --- a/utils/convert2OlderMatlab.m +++ b/utils/convert2OlderMatlab.m @@ -1,25 +1,25 @@ proj = currentProject; -Simulink.exportToVersion(proj,'Acme_R2020a','R2020a'); - -%unzip -%remove files -%copy to other folder +cd('~/Documents/acme/') +fileList = dir('simulations/Tutorial/xhps_integration/'); +for i = 1:length(fileList) + try + proj.removeFile([fileList(i).folder '/' fileList(i).name]); + end +end +Simulink.exportToVersion(proj,'Acme_R2020a','R2020a'); -%save simulations "manually" +unzip("/Acme_R2020a.zip","acme-public/") - % make temp folder with simulations files - % proj.addFile - % copy xhps toolbox to temp folder - % add xhps to project (how to do that programmatically??) - % exportToVersion on temp folder - % unzip - % copy simulation files - % exclude xhps files (%git .ignore?) - % system('git .....') +commit_message = "Added SGRS model with thermal and cap noise"; -%git commit +cd('../acme-public/') +system('git add .') +system(strcat('git commit -m "', commit_message, ' "')) +system('git push') -% add starter script - % add xhps path/start up \ No newline at end of file +cd('../acme/') +system('git add .') +system(strcat('git commit -m "', commit_message, ' "')) +system('git push')