Use App for User Input for calculation?

2 visualizzazioni (ultimi 30 giorni)
Jan Böttner
Jan Böttner il 29 Ago 2023
Risposto: Harald il 30 Ago 2023
Hi,
I need the user of my Script to Input some data and decide whether the created plots should be saved, what the resolution should be and so on. Further there are some values implemented for the calculation that might be changed by the user, otherwise the default values should be used ("base data")
At the moment it ist just at the top of my Script. I am wondering if there is a "nicer looking" aproach to this and was thinking about creating an App.
My Question is if it is worth the effort oder not or if there is another way to do this.
Here is the Code of the values that need to be eddited/checked:
%% Insert Data for the Parametric Study % Please insert the necessary data for the file import here.
P = '\\dbfz-user.leipzig.dbfz.de\user$\jboettner\Documents\HiWi\Matlab\File import\angepasste_Ausgabedatein'; % This is the file path for the folder, in which the result files are saved.
numberofruns = 29; % This is the number of runs that were calculated in the parametric study
numberofenerbalfiles = 3; % This is the number of energybalance output files that were created with TRNSYS. Only needs to be...
% adapted, when the output files in TRNSYS are changed (needs further changing in this script as well)
Tmin = -6; % The minimal temperature that was set for the Bivalence Point in the Parametric study.
Tmax = 20; % The maximum temperature that was set for the Bivalence Point in the Parametric study.
%% ----set-which-results-should-be-plotted-------------------
shouldplot.primaryenergy = 1; % set here, which of the results should be plotted.
shouldplot.enduseenergy = 1;
shouldplot.emissions = 1;
shouldplot.costs = 1;
shouldplot.overview = 1;
shouldplot.eta = 1;
shouldplot.saveplots = 1;
resolution = '-r300'; %standard is set to 300 dpi
folderforplots = append(P,'\Plots');
if not(isfolder(folderforplots))
mkdir(folderforplots);
end
%% Base Data required for the calculation of the output table (keep as it is or manipulate if desired)
basedata.primaryenergyfactor.Biomass.today = 1.03; %[-], the primary energy factor for Biomass (today/2020) [taken from GEMIS, [R1]]
basedata.primaryenergyfactor.Biomass.midterm = 1.022; %[-], the primary energy factor for Biomass (midterm/2030) [taken from GEMIS, [R1]]
basedata.primaryenergyfactor.Biomass.longterm = 1.022; %[-], the primary energy factor for Biomass (longterm/2050) [taken from GEMIS, [R1]]
basedata.primaryenergyfactor.Electricity.today = 2.065; %[-], the primary energy factor for Electricity (today/2020) [taken from GEMIS, [R1]]
basedata.primaryenergyfactor.Electricity.midterm = 1.705; %[-], the primary energy factor for Electricity (midterm/2020) [taken from GEMIS, [R1]]
basedata.primaryenergyfactor.Electricity.longterm = 1.224; %[-], the primary energy factor for Electricity (longterm/2020) [taken from GEMIS, [R1]]
basedata.Energy_LGB_one_Load = 4.58E+05; %[kJ], the energy that is provided with one combustion cycle/load of the LGB
basedata.Q_DHW_clc = 2000*1.1*3600; %[kJ], the energy needed for the Domestic hot water (DHW) with losses
basedata.eta_LGB = 0.89; %[-]
basedata.Emissionsfaktor.Biomass.today = 0.012; %kg(CO2)/kWh
basedata.Emissionsfaktor.Biomass.midterm = 0.008; %kg(CO2)/kWh
basedata.Emissionsfaktor.Biomass.longterm = 0.008; %kg(CO2)/kWh
basedata.Emissionsfaktor.Electricity.today = 0.351; %kg(CO2)/kWh
basedata.Emissionsfaktor.Electricity.midterm = 0.261; %kg(CO2)/kWh
basedata.Emissionsfaktor.Electricity.longterm = 0.03; %kg(CO2)/kWh
basedata.Heatpump.leakage.amountofrefrigerant = 2.98; %kg
basedata.Heatpump.leakage.GWPrefrigerant = 2088; %CO2-Equivalents / kg
basedata.Heatpump.leakage.yearlyleakagerate = 0.0133; %leakagerate per year
basedata.Heatpump.leakage.recyclingleakagerate = 0.15; %leakagerate at recycling
basedata.Heatpump.usagetime = 20; %Usage time for the heat pump in years
basedata.costs.annuityinvestHybrid = 2614; %annuity [€] for the Investment costs for the Hybrid system
basedata.costs.annuityinvestHPsingle = 1230; %annuity [€] for the Investment costs for the Hybrid system
basedata.costs.annuityinvestLGBsingle = 1538; %annuity [€] for the Investment costs for the Hybrid system
basedata.costs.annuitymaintenanceHybrid = 945; %annuity [€] for the maintenance costs for the Hybrid system
basedata.costs.annuitymaintenanceHPsingle = 295; %annuity [€] for the maintenance costs for the Hybrid system
basedata.costs.annuitymaintenanceLGBsingle = 655; %annuity [€] for the maintenance costs for the Hybrid system
basedata.costs.operationLGB = 22; %hourly costs [€] for operating the LGB
basedata.costs.operationHP = 110; %annual costs [€] for operating the LGB
basedata.costs.logwood.low = 60; %minimum price [€] for one cubic meter of log wood
basedata.costs.logwood.mean = 120; %mean price [€] for one cubic meter of log wood
basedata.costs.logwood.high = 220; %maximum price [€] for one cubic meter of log wood
basedata.costs.electricity.low = 0.2854; %minimum price [€] for one kWh electricity
basedata.costs.electricity.mean = 0.3857; %mean price [€] for one kWh electricity
basedata.costs.electricity.high = 0.55; %maximum price [€] for one kWh electricity

Risposte (1)

Harald
Harald il 30 Ago 2023
Hi Jan,
I would consider live controls as the alternative.
For the amount of parameters to be set, an app might still be the better choice. An advantage of this would be that you can perform checks like low < mean < high directly when the data is entered and have the app revert to the previous entry if needed.
If you are deciding in favor of an app, it seems nice to also show the results in that app.
Best wishes,
Harald

Categorie

Scopri di più su Energy Production in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by