Skip to content
Snippets Groups Projects
Commit 2ec74394 authored by Arthur Reis's avatar Arthur Reis
Browse files

v0.1 release

parent fa772382
Branches
No related tags found
No related merge requests found
Showing
with 475 additions and 91 deletions
# List of untracked files to ignore
### MATLAB ###
# Windows default autosave extension
*.asv
# MATLAB project files
resources
Acme.prj
# OSX / *nix default autosave extension
*.m~
# Compiled MEX binaries (all platforms)
*.mex*
# Packaged app and toolbox files
*.mlappinstall
*.mltbx
# Generated helpsearch folders
helpsearch*/
# Simulink code generation folders
slprj/
sccprj/
# Matlab code generation folders
codegen/
# Simulink autosave extension
*.autosave
# Simulink cache files
*.slxc
#matlab data
*.mat
# ACME public
# ACME
Accelerometer Models Extended: simulink package with the framework to simulate accelerometers for space-based missions, from GRACE-like to after LISA.
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://gitlab.aei.uni-hannover.de/arthur.reis/acme-public.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
- [ ] [Set up project integrations](https://gitlab.aei.uni-hannover.de/arthur.reis/acme-public/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
Accelerometer Models Extended: package with the framework to simulate accelerometers for space-based missions, from GRACE-like to after LISA.
\ No newline at end of file
classdef AcmeBlock
%ACMEBLOCK Summary of this class goes here
% Detailed explanation goes here
properties
name
model
blockhandle
blocktype
parameters
end
methods
function obj = AcmeBlock(name, model, parameters)
%ACMEBLOCK Construct an instance of this class
% Detailed explanation goes here
% receives from AcmeBlockType
obj.name = name;
obj.model = model;
%obj.blockhandle = 1;
obj.blockhandle = Simulink.findBlocks(model,'Name',name);
assert(~isempty(obj.blockhandle), "Could not find block '%s' in model '%s'", name, model);
obj.parameters = parameters;
for iparm = 1:length(obj.parameters.name)
setBlockParm(obj,obj.parameters.name{iparm},...
obj.parameters.value{iparm});
end
end
function setBlockParm(obj,name,value)
s = "";
if isnumeric(value)
if isequal(size(value),[1 1])
s = num2str(value);
else
s = mat2str(value);
end
elseif isstring(value)
s = value;
end
set_param(obj.blockhandle,name,s);
%set_param_test(obj.blockhandle,name,s);
end
end
end
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
function blockHandle = setActuatorParaPlates(varargin)%model, block, Kp ,Ki ,Kd ,...
%Vp ,Vt ,eps0 ,faceArea ,gap)
%SETACTUATORPARAPLATES - Sets the initial parameters of a paralel plates
%actuator block.
%Sets the initial parameters of a paralel plates actuator block. The PID gains
%can be obtained with the tuning app
%
% Syntax: setActuatorParaPlates(Kp,Ki,Kd,Vp,Vt,eps0,faceArea,gap)
%
% Inputs:
% Kp - Proportional gain, double;
% Ki - Integral gain, double;
% Kd - Differential gain, double;
% Vp - Polarization voltage, double;
% Vt - sqrt of squares of the polarization and detection voltages;
% eps0 - Vacuum permittivity, F/m, double;
% faceArea - area of the plates, m^2, double;
% gap - nominal gap between the plates, m, double;
%
% See also: setSensParaPlates
%
% Author: Arthur Reis
% email: arthur.reis@aei.mpg.de
% Nov 2021; Last revision: 16.Feb.2022;
% try to load from local json
% should be handle or name
if strcmp(varargin{1},'blockName')
blockName = varargin{2};
elseif strcmp(varargin{1},'blockHandle')
blockName = get_param(varargin{2},'Name');
end
%if file exists
%blockName = get_param(varargin{1},'Name');
%JSONFILE_name= sprintf(strcat(blockName,'.json'));
%fid=fopen(JSONFILE_name,'r');
%raw = fread(fid,inf);
%str = char(raw');
%j = jsondecode(str);
% parses existing json as defaults
% and allows updating
p = inputParser;
addParameter(p, 'model' , '');
addParameter(p, 'blockName', '');
addParameter(p, 'Kp' , 0, @isnumeric);
addParameter(p, 'Ki' , 0, @isnumeric);
addParameter(p, 'Kd' , 0, @isnumeric);
addParameter(p, 'Vp' , 0, @isnumeric);
addParameter(p, 'Vt' , 0, @isnumeric);
addParameter(p, 'eps0' , 0, @isnumeric);
addParameter(p, 'faceArea' , 0, @isnumeric);
addParameter(p, 'gap' , 0, @isnumeric);
parse(p, varargin{:});
j = p.Results;
js = jsonencode(j,'PrettyPrint',true);
%save p.Results as json
JSONFILE_name= sprintf(strcat(p.Results.blockName,'.json'));
fid=fopen(JSONFILE_name,'w');
fprintf(fid, js);
fclose(fid);
blockHandle = Simulink.findBlocks(j.model,'Name',j.blockName);
set_param(blockHandle, 'Kp' , num2str(j.Kp));
set_param(blockHandle, 'Ki' , num2str(j.Ki));
set_param(blockHandle, 'Kd' , num2str(j.Kd));
set_param(blockHandle, 'Vp' , num2str(j.Vp));
set_param(blockHandle, 'Vt' , num2str(j.Vt));
set_param(blockHandle, 'eps0' , num2str(j.eps0));
set_param(blockHandle, 'faceArea', num2str(j.faceArea));
set_param(blockHandle, 'gap' , num2str(j.gap));
end
function blockHandle = setSinglePlate(varargin)
%SETACTUATORPARAPLATES - Sets the initial parameters of a paralel plates
%actuator block.
%Sets the initial parameters of a paralel plates actuator block. The PID gains
%can be obtained with the tuning app
%
% Syntax: setActuatorParaPlates(Kp,Ki,Kd,Vp,Vt,eps0,faceArea,gap)
%
% Inputs:
% Kp - Proportional gain, double;
% Ki - Integral gain, double;
% Kd - Differential gain, double;
% Vp - Polarization voltage, double;
% Vt - sqrt of squares of the polarization and detection voltages;
% eps0 - Vacuum permittivity, F/m, double;
% faceArea - area of the plates, m^2, double;
% gap - nominal gap between the plates, m, double;
%
% See also: setSensParaPlates
%
% Author: Arthur Reis
% email: arthur.reis@aei.mpg.de
% Nov 2021; Last revision: 16.Feb.2022;
% try to load from local json
% should be handle or name
if strcmp(varargin{1},'blockName')
blockName = varargin{2};
elseif strcmp(varargin{1},'blockHandle')
blockName = get_param(varargin{2},'Name');
end
%if file exists
%blockName = get_param(varargin{1},'Name');
%JSONFILE_name= sprintf(strcat(blockName,'.json'));
%fid=fopen(JSONFILE_name,'r');
%raw = fread(fid,inf);
%str = char(raw');
%j = jsondecode(str);
% parses existing json as defaults
% and allows updating
p = inputParser;
addParameter(p, 'model' , '');
addParameter(p, 'blockName', '');
addParameter(p, 'Vt' , 0, @isnumeric);
addParameter(p, 'eps0' , 0, @isnumeric);
addParameter(p, 'faceArea' , 0, @isnumeric);
addParameter(p, 'gap' , 0, @isnumeric);
parse(p, varargin{:});
j = p.Results;
js = jsonencode(j,'PrettyPrint',true);
%save p.Results as json
JSONFILE_name= sprintf(strcat(p.Results.blockName,'.json'));
fid=fopen(JSONFILE_name,'w');
fprintf(fid, js);
fclose(fid);
blockHandle = Simulink.findBlocks(j.model,'Name',j.blockName);
set_param(blockHandle, 'Vt' , num2str(j.Vt));
set_param(blockHandle, 'eps0' , num2str(j.eps0));
set_param(blockHandle, 'faceArea', num2str(j.faceArea));
set_param(blockHandle, 'gap' , num2str(j.gap));
end
function blockHandle = setSinglePlate_Vsqr(varargin)
%SETACTUATORPARAPLATES - Sets the initial parameters of a paralel plates
%actuator block.
%Sets the initial parameters of a paralel plates actuator block. The PID gains
%can be obtained with the tuning app
%
% Syntax: setActuatorParaPlates(Kp,Ki,Kd,Vp,Vt,eps0,faceArea,gap)
%
% Inputs:
% Kp - Proportional gain, double;
% Ki - Integral gain, double;
% Kd - Differential gain, double;
% Vp - Polarization voltage, double;
% Vt - sqrt of squares of the polarization and detection voltages;
% eps0 - Vacuum permittivity, F/m, double;
% faceArea - area of the plates, m^2, double;
% gap - nominal gap between the plates, m, double;
%
% See also: setSensParaPlates
%
% Author: Arthur Reis
% email: arthur.reis@aei.mpg.de
% Nov 2021; Last revision: 16.Feb.2022;
% try to load from local json
% should be handle or name
if strcmp(varargin{1},'blockName')
blockName = varargin{2};
elseif strcmp(varargin{1},'blockHandle')
blockName = get_param(varargin{2},'Name');
end
%if file exists
%blockName = get_param(varargin{1},'Name');
%JSONFILE_name= sprintf(strcat(blockName,'.json'));
%fid=fopen(JSONFILE_name,'r');
%raw = fread(fid,inf);
%str = char(raw');
%j = jsondecode(str);
% parses existing json as defaults
% and allows updating
p = inputParser;
addParameter(p, 'model' , '');
addParameter(p, 'blockName', '');
addParameter(p, 'Vt' , 0, @isnumeric);
addParameter(p, 'eps0' , 0, @isnumeric);
addParameter(p, 'faceArea' , 0, @isnumeric);
addParameter(p, 'gap' , 0, @isnumeric);
parse(p, varargin{:});
j = p.Results;
js = jsonencode(j,'PrettyPrint',true);
%save p.Results as json
JSONFILE_name= sprintf(strcat(p.Results.blockName,'.json'));
fid=fopen(JSONFILE_name,'w');
fprintf(fid, js);
fclose(fid);
blockHandle = Simulink.findBlocks(j.model,'Name',j.blockName);
set_param(blockHandle, 'Vt' , num2str(j.Vt));
set_param(blockHandle, 'eps0' , num2str(j.eps0));
set_param(blockHandle, 'faceArea', num2str(j.faceArea));
set_param(blockHandle, 'gap' , num2str(j.gap));
end
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
classdef Electrode < AcmeBlock
%ELECTRODE Summary of this class goes here
methods
function obj = Electrode(name, model, Vbias, pos0, theta0, area)
%ELECTRODE Construct an instance of this class
%setElectrode(model, block, Vbias, pos0, theta0, area)
parameters.name = ["Vbias", "pos0", "theta0", "area"];
parameters.value = {Vbias , pos0 , theta0 , area };
obj = obj@AcmeBlock(name, model, parameters);
obj.blocktype = "electrode";
end
end
end
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
function blockHandle = setElectrode(varargin)
%
%SETELECTRODE - Sets the initial parameters of a electrode
% Sets the initial parameters of a electrode, to be paired to form a parallel
% plates capacitor.
%
% Syntax: blockHandle = setElectrode(model, block, Vbias, pos0, n0, area)
%
% Inputs:
% model - Name of the Simulink model, string;
% block - Name of the target instance of the Injection Block, string;
% Vbias - Offset voltage, V;
% pos0 - initial/nominal position of the center of the plate, m.
% theta0- initial/nominal direction of plate, comparing to the direction
% towards the other plate of the capacitor.
% area - area of the plate, m^s
%
% Output:
% blockHandle - Simulink block instance handle reference number;
%
% See also:
%
% Author: Arthur Reis
% email: arthur.reis@aei.mpg.de
% Last revision: 7.Apr.2022;
%model, block, Vbias, pos0, theta0, area
defaultSolver = "Variable-step";
defaultTheta0 = 0;
p = inputParser;
addRequired(p, 'model');
addRequired(p, 'block');
addRequired(p, 'Vbias', @(x) isnumeric(x) && isscalar(x));
addRequired(p, 'pos0', @(x) isnumeric(x) && isscalar(x));
addRequired(p, 'area', @(x) isnumeric(x) && isscalar(x));
addOptional(p, 'theta0', defaultTheta0);
addParameter(p, "solver", defaultSolver);
parse(p, varargin{:});
blockHandle = Simulink.findBlocks(p.Results.model,'Name',p.Results.block);
set_param(blockHandle,'Vbias', num2str(p.Results.Vbias));
set_param(blockHandle,'pos0', num2str(p.Results.pos0));
set_param(blockHandle,'theta0',num2str(p.Results.theta0));
set_param(blockHandle,'area', num2str(p.Results.area));
if strcmp(p.Results.solver,defaultSolver)
load_system("electrode");
set_param("electrode","SolverType","Variable-step");
elseif strcmp(p.Results.solver,'Fixed-step')
%set_param(blockHandle,'Vbias', num2str(Vbias));
load_system("electrode");
set_param("electrode","SolverType", "Fixed-step")
end
end
function blockHandle = setPlaneCapacitor(varargin)
%SETPLANECAPACITOR - Sets the initial parameters of a capacitor.
%Sets the initial parameters of a capacitor. Based on a parallel planes capacitor.
%
% Syntax: blockHandle = setPlaneCapacitor(model, block, eps0)
%
% Inputs:
% model - Name of the Simulink model, string;
% block - Name of the target instance of the Injection Block, string;
% eps0 - Vacuum permittivity, F/m, double;
%
% Outputs:
% blockHandle - Simulink block instance handle reference number;
% See also:
%
% Author: Arthur Reis
% email: arthur.reis@aei.mpg.de
% Apr 2022; Last revision: 7.Apr.2022;
defaultEps0 = 8.8541878128e-12;
defaultSolver = "Variable-step";
p = inputParser;
addRequired(p, 'model');
addRequired(p, 'block');
addOptional(p, 'eps0', defaultEps0, @(x) isnumeric(x) && isscalar(x));
addParameter(p, "solver", defaultSolver);
parse(p, varargin{:});
blockHandle = Simulink.findBlocks(p.Results.model,'Name',p.Results.block);
set_param(blockHandle,'eps0', num2str(p.Results.eps0));
% if strcmp(p.Results.solver,defaultSolver)
% set_param('planeCapacitor','SolverType','Variable-step');
% elseif strcmp(p.Results.solver,'Fixed-step')
% %set_param(blockHandle,'Vbias', num2str(Vbias));
% set_param('planeCapacitor', 'SolverType', 'Fixed-step')
% end
end
function blockHandle = setSinglePlate(varargin)
%SETACTUATORPARAPLATES - Sets the initial parameters of a paralel plates
%actuator block.
%Sets the initial parameters of a paralel plates actuator block. The PID gains
%can be obtained with the tuning app
%
% Syntax: setActuatorParaPlates(Kp,Ki,Kd,Vp,Vt,eps0,faceArea,gap)
%
% Inputs:
% Kp - Proportional gain, double;
% Ki - Integral gain, double;
% Kd - Differential gain, double;
% Vp - Polarization voltage, double;
% Vt - sqrt of squares of the polarization and detection voltages;
% eps0 - Vacuum permittivity, F/m, double;
% faceArea - area of the plates, m^2, double;
% gap - nominal gap between the plates, m, double;
%
% See also: setSensParaPlates
%
% Author: Arthur Reis
% email: arthur.reis@aei.mpg.de
% Nov 2021; Last revision: 16.Feb.2022;
% try to load from local json
% should be handle or name
if strcmp(varargin{1},'blockName')
blockName = varargin{2};
elseif strcmp(varargin{1},'blockHandle')
blockName = get_param(varargin{2},'Name');
end
%if file exists
%blockName = get_param(varargin{1},'Name');
%JSONFILE_name= sprintf(strcat(blockName,'.json'));
%fid=fopen(JSONFILE_name,'r');
%raw = fread(fid,inf);
%str = char(raw');
%j = jsondecode(str);
% parses existing json as defaults
% and allows updating
p = inputParser;
addParameter(p, 'model' , '');
addParameter(p, 'blockName', '');
addParameter(p, 'Vt' , 0, @isnumeric);
addParameter(p, 'eps0' , 0, @isnumeric);
addParameter(p, 'faceArea' , 0, @isnumeric);
addParameter(p, 'gap' , 0, @isnumeric);
parse(p, varargin{:});
j = p.Results;
js = jsonencode(j,'PrettyPrint',true);
%save p.Results as json
JSONFILE_name= sprintf(strcat(p.Results.blockName,'.json'));
fid=fopen(JSONFILE_name,'w');
fprintf(fid, js);
fclose(fid);
blockHandle = Simulink.findBlocks(j.model,'Name',j.blockName);
set_param(blockHandle, 'Vt' , num2str(j.Vt));
set_param(blockHandle, 'eps0' , num2str(j.eps0));
set_param(blockHandle, 'faceArea', num2str(j.faceArea));
set_param(blockHandle, 'gap' , num2str(j.gap));
end
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment