├── Bateria.docx ├── Consumers ├── Consumer.m ├── Consumer.xml ├── CurveTrial_withsplinedraw.fig ├── Diesel.xml ├── MyLittleDEMIS.m ├── eNode.m ├── generateRandomCurve.m ├── splinedraw.m └── xml2struct.m ├── Diesel.docx ├── Diesel ├── Diesel.m ├── Diesel.req ├── Diesel.xml ├── MyLittleDEMIS.m ├── damping.slx ├── eNode.m ├── freqOscillations.slx ├── mechPower.slx └── xml2struct.m ├── EkaitzScheme_SmartGridControl ├── MainProgram │ └── MainProgram.m ├── Models │ ├── Battery.m │ ├── Battery │ │ ├── PowElec_Stg_Zigor.p │ │ ├── SimulateZigorBatteryModel_CMG.m │ │ └── SolveProblemBatteryZigor.m │ ├── CentraleNode.m │ ├── CentraleNode │ │ └── PruebasEkaitz │ │ │ ├── Central_eNode_PruebasEkaitz.m │ │ │ └── Central_eNode_PruebasEkaitz.xml │ ├── Consumer.m │ ├── Consumer │ │ └── CurveTrial_withsplinedraw.fig │ ├── Diesel.m │ ├── FlyWheel.m │ ├── FlyWheel │ │ ├── FWClass.xml │ │ ├── FlyWheeleNode.rar │ │ ├── InformeFW+B.rar │ │ ├── MyLittleDEMIS_FW_Zigor.m │ │ ├── PowElec_Stg_Zigor.p │ │ ├── SOC_FW.emf │ │ ├── SimulateZigorFWModel_CMG.m │ │ └── SolveProblemFWZigor.m │ ├── PV │ │ ├── GRC_ANDRAVIDA_166820_iw2_ESWN_INCAS_Irr.mat │ │ ├── GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat │ │ ├── GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat │ │ ├── GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat │ │ ├── GRC_ANDRAVIDA_166820_iw2_NSEW_Irr.mat │ │ ├── GRC_ANDRAVIDA_166820_iw2_SunPosition.mat │ │ ├── Irr_PV_Inc_30_Orient_0.mat │ │ ├── MyLittleDEMIS_PV_Zigor.m │ │ ├── Office_Building_sfun_vect.m │ │ ├── PV.7z │ │ ├── PVClass.xml │ │ ├── PV_Zigor_Test_InitFile.m │ │ ├── PowElec_PV.p │ │ ├── PowSolar_PV.m │ │ ├── PowSolar_PV.p │ │ ├── PruebaAislada.m │ │ ├── SolveProblem.m │ │ ├── TestFile.m │ │ ├── ZigorPV │ │ │ ├── GRC_ANDRAVIDA_166820_iw2_ESWN_INCAS_Irr.mat │ │ │ ├── GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat │ │ │ ├── GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat │ │ │ ├── GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat │ │ │ ├── GRC_ANDRAVIDA_166820_iw2_NSEW_Irr.mat │ │ │ ├── GRC_ANDRAVIDA_166820_iw2_SunPosition.mat │ │ │ ├── MyLittleDEMIS_PV_Zigor.m │ │ │ ├── PVClass.xml │ │ │ ├── PowElec_PV.p │ │ │ ├── PowSolar_PV.p │ │ │ ├── SolarPanel.m │ │ │ ├── SolveProblem.m │ │ │ ├── ZigorPV.rar │ │ │ ├── Zigor_Model.slx │ │ │ ├── eNode.m │ │ │ ├── getControl.m │ │ │ ├── getOptimResult.m │ │ │ └── xml2struct.m │ │ ├── Zigor_Model.slx │ │ ├── eNode.m │ │ ├── getControl.m │ │ ├── getOptimResult.m │ │ ├── los ficheros p │ │ │ ├── PowElec_PV.p │ │ │ └── PowSolar_PV.p │ │ ├── slprj │ │ │ └── _sfprj │ │ │ │ └── Zigor_Model │ │ │ │ └── _self │ │ │ │ └── sfun │ │ │ │ ├── info │ │ │ │ ├── binfo.mat │ │ │ │ ├── chart4_3pf05y3O2w01esZ1x9v1T.mat │ │ │ │ ├── chart5_BT217wIQUpnkWmF0rhCqnE.mat │ │ │ │ └── chart5_NV6lfvbUCbuwZyb6W2Fv0E.mat │ │ │ │ └── src │ │ │ │ ├── Zigor_Model_sfun.bat │ │ │ │ ├── Zigor_Model_sfun.c │ │ │ │ ├── Zigor_Model_sfun.exp │ │ │ │ ├── Zigor_Model_sfun.h │ │ │ │ ├── Zigor_Model_sfun.lib │ │ │ │ ├── Zigor_Model_sfun.mak │ │ │ │ ├── Zigor_Model_sfun.map │ │ │ │ ├── Zigor_Model_sfun.mexw64.manifest │ │ │ │ ├── Zigor_Model_sfun.mol │ │ │ │ ├── Zigor_Model_sfun.obj │ │ │ │ ├── Zigor_Model_sfun_debug_macros.h │ │ │ │ ├── Zigor_Model_sfun_registry.c │ │ │ │ ├── Zigor_Model_sfun_registry.obj │ │ │ │ ├── c4_Zigor_Model.c │ │ │ │ ├── c4_Zigor_Model.c~ │ │ │ │ ├── c4_Zigor_Model.h │ │ │ │ ├── c4_Zigor_Model.obj │ │ │ │ ├── c5_Zigor_Model.c │ │ │ │ ├── c5_Zigor_Model.h │ │ │ │ ├── c5_Zigor_Model.obj │ │ │ │ ├── mexopts.bat │ │ │ │ ├── rtwtypes.h │ │ │ │ └── rtwtypeschksum.mat │ │ └── xml2struct.m │ ├── SolarPanel.m │ ├── WindTurbine.m │ ├── WindTurbine │ │ ├── GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat │ │ ├── PowElec_WT.m │ │ ├── PowElec_WT.p │ │ ├── PowWind_WT.m │ │ ├── PowWind_WT.p │ │ ├── SolveProblemWTZigor.m │ │ ├── WindTurbine_EkaitzPruebas │ │ │ ├── GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat │ │ │ ├── IntegrationZigorDemisV3.rar │ │ │ ├── IntegrationZigorDemisV4.zip │ │ │ ├── MyLittleDEMIS.m │ │ │ ├── PowElec_WT.m │ │ │ ├── PowElec_WT.p │ │ │ ├── PowWind_WT.m │ │ │ ├── PowWind_WT.p │ │ │ ├── SolveProblemWTZigor.m │ │ │ ├── WindTurbine.m │ │ │ ├── WindTurbine.xml │ │ │ ├── Zigor_WT_profit.m │ │ │ ├── eNode.m │ │ │ ├── license.txt │ │ │ └── xml2struct.m │ │ └── Zigor_WT_profit.m │ └── eNode.m ├── Utils │ ├── createConsumer.m │ ├── createDiesel.m │ ├── createPhotoVoltaic.m │ ├── createWindTurbine.m │ ├── funcLocalSearch.m │ ├── generateRandomCurve.m │ ├── intersections.m │ ├── intersections │ │ ├── intersections.m │ │ └── license.txt │ ├── splinedraw.m │ └── xml2struct.m └── Work │ ├── CentraleNode │ └── CentraleNode.xml │ ├── GridComponents │ ├── Consumer_001.xml │ ├── Diesel_002.xml │ ├── Not_used_yet │ │ ├── Battery_001.xml │ │ ├── Copy_WindTurbine3_Documentation.xml │ │ ├── Diesel_001.xml │ │ ├── FWClass.xml │ │ ├── PVClass.xml │ │ └── WindTurbine3.xml │ ├── PVClass.xml │ ├── WindTurbine1.xml │ ├── WindTurbine2.xml │ └── WindTurbine3.xml │ └── XMLs_EkaitzPruebas │ ├── Battery1.xml │ ├── Central_eNode.xml │ ├── FWClass.xml │ ├── PVClass.xml │ ├── WindTurbine 1.xml │ ├── WindTurbine2.xml │ └── WindTurbine3.xml ├── PV.docx ├── Problem Log.docx ├── README.md ├── SmartGridControl ├── Flowcharts of Algorithm │ ├── Price_Pgap_Algorithm.graphml │ └── flowchart-algorithm.graphml ├── MainProgram │ └── MainProgram.m ├── Models │ ├── Battery.m │ ├── Battery │ │ ├── PowElec_Stg_Zigor.p │ │ ├── SimulateZigorBatteryModel_CMG.m │ │ └── SolveProblemBatteryZigor.m │ ├── CentraleNode.m │ ├── CentraleNode │ │ └── PruebasEkaitz │ │ │ ├── Central_eNode_PruebasEkaitz.m │ │ │ └── Central_eNode_PruebasEkaitz.xml │ ├── Consumer.m │ ├── Consumer │ │ └── CurveTrial_withsplinedraw.fig │ ├── Diesel.m │ ├── FlyWheel.m │ ├── FlyWheel │ │ ├── FWClass.xml │ │ ├── FlyWheeleNode.rar │ │ ├── InformeFW+B.rar │ │ ├── MyLittleDEMIS_FW_Zigor.m │ │ ├── PowElec_Stg_Zigor.p │ │ ├── SOC_FW.emf │ │ ├── SimulateZigorFWModel_CMG.m │ │ └── SolveProblemFWZigor.m │ ├── Hydro.m │ ├── PV │ │ ├── GRC_ANDRAVIDA_166820_iw2_ESWN_INCAS_Irr.mat │ │ ├── GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat │ │ ├── GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat │ │ ├── GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat │ │ ├── GRC_ANDRAVIDA_166820_iw2_NSEW_Irr.mat │ │ ├── GRC_ANDRAVIDA_166820_iw2_SunPosition.mat │ │ ├── Irr_PV_Inc_30_Orient_0.mat │ │ ├── MyLittleDEMIS_PV_Zigor.m │ │ ├── Office_Building_sfun_vect.m │ │ ├── PV.7z │ │ ├── PVClass.xml │ │ ├── PV_Zigor_Test_InitFile.m │ │ ├── PowElec_PV.p │ │ ├── PowSolar_PV.m │ │ ├── PowSolar_PV.p │ │ ├── PruebaAislada.m │ │ ├── SolveProblem.m │ │ ├── TestFile.m │ │ ├── ZigorPV │ │ │ ├── GRC_ANDRAVIDA_166820_iw2_ESWN_INCAS_Irr.mat │ │ │ ├── GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat │ │ │ ├── GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat │ │ │ ├── GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat │ │ │ ├── GRC_ANDRAVIDA_166820_iw2_NSEW_Irr.mat │ │ │ ├── GRC_ANDRAVIDA_166820_iw2_SunPosition.mat │ │ │ ├── MyLittleDEMIS_PV_Zigor.m │ │ │ ├── PVClass.xml │ │ │ ├── PowElec_PV.p │ │ │ ├── PowSolar_PV.p │ │ │ ├── SolarPanel.m │ │ │ ├── SolveProblem.m │ │ │ ├── ZigorPV.rar │ │ │ ├── Zigor_Model.slx │ │ │ ├── eNode.m │ │ │ ├── getControl.m │ │ │ ├── getOptimResult.m │ │ │ └── xml2struct.m │ │ ├── Zigor_Model.slx │ │ ├── eNode.m │ │ ├── getControl.m │ │ ├── getOptimResult.m │ │ ├── los ficheros p │ │ │ ├── PowElec_PV.p │ │ │ └── PowSolar_PV.p │ │ ├── slprj │ │ │ └── _sfprj │ │ │ │ └── Zigor_Model │ │ │ │ └── _self │ │ │ │ └── sfun │ │ │ │ ├── info │ │ │ │ ├── binfo.mat │ │ │ │ ├── chart4_3pf05y3O2w01esZ1x9v1T.mat │ │ │ │ ├── chart5_BT217wIQUpnkWmF0rhCqnE.mat │ │ │ │ └── chart5_NV6lfvbUCbuwZyb6W2Fv0E.mat │ │ │ │ └── src │ │ │ │ ├── Zigor_Model_sfun.bat │ │ │ │ ├── Zigor_Model_sfun.c │ │ │ │ ├── Zigor_Model_sfun.exp │ │ │ │ ├── Zigor_Model_sfun.h │ │ │ │ ├── Zigor_Model_sfun.lib │ │ │ │ ├── Zigor_Model_sfun.mak │ │ │ │ ├── Zigor_Model_sfun.map │ │ │ │ ├── Zigor_Model_sfun.mexw64.manifest │ │ │ │ ├── Zigor_Model_sfun.mol │ │ │ │ ├── Zigor_Model_sfun.obj │ │ │ │ ├── Zigor_Model_sfun_debug_macros.h │ │ │ │ ├── Zigor_Model_sfun_registry.c │ │ │ │ ├── Zigor_Model_sfun_registry.obj │ │ │ │ ├── c4_Zigor_Model.c │ │ │ │ ├── c4_Zigor_Model.c~ │ │ │ │ ├── c4_Zigor_Model.h │ │ │ │ ├── c4_Zigor_Model.obj │ │ │ │ ├── c5_Zigor_Model.c │ │ │ │ ├── c5_Zigor_Model.h │ │ │ │ ├── c5_Zigor_Model.obj │ │ │ │ ├── mexopts.bat │ │ │ │ ├── rtwtypes.h │ │ │ │ └── rtwtypeschksum.mat │ │ └── xml2struct.m │ ├── SolarPanel.m │ ├── WindTurbine.m │ ├── WindTurbine │ │ ├── GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat │ │ ├── PowElec_WT.m │ │ ├── PowElec_WT.p │ │ ├── PowWind_WT.m │ │ ├── PowWind_WT.p │ │ ├── SolveProblemWTZigor.m │ │ ├── WindTurbine_EkaitzPruebas │ │ │ ├── GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat │ │ │ ├── IntegrationZigorDemisV3.rar │ │ │ ├── IntegrationZigorDemisV4.zip │ │ │ ├── MyLittleDEMIS.m │ │ │ ├── PowElec_WT.m │ │ │ ├── PowElec_WT.p │ │ │ ├── PowWind_WT.m │ │ │ ├── PowWind_WT.p │ │ │ ├── SolveProblemWTZigor.m │ │ │ ├── WindTurbine.m │ │ │ ├── WindTurbine.xml │ │ │ ├── Zigor_WT_profit.m │ │ │ ├── eNode.m │ │ │ ├── license.txt │ │ │ └── xml2struct.m │ │ └── Zigor_WT_profit.m │ └── eNode.m ├── Utils │ ├── createConsumer.m │ ├── createDiesel.m │ ├── createHydro.m │ ├── createPhotoVoltaic.m │ ├── createWindTurbine.m │ ├── funcLocalSearch.m │ ├── generateRandomCurve.m │ ├── intersections.m │ ├── intersections │ │ ├── intersections.m │ │ └── license.txt │ ├── splinedraw.m │ └── xml2struct.m └── Work │ ├── CentraleNode │ └── CentraleNode.xml │ ├── GridComponents │ ├── Consumer_001.xml │ ├── Diesel_002.xml │ ├── Hydro.xml │ ├── Not_used_yet │ │ ├── Battery_001.xml │ │ ├── Copy_WindTurbine3_Documentation.xml │ │ ├── Diesel_001.xml │ │ ├── FWClass.xml │ │ └── PVClass.xml │ ├── PVClass.xml │ ├── WindTurbine1.xml │ ├── WindTurbine2.xml │ └── WindTurbine3.xml │ └── XMLs_EkaitzPruebas │ ├── Battery1.xml │ ├── Central_eNode.xml │ ├── FWClass.xml │ ├── PVClass.xml │ ├── WindTurbine 1.xml │ ├── WindTurbine2.xml │ └── WindTurbine3.xml ├── SmartGridControl_23122015.zip ├── WT.docx └── WindTurbine ├── GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat ├── MyLittleDEMIS.m ├── PowElec_WT.m ├── PowElec_WT.p ├── PowWind_WT.m ├── PowWind_WT.p ├── SolveProblemWTZigor.m ├── WindTurbine.m ├── WindTurbine.xml ├── Zigor_WT_profit.m ├── eNode.m └── xml2struct.m /Bateria.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/Bateria.docx -------------------------------------------------------------------------------- /Consumers/Consumer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Consumer 4 | autonomous 5 | 6 | Consumer 7 | 8 | 9 | 10 | 11 | 12 | [[1:1:96]; [1:1:96]] 13 | .9 14 | 100 15 | [ 0.1535 0.1689 0.2620 0.4145 2.8270 4.6390 0.9211 2.6362 3.2084 1.1404 6.0979 0.7895 1.3205 14.0789 22.1199 1.5875 9.7368 0.7456 1.6667 1.3158 1.6667 1.6667 1.8421 2.1199 0.7895 2.6316 0.7895 2.5439 4.4298 7.7151 25.1754 22.5439 25.3509 28.3333 35.0000 16.2281 7.5371 2.7193 1.9737 1.3158 0.7895 0.2632 0.9649 0.0593 0.2967 0.0593 11.4540 26.9436 23.3086 10.7418 0.4154 10.7418 13.0564 8.4273 3.9763 2.7300 2.5519 2.7300 3.4421 4.3323 3.9763 3.2641 4.6884 3.4421 5.0593 4.5104 3.9763 3.7982 4.5104 3.9763 3.7982 3.6202 4.6884 4.1543 5.2226 4.1543 4.3323 7.1810 12.1662 16.2611 25.2077 37.4481 39.4065 38.3383 42.6113 26.9436 23.9169 18.0415 10.9199 7.3591 4.6390 2.8270 0.4145 0.2620 0.1689 0.1535 ] 16 | [ 0.1564 0.3925 0.3945 0.3945 0.3945 0.3317 0.3200 0.3265 0.3243 0.3243 0.3447 0.3562 0.3338 0.3375 0.3309 0.3338 0.3360 0.3360 0.3580 0.3660 0.3740 0.3799 0.3814 0.3799 0.3836 0.3624 0.3558 0.3287 0.3039 0.2871 0.2651 0.2395 0.2162 0.2147 0.2315 0.2257 0.2220 0.2205 0.2205 0.2205 0.2520 0.2754 0.2936 0.2958 0.2951 0.2754 0.2607 0.2520 0.2505 0.2520 0.2490 0.2520 0.3302 0.3740 0.3510 0.3514 0.3514 0.3507 0.2927 0.2556 0.2286 0.2288 0.2201 0.2140 0.2074 0.2059 0.2045 0.2008 0.2096 0.2008 0.1825 0.2001 0.2374 0.2644 0.2973 0.3105 0.3163 0.3178 0.3192 0.3061 0.3031 0.2944 0.2790 0.2702 0.2564 0.2352 0.2337 0.2527 0.2827 0.3675 0.3616 0.3695 0.3682 0.3697 0.3697 0.3697] 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Consumers/CurveTrial_withsplinedraw.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/Consumers/CurveTrial_withsplinedraw.fig -------------------------------------------------------------------------------- /Consumers/Diesel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Diesel 4 | autonomous 5 | 6 | Diesel 7 | 8 | 9 | 10 | 11 | 12 | 100 13 | [0 5.7 9.5 13.6 18] 14 | 0 15 | 250 16 | 17 | 18 | 19 | 20 | 21 | 0.85 22 | 0.9 23 | 0 24 | 1 25 | 0.25 26 | [3 4 6 7.5 9.5 11 14 16 18 21 140 470 780 1450 1860 2200 2280 2300 2400 2500 3 4 6 7.5 9.5 11 14 16 18 21 140 470 780 1450 1860 2200 2280 2300 2400 25003 4 6 7.5 9.5 11 14 16 18 21] 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Consumers/MyLittleDEMIS.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear all 3 | close all 4 | 5 | %XML 6 | XML='Consumer.xml'; 7 | %scheduleXML 8 | scheduleXML = []; 9 | % %currentTime 10 | currentTime=0; %We do not need this variable 11 | %OptimParams 12 | OptimParams.beta=[]; 13 | OptimParams.PriceCutoff=[]; 14 | 15 | OptimParams.horizon=24; %I suppose that this time goes in hours. 16 | OptimParams.tSample = 0.25; %I suppose that this time goes in hours. 17 | OptimParams.updatePeriod=[]; 18 | 19 | %measures 20 | measures=[]; %Not used 21 | 22 | MiConsumidor = Consumer( XML, scheduleXML, currentTime, OptimParams, measures); 23 | 24 | %t=10.*[0:95]/9.5; 25 | time = [0:length(MiConsumidor.Model.powerConsumed(1,:)) - 1] ; 26 | curve = MiConsumidor.Model.powerConsumed(2,:); 27 | % Ts = 0.001; 28 | % for i = 1 : length(curve)-1 29 | % curve2(i) = tf( curve(i), [ Ts, 1]); 30 | % end 31 | % stepplot(curve2); 32 | hold on 33 | %plot( time, curve, 'r'); 34 | plot( time, MiConsumidor.Model.CurveZ, 'r'); 35 | hold off 36 | set(gcf,'units','normalized','outerposition',[0 0 1 1]) 37 | %curveHeavi = heaviside(time); 38 | %h = stepplot(time,curve); 39 | % sys = ar(time, 10); 40 | % sys2 = ar(curve, 2); 41 | % data = iddata( time, curve, 96); 42 | % sys = impulse(data); 43 | % t = (0:1:96); 44 | % h = stepplot(sys, time , t); 45 | % showConfidence(h, 3); 46 | % sys = tf( 1, [3 2 1], .1); 47 | % step(sys); 48 | xlabel('Time') 49 | ylabel('Power [Watts]') 50 | grid on 51 | ax = gca; 52 | set(ax,'XTick',(0:100)); -------------------------------------------------------------------------------- /Consumers/generateRandomCurve.m: -------------------------------------------------------------------------------- 1 | function [ result ] = generateRandomCurve( pPower, pSize ) 2 | %GENERATERANDOMCURVE Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | 6 | %tempPowerMatrix = Consumer.Model.powerConsumed(2,:); 7 | %r_range = [min(r) max(r)]; 8 | r = randi( pPower, 1, pSize); 9 | 10 | result = r; 11 | end 12 | 13 | -------------------------------------------------------------------------------- /Diesel.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/Diesel.docx -------------------------------------------------------------------------------- /Diesel/Diesel.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/Diesel/Diesel.m -------------------------------------------------------------------------------- /Diesel/Diesel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Diesel 4 | autonomous 5 | 6 | Diesel 7 | 8 | 9 | 10 | 11 | 12 | 100 13 | [0 5.7 9.5 13.6 18] 14 | 0 15 | 250 16 | 17 | 18 | 19 | 20 | 21 | 0.85 22 | 0.9 23 | 0 24 | 1 25 | 0.25 26 | [ 1 2 3 4 5 6 7 8 9 10] 27 | [3100 2700 2600 2300 2280 2200 1860 1450 780 470 140 0] 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Diesel/MyLittleDEMIS.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/Diesel/MyLittleDEMIS.m -------------------------------------------------------------------------------- /Diesel/damping.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/Diesel/damping.slx -------------------------------------------------------------------------------- /Diesel/freqOscillations.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/Diesel/freqOscillations.slx -------------------------------------------------------------------------------- /Diesel/mechPower.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/Diesel/mechPower.slx -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/MainProgram/MainProgram.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear all 3 | close all 4 | % GLOBAL VARIABLES 5 | gPrice = 0.0648; 6 | 7 | % XML 8 | XML='CentraleNode.xml'; 9 | % scheduleXML 10 | scheduleXML = []; 11 | % currentTime 12 | currentTime=0; %We do not need this variable 13 | % OptimProblem 14 | OptimProblem.Price = gPrice; % It's in euros per Kwh 15 | % OptimParams 16 | OptimParams.horizon = 24; % I suppose that this time goes in hours. 17 | OptimParams.tSample = 0.25; % I suppose that this time goes in hours. 18 | OptimParams.updatePeriod=[]; 19 | % predictions 20 | predictions=[]; 21 | %Inventado 22 | % measures 23 | measures=[]; %Not used 24 | cd ../Models; 25 | MiCentral = CentraleNode(XML, scheduleXML, currentTime, OptimParams, OptimProblem, predictions, measures); 26 | %MiCentral = CentraleNode(); 27 | % for x=1:( length(MiCentral.Consumers.ConsumerNodes) ) 28 | % MiCentral.Consumers.ConsumerNodes 29 | % end 30 | %data = MiCentral.Consumers.ConsumerNodes; 31 | 32 | fnC = fieldnames(MiCentral.Consumers.ConsumerNodes); % fnC = field name consumers 33 | numCon = length(fnC); 34 | 35 | powerGap = 0; 36 | cd ../Models; 37 | for i=1:numCon 38 | itself = MiCentral.Consumers.ConsumerNodes.(fnC{i}); 39 | powerGap = powerGap + itself.getPowerWanted( ); 40 | end 41 | powerGap 42 | 43 | fnWT = fieldnames(MiCentral.Generators.WTNodes); % Field names for every WindTurbines 44 | numWT = length(fnWT); % number of WTnodes 45 | fnPV = fieldnames(MiCentral.Generators.PVNodes); % Field names for every PhotoVoltaic 46 | numPV = length(fnPV); % number of PVnodes 47 | 48 | freqWT = 0; 49 | powWT = 0; 50 | sumFreqWT = 0; 51 | totalFreqWT = 0; 52 | 53 | % Loop for getting total frequency and power for all the WTNodes 54 | for c = 1:numWT 55 | freqWT = MiCentral.Generators.WTNodes.( fnWT{numWT} ).getFreqFromPrice( gPrice ); % Freq of the WTNode number 'c' 56 | sumFreqWT = sumFreqWT + freqWT; % Sum of all frequencies 57 | powWT = powWT + MiCentral.Generators.WTNodes.( fnWT{numWT} ).getPowerFromFreq( freqWT ); % Sum the power of the WTNode 'c' and sum it to the total 58 | end 59 | % Results of the WT Grid sent to the Central eNode 60 | totalFreqWT = sumFreqWT / numWT; % Result freq of WT Grid sent to Central eNode 61 | totalPowWT = powWT % Result total power of WT Grid sent to Central eNode 62 | 63 | gPrice = 0.0648; % It's the starting price of the PV for now. Needs to change 64 | 65 | freqPV = 0; 66 | totalPowPV = 0; 67 | powPV=0; 68 | sumFreqPV = 0; 69 | totalFreqPV = 0; 70 | 71 | % Loop for getting total frequency and power for all the PVNodes 72 | for c = 1:numPV 73 | freqPV = MiCentral.Generators.PVNodes.( fnPV{numPV} ).getFreqFromEuro( gPrice ); % Freq of the PVNode number 'c' 74 | sumFreqPV = sumFreqPV + freqPV; % Sum of all frequencies 75 | % totalFreqPV = sumFreqPV / c; 76 | %freqPV = 47.512 77 | powPV = powPV + MiCentral.Generators.PVNodes.( fnPV{numPV} ).getPowerFromFreq( freqPV ); % Sum the power of the PVNode 'c' and sum it to the total 78 | end 79 | % Results of the PV Grid sent to the Central eNode 80 | totalFreqPV = sumFreqPV / numPV 81 | totalPowPV = powPV; 82 | 83 | generatorsTotalFreq = (sumFreqPV + sumFreqWT) / (numPV + numWT) 84 | generatorsTotalPow = totalPowWT + totalPowPV 85 | 86 | 87 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/Battery/PowElec_Stg_Zigor.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/Battery/PowElec_Stg_Zigor.p -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/CentraleNode/PruebasEkaitz/Central_eNode_PruebasEkaitz.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Central_eNode 4 | autonomous 5 | 6 | Central_eNode 7 | 8 | 9 | 10 | 11 | 12 | WindTurbine1.xml 13 | WindTurbine3.xml 14 | FWClass.xml 15 | Battery1.xml 16 | PVClass.xml 17 | Consumer.xml 18 | 19 | 20 | Diesel.xml 21 | Diesel.xml 22 | Hydraulic.xml 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/Consumer/CurveTrial_withsplinedraw.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/Consumer/CurveTrial_withsplinedraw.fig -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/Diesel.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/Diesel.m -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/FlyWheel.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/FlyWheel.m -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/FlyWheel/FWClass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | FWZigor 4 | autonomous 5 | 6 | FWZigor 7 | 8 | 9 | 10 | 11 | 0.311*15 12 | 50e3*2*pi/60 13 | 0.75*50e3*2*pi/60 14 | 0.08*1000/ (50000*pi/30) 15 | 0.15*1000/ (50000*pi/30)^2 16 | 0.3*1000/ (50000*pi/30)^3 17 | 0.95 18 | 100 19 | -100 20 | 100e3 21 | -100e3 22 | 100000 23 | 10 24 | 1000 25 | 95 26 | 93 27 | 0.001 28 | 29 | 30 | 0.01 31 | 0.001 32 | 0 33 | 1 34 | 0.1 35 | 0.2 36 | 0.8 37 | 1 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/FlyWheel/FlyWheeleNode.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/FlyWheel/FlyWheeleNode.rar -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/FlyWheel/InformeFW+B.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/FlyWheel/InformeFW+B.rar -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/FlyWheel/MyLittleDEMIS_FW_Zigor.m: -------------------------------------------------------------------------------- 1 | 2 | clc 3 | clear all 4 | close all 5 | %XML 6 | XML='FWClass.xml'; 7 | %scheduleXML 8 | scheduleXML=0; %We do not need this variable 9 | % %currentTime 10 | currentTime=0; %We do not need this variable 11 | %OptimParams 12 | OptimParams.beta=[]; 13 | OptimParams.PriceCutoff=[]; 14 | OptimParams.Incentivemin=[]; 15 | OptimParams.Incentivemax=[]; 16 | 17 | OptimParams.horizon=24*60*60; 18 | OptimParams.tSample = 0.25*60*60; 19 | OptimParams.updatePeriod=[]; 20 | 21 | %predictions 22 | t=10*[0:95]/95; 23 | predictions.tariff=0.06*(sin(t)+ones(1,96));%Inventado ones(1,96);%0.5*ones(1,96);% 24 | %measures 25 | measures=[]; %Not used 26 | MiFlyWheel= FlyWheel(XML, scheduleXML, currentTime, OptimParams, predictions, measures); 27 | MiFlyWheel = getOptimResult(MiFlyWheel); 28 | % figure 29 | % %subplot(2,1,1) 30 | % %Resultados=MyTurbine.getOptimResult(MyTurbine); 31 | % %subplot(2,1,1) 32 | % plot(predictions.tariff,'r') 33 | % hold on 34 | % xlabel('Time Slot') 35 | % ylabel('Tariff') 36 | % grid on 37 | % 38 | % %subplot(2,1,2) 39 | % figure 40 | % plot(MiFlyWheel.ProductionPUproposal) 41 | % grid on 42 | % xlabel('Time Slot') 43 | % ylabel('Production') 44 | 45 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/FlyWheel/PowElec_Stg_Zigor.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/FlyWheel/PowElec_Stg_Zigor.p -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/FlyWheel/SOC_FW.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/FlyWheel/SOC_FW.emf -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/FlyWheel/SolveProblemFWZigor.m: -------------------------------------------------------------------------------- 1 | function [Results] = SolveProblemFWZigor( SP ) 2 | %SolveProblem Summary of this function goes here 3 | % Detailed explanation goes here 4 | Nslot = SP.OptimParams.horizon/SP.OptimParams.tSample; 5 | Price=SP.StoredData.tariff; 6 | t0=0; 7 | tfin=1*24*3600; 8 | deltaT=SP.OptimParams.deltaT; 9 | Time=[t0:deltaT:tfin]; 10 | beta=SP.OptimParams.beta; 11 | Incentivemax=SP.OptimParams.Incentivemax; 12 | Incentivemin=SP.OptimParams.Incentivemin; 13 | PriceCutoff=SP.OptimParams.PriceCutoff; 14 | lambda=SP.OptimParams.lambda; 15 | if lambda==0 16 | lambda=1; 17 | end 18 | 19 | %Incentive Factor 20 | f=1./(1+exp(-(Price-SP.OptimParams.PriceCutoff)/SP.OptimParams.beta)); 21 | IncentiveFactor=SP.OptimParams.Incentivemin+(SP.OptimParams.Incentivemax-SP.OptimParams.Incentivemin)*f; 22 | IncentiveFactor(IncentiveFactor<0)=0; 23 | Nslot = SP.OptimParams.horizon/SP.OptimParams.tSample; 24 | IF=interp1((tfin-t0)*[0:Nslot-1]/Nslot,IncentiveFactor,Time,'linear','extrap'); 25 | Ithmean=mean(IncentiveFactor); 26 | 27 | %Model's initial values 28 | w0=SP.Model.Wini; 29 | Wmin=SP.Model.Wmin; 30 | 31 | %Model's variables 32 | Psetpoint=zeros(1,length(Time)); 33 | Pelec=zeros(1,length(Time)); 34 | w=zeros(1,length(Time)); 35 | w(1)=SP.Model.Wini; 36 | SOC=zeros(1,length(Time)); 37 | Plosses=zeros(1,length(Time)); 38 | 39 | [w(1),SOC(1),Psetpoint(1),Pelec(1),Plosses(1)]=SimulateZigorFWModel_CMG(SP,IF(1),Ithmean,w0,Wmin,deltaT); 40 | for k=2:length(Time) 41 | 100*k/length(Time) 42 | [w(k),SOC(k),Psetpoint(k),Pelec(k),Plosses(k)]=SimulateZigorFWModel_CMG(SP,IF(k),Ithmean,w(k-1),Wmin,deltaT); 43 | end 44 | 45 | Energia1=(sum(Pelec)-sum(Plosses))*deltaT 46 | Energia2=(SOC(length(Time))-(SP.Model.Wini/SP.Model.Wmax)^2)*(0.5*SP.Model.J*(SP.Model.Wmax^2)); 47 | Energia1-Energia2 48 | 49 | 50 | % %subplot(3,1,1) 51 | % figure 52 | % plot(Time,SOC,'r') 53 | % xlabel('Time [secs]') 54 | % ylabel('State of Charge [%]') 55 | % grid on 56 | % 57 | % %subplot(3,1,2) 58 | % figure 59 | % plot(Time,IF,'r') 60 | % xlabel('Time [secs]') 61 | % ylabel('IF [-]') 62 | % grid on 63 | % 64 | % %subplot(3,1,3) 65 | % figure 66 | % plot(Time,Pelec,'r') 67 | % xlabel('Time [secs]') 68 | % ylabel('Power Production [Watts]') 69 | % grid on 70 | % 71 | % figure 72 | % PriceVec=[0:0.01:1]; 73 | % f=1./(1+exp(-(PriceVec-SP.OptimParams.PriceCutoff)/SP.OptimParams.beta)); 74 | % IncentiveFactor=SP.OptimParams.Incentivemin+(SP.OptimParams.Incentivemax-SP.OptimParams.Incentivemin)*f; 75 | % IncentiveFactor(IncentiveFactor<0)=0; 76 | % plot(PriceVec,IncentiveFactor,'r') 77 | % xlabel('Virtual tariff [-]') 78 | % ylabel('Incentive factor [-]') 79 | % grid on 80 | % 81 | % figure 82 | % TimePrice=tfin*[0:length(Price)-1]/(length(Price)); 83 | % plot(TimePrice,Price,'r') 84 | % grid on 85 | % xlabel('Time [secs]') 86 | % ylabel('Virtual tariff') 87 | % pause 88 | 89 | Results.pow=interp1(Time,Pelec,(tfin-t0)*[0:Nslot-1]/Nslot); 90 | Results.objval=sum(IF.*Pelec/SP.Model.nPW)/Nslot; 91 | Results.ProductionPUproposal=interp1(Time,Pelec/SP.Model.nPW,(tfin-t0)*[0:Nslot-1]/Nslot); 92 | 93 | end 94 | 95 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_ESWN_INCAS_Irr.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_ESWN_INCAS_Irr.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_NSEW_Irr.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_NSEW_Irr.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_SunPosition.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_SunPosition.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/Irr_PV_Inc_30_Orient_0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/Irr_PV_Inc_30_Orient_0.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/MyLittleDEMIS_PV_Zigor.m: -------------------------------------------------------------------------------- 1 | 2 | clc 3 | clear all 4 | close all 5 | %XML 6 | XML='PVClass.xml'; 7 | %scheduleXML 8 | scheduleXML=0; %We do not need this variable 9 | % %currentTime 10 | currentTime=0; %We do not need this variable 11 | %OptimParams 12 | OptimParams.beta=[]; 13 | OptimParams.PriceCutoff=[]; 14 | OptimParams.Incentivemin=[]; 15 | OptimParams.Incentivemax=[]; 16 | 17 | OptimParams.horizon=24*60*60; %I suppose that this time goes in secs. 18 | OptimParams.tSample = 15*60; %I suppose that this time goes in secs. 19 | 20 | %predictions 21 | 22 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat') 23 | timeirrDif=[0:60*60:24*60*60]; %We take only the first day, each hour 24 | 25 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat') 26 | timeirrDir=[0:60*60:24*60*60]; %We take only the first day, each hour 27 | 28 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat') 29 | timeTAir=[0:1*60*60:24*60*60]; 30 | load('GRC_ANDRAVIDA_166820_iw2_SunPosition.mat') 31 | timeAzi=SunPosition(1,:); 32 | timeEle=timeAzi; 33 | 34 | Time=24*60*60*[0:95]/95; 35 | 36 | predictions.Azimut_Angle=interp1(timeAzi,SunPosition(2,:),Time,'linear','extrap'); 37 | predictions.Elevation_Angle=interp1(timeEle,SunPosition(3,:),Time,'linear','extrap'); 38 | predictions.TAirExt=interp1(timeTAir,temperature_Forecast(:,1),Time,'linear','extrap'); 39 | predictions.irrDir=interp1(timeirrDir,irrDir_Forecast(:,1)',Time,'linear','extrap'); 40 | predictions.irrDif=interp1(timeirrDif,irrDif_Forecast(:,1),Time,'linear','extrap'); 41 | 42 | predictions.tariff=ones(1,96);%Inventado 43 | %measures 44 | measures=[]; %Not used 45 | MiPanel = SolarPanel(XML, scheduleXML, currentTime, OptimParams, predictions, measures); 46 | MiPanel = getOptimResult(MiPanel); 47 | figure 48 | subplot(2,1,1) 49 | %Resultados=MyTurbine.getOptimResult(MyTurbine); 50 | % plot(MiPanel.OptimProblem.currentSolution.pow) 51 | % hold on 52 | % grid on 53 | % xlabel('Time Slot') 54 | % ylabel('Production') 55 | % subplot(2,1,2) 56 | % plot(timeirrDif,irrDir_Forecast(:,1),'r') 57 | % hold on 58 | % xlabel('Time Slot') 59 | % ylabel('Direct Irradiance') 60 | % grid on 61 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/PV.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/PV.7z -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/PVClass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PhotoVoltaic 4 | autonomous 5 | 6 | PV 7 | 8 | 9 | 10 | 11 | 30 12 | -20 13 | 16500 14 | -0.4 15 | 47 16 | 0.95 17 | 0.25 18 | 15000 19 | 0 20 | 15 21 | 97 22 | 96 23 | 150 24 | 100 25 | 26 | 27 | 15*60 28 | 24*60*60 29 | 0.9 30 | 0.5 31 | -0.1 32 | 1 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/PV_Zigor_Test_InitFile.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/PV_Zigor_Test_InitFile.m -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/PowElec_PV.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/PowElec_PV.p -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/PowSolar_PV.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/PowSolar_PV.m -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/PowSolar_PV.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/PowSolar_PV.p -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/PruebaAislada.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear all 3 | close all 4 | DATA = PV_Zigor_Test_InitFile ; 5 | Param=DATA; 6 | Param.Orientation.tilt=DATA.tilt; 7 | Param.Orientation.SO=DATA.SO; 8 | Param.Eff.Ploss_off = DATA.Ploss_off; 9 | Param.Eff.Ploss_on = DATA.Ploss_on; 10 | Param.Eff.Eff_hl = DATA.Eff_hl; 11 | Param.Eff.Eff_fl = DATA.Eff_fl; 12 | 13 | %predictions 14 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat') 15 | timeirrDif=[0:60*60:24*60*60]; %We take only the first day, each hour 16 | 17 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat') 18 | timeirrDir=[0:60*60:24*60*60]; %We take only the first day, each hour 19 | 20 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat') 21 | timeTAir=[0:1*60*60:24*60*60]; 22 | load('GRC_ANDRAVIDA_166820_iw2_SunPosition.mat') 23 | timeAzi=SunPosition(1,:); 24 | timeEle=timeAzi; 25 | 26 | Time=24*60*60*[0:95]/95; 27 | 28 | predictions.Azimut_Angle=interp1(timeAzi,SunPosition(2,:),Time,'linear','extrap'); 29 | predictions.Elevation_Angle=interp1(timeEle,SunPosition(3,:),Time,'linear','extrap'); 30 | predictions.TAirExt=interp1(timeTAir,temperature_Forecast(:,1),Time,'linear','extrap'); 31 | predictions.irrDir=interp1(timeirrDir,irrDir_Forecast(:,1)',Time,'linear','extrap'); 32 | predictions.irrDif=interp1(timeirrDif,irrDif_Forecast(:,1),Time,'linear','extrap'); 33 | 34 | PV_Ctl=ones(1,96); 35 | PV_Shaving_Ctl=ones(1,96); 36 | P_Solar=zeros(1,96); 37 | P_Elec=zeros(1,96); 38 | 39 | 40 | for k=1:length(PV_Shaving_Ctl) 41 | P_Solar(k) = PowSolar_PV(Param, predictions.irrDir(k),predictions.irrDif(k),predictions.Elevation_Angle(k), predictions.Azimut_Angle(k), predictions.TAirExt(k)); 42 | if P_Solar(k)<0 43 | P_Solar(k)=0; 44 | end 45 | P_Elec(k) = PowElec_PV(Param, real(P_Solar(k)), PV_Ctl(k), PV_Shaving_Ctl(k)); 46 | end 47 | figure 48 | subplot(3,1,1) 49 | plot(real(P_Solar),'xb') 50 | hold on 51 | grid on 52 | 53 | 54 | subplot(3,1,2) 55 | plot(P_Elec,'xr') 56 | hold on 57 | grid on 58 | 59 | subplot(3,1,3) 60 | plot(predictions.irrDir,'xb') 61 | hold on 62 | grid on 63 | 64 | figure 65 | Price=[0:0.01:10]; 66 | beta=0.9; 67 | Incentivemax=1; 68 | Incentivemin=-0.1; 69 | PriceCutoff=0.85; 70 | f=1./(1+exp(-(Price-PriceCutoff)/beta)); 71 | IncentiveFactor=Incentivemin+(Incentivemax-Incentivemin)*f; 72 | IncentiveFactor(IncentiveFactor<0)=0; 73 | plot(Price,IncentiveFactor,'r') -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/SolveProblem.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/SolveProblem.m -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_ESWN_INCAS_Irr.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_ESWN_INCAS_Irr.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_NSEW_Irr.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_NSEW_Irr.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_SunPosition.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_SunPosition.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/MyLittleDEMIS_PV_Zigor.m: -------------------------------------------------------------------------------- 1 | 2 | clc 3 | clear all 4 | close all 5 | %XML 6 | XML='PVClass.xml'; 7 | %scheduleXML 8 | scheduleXML=0; %We do not need this variable 9 | % %currentTime 10 | currentTime=0; %We do not need this variable 11 | %OptimParams 12 | OptimParams.beta=[]; 13 | OptimParams.PriceCutoff=[]; 14 | OptimParams.Incentivemin=[]; 15 | OptimParams.Incentivemax=[]; 16 | 17 | OptimParams.horizon=24*60*60; %I suppose that this time goes in secs. 18 | OptimParams.tSample = 15*60; %I suppose that this time goes in secs. 19 | 20 | %predictions 21 | 22 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat') 23 | timeirrDif=[0:60*60:24*60*60]; %We take only the first day, each hour 24 | 25 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat') 26 | timeirrDir=[0:60*60:24*60*60]; %We take only the first day, each hour 27 | 28 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat') 29 | timeTAir=[0:1*60*60:24*60*60]; 30 | load('GRC_ANDRAVIDA_166820_iw2_SunPosition.mat') 31 | timeAzi=SunPosition(1,:); 32 | timeEle=timeAzi; 33 | 34 | Time=24*60*60*[0:95]/95; 35 | 36 | predictions.Azimut_Angle=interp1(timeAzi,SunPosition(2,:),Time,'linear','extrap'); 37 | predictions.Elevation_Angle=interp1(timeEle,SunPosition(3,:),Time,'linear','extrap'); 38 | predictions.TAirExt=interp1(timeTAir,temperature_Forecast(:,1),Time,'linear','extrap'); 39 | predictions.irrDir=interp1(timeirrDir,irrDir_Forecast(:,1)',Time,'linear','extrap'); 40 | predictions.irrDif=interp1(timeirrDif,irrDif_Forecast(:,1),Time,'linear','extrap'); 41 | 42 | predictions.tariff=0.5*ones(1,96);%Inventado 43 | %measures 44 | measures=[]; %Not used 45 | MiPanel = SolarPanel(XML, scheduleXML, currentTime, OptimParams, predictions, measures); 46 | MiPanel = getOptimResult(MiPanel); 47 | figure 48 | subplot(2,1,1) 49 | %Resultados=MyTurbine.getOptimResult(MyTurbine); 50 | plot(MiPanel.OptimProblem.currentSolution.pow) 51 | hold on 52 | grid on 53 | xlabel('Time Slot') 54 | ylabel('Production') 55 | subplot(2,1,2) 56 | plot(timeirrDif,irrDir_Forecast(:,1),'r') 57 | hold on 58 | xlabel('Time Slot') 59 | ylabel('Direct Irradiance') 60 | grid on 61 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/PVClass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PhotoVoltaic 4 | autonomous 5 | 6 | PV 7 | 8 | 9 | 10 | 11 | 30 12 | -20 13 | 16500 14 | -0.4 15 | 47 16 | 0.95 17 | 0.25 18 | 15000 19 | 0 20 | 15 21 | 97 22 | 96 23 | 150 24 | 100 25 | 26 | 27 | 15*60 28 | 24*60*60 29 | 0.9 30 | 0.85 31 | -0.1 32 | 1 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/PowElec_PV.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/PowElec_PV.p -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/PowSolar_PV.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/PowSolar_PV.p -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/SolveProblem.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/SolveProblem.m -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/ZigorPV.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/ZigorPV.rar -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/Zigor_Model.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/Zigor_Model.slx -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/getControl.m: -------------------------------------------------------------------------------- 1 | function [ control ] = getControl( SP ) 2 | %GetControl Summary of this function goes here 3 | % Detailed explanation goes here 4 | control.pow=SP.OptimProblem.currentSolution.ProductionPUproposal 5 | end 6 | 7 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/ZigorPV/getOptimResult.m: -------------------------------------------------------------------------------- 1 | function [ result ] = getOptimResult( SP ) 2 | %UNTITLED9 Summary of this function goes here 3 | % Detailed explanation goes here 4 | Results=SolveProblem(SP); 5 | SP.OptimProblem.currentSolution.pow; 6 | SP.OptimProblem.currentSolution.objval=result.objval; 7 | SP.OptimProblem.currentSolution=Results.ProductionPUproposal; 8 | disp('Hello!') 9 | end 10 | 11 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/Zigor_Model.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/Zigor_Model.slx -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/getControl.m: -------------------------------------------------------------------------------- 1 | function [ control ] = getControl( SP ) 2 | %GetControl Summary of this function goes here 3 | % Detailed explanation goes here 4 | control.pow=SP.OptimProblem.currentSolution.ProductionPUproposal 5 | end 6 | 7 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/getOptimResult.m: -------------------------------------------------------------------------------- 1 | function [ result ] = getOptimResult( SP ) 2 | %UNTITLED9 Summary of this function goes here 3 | % Detailed explanation goes here 4 | Results=SolveProblem(SP); 5 | SP.OptimProblem.currentSolution.pow; 6 | SP.OptimProblem.currentSolution.objval=result.objval; 7 | SP.OptimProblem.currentSolution=Results.ProductionPUproposal; 8 | disp('Hello!') 9 | end 10 | 11 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/los ficheros p/PowElec_PV.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/los ficheros p/PowElec_PV.p -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/los ficheros p/PowSolar_PV.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/los ficheros p/PowSolar_PV.p -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/info/binfo.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/info/binfo.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/info/chart4_3pf05y3O2w01esZ1x9v1T.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/info/chart4_3pf05y3O2w01esZ1x9v1T.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/info/chart5_BT217wIQUpnkWmF0rhCqnE.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/info/chart5_BT217wIQUpnkWmF0rhCqnE.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/info/chart5_NV6lfvbUCbuwZyb6W2Fv0E.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/info/chart5_NV6lfvbUCbuwZyb6W2Fv0E.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.bat: -------------------------------------------------------------------------------- 1 | call "mexopts.bat" 2 | nmake -f Zigor_Model_sfun.mak 3 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.exp -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.h: -------------------------------------------------------------------------------- 1 | #ifndef __Zigor_Model_sfun_h__ 2 | #define __Zigor_Model_sfun_h__ 3 | 4 | /* Include files */ 5 | #define S_FUNCTION_NAME sf_sfun 6 | #include "sfc_sf.h" 7 | #include "sfc_mex.h" 8 | #include "rtwtypes.h" 9 | #include "sfcdebug.h" 10 | #define rtInf (mxGetInf()) 11 | #define rtMinusInf (-(mxGetInf())) 12 | #define rtNaN (mxGetNaN()) 13 | #define rtIsNaN(X) ((int)mxIsNaN(X)) 14 | #define rtIsInf(X) ((int)mxIsInf(X)) 15 | 16 | /* Type Definitions */ 17 | 18 | /* Named Constants */ 19 | 20 | /* Variable Declarations */ 21 | extern uint32_T _Zigor_ModelMachineNumber_; 22 | extern real_T _sfTime_; 23 | 24 | /* Variable Definitions */ 25 | 26 | /* Function Declarations */ 27 | extern void Zigor_Model_initializer(void); 28 | extern void Zigor_Model_terminator(void); 29 | 30 | /* Function Definitions */ 31 | 32 | /* We load infoStruct for rtw_optimation_info on demand in mdlSetWorkWidths and 33 | free it immediately in mdlStart. Given that this is machine-wide as 34 | opposed to chart specific, we use NULL check to make sure it gets loaded 35 | and unloaded once per machine even though the methods mdlSetWorkWidths/mdlStart 36 | are chart/instance specific. The following methods abstract this out. */ 37 | extern mxArray* load_Zigor_Model_optimization_info(void); 38 | extern void unload_Zigor_Model_optimization_info(void); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.lib -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.mexw64.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.mol: -------------------------------------------------------------------------------- 1 | c4_Zigor_Model.obj 2 | c5_Zigor_Model.obj 3 | Zigor_Model_sfun_registry.obj 4 | Zigor_Model_sfun.obj 5 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.obj -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun_registry.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun_registry.obj -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/c4_Zigor_Model.h: -------------------------------------------------------------------------------- 1 | #ifndef __c4_Zigor_Model_h__ 2 | #define __c4_Zigor_Model_h__ 3 | 4 | /* Include files */ 5 | #include "sfc_sf.h" 6 | #include "sfc_mex.h" 7 | #include "rtwtypes.h" 8 | 9 | /* Type Definitions */ 10 | #ifndef struct_szlnHL9Df6pKpDV9xqQkSJG 11 | #define struct_szlnHL9Df6pKpDV9xqQkSJG 12 | 13 | struct szlnHL9Df6pKpDV9xqQkSJG 14 | { 15 | real_T Ploss_off; 16 | real_T Ploss_on; 17 | real_T Eff_hl; 18 | real_T Eff_fl; 19 | }; 20 | 21 | #endif /*struct_szlnHL9Df6pKpDV9xqQkSJG*/ 22 | 23 | #ifndef typedef_c4_szlnHL9Df6pKpDV9xqQkSJG 24 | #define typedef_c4_szlnHL9Df6pKpDV9xqQkSJG 25 | 26 | typedef struct szlnHL9Df6pKpDV9xqQkSJG c4_szlnHL9Df6pKpDV9xqQkSJG; 27 | 28 | #endif /*typedef_c4_szlnHL9Df6pKpDV9xqQkSJG*/ 29 | 30 | #ifndef struct_sao7lvpULMJbzgO3vhk2pkD 31 | #define struct_sao7lvpULMJbzgO3vhk2pkD 32 | 33 | struct sao7lvpULMJbzgO3vhk2pkD 34 | { 35 | real_T nPW; 36 | c4_szlnHL9Df6pKpDV9xqQkSJG Eff; 37 | real_T MinPVPW_On; 38 | real_T MinPVPW_av; 39 | }; 40 | 41 | #endif /*struct_sao7lvpULMJbzgO3vhk2pkD*/ 42 | 43 | #ifndef typedef_c4_sao7lvpULMJbzgO3vhk2pkD 44 | #define typedef_c4_sao7lvpULMJbzgO3vhk2pkD 45 | 46 | typedef struct sao7lvpULMJbzgO3vhk2pkD c4_sao7lvpULMJbzgO3vhk2pkD; 47 | 48 | #endif /*typedef_c4_sao7lvpULMJbzgO3vhk2pkD*/ 49 | 50 | #ifndef typedef_c4_ResolvedFunctionInfo 51 | #define typedef_c4_ResolvedFunctionInfo 52 | 53 | typedef struct { 54 | const char * context; 55 | const char * name; 56 | const char * dominantType; 57 | const char * resolved; 58 | uint32_T fileTimeLo; 59 | uint32_T fileTimeHi; 60 | uint32_T mFileTimeLo; 61 | uint32_T mFileTimeHi; 62 | } c4_ResolvedFunctionInfo; 63 | 64 | #endif /*typedef_c4_ResolvedFunctionInfo*/ 65 | 66 | #ifndef typedef_SFc4_Zigor_ModelInstanceStruct 67 | #define typedef_SFc4_Zigor_ModelInstanceStruct 68 | 69 | typedef struct { 70 | SimStruct *S; 71 | ChartInfoStruct chartInfo; 72 | uint32_T chartNumber; 73 | uint32_T instanceNumber; 74 | int32_T c4_sfEvent; 75 | boolean_T c4_isStable; 76 | boolean_T c4_doneDoubleBufferReInit; 77 | uint8_T c4_is_active_c4_Zigor_Model; 78 | } SFc4_Zigor_ModelInstanceStruct; 79 | 80 | #endif /*typedef_SFc4_Zigor_ModelInstanceStruct*/ 81 | 82 | /* Named Constants */ 83 | 84 | /* Variable Declarations */ 85 | 86 | /* Variable Definitions */ 87 | 88 | /* Function Declarations */ 89 | extern const mxArray *sf_c4_Zigor_Model_get_eml_resolved_functions_info(void); 90 | 91 | /* Function Definitions */ 92 | extern void sf_c4_Zigor_Model_get_check_sum(mxArray *plhs[]); 93 | extern void c4_Zigor_Model_method_dispatcher(SimStruct *S, int_T method, void 94 | *data); 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/c4_Zigor_Model.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/c4_Zigor_Model.obj -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/c5_Zigor_Model.h: -------------------------------------------------------------------------------- 1 | #ifndef __c5_Zigor_Model_h__ 2 | #define __c5_Zigor_Model_h__ 3 | 4 | /* Include files */ 5 | #include "sfc_sf.h" 6 | #include "sfc_mex.h" 7 | #include "rtwtypes.h" 8 | 9 | /* Type Definitions */ 10 | #ifndef struct_sCKvBU3U0z4KB0OM7v1DGpC 11 | #define struct_sCKvBU3U0z4KB0OM7v1DGpC 12 | 13 | struct sCKvBU3U0z4KB0OM7v1DGpC 14 | { 15 | real_T tilt; 16 | real_T SO; 17 | }; 18 | 19 | #endif /*struct_sCKvBU3U0z4KB0OM7v1DGpC*/ 20 | 21 | #ifndef typedef_c5_sCKvBU3U0z4KB0OM7v1DGpC 22 | #define typedef_c5_sCKvBU3U0z4KB0OM7v1DGpC 23 | 24 | typedef struct sCKvBU3U0z4KB0OM7v1DGpC c5_sCKvBU3U0z4KB0OM7v1DGpC; 25 | 26 | #endif /*typedef_c5_sCKvBU3U0z4KB0OM7v1DGpC*/ 27 | 28 | #ifndef struct_saSOdeh07LmZXv3qQ5udJsG 29 | #define struct_saSOdeh07LmZXv3qQ5udJsG 30 | 31 | struct saSOdeh07LmZXv3qQ5udJsG 32 | { 33 | c5_sCKvBU3U0z4KB0OM7v1DGpC Orientation; 34 | real_T insPwPV; 35 | real_T TempPcoeffPV; 36 | real_T NOCT; 37 | real_T Kl; 38 | real_T Albedo; 39 | }; 40 | 41 | #endif /*struct_saSOdeh07LmZXv3qQ5udJsG*/ 42 | 43 | #ifndef typedef_c5_saSOdeh07LmZXv3qQ5udJsG 44 | #define typedef_c5_saSOdeh07LmZXv3qQ5udJsG 45 | 46 | typedef struct saSOdeh07LmZXv3qQ5udJsG c5_saSOdeh07LmZXv3qQ5udJsG; 47 | 48 | #endif /*typedef_c5_saSOdeh07LmZXv3qQ5udJsG*/ 49 | 50 | #ifndef typedef_c5_ResolvedFunctionInfo 51 | #define typedef_c5_ResolvedFunctionInfo 52 | 53 | typedef struct { 54 | const char * context; 55 | const char * name; 56 | const char * dominantType; 57 | const char * resolved; 58 | uint32_T fileTimeLo; 59 | uint32_T fileTimeHi; 60 | uint32_T mFileTimeLo; 61 | uint32_T mFileTimeHi; 62 | } c5_ResolvedFunctionInfo; 63 | 64 | #endif /*typedef_c5_ResolvedFunctionInfo*/ 65 | 66 | #ifndef typedef_SFc5_Zigor_ModelInstanceStruct 67 | #define typedef_SFc5_Zigor_ModelInstanceStruct 68 | 69 | typedef struct { 70 | SimStruct *S; 71 | ChartInfoStruct chartInfo; 72 | uint32_T chartNumber; 73 | uint32_T instanceNumber; 74 | int32_T c5_sfEvent; 75 | boolean_T c5_isStable; 76 | boolean_T c5_doneDoubleBufferReInit; 77 | uint8_T c5_is_active_c5_Zigor_Model; 78 | } SFc5_Zigor_ModelInstanceStruct; 79 | 80 | #endif /*typedef_SFc5_Zigor_ModelInstanceStruct*/ 81 | 82 | /* Named Constants */ 83 | 84 | /* Variable Declarations */ 85 | 86 | /* Variable Definitions */ 87 | 88 | /* Function Declarations */ 89 | extern const mxArray *sf_c5_Zigor_Model_get_eml_resolved_functions_info(void); 90 | 91 | /* Function Definitions */ 92 | extern void sf_c5_Zigor_Model_get_check_sum(mxArray *plhs[]); 93 | extern void c5_Zigor_Model_method_dispatcher(SimStruct *S, int_T method, void 94 | *data); 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/c5_Zigor_Model.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/c5_Zigor_Model.obj -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/mexopts.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem MSSDK71OPTS.BAT 3 | rem 4 | rem Compile and link options used for building MEX-files 5 | rem using the Microsoft Windows Software Development Kit. 6 | rem 7 | rem $Revision: 1.1.6.3.2.1 $ $Date: 2012/07/12 13:53:58 $ 8 | rem Copyright 2010 The MathWorks, Inc. 9 | rem 10 | rem StorageVersion: 1.0 11 | rem C++keyFileName: MSSDK71OPTS.BAT 12 | rem C++keyName: Microsoft SDK 13 | rem C++keyManufacturer: Microsoft 14 | rem C++keyVersion: 7.1 15 | rem C++keyLanguage: C++ 16 | rem C++keyLinkerName: Microsoft SDK 17 | rem C++keyLinkerVersion: 7.1 18 | rem 19 | rem ******************************************************************** 20 | rem General parameters 21 | rem ******************************************************************** 22 | 23 | set MATLAB=%MATLAB% 24 | set VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 10.0 25 | set VCINSTALLDIR=%VSINSTALLDIR%\VC 26 | rem In this case, LINKERDIR is being used to specify the location of the SDK 27 | set LINKERDIR=C:\Program Files\Microsoft SDKs\Windows\v7.1\ 28 | set PATH=%VCINSTALLDIR%\bin\amd64;%VCINSTALLDIR%\bin;%VCINSTALLDIR%\VCPackages;%VSINSTALLDIR%\Common7\IDE;%VSINSTALLDIR%\Common7\Tools;%LINKERDIR%\bin\x64;%LINKERDIR%\bin;%MATLAB_BIN%;%PATH% 29 | set INCLUDE=%VCINSTALLDIR%\INCLUDE;%LINKERDIR%\include;%LINKERDIR%\include\gl;%VCINSTALLDIR%\ATLMFC\INCLUDE;%INCLUDE% 30 | set LIB=%VCINSTALLDIR%\LIB\amd64;%LINKERDIR%\LIB\X64;%VCINSTALLDIR%\ATLMFC\LIB\AMD64;%MATLAB%\extern\lib\win64;%LIB% 31 | set MW_TARGET_ARCH=win64 32 | 33 | rem ******************************************************************** 34 | rem Compiler parameters 35 | rem ******************************************************************** 36 | set COMPILER=cl 37 | set COMPFLAGS=/c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD 38 | set OPTIMFLAGS=/O2 /Oy- /DNDEBUG 39 | set DEBUGFLAGS=/Z7 40 | set NAME_OBJECT=/Fo 41 | 42 | rem ******************************************************************** 43 | rem Linker parameters 44 | rem ******************************************************************** 45 | set LIBLOC=%MATLAB%\extern\lib\win64\microsoft 46 | set LINKER=link 47 | set LINKFLAGS=/dll /export:%ENTRYPOINT% /LIBPATH:"%LIBLOC%" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /manifest /incremental:NO /implib:"%LIB_NAME%.x" /MAP:"%OUTDIR%%MEX_NAME%%MEX_EXT%.map" 48 | set LINKOPTIMFLAGS= 49 | set LINKDEBUGFLAGS=/debug /PDB:"%OUTDIR%%MEX_NAME%%MEX_EXT%.pdb" 50 | set LINK_FILE= 51 | set LINK_LIB= 52 | set NAME_OUTPUT=/out:"%OUTDIR%%MEX_NAME%%MEX_EXT%" 53 | set RSP_FILE_INDICATOR=@ 54 | 55 | rem ******************************************************************** 56 | rem Resource compiler parameters 57 | rem ******************************************************************** 58 | set RC_COMPILER=rc /fo "%OUTDIR%mexversion.res" 59 | set RC_LINKER= 60 | 61 | set POSTLINK_CMDS=del "%LIB_NAME%.x" "%LIB_NAME%.exp" 62 | set POSTLINK_CMDS1=mt -outputresource:"%OUTDIR%%MEX_NAME%%MEX_EXT%;2" -manifest "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest" 63 | set POSTLINK_CMDS2=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest" 64 | set POSTLINK_CMDS3=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.map" 65 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/rtwtypeschksum.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/rtwtypeschksum.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/SolarPanel.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/SolarPanel.m -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/WindTurbine/GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/PowElec_WT.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/WindTurbine/PowElec_WT.m -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/PowElec_WT.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/WindTurbine/PowElec_WT.p -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/PowWind_WT.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/WindTurbine/PowWind_WT.m -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/PowWind_WT.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/WindTurbine/PowWind_WT.p -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/SolveProblemWTZigor.m: -------------------------------------------------------------------------------- 1 | function [Results] = SolveProblemWTZigor( SP ) 2 | %SolveProblem Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | Nslot = SP.OptimParams.horizon/SP.OptimParams.tSample; 6 | Wind=SP.StoredData.WindSpeed; 7 | Price=SP.StoredData.tariff; 8 | ProductionPUvector=[0:0.01:1]; %The productionPU possible values this variable is between 0 and 1 9 | ProductionProposal=zeros(1,Nslot); 10 | ProductionPUproposal=zeros(1,Nslot); 11 | ProductionVector=zeros(1,length(ProductionPUvector)); 12 | 13 | beta=SP.OptimParams.beta; 14 | Incentivemax=SP.OptimParams.Incentivemax; 15 | Incentivemin=SP.OptimParams.Incentivemax; 16 | PriceCutoff=SP.OptimParams.PriceCutoff; 17 | Benefit=zeros(1,Nslot); 18 | for k1=1:Nslot 19 | %k-th Time Slot optimization 20 | for k2=1:length(ProductionPUvector) 21 | [B,ProductionVector(k2)]=Zigor_WT_profit(ProductionPUvector(k2),Price(k1),Wind(k1),SP); 22 | end 23 | %The second alternative 24 | [ProductionProposal(k1),Ref]=min(ProductionVector); % The production has negative value, So to maximime production, we have to minime this value 25 | ProductionPUproposal(k1)=ProductionPUvector(Ref); 26 | f=1/(1+exp(-(Price(k1)-PriceCutoff)/beta)); 27 | IncentiveFactor=Incentivemin+(Incentivemax-Incentivemin)*f; 28 | IncentiveFactor(IncentiveFactor<0)=0; 29 | ProductionPUproposal(k1)=IncentiveFactor*ProductionPUproposal(k1); 30 | [B,ProductionProposal(k1)]=Zigor_WT_profit(ProductionPUproposal(k1),Price(k1),Wind(k1),SP); 31 | Benefit(k1)=B; 32 | end 33 | % SP.OptimProblem.currentSolution.pow=ProductionProposal; 34 | % SP.OptimProblem.currentSolution.objval=sum(Benefit); 35 | % SP.OptimProblem.currentSolution.ProductionPUproposal=ProductionPUproposal; 36 | Results.pow=ProductionProposal; 37 | Results.objval=sum(Benefit); 38 | Results.ProductionPUproposal=ProductionPUproposal; 39 | end 40 | 41 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/IntegrationZigorDemisV3.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/IntegrationZigorDemisV3.rar -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/IntegrationZigorDemisV4.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/IntegrationZigorDemisV4.zip -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/MyLittleDEMIS.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear all 3 | close all 4 | %XML 5 | XML='WindTurbine.xml'; 6 | %scheduleXML 7 | scheduleXML=0; %We do not need this variable 8 | % %currentTime 9 | currentTime=0; %We do not need this variable 10 | %OptimParams 11 | OptimParams.beta=[]; 12 | OptimParams.PriceCutoff=[]; 13 | OptimParams.Incentivemin=[]; 14 | OptimParams.Incentivemax=[]; 15 | 16 | OptimParams.horizon=24; %I suppose that this time goes in hours. 17 | OptimParams.tSample = 0.25; %I suppose that this time goes in hours. 18 | OptimParams.updatePeriod=[]; 19 | 20 | %predictions 21 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat') 22 | Wind=windSpeed_forecast(:,1); 23 | TimeWind=[0:OptimParams.tSample:OptimParams.horizon]; 24 | predictions.WindSpeed=interp1([0:OptimParams.horizon],Wind,TimeWind,'linear'); 25 | predictions.tariff=ones(1,96);%Inventado 26 | %measures 27 | measures=[]; %Not used 28 | MiTurbina = WindTurbine(XML, scheduleXML, currentTime, OptimParams, predictions, measures); 29 | MiTurbina = getOptimResult(MiTurbina) 30 | subplot(2,1,1) 31 | %Resultados=MyTurbine.getOptimResult(MyTurbine); 32 | plot(MiTurbina.OptimProblem.currentSolution.pow) 33 | hold on 34 | grid on 35 | xlabel('Time Slot') 36 | ylabel('Production') 37 | subplot(2,1,2) 38 | plot(Wind,'r') 39 | hold on 40 | xlabel('Time Slot') 41 | ylabel('Wind Speed') 42 | grid on -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/PowElec_WT.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/PowElec_WT.m -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/PowElec_WT.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/PowElec_WT.p -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/PowWind_WT.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/PowWind_WT.m -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/PowWind_WT.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/PowWind_WT.p -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/SolveProblemWTZigor.m: -------------------------------------------------------------------------------- 1 | function [Results] = SolveProblemWTZigor( SP ) 2 | %SolveProblem Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | Nslot = SP.OptimParams.horizon/SP.OptimParams.tSample; 6 | Wind=SP.StoredData.WindSpeed; 7 | Price=SP.StoredData.tariff; 8 | ProductionPUvector=[0:0.01:1]; %The productionPU possible values this variable is between 0 and 1 9 | ProductionProposal=zeros(1,Nslot); 10 | ProductionPUproposal=zeros(1,Nslot); 11 | ProductionVector=zeros(1,length(ProductionPUvector)); 12 | 13 | beta=SP.OptimParams.beta; 14 | Incentivemax=SP.OptimParams.Incentivemax; 15 | Incentivemin=SP.OptimParams.Incentivemax; 16 | PriceCutoff=SP.OptimParams.PriceCutoff; 17 | Benefit=zeros(1,Nslot); 18 | for k1=1:Nslot 19 | %k-th Time Slot optimization 20 | for k2=1:length(ProductionPUvector) 21 | [B,ProductionVector(k2)]=Zigor_WT_profit(ProductionPUvector(k2),Price(k1),Wind(k1),SP); 22 | end 23 | %The second alternative 24 | [ProductionProposal(k1),Ref]=min(ProductionVector); % The production has negative value, So to maximime production, we have to minime this value 25 | ProductionPUproposal(k1)=ProductionPUvector(Ref); 26 | f=1/(1+exp(-(Price(k1)-PriceCutoff)/beta)); 27 | IncentiveFactor=Incentivemin+(Incentivemax-Incentivemin)*f; 28 | IncentiveFactor(IncentiveFactor<0)=0; 29 | ProductionPUproposal(k1)=IncentiveFactor*ProductionPUproposal(k1); 30 | [B,ProductionProposal(k1)]=Zigor_WT_profit(ProductionPUproposal(k1),Price(k1),Wind(k1),SP); 31 | Benefit(k1)=B; 32 | end 33 | % SP.OptimProblem.currentSolution.pow=ProductionProposal; 34 | % SP.OptimProblem.currentSolution.objval=sum(Benefit); 35 | % SP.OptimProblem.currentSolution.ProductionPUproposal=ProductionPUproposal; 36 | Results.pow=ProductionProposal; 37 | Results.objval=sum(Benefit); 38 | Results.ProductionPUproposal=ProductionPUproposal; 39 | end 40 | 41 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/WindTurbine.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WindTurbine 4 | autonomous 5 | 6 | WindTurbine 7 | 8 | 9 | 10 | 11 | 3 12 | 18 13 | [3 4 6 7.5 9.5 11 14 16 18;0 140 470 780 1450 1860 2200 2280 2300] 14 | 5000 15 | 5000 16 | 0 17 | 7 18 | 97 19 | 96 20 | 42 21 | 35 22 | 23 | 24 | 0.85 25 | 0.9 26 | 0 27 | 1 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/Zigor_WT_profit.m: -------------------------------------------------------------------------------- 1 | function [B,Production]=Zigor_WT_profit(ProductionPU,Price,Wind,SP) 2 | 3 | %% Wind Turbine Parameter loading 4 | 5 | Param_s.Vcuton=SP.Model.Params.Vcuton; 6 | Param_s.Vcutoff=SP.Model.Params.Vcutoff; 7 | Param_m.PowerCurve=SP.Model.Params.PowerCurve; 8 | Param.nPW=SP.Model.Params.nPW; 9 | Param.MaxPW=SP.Model.Params.MaxPW; 10 | Param.Eff.Ploss_off=SP.Model.Params.Ploss_off; 11 | Param.Eff.Ploss_on=SP.Model.Params.Ploss_on; 12 | Param.Eff.Eff_hl=SP.Model.Params.Eff_hl; 13 | Param.Eff.Eff_fl=SP.Model.Params.Eff_fl; 14 | Param.MinWindPW_On=SP.Model.Params.MinWindPW_On; 15 | Param.MinWindPW_av=SP.Model.Params.MinWindPW_av; 16 | 17 | NtimeSlots = SP.OptimParams.horizon/SP.OptimParams.tSample; 18 | 19 | 20 | %Control time series 21 | WT_Shaving_Ctl=ProductionPU;%Algo progresivo de 0 a 1. Variable a manipular, a determinar por nuestro algoritmo 22 | WT_Ctl=ones(NtimeSlots,1); %Disponibilidad 0 o 1 23 | 24 | % Wind Turbine power resource 25 | pwTurbine=PowWind_WT(Param_s,Param_m,Wind); 26 | % Wind Turbine's power stage energy production 27 | pwE=PowElec_WT(Param,pwTurbine,WT_Ctl,WT_Shaving_Ctl); 28 | Production=pwE; 29 | %%Profit calculation 30 | B=-Production*Price; 31 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010, Wouter Falkena 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the distribution 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Models/WindTurbine/Zigor_WT_profit.m: -------------------------------------------------------------------------------- 1 | function [B,Production]=Zigor_WT_profit(ProductionPU,Price,Wind,SP) 2 | 3 | %% Wind Turbine Parameter loading 4 | 5 | Param_s.Vcuton=SP.Model.Params.Vcuton; 6 | Param_s.Vcutoff=SP.Model.Params.Vcutoff; 7 | Param_m.PowerCurve=SP.Model.Params.PowerCurve; 8 | Param.nPW=SP.Model.Params.nPW; 9 | Param.MaxPW=SP.Model.Params.MaxPW; 10 | Param.Eff.Ploss_off=SP.Model.Params.Ploss_off; 11 | Param.Eff.Ploss_on=SP.Model.Params.Ploss_on; 12 | Param.Eff.Eff_hl=SP.Model.Params.Eff_hl; 13 | Param.Eff.Eff_fl=SP.Model.Params.Eff_fl; 14 | Param.MinWindPW_On=SP.Model.Params.MinWindPW_On; 15 | Param.MinWindPW_av=SP.Model.Params.MinWindPW_av; 16 | 17 | NtimeSlots = SP.OptimParams.horizon/SP.OptimParams.tSample; 18 | 19 | 20 | %Control time series 21 | WT_Shaving_Ctl=ProductionPU;%Algo progresivo de 0 a 1. Variable a manipular, a determinar por nuestro algoritmo 22 | WT_Ctl=ones(NtimeSlots,1); %Disponibilidad 0 o 1 23 | 24 | % Wind Turbine power resource 25 | pwTurbine=PowWind_WT(Param_s,Param_m,Wind); 26 | % Wind Turbine's power stage energy production 27 | pwE=PowElec_WT(Param,pwTurbine,WT_Ctl,WT_Shaving_Ctl); 28 | Production=pwE; 29 | %%Profit calculation 30 | B=-Production*Price; 31 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Utils/createConsumer.m: -------------------------------------------------------------------------------- 1 | function [ outConsumer ] = createConsumer( pXML ) 2 | %UNTITLED2 Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | %myXML = strcat('../Work/GridComponents',pXML); 6 | % Schedule is not used 7 | scheduleXML = []; 8 | % %currentTime 9 | currentTime=0; %We do not need this variable 10 | %OptimParams 11 | OptimParams.beta=[]; 12 | OptimParams.PriceCutoff=[]; 13 | 14 | OptimParams.horizon=24; %I suppose that this time goes in hours. 15 | OptimParams.tSample = 0.25; %I suppose that this time goes in hours. 16 | OptimParams.updatePeriod=[]; 17 | 18 | %measures 19 | measures=[]; %Not used 20 | cd ../Models; 21 | outConsumer = Consumer( pXML, scheduleXML, currentTime, OptimParams, measures) 22 | end 23 | 24 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Utils/createDiesel.m: -------------------------------------------------------------------------------- 1 | function [ outDiesel ] = createDiesel( pXML ) 2 | %CREATEDIESEL Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | % Read configuration from XML 6 | %myXML = strcat('../Work/GridComponents',pXML); 7 | 8 | if isstruct(pXML) 9 | def.eNode = pXML; 10 | else 11 | def = xml2struct(pXML); 12 | end 13 | 14 | %scheduleXML 15 | scheduleXML=0; %We do not need this variable 16 | % %currentTime 17 | currentTime=0; %We do not need this variable 18 | %OptimParams 19 | OptimParams.beta=[]; 20 | OptimParams.PriceCutoff=[]; 21 | OptimParams.Incentivemin=[]; 22 | OptimParams.Incentivemax=[]; 23 | 24 | OptimParams.horizon=24; %I suppose that this time goes in hours. 25 | OptimParams.tSample = 0.25; %I suppose that this time goes in hours. 26 | OptimParams.updatePeriod=[]; 27 | OptimParams.powerCurve = str2num(def.eNode.OptimParams.stableNetCurve.Text); 28 | %OptimParams.powerCurve2 = str2num(def.eNode.OptimParams.stableNetCurve2.Text); 29 | %measures 30 | measures=[]; %Not used 31 | cd ../Models; 32 | outDiesel = Diesel(pXML, scheduleXML, currentTime, OptimParams, measures) 33 | end 34 | 35 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Utils/createPhotoVoltaic.m: -------------------------------------------------------------------------------- 1 | function [ outPanel ] = createPhotoVoltaic( pXML ) 2 | %CREATEPHOTOVOLTAIC Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | %scheduleXML 6 | scheduleXML=0; %We do not need this variable 7 | % %currentTime 8 | currentTime=0; %We do not need this variable 9 | %OptimParams 10 | OptimParams.beta=[]; 11 | OptimParams.PriceCutoff=[]; 12 | OptimParams.Incentivemin=[]; 13 | OptimParams.Incentivemax=[]; 14 | 15 | OptimParams.horizon=24*60*60; %I suppose that this time goes in secs. 16 | OptimParams.tSample = 15*60; %I suppose that this time goes in secs. 17 | 18 | %predictions 19 | cd ../Models/PV; 20 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat') 21 | timeirrDif=[0:60*60:24*60*60]; %We take only the first day, each hour 22 | 23 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat') 24 | timeirrDir=[0:60*60:24*60*60]; %We take only the first day, each hour 25 | 26 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat') 27 | timeTAir=[0:1*60*60:24*60*60]; 28 | load('GRC_ANDRAVIDA_166820_iw2_SunPosition.mat') 29 | timeAzi=SunPosition(1,:); 30 | timeEle=timeAzi; 31 | 32 | Time=24*60*60*[0:95]/95; 33 | 34 | predictions.Azimut_Angle=interp1(timeAzi,SunPosition(2,:),Time,'linear','extrap'); 35 | predictions.Elevation_Angle=interp1(timeEle,SunPosition(3,:),Time,'linear','extrap'); 36 | predictions.TAirExt=interp1(timeTAir,temperature_Forecast(:,1),Time,'linear','extrap'); 37 | predictions.irrDir=interp1(timeirrDir,irrDir_Forecast(:,1)',Time,'linear','extrap'); 38 | predictions.irrDif=interp1(timeirrDif,irrDif_Forecast(:,1),Time,'linear','extrap'); 39 | 40 | predictions.tariff=ones(1,96);%Inventado 41 | %measures 42 | measures=[]; %Not used 43 | cd ../; 44 | outPanel = SolarPanel(pXML, scheduleXML, currentTime, OptimParams, predictions, measures) 45 | 46 | end 47 | 48 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Utils/createWindTurbine.m: -------------------------------------------------------------------------------- 1 | function [ outWindTurbine ] = createWindTurbine( pXML ) 2 | %CREATEWINDTURBINE Summary of this function goes here 3 | % Detailed explanation goes here 4 | % XML 5 | %scheduleXML 6 | scheduleXML=0; %We do not need this variable 7 | % %currentTime 8 | currentTime=0; %We do not need this variable 9 | %OptimParams 10 | OptimParams.beta=[]; 11 | OptimParams.PriceCutoff=[]; 12 | OptimParams.Incentivemin=[]; 13 | OptimParams.Incentivemax=[]; 14 | 15 | OptimParams.horizon=24; %I suppose that this time goes in hours. 16 | OptimParams.tSample = 0.25; %I suppose that this time goes in hours. 17 | OptimParams.updatePeriod=[]; 18 | 19 | %predictions 20 | cd ../Models/WindTurbine; 21 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat') 22 | Wind = windSpeed_forecast(:,1); 23 | TimeWind=[0:OptimParams.tSample:OptimParams.horizon]; 24 | predictions.WindSpeed=interp1([0:OptimParams.horizon],Wind,TimeWind,'linear'); 25 | predictions.tariff=ones(1,96);%Inventado 26 | %measures 27 | measures=[]; %Not used 28 | 29 | cd ../; 30 | outWindTurbine = WindTurbine(pXML, scheduleXML, currentTime, OptimParams, predictions, measures) 31 | end 32 | 33 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Utils/funcLocalSearch.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/EkaitzScheme_SmartGridControl/Utils/funcLocalSearch.m -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Utils/generateRandomCurve.m: -------------------------------------------------------------------------------- 1 | function [ result ] = generateRandomCurve( pPower, pSize ) 2 | %GENERATERANDOMCURVE Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | 6 | %tempPowerMatrix = Consumer.Model.powerConsumed(2,:); 7 | %r_range = [min(r) max(r)]; 8 | r = randi( pPower, 1, pSize); 9 | 10 | result = r; 11 | end 12 | 13 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Utils/intersections/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008, Douglas M. Schwarz 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the distribution 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/CentraleNode/CentraleNode.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | CentraleNode 4 | autonomous 5 | 6 | CentraleNode 7 | 8 | 9 | 10 | 11 | 12 | ../Work/GridComponents 13 | 14 | 15 | Consumer 16 | C:\Users\Grid\Zigor\TFG 2015-2016\Code\Grid\Consumers 17 | 18 | 19 | Diesel 20 | C:\Users\Grid\Zigor\TFG 2015-2016\Code\Grid\Diesel 21 | 22 | 23 | WindTurbine 24 | C:\Users\Grid\Zigor\TFG 2015-2016\Code\Grid\WindTurbine 25 | 26 | 27 | Battery 28 | 29 | 30 | 31 | 32 | 33 | 100 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/GridComponents/Consumer_001.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Consumer 4 | autonomous 5 | 6 | Consumer_001 7 | 8 | 9 | 10 | 11 | 12 | [[1:1:96]; [1:1:96]] 13 | .9 14 | 100 15 | [ 0.1535 0.1689 0.2620 0.4145 2.8270 4.6390 0.9211 2.6362 3.2084 1.1404 6.0979 0.7895 1.3205 14.0789 22.1199 1.5875 9.7368 0.7456 1.6667 1.3158 1.6667 1.6667 1.8421 2.1199 0.7895 2.6316 0.7895 2.5439 4.4298 7.7151 25.1754 22.5439 25.3509 28.3333 35.0000 16.2281 7.5371 2.7193 1.9737 1.3158 0.7895 0.2632 0.9649 0.0593 0.2967 0.0593 11.4540 26.9436 23.3086 10.7418 0.4154 10.7418 13.0564 8.4273 3.9763 2.7300 2.5519 2.7300 3.4421 4.3323 3.9763 3.2641 4.6884 3.4421 5.0593 4.5104 3.9763 3.7982 4.5104 3.9763 3.7982 3.6202 4.6884 4.1543 5.2226 4.1543 4.3323 7.1810 12.1662 16.2611 25.2077 37.4481 39.4065 38.3383 42.6113 26.9436 23.9169 18.0415 10.9199 7.3591 4.6390 2.8270 0.4145 0.2620 0.1689 0.1535 ] 16 | [ 0.1564 0.3925 0.3945 0.3945 0.3945 0.3317 0.3200 0.3265 0.3243 0.3243 0.3447 0.3562 0.3338 0.3375 0.3309 0.3338 0.3360 0.3360 0.3580 0.3660 0.3740 0.3799 0.3814 0.3799 0.3836 0.3624 0.3558 0.3287 0.3039 0.2871 0.2651 0.2395 0.2162 0.2147 0.2315 0.2257 0.2220 0.2205 0.2205 0.2205 0.2520 0.2754 0.2936 0.2958 0.2951 0.2754 0.2607 0.2520 0.2505 0.2520 0.2490 0.2520 0.3302 0.3740 0.3510 0.3514 0.3514 0.3507 0.2927 0.2556 0.2286 0.2288 0.2201 0.2140 0.2074 0.2059 0.2045 0.2008 0.2096 0.2008 0.1825 0.2001 0.2374 0.2644 0.2973 0.3105 0.3163 0.3178 0.3192 0.3061 0.3031 0.2944 0.2790 0.2702 0.2564 0.2352 0.2337 0.2527 0.2827 0.3675 0.3616 0.3695 0.3682 0.3697 0.3697 0.3697] 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/GridComponents/Diesel_002.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Diesel 4 | autonomous 5 | 6 | Diesel_002 7 | 8 | 9 | 10 | 11 | 12 | 100 13 | [0 5.7 9.5 13.6 18] 14 | 0 15 | 250 16 | 17 | 18 | 19 | 20 | 21 | 0.85 22 | 0.9 23 | 0 24 | 1 25 | 0.25 26 | [47 47.5 48 48.5 49 49.5 50 50.5 51 51.5 52 52.5 53 ; 3100 2700 2600 2300 2280 2200 1860 1450 780 470 140 70 0] 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/GridComponents/Not_used_yet/Battery_001.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Battery 4 | autonomous 5 | 6 | Battery_001 7 | 8 | 9 | 10 | 11 | 5000 12 | 0 13 | 7 14 | 97 15 | 96 16 | 300 17 | 35 18 | 0 19 | 37800000 20 | 65 21 | -65 22 | [0 0.200000000000000 0.950000000000000 1] 23 | [0.800000000000000 0.810000000000000 1.400000000000000 1.500000000000000] 24 | [0 0.200000000000000 0.950000000000000 1] 25 | [0.007000000000000 0.007010000000000 0.007020000000000 0.007030000000000] 26 | 30 27 | 12 28 | 65 29 | -65 30 | [0 0.200000000000000 0.950000000000000 1] 31 | [288 2.916000000000000e+02 504 540] 32 | [0 0.200000000000000 0.950000000000000 1] 33 | [2.520000000000000 2.523600000000000 2.527200000000000 2.530800000000000] 34 | [0 0.003002000000000] 35 | [0 150000] 36 | 0.75 37 | [0 65] 38 | [0 0.003000000000000] 39 | 0.001 40 | 0.5 41 | 42 | 43 | 0.85 44 | 0.9 45 | 0 46 | 1 47 | 0.5 48 | 0.2 49 | 0.8 50 | 10 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/GridComponents/Not_used_yet/Copy_WindTurbine3_Documentation.xml: -------------------------------------------------------------------------------- 1 | 18 2 | 3 | [48 48.5 49 49.5 50 50.5 51 51.5 52 ; 0 140 470 780 1450 1860 2200 2280 2300] 4 | 5 | 6 | [48 48.5 49 49.5 50 50.5 51 51.5 52; 0.0539 0.0648 0.0757 0.0839 0.0939 0.1039 0.1139 0.1139 0.1239] -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/GridComponents/Not_used_yet/Diesel_001.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Diesel 4 | autonomous 5 | 6 | Diesel_001 7 | 8 | 9 | 10 | 11 | 12 | 100 13 | [0 5.7 9.5 13.6 18] 14 | 0 15 | 250 16 | 17 | 18 | 19 | 20 | 21 | 0.85 22 | 0.9 23 | 0 24 | 1 25 | 0.25 26 | [ 1 2 3 4 5 6 7 8 9 10] 27 | [3 4 6 7.5 9.5 11 14 16 18 21 140 470 780 1450 1860 2200 2280 2300 2400 2500 3 4 6 7.5 9.5 11 14 16 18 21 140 470 780 1450 1860 2200 2280 2300 2400 25003 4 6 7.5 9.5 11 14 16 18 21] 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/GridComponents/Not_used_yet/FWClass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | FWZigor 4 | autonomous 5 | 6 | FWZigor 7 | 8 | 9 | 10 | 11 | 0.311*15 12 | 50e3*2*pi/60 13 | 0.75*50e3*2*pi/60 14 | 0.08*1000/ (50000*pi/30) 15 | 0.15*1000/ (50000*pi/30)^2 16 | 0.3*1000/ (50000*pi/30)^3 17 | 0.95 18 | 100 19 | -100 20 | 100e3 21 | -100e3 22 | 100000 23 | 10 24 | 1000 25 | 95 26 | 93 27 | 0.001 28 | 29 | 30 | 0.01 31 | 0.001 32 | 0 33 | 1 34 | 0.1 35 | 0.2 36 | 0.8 37 | 1 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/GridComponents/Not_used_yet/PVClass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PhotoVoltaic 4 | autonomous 5 | 6 | PV 7 | 8 | 9 | 10 | 11 | 30 12 | -20 13 | 16500 14 | -0.4 15 | 47 16 | 0.95 17 | 0.25 18 | 15000 19 | 0 20 | 15 21 | 97 22 | 96 23 | 150 24 | 100 25 | 26 | 27 | 15*60 28 | 24*60*60 29 | 0.9 30 | 0.5 31 | -0.1 32 | 1 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/GridComponents/Not_used_yet/WindTurbine3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WindTurbine 4 | autonomous 5 | 6 | WindTurbine_003 7 | 8 | 9 | 10 | 11 | 3 12 | 18 13 | 14 | [48 48.5 49 49.5 50 50.5 51 51.5 52 ; 0 140 470 780 1450 1860 2200 2280 2300] 15 | 16 | 17 | [48 48.5 49 49.5 50 50.5 51 51.5 52; 0.0539 0.0648 0.0757 0.0839 0.0939 0.1039 0.1139 0.1139 0.1239] 18 | 19 | 5000 20 | 5000 21 | 0 22 | 7 23 | 97 24 | 96 25 | 42 26 | 35 27 | 28 | 29 | 0.85 30 | 0.9 31 | 0 32 | 1 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/GridComponents/PVClass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PhotoVoltaic 4 | autonomous 5 | 6 | PV 7 | 8 | 9 | 10 | 11 | 30 12 | -20 13 | 16500 14 | -0.4 15 | 47 16 | 0.95 17 | 0.25 18 | 15000 19 | 0 20 | 15 21 | 97 22 | 96 23 | 150 24 | 100 25 | [47.5 48 48.5 49 49.5 50 50.5 51 51.5 52 52.5 ; 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000] 26 | [47.5 48 48.5 49 49.5 50 50.5 51 51.5 52 52.5; 0 0.0539 0.0596 0.0648 0.0757 0.0839 0.0939 0.1039 0.1139 0.1139 0.1239] 27 | 28 | 29 | 15*60 30 | 24*60*60 31 | 0.9 32 | 0.5 33 | -0.1 34 | 1 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/GridComponents/WindTurbine1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WindTurbine 4 | autonomous 5 | 6 | WindTurbine_001 7 | 8 | 9 | 10 | 11 | 3 12 | 18 13 | [48 48.5 49 49.5 50 50.5 51 51.5 52 ; 0 140 470 780 1450 1860 2200 2280 2300] 14 | 15 | [48 48.5 49 49.5 50 50.5 51 51.5 52; 0.0539 0.0648 0.0757 0.0839 0.0939 0.1039 0.1139 0.1139 0.1239] 16 | 5000 17 | 5000 18 | 0 19 | 7 20 | 97 21 | 96 22 | 42 23 | 35 24 | 25 | 26 | 0.85 27 | 0.9 28 | 0 29 | 1 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/GridComponents/WindTurbine2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WindTurbine 4 | autonomous 5 | 6 | WindTurbine_002 7 | 8 | 9 | 10 | 11 | 3 12 | 18 13 | [48 48.5 49 49.5 50 50.5 51 51.5 52 ; 0 140 470 780 1450 1860 2200 2280 2300] 14 | 15 | [48 48.5 49 49.5 50 50.5 51 51.5 52; 0.0539 0.0648 0.0757 0.0839 0.0939 0.1039 0.1139 0.1139 0.1239] 16 | 5000 17 | 5000 18 | 0 19 | 7 20 | 97 21 | 96 22 | 42 23 | 35 24 | 25 | 26 | 0.85 27 | 0.9 28 | 0 29 | 1 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/GridComponents/WindTurbine3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WindTurbine 4 | autonomous 5 | 6 | WindTurbine_003 7 | 8 | 9 | 10 | 11 | 3 12 | 18 13 | [48 48.5 49 49.5 50 50.5 51 51.5 52 ; 0 140 470 780 1450 1860 2200 2280 2300] 14 | 15 | [48 48.5 49 49.5 50 50.5 51 51.5 52; 0.0539 0.0648 0.0757 0.0839 0.0939 0.1039 0.1139 0.1139 0.1239] 16 | 17 | 5000 18 | 5000 19 | 0 20 | 7 21 | 97 22 | 96 23 | 42 24 | 35 25 | 26 | 27 | 0.85 28 | 0.9 29 | 0 30 | 1 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/XMLs_EkaitzPruebas/Battery1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Battery 4 | autonomous 5 | 6 | Battery 7 | 8 | 9 | 10 | 11 | 5000 12 | 0 13 | 7 14 | 97 15 | 96 16 | 300 17 | 35 18 | 0 19 | 37800000 20 | 65 21 | -65 22 | [0 0.200000000000000 0.950000000000000 1] 23 | [0.800000000000000 0.810000000000000 1.400000000000000 1.500000000000000] 24 | [0 0.200000000000000 0.950000000000000 1] 25 | [0.007000000000000 0.007010000000000 0.007020000000000 0.007030000000000] 26 | 30 27 | 12 28 | 65 29 | -65 30 | [0 0.200000000000000 0.950000000000000 1] 31 | [288 2.916000000000000e+02 504 540] 32 | [0 0.200000000000000 0.950000000000000 1] 33 | [2.520000000000000 2.523600000000000 2.527200000000000 2.530800000000000] 34 | [0 0.003002000000000] 35 | [0 150000] 36 | 0.75 37 | [0 65] 38 | [0 0.003000000000000] 39 | 0.001 40 | 0.5 41 | 42 | 43 | 0.85 44 | 0.9 45 | 0 46 | 1 47 | 0.5 48 | 0.2 49 | 0.8 50 | 10 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/XMLs_EkaitzPruebas/Central_eNode.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Central_eNode 4 | autonomous 5 | 6 | Central_eNode 7 | 8 | 9 | 10 | 11 | 12 | C:\ 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/XMLs_EkaitzPruebas/FWClass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | FWZigor 4 | autonomous 5 | 6 | FWZigor 7 | 8 | 9 | 10 | 11 | 0.311*15 12 | 50e3*2*pi/60 13 | 0.75*50e3*2*pi/60 14 | 0.08*1000/ (50000*pi/30) 15 | 0.15*1000/ (50000*pi/30)^2 16 | 0.3*1000/ (50000*pi/30)^3 17 | 0.95 18 | 100 19 | -100 20 | 100e3 21 | -100e3 22 | 100000 23 | 10 24 | 1000 25 | 95 26 | 93 27 | 0.001 28 | 29 | 30 | 0.01 31 | 0.001 32 | 0 33 | 1 34 | 0.1 35 | 0.2 36 | 0.8 37 | 1 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/XMLs_EkaitzPruebas/PVClass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PhotoVoltaic 4 | autonomous 5 | 6 | PV 7 | 8 | 9 | 10 | 11 | 30 12 | -20 13 | 16500 14 | -0.4 15 | 47 16 | 0.95 17 | 0.25 18 | 15000 19 | 0 20 | 15 21 | 97 22 | 96 23 | 150 24 | 100 25 | 26 | 27 | 15*60 28 | 24*60*60 29 | 0.9 30 | 0.5 31 | -0.1 32 | 1 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/XMLs_EkaitzPruebas/WindTurbine 1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WindTurbine 4 | autonomous 5 | 6 | WindTurbine 7 | 8 | 9 | 10 | 11 | 3 12 | 18 13 | [3 4 6 7.5 9.5 11 14 16 18;0 140 470 780 1450 1860 2200 2280 2300] 14 | 5000 15 | 5000 16 | 0 17 | 7 18 | 97 19 | 96 20 | 42 21 | 35 22 | 23 | 24 | 0.85 25 | 0.9 26 | 0 27 | 1 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/XMLs_EkaitzPruebas/WindTurbine2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WindTurbine 4 | autonomous 5 | 6 | WindTurbine 7 | 8 | 9 | 10 | 11 | 3 12 | 18 13 | [3 4 6 7.5 9.5 11 14 16 18;0 140 470 780 1450 1860 2200 2280 2300] 14 | 5000 15 | 5000 16 | 0 17 | 7 18 | 97 19 | 96 20 | 42 21 | 35 22 | 23 | 24 | 0.85 25 | 0.9 26 | 0 27 | 1 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /EkaitzScheme_SmartGridControl/Work/XMLs_EkaitzPruebas/WindTurbine3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WindTurbine 4 | autonomous 5 | 6 | WindTurbine 7 | 8 | 9 | 10 | 11 | 3 12 | 18 13 | [3 4 6 7.5 9.5 11 14 16 18;0 140 470 780 1450 1860 2200 2280 2300] 14 | 5000 15 | 5000 16 | 0 17 | 7 18 | 97 19 | 96 20 | 42 21 | 35 22 | 23 | 24 | 0.85 25 | 0.9 26 | 0 27 | 1 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /PV.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/PV.docx -------------------------------------------------------------------------------- /Problem Log.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/Problem Log.docx -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hybrid-grid-simulation 2 | Our master thesis 3 | -------------------------------------------------------------------------------- /SmartGridControl/MainProgram/MainProgram.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/MainProgram/MainProgram.m -------------------------------------------------------------------------------- /SmartGridControl/Models/Battery/PowElec_Stg_Zigor.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/Battery/PowElec_Stg_Zigor.p -------------------------------------------------------------------------------- /SmartGridControl/Models/Battery/SolveProblemBatteryZigor.m: -------------------------------------------------------------------------------- 1 | function [Results] = SolveProblemBatteryZigor( SP ) 2 | %SolveProblem Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | Nslot = SP.OptimParams.horizon/SP.OptimParams.tSample; 6 | Price=SP.StoredData.tariff; 7 | t0=0; 8 | tfin=1*24*3600; 9 | deltaT=SP.OptimParams.deltaT; 10 | Time=[t0:deltaT:tfin]; 11 | 12 | %Model's initial values 13 | SOC0=SP.Model.SOC0; 14 | V0=0.8*SP.Model.NCellsPerStack*SP.Model.NStacks; 15 | V0=interp1(SP.Model.OCVvsSOC_x,SP.Model.OCVvsSOC_y,SOC0,'linear','extrap'); 16 | Vmin=SP.Model.Vmin; 17 | 18 | %Model's variables 19 | PlossHidr=zeros(1,length(Time)); 20 | IlossHidr=zeros(1,length(Time)); 21 | Pelec=zeros(1,length(Time)); 22 | Psetpoint=zeros(1,length(Time)); 23 | PlossElec=zeros(1,length(Time)); 24 | Ibat=zeros(1,length(Time)); 25 | V=zeros(1,length(Time)); 26 | V(1)=V0; 27 | SOC=zeros(1,length(Time)); 28 | Ired=zeros(1,length(Time)); 29 | Q=zeros(1,length(Time)); 30 | R=zeros(1,length(Time)); 31 | PowLoss_Bat=zeros(1,length(Time)); 32 | PowElec_Bat=zeros(1,length(Time)); 33 | OCV=zeros(1,length(Time)); 34 | 35 | %Incentive Factor 36 | f=1./(1+exp(-(Price-SP.OptimParams.PriceCutoff)/SP.OptimParams.beta)); 37 | IncentiveFactor=SP.OptimParams.Incentivemin+(SP.OptimParams.Incentivemax-SP.OptimParams.Incentivemin)*f; 38 | IncentiveFactor(IncentiveFactor<0)=0; 39 | IF=interp1((tfin-t0)*[0:(length(IncentiveFactor))-1]/length(IncentiveFactor),IncentiveFactor,Time,'linear','extrap'); 40 | Ithmean=mean(IncentiveFactor); 41 | 42 | for k=1:length(Time) 43 | %k 44 | if k==1 45 | [SOC(k),V(k),Ired(k),Ibat(k),R(k),OCV(k),Psetpoint(k),PowLoss_Bat(k),PowElec_Bat(k),Q(k)]=SimulateZigorBatteryModel_CMG(SP,IF(k),Ithmean,SOC0,V0,Vmin,deltaT); 46 | else 47 | [SOC(k),V(k),Ired(k),Ibat(k),R(k),OCV(k),Psetpoint(k),PowLoss_Bat(k),PowElec_Bat(k),Q(k)]=SimulateZigorBatteryModel_CMG(SP,IF(k),Ithmean,SOC(k-1),V(k-1),Vmin,deltaT); 48 | end 49 | Pelec(k)=PowElec_Bat(k); 50 | 51 | end 52 | 53 | Energia1=(sum(PowElec_Bat)-sum(PowLoss_Bat))*deltaT; 54 | Energia2=(SOC(length(Time))-SOC0)*SP.Model.WsMax; 55 | %Energia1-Energia2 56 | 57 | figure 58 | %subplot(5,1,1) 59 | plot(Time,SOC,'r') 60 | xlabel('Time [sec]') 61 | ylabel('State of Charge [%]') 62 | grid on 63 | 64 | figure 65 | %subplot(5,1,2) 66 | plot(Time,IF,'r') 67 | xlabel('Time [sec]') 68 | ylabel('IF [-]') 69 | grid on 70 | 71 | figure 72 | %subplot(5,1,3) 73 | plot(Time,Pelec,'r',Time,Psetpoint,'g') 74 | xlabel('Time [sec]') 75 | ylabel('Power Production [Watts]') 76 | grid on 77 | legend('Real Power','Power setpoint') 78 | 79 | figure 80 | %subplot(5,1,4) 81 | plot(Time,Ired,'r') 82 | xlabel('Time [sec]') 83 | ylabel('Network current [Amp]') 84 | grid on 85 | 86 | figure 87 | %subplot(5,1,5) 88 | plot(Time,V,'r') 89 | xlabel('Time [sec]') 90 | ylabel('Voltage [V]') 91 | grid on 92 | 93 | figure 94 | PriceVec=[-10:0.1:10]; 95 | f=1./(1+exp(-(PriceVec-SP.OptimParams.PriceCutoff)/SP.OptimParams.beta)); 96 | IncentiveFactor=SP.OptimParams.Incentivemin+(SP.OptimParams.Incentivemax-SP.OptimParams.Incentivemin)*f; 97 | IncentiveFactor(IncentiveFactor<0)=0; 98 | plot(PriceVec,IncentiveFactor,'r') 99 | xlabel('Price') 100 | ylabel('Incentive Factor [pu]') 101 | grid on 102 | 103 | Results.pow=interp1(Time,Pelec,(tfin-t0)*[0:Nslot-1]/Nslot); 104 | Results.objval=sum(IF.*Pelec/SP.Model.nPW)/Nslot; 105 | Results.ProductionPUproposal=interp1(Time,Pelec/SP.Model.nPW,(tfin-t0)*[0:Nslot-1]/Nslot); 106 | end 107 | 108 | -------------------------------------------------------------------------------- /SmartGridControl/Models/CentraleNode/PruebasEkaitz/Central_eNode_PruebasEkaitz.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Central_eNode 4 | autonomous 5 | 6 | Central_eNode 7 | 8 | 9 | 10 | 11 | 12 | WindTurbine1.xml 13 | WindTurbine3.xml 14 | FWClass.xml 15 | Battery1.xml 16 | PVClass.xml 17 | Consumer.xml 18 | 19 | 20 | Diesel.xml 21 | Diesel.xml 22 | Hydraulic.xml 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /SmartGridControl/Models/Consumer/CurveTrial_withsplinedraw.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/Consumer/CurveTrial_withsplinedraw.fig -------------------------------------------------------------------------------- /SmartGridControl/Models/FlyWheel.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/FlyWheel.m -------------------------------------------------------------------------------- /SmartGridControl/Models/FlyWheel/FWClass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | FWZigor 4 | autonomous 5 | 6 | FWZigor 7 | 8 | 9 | 10 | 11 | 0.311*15 12 | 50e3*2*pi/60 13 | 0.75*50e3*2*pi/60 14 | 0.08*1000/ (50000*pi/30) 15 | 0.15*1000/ (50000*pi/30)^2 16 | 0.3*1000/ (50000*pi/30)^3 17 | 0.95 18 | 100 19 | -100 20 | 100e3 21 | -100e3 22 | 100000 23 | 10 24 | 1000 25 | 95 26 | 93 27 | 0.001 28 | 29 | 30 | 0.01 31 | 0.001 32 | 0 33 | 1 34 | 0.1 35 | 0.2 36 | 0.8 37 | 1 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /SmartGridControl/Models/FlyWheel/FlyWheeleNode.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/FlyWheel/FlyWheeleNode.rar -------------------------------------------------------------------------------- /SmartGridControl/Models/FlyWheel/InformeFW+B.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/FlyWheel/InformeFW+B.rar -------------------------------------------------------------------------------- /SmartGridControl/Models/FlyWheel/MyLittleDEMIS_FW_Zigor.m: -------------------------------------------------------------------------------- 1 | 2 | clc 3 | clear all 4 | close all 5 | %XML 6 | XML='FWClass.xml'; 7 | %scheduleXML 8 | scheduleXML=0; %We do not need this variable 9 | % %currentTime 10 | currentTime=0; %We do not need this variable 11 | %OptimParams 12 | OptimParams.beta=[]; 13 | OptimParams.PriceCutoff=[]; 14 | OptimParams.Incentivemin=[]; 15 | OptimParams.Incentivemax=[]; 16 | 17 | OptimParams.horizon=24*60*60; 18 | OptimParams.tSample = 0.25*60*60; 19 | OptimParams.updatePeriod=[]; 20 | 21 | %predictions 22 | t=10*[0:95]/95; 23 | predictions.tariff=0.06*(sin(t)+ones(1,96));%Inventado ones(1,96);%0.5*ones(1,96);% 24 | %measures 25 | measures=[]; %Not used 26 | MiFlyWheel= FlyWheel(XML, scheduleXML, currentTime, OptimParams, predictions, measures); 27 | MiFlyWheel = getOptimResult(MiFlyWheel); 28 | % figure 29 | % %subplot(2,1,1) 30 | % %Resultados=MyTurbine.getOptimResult(MyTurbine); 31 | % %subplot(2,1,1) 32 | % plot(predictions.tariff,'r') 33 | % hold on 34 | % xlabel('Time Slot') 35 | % ylabel('Tariff') 36 | % grid on 37 | % 38 | % %subplot(2,1,2) 39 | % figure 40 | % plot(MiFlyWheel.ProductionPUproposal) 41 | % grid on 42 | % xlabel('Time Slot') 43 | % ylabel('Production') 44 | 45 | -------------------------------------------------------------------------------- /SmartGridControl/Models/FlyWheel/PowElec_Stg_Zigor.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/FlyWheel/PowElec_Stg_Zigor.p -------------------------------------------------------------------------------- /SmartGridControl/Models/FlyWheel/SOC_FW.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/FlyWheel/SOC_FW.emf -------------------------------------------------------------------------------- /SmartGridControl/Models/FlyWheel/SolveProblemFWZigor.m: -------------------------------------------------------------------------------- 1 | function [Results] = SolveProblemFWZigor( SP ) 2 | %SolveProblem Summary of this function goes here 3 | % Detailed explanation goes here 4 | Nslot = SP.OptimParams.horizon/SP.OptimParams.tSample; 5 | Price=SP.StoredData.tariff; 6 | t0=0; 7 | tfin=1*24*3600; 8 | deltaT=SP.OptimParams.deltaT; 9 | Time=[t0:deltaT:tfin]; 10 | beta=SP.OptimParams.beta; 11 | Incentivemax=SP.OptimParams.Incentivemax; 12 | Incentivemin=SP.OptimParams.Incentivemin; 13 | PriceCutoff=SP.OptimParams.PriceCutoff; 14 | lambda=SP.OptimParams.lambda; 15 | if lambda==0 16 | lambda=1; 17 | end 18 | 19 | %Incentive Factor 20 | f=1./(1+exp(-(Price-SP.OptimParams.PriceCutoff)/SP.OptimParams.beta)); 21 | IncentiveFactor=SP.OptimParams.Incentivemin+(SP.OptimParams.Incentivemax-SP.OptimParams.Incentivemin)*f; 22 | IncentiveFactor(IncentiveFactor<0)=0; 23 | Nslot = SP.OptimParams.horizon/SP.OptimParams.tSample; 24 | IF=interp1((tfin-t0)*[0:Nslot-1]/Nslot,IncentiveFactor,Time,'linear','extrap'); 25 | Ithmean=mean(IncentiveFactor); 26 | 27 | %Model's initial values 28 | w0=SP.Model.Wini; 29 | Wmin=SP.Model.Wmin; 30 | 31 | %Model's variables 32 | Psetpoint=zeros(1,length(Time)); 33 | Pelec=zeros(1,length(Time)); 34 | w=zeros(1,length(Time)); 35 | w(1)=SP.Model.Wini; 36 | SOC=zeros(1,length(Time)); 37 | Plosses=zeros(1,length(Time)); 38 | 39 | [w(1),SOC(1),Psetpoint(1),Pelec(1),Plosses(1)]=SimulateZigorFWModel_CMG(SP,IF(1),Ithmean,w0,Wmin,deltaT); 40 | for k=2:length(Time) 41 | 100*k/length(Time) 42 | [w(k),SOC(k),Psetpoint(k),Pelec(k),Plosses(k)]=SimulateZigorFWModel_CMG(SP,IF(k),Ithmean,w(k-1),Wmin,deltaT); 43 | end 44 | 45 | Energia1=(sum(Pelec)-sum(Plosses))*deltaT 46 | Energia2=(SOC(length(Time))-(SP.Model.Wini/SP.Model.Wmax)^2)*(0.5*SP.Model.J*(SP.Model.Wmax^2)); 47 | Energia1-Energia2 48 | 49 | 50 | % %subplot(3,1,1) 51 | % figure 52 | % plot(Time,SOC,'r') 53 | % xlabel('Time [secs]') 54 | % ylabel('State of Charge [%]') 55 | % grid on 56 | % 57 | % %subplot(3,1,2) 58 | % figure 59 | % plot(Time,IF,'r') 60 | % xlabel('Time [secs]') 61 | % ylabel('IF [-]') 62 | % grid on 63 | % 64 | % %subplot(3,1,3) 65 | % figure 66 | % plot(Time,Pelec,'r') 67 | % xlabel('Time [secs]') 68 | % ylabel('Power Production [Watts]') 69 | % grid on 70 | % 71 | % figure 72 | % PriceVec=[0:0.01:1]; 73 | % f=1./(1+exp(-(PriceVec-SP.OptimParams.PriceCutoff)/SP.OptimParams.beta)); 74 | % IncentiveFactor=SP.OptimParams.Incentivemin+(SP.OptimParams.Incentivemax-SP.OptimParams.Incentivemin)*f; 75 | % IncentiveFactor(IncentiveFactor<0)=0; 76 | % plot(PriceVec,IncentiveFactor,'r') 77 | % xlabel('Virtual tariff [-]') 78 | % ylabel('Incentive factor [-]') 79 | % grid on 80 | % 81 | % figure 82 | % TimePrice=tfin*[0:length(Price)-1]/(length(Price)); 83 | % plot(TimePrice,Price,'r') 84 | % grid on 85 | % xlabel('Time [secs]') 86 | % ylabel('Virtual tariff') 87 | % pause 88 | 89 | Results.pow=interp1(Time,Pelec,(tfin-t0)*[0:Nslot-1]/Nslot); 90 | Results.objval=sum(IF.*Pelec/SP.Model.nPW)/Nslot; 91 | Results.ProductionPUproposal=interp1(Time,Pelec/SP.Model.nPW,(tfin-t0)*[0:Nslot-1]/Nslot); 92 | 93 | end 94 | 95 | -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_ESWN_INCAS_Irr.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_ESWN_INCAS_Irr.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_NSEW_Irr.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_NSEW_Irr.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_SunPosition.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/GRC_ANDRAVIDA_166820_iw2_SunPosition.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/Irr_PV_Inc_30_Orient_0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/Irr_PV_Inc_30_Orient_0.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/MyLittleDEMIS_PV_Zigor.m: -------------------------------------------------------------------------------- 1 | 2 | clc 3 | clear all 4 | close all 5 | %XML 6 | XML='PVClass.xml'; 7 | %scheduleXML 8 | scheduleXML=0; %We do not need this variable 9 | % %currentTime 10 | currentTime=0; %We do not need this variable 11 | %OptimParams 12 | OptimParams.beta=[]; 13 | OptimParams.PriceCutoff=[]; 14 | OptimParams.Incentivemin=[]; 15 | OptimParams.Incentivemax=[]; 16 | 17 | OptimParams.horizon=24*60*60; %I suppose that this time goes in secs. 18 | OptimParams.tSample = 15*60; %I suppose that this time goes in secs. 19 | 20 | %predictions 21 | 22 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat') 23 | timeirrDif=[0:60*60:24*60*60]; %We take only the first day, each hour 24 | 25 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat') 26 | timeirrDir=[0:60*60:24*60*60]; %We take only the first day, each hour 27 | 28 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat') 29 | timeTAir=[0:1*60*60:24*60*60]; 30 | load('GRC_ANDRAVIDA_166820_iw2_SunPosition.mat') 31 | timeAzi=SunPosition(1,:); 32 | timeEle=timeAzi; 33 | 34 | Time=24*60*60*[0:95]/95; 35 | 36 | predictions.Azimut_Angle=interp1(timeAzi,SunPosition(2,:),Time,'linear','extrap'); 37 | predictions.Elevation_Angle=interp1(timeEle,SunPosition(3,:),Time,'linear','extrap'); 38 | predictions.TAirExt=interp1(timeTAir,temperature_Forecast(:,1),Time,'linear','extrap'); 39 | predictions.irrDir=interp1(timeirrDir,irrDir_Forecast(:,1)',Time,'linear','extrap'); 40 | predictions.irrDif=interp1(timeirrDif,irrDif_Forecast(:,1),Time,'linear','extrap'); 41 | 42 | predictions.tariff=ones(1,96);%Inventado 43 | %measures 44 | measures=[]; %Not used 45 | MiPanel = SolarPanel(XML, scheduleXML, currentTime, OptimParams, predictions, measures); 46 | MiPanel = getOptimResult(MiPanel); 47 | figure 48 | subplot(2,1,1) 49 | %Resultados=MyTurbine.getOptimResult(MyTurbine); 50 | % plot(MiPanel.OptimProblem.currentSolution.pow) 51 | % hold on 52 | % grid on 53 | % xlabel('Time Slot') 54 | % ylabel('Production') 55 | % subplot(2,1,2) 56 | % plot(timeirrDif,irrDir_Forecast(:,1),'r') 57 | % hold on 58 | % xlabel('Time Slot') 59 | % ylabel('Direct Irradiance') 60 | % grid on 61 | -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/PV.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/PV.7z -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/PVClass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PhotoVoltaic 4 | autonomous 5 | 6 | PV 7 | 8 | 9 | 10 | 11 | 30 12 | -20 13 | 16500 14 | -0.4 15 | 47 16 | 0.95 17 | 0.25 18 | 15000 19 | 0 20 | 15 21 | 97 22 | 96 23 | 150 24 | 100 25 | 26 | 27 | 15*60 28 | 24*60*60 29 | 0.9 30 | 0.5 31 | -0.1 32 | 1 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/PV_Zigor_Test_InitFile.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/PV_Zigor_Test_InitFile.m -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/PowElec_PV.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/PowElec_PV.p -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/PowSolar_PV.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/PowSolar_PV.m -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/PowSolar_PV.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/PowSolar_PV.p -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/PruebaAislada.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear all 3 | close all 4 | DATA = PV_Zigor_Test_InitFile ; 5 | Param=DATA; 6 | Param.Orientation.tilt=DATA.tilt; 7 | Param.Orientation.SO=DATA.SO; 8 | Param.Eff.Ploss_off = DATA.Ploss_off; 9 | Param.Eff.Ploss_on = DATA.Ploss_on; 10 | Param.Eff.Eff_hl = DATA.Eff_hl; 11 | Param.Eff.Eff_fl = DATA.Eff_fl; 12 | 13 | %predictions 14 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat') 15 | timeirrDif=[0:60*60:24*60*60]; %We take only the first day, each hour 16 | 17 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat') 18 | timeirrDir=[0:60*60:24*60*60]; %We take only the first day, each hour 19 | 20 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat') 21 | timeTAir=[0:1*60*60:24*60*60]; 22 | load('GRC_ANDRAVIDA_166820_iw2_SunPosition.mat') 23 | timeAzi=SunPosition(1,:); 24 | timeEle=timeAzi; 25 | 26 | Time=24*60*60*[0:95]/95; 27 | 28 | predictions.Azimut_Angle=interp1(timeAzi,SunPosition(2,:),Time,'linear','extrap'); 29 | predictions.Elevation_Angle=interp1(timeEle,SunPosition(3,:),Time,'linear','extrap'); 30 | predictions.TAirExt=interp1(timeTAir,temperature_Forecast(:,1),Time,'linear','extrap'); 31 | predictions.irrDir=interp1(timeirrDir,irrDir_Forecast(:,1)',Time,'linear','extrap'); 32 | predictions.irrDif=interp1(timeirrDif,irrDif_Forecast(:,1),Time,'linear','extrap'); 33 | 34 | PV_Ctl=ones(1,96); 35 | PV_Shaving_Ctl=ones(1,96); 36 | P_Solar=zeros(1,96); 37 | P_Elec=zeros(1,96); 38 | 39 | 40 | for k=1:length(PV_Shaving_Ctl) 41 | P_Solar(k) = PowSolar_PV(Param, predictions.irrDir(k),predictions.irrDif(k),predictions.Elevation_Angle(k), predictions.Azimut_Angle(k), predictions.TAirExt(k)); 42 | if P_Solar(k)<0 43 | P_Solar(k)=0; 44 | end 45 | P_Elec(k) = PowElec_PV(Param, real(P_Solar(k)), PV_Ctl(k), PV_Shaving_Ctl(k)); 46 | end 47 | figure 48 | subplot(3,1,1) 49 | plot(real(P_Solar),'xb') 50 | hold on 51 | grid on 52 | 53 | 54 | subplot(3,1,2) 55 | plot(P_Elec,'xr') 56 | hold on 57 | grid on 58 | 59 | subplot(3,1,3) 60 | plot(predictions.irrDir,'xb') 61 | hold on 62 | grid on 63 | 64 | figure 65 | Price=[0:0.01:10]; 66 | beta=0.9; 67 | Incentivemax=1; 68 | Incentivemin=-0.1; 69 | PriceCutoff=0.85; 70 | f=1./(1+exp(-(Price-PriceCutoff)/beta)); 71 | IncentiveFactor=Incentivemin+(Incentivemax-Incentivemin)*f; 72 | IncentiveFactor(IncentiveFactor<0)=0; 73 | plot(Price,IncentiveFactor,'r') -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/SolveProblem.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/SolveProblem.m -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_ESWN_INCAS_Irr.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_ESWN_INCAS_Irr.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_NSEW_Irr.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_NSEW_Irr.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_SunPosition.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/ZigorPV/GRC_ANDRAVIDA_166820_iw2_SunPosition.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/ZigorPV/MyLittleDEMIS_PV_Zigor.m: -------------------------------------------------------------------------------- 1 | 2 | clc 3 | clear all 4 | close all 5 | %XML 6 | XML='PVClass.xml'; 7 | %scheduleXML 8 | scheduleXML=0; %We do not need this variable 9 | % %currentTime 10 | currentTime=0; %We do not need this variable 11 | %OptimParams 12 | OptimParams.beta=[]; 13 | OptimParams.PriceCutoff=[]; 14 | OptimParams.Incentivemin=[]; 15 | OptimParams.Incentivemax=[]; 16 | 17 | OptimParams.horizon=24*60*60; %I suppose that this time goes in secs. 18 | OptimParams.tSample = 15*60; %I suppose that this time goes in secs. 19 | 20 | %predictions 21 | 22 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat') 23 | timeirrDif=[0:60*60:24*60*60]; %We take only the first day, each hour 24 | 25 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat') 26 | timeirrDir=[0:60*60:24*60*60]; %We take only the first day, each hour 27 | 28 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat') 29 | timeTAir=[0:1*60*60:24*60*60]; 30 | load('GRC_ANDRAVIDA_166820_iw2_SunPosition.mat') 31 | timeAzi=SunPosition(1,:); 32 | timeEle=timeAzi; 33 | 34 | Time=24*60*60*[0:95]/95; 35 | 36 | predictions.Azimut_Angle=interp1(timeAzi,SunPosition(2,:),Time,'linear','extrap'); 37 | predictions.Elevation_Angle=interp1(timeEle,SunPosition(3,:),Time,'linear','extrap'); 38 | predictions.TAirExt=interp1(timeTAir,temperature_Forecast(:,1),Time,'linear','extrap'); 39 | predictions.irrDir=interp1(timeirrDir,irrDir_Forecast(:,1)',Time,'linear','extrap'); 40 | predictions.irrDif=interp1(timeirrDif,irrDif_Forecast(:,1),Time,'linear','extrap'); 41 | 42 | predictions.tariff=0.5*ones(1,96);%Inventado 43 | %measures 44 | measures=[]; %Not used 45 | MiPanel = SolarPanel(XML, scheduleXML, currentTime, OptimParams, predictions, measures); 46 | MiPanel = getOptimResult(MiPanel); 47 | figure 48 | subplot(2,1,1) 49 | %Resultados=MyTurbine.getOptimResult(MyTurbine); 50 | plot(MiPanel.OptimProblem.currentSolution.pow) 51 | hold on 52 | grid on 53 | xlabel('Time Slot') 54 | ylabel('Production') 55 | subplot(2,1,2) 56 | plot(timeirrDif,irrDir_Forecast(:,1),'r') 57 | hold on 58 | xlabel('Time Slot') 59 | ylabel('Direct Irradiance') 60 | grid on 61 | -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/ZigorPV/PVClass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PhotoVoltaic 4 | autonomous 5 | 6 | PV 7 | 8 | 9 | 10 | 11 | 30 12 | -20 13 | 16500 14 | -0.4 15 | 47 16 | 0.95 17 | 0.25 18 | 15000 19 | 0 20 | 15 21 | 97 22 | 96 23 | 150 24 | 100 25 | 26 | 27 | 15*60 28 | 24*60*60 29 | 0.9 30 | 0.85 31 | -0.1 32 | 1 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/ZigorPV/PowElec_PV.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/ZigorPV/PowElec_PV.p -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/ZigorPV/PowSolar_PV.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/ZigorPV/PowSolar_PV.p -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/ZigorPV/SolveProblem.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/ZigorPV/SolveProblem.m -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/ZigorPV/ZigorPV.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/ZigorPV/ZigorPV.rar -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/ZigorPV/Zigor_Model.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/ZigorPV/Zigor_Model.slx -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/ZigorPV/getControl.m: -------------------------------------------------------------------------------- 1 | function [ control ] = getControl( SP ) 2 | %GetControl Summary of this function goes here 3 | % Detailed explanation goes here 4 | control.pow=SP.OptimProblem.currentSolution.ProductionPUproposal 5 | end 6 | 7 | -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/ZigorPV/getOptimResult.m: -------------------------------------------------------------------------------- 1 | function [ result ] = getOptimResult( SP ) 2 | %UNTITLED9 Summary of this function goes here 3 | % Detailed explanation goes here 4 | Results=SolveProblem(SP); 5 | SP.OptimProblem.currentSolution.pow; 6 | SP.OptimProblem.currentSolution.objval=result.objval; 7 | SP.OptimProblem.currentSolution=Results.ProductionPUproposal; 8 | disp('Hello!') 9 | end 10 | 11 | -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/Zigor_Model.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/Zigor_Model.slx -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/getControl.m: -------------------------------------------------------------------------------- 1 | function [ control ] = getControl( SP ) 2 | %GetControl Summary of this function goes here 3 | % Detailed explanation goes here 4 | control.pow=SP.OptimProblem.currentSolution.ProductionPUproposal 5 | end 6 | 7 | -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/getOptimResult.m: -------------------------------------------------------------------------------- 1 | function [ result ] = getOptimResult( SP ) 2 | %UNTITLED9 Summary of this function goes here 3 | % Detailed explanation goes here 4 | Results=SolveProblem(SP); 5 | SP.OptimProblem.currentSolution.pow; 6 | SP.OptimProblem.currentSolution.objval=result.objval; 7 | SP.OptimProblem.currentSolution=Results.ProductionPUproposal; 8 | disp('Hello!') 9 | end 10 | 11 | -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/los ficheros p/PowElec_PV.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/los ficheros p/PowElec_PV.p -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/los ficheros p/PowSolar_PV.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/los ficheros p/PowSolar_PV.p -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/info/binfo.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/info/binfo.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/info/chart4_3pf05y3O2w01esZ1x9v1T.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/info/chart4_3pf05y3O2w01esZ1x9v1T.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/info/chart5_BT217wIQUpnkWmF0rhCqnE.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/info/chart5_BT217wIQUpnkWmF0rhCqnE.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/info/chart5_NV6lfvbUCbuwZyb6W2Fv0E.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/info/chart5_NV6lfvbUCbuwZyb6W2Fv0E.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.bat: -------------------------------------------------------------------------------- 1 | call "mexopts.bat" 2 | nmake -f Zigor_Model_sfun.mak 3 | -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.exp -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.h: -------------------------------------------------------------------------------- 1 | #ifndef __Zigor_Model_sfun_h__ 2 | #define __Zigor_Model_sfun_h__ 3 | 4 | /* Include files */ 5 | #define S_FUNCTION_NAME sf_sfun 6 | #include "sfc_sf.h" 7 | #include "sfc_mex.h" 8 | #include "rtwtypes.h" 9 | #include "sfcdebug.h" 10 | #define rtInf (mxGetInf()) 11 | #define rtMinusInf (-(mxGetInf())) 12 | #define rtNaN (mxGetNaN()) 13 | #define rtIsNaN(X) ((int)mxIsNaN(X)) 14 | #define rtIsInf(X) ((int)mxIsInf(X)) 15 | 16 | /* Type Definitions */ 17 | 18 | /* Named Constants */ 19 | 20 | /* Variable Declarations */ 21 | extern uint32_T _Zigor_ModelMachineNumber_; 22 | extern real_T _sfTime_; 23 | 24 | /* Variable Definitions */ 25 | 26 | /* Function Declarations */ 27 | extern void Zigor_Model_initializer(void); 28 | extern void Zigor_Model_terminator(void); 29 | 30 | /* Function Definitions */ 31 | 32 | /* We load infoStruct for rtw_optimation_info on demand in mdlSetWorkWidths and 33 | free it immediately in mdlStart. Given that this is machine-wide as 34 | opposed to chart specific, we use NULL check to make sure it gets loaded 35 | and unloaded once per machine even though the methods mdlSetWorkWidths/mdlStart 36 | are chart/instance specific. The following methods abstract this out. */ 37 | extern mxArray* load_Zigor_Model_optimization_info(void); 38 | extern void unload_Zigor_Model_optimization_info(void); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.lib -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.mexw64.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.mol: -------------------------------------------------------------------------------- 1 | c4_Zigor_Model.obj 2 | c5_Zigor_Model.obj 3 | Zigor_Model_sfun_registry.obj 4 | Zigor_Model_sfun.obj 5 | -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun.obj -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun_registry.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/Zigor_Model_sfun_registry.obj -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/c4_Zigor_Model.h: -------------------------------------------------------------------------------- 1 | #ifndef __c4_Zigor_Model_h__ 2 | #define __c4_Zigor_Model_h__ 3 | 4 | /* Include files */ 5 | #include "sfc_sf.h" 6 | #include "sfc_mex.h" 7 | #include "rtwtypes.h" 8 | 9 | /* Type Definitions */ 10 | #ifndef struct_szlnHL9Df6pKpDV9xqQkSJG 11 | #define struct_szlnHL9Df6pKpDV9xqQkSJG 12 | 13 | struct szlnHL9Df6pKpDV9xqQkSJG 14 | { 15 | real_T Ploss_off; 16 | real_T Ploss_on; 17 | real_T Eff_hl; 18 | real_T Eff_fl; 19 | }; 20 | 21 | #endif /*struct_szlnHL9Df6pKpDV9xqQkSJG*/ 22 | 23 | #ifndef typedef_c4_szlnHL9Df6pKpDV9xqQkSJG 24 | #define typedef_c4_szlnHL9Df6pKpDV9xqQkSJG 25 | 26 | typedef struct szlnHL9Df6pKpDV9xqQkSJG c4_szlnHL9Df6pKpDV9xqQkSJG; 27 | 28 | #endif /*typedef_c4_szlnHL9Df6pKpDV9xqQkSJG*/ 29 | 30 | #ifndef struct_sao7lvpULMJbzgO3vhk2pkD 31 | #define struct_sao7lvpULMJbzgO3vhk2pkD 32 | 33 | struct sao7lvpULMJbzgO3vhk2pkD 34 | { 35 | real_T nPW; 36 | c4_szlnHL9Df6pKpDV9xqQkSJG Eff; 37 | real_T MinPVPW_On; 38 | real_T MinPVPW_av; 39 | }; 40 | 41 | #endif /*struct_sao7lvpULMJbzgO3vhk2pkD*/ 42 | 43 | #ifndef typedef_c4_sao7lvpULMJbzgO3vhk2pkD 44 | #define typedef_c4_sao7lvpULMJbzgO3vhk2pkD 45 | 46 | typedef struct sao7lvpULMJbzgO3vhk2pkD c4_sao7lvpULMJbzgO3vhk2pkD; 47 | 48 | #endif /*typedef_c4_sao7lvpULMJbzgO3vhk2pkD*/ 49 | 50 | #ifndef typedef_c4_ResolvedFunctionInfo 51 | #define typedef_c4_ResolvedFunctionInfo 52 | 53 | typedef struct { 54 | const char * context; 55 | const char * name; 56 | const char * dominantType; 57 | const char * resolved; 58 | uint32_T fileTimeLo; 59 | uint32_T fileTimeHi; 60 | uint32_T mFileTimeLo; 61 | uint32_T mFileTimeHi; 62 | } c4_ResolvedFunctionInfo; 63 | 64 | #endif /*typedef_c4_ResolvedFunctionInfo*/ 65 | 66 | #ifndef typedef_SFc4_Zigor_ModelInstanceStruct 67 | #define typedef_SFc4_Zigor_ModelInstanceStruct 68 | 69 | typedef struct { 70 | SimStruct *S; 71 | ChartInfoStruct chartInfo; 72 | uint32_T chartNumber; 73 | uint32_T instanceNumber; 74 | int32_T c4_sfEvent; 75 | boolean_T c4_isStable; 76 | boolean_T c4_doneDoubleBufferReInit; 77 | uint8_T c4_is_active_c4_Zigor_Model; 78 | } SFc4_Zigor_ModelInstanceStruct; 79 | 80 | #endif /*typedef_SFc4_Zigor_ModelInstanceStruct*/ 81 | 82 | /* Named Constants */ 83 | 84 | /* Variable Declarations */ 85 | 86 | /* Variable Definitions */ 87 | 88 | /* Function Declarations */ 89 | extern const mxArray *sf_c4_Zigor_Model_get_eml_resolved_functions_info(void); 90 | 91 | /* Function Definitions */ 92 | extern void sf_c4_Zigor_Model_get_check_sum(mxArray *plhs[]); 93 | extern void c4_Zigor_Model_method_dispatcher(SimStruct *S, int_T method, void 94 | *data); 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/c4_Zigor_Model.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/c4_Zigor_Model.obj -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/c5_Zigor_Model.h: -------------------------------------------------------------------------------- 1 | #ifndef __c5_Zigor_Model_h__ 2 | #define __c5_Zigor_Model_h__ 3 | 4 | /* Include files */ 5 | #include "sfc_sf.h" 6 | #include "sfc_mex.h" 7 | #include "rtwtypes.h" 8 | 9 | /* Type Definitions */ 10 | #ifndef struct_sCKvBU3U0z4KB0OM7v1DGpC 11 | #define struct_sCKvBU3U0z4KB0OM7v1DGpC 12 | 13 | struct sCKvBU3U0z4KB0OM7v1DGpC 14 | { 15 | real_T tilt; 16 | real_T SO; 17 | }; 18 | 19 | #endif /*struct_sCKvBU3U0z4KB0OM7v1DGpC*/ 20 | 21 | #ifndef typedef_c5_sCKvBU3U0z4KB0OM7v1DGpC 22 | #define typedef_c5_sCKvBU3U0z4KB0OM7v1DGpC 23 | 24 | typedef struct sCKvBU3U0z4KB0OM7v1DGpC c5_sCKvBU3U0z4KB0OM7v1DGpC; 25 | 26 | #endif /*typedef_c5_sCKvBU3U0z4KB0OM7v1DGpC*/ 27 | 28 | #ifndef struct_saSOdeh07LmZXv3qQ5udJsG 29 | #define struct_saSOdeh07LmZXv3qQ5udJsG 30 | 31 | struct saSOdeh07LmZXv3qQ5udJsG 32 | { 33 | c5_sCKvBU3U0z4KB0OM7v1DGpC Orientation; 34 | real_T insPwPV; 35 | real_T TempPcoeffPV; 36 | real_T NOCT; 37 | real_T Kl; 38 | real_T Albedo; 39 | }; 40 | 41 | #endif /*struct_saSOdeh07LmZXv3qQ5udJsG*/ 42 | 43 | #ifndef typedef_c5_saSOdeh07LmZXv3qQ5udJsG 44 | #define typedef_c5_saSOdeh07LmZXv3qQ5udJsG 45 | 46 | typedef struct saSOdeh07LmZXv3qQ5udJsG c5_saSOdeh07LmZXv3qQ5udJsG; 47 | 48 | #endif /*typedef_c5_saSOdeh07LmZXv3qQ5udJsG*/ 49 | 50 | #ifndef typedef_c5_ResolvedFunctionInfo 51 | #define typedef_c5_ResolvedFunctionInfo 52 | 53 | typedef struct { 54 | const char * context; 55 | const char * name; 56 | const char * dominantType; 57 | const char * resolved; 58 | uint32_T fileTimeLo; 59 | uint32_T fileTimeHi; 60 | uint32_T mFileTimeLo; 61 | uint32_T mFileTimeHi; 62 | } c5_ResolvedFunctionInfo; 63 | 64 | #endif /*typedef_c5_ResolvedFunctionInfo*/ 65 | 66 | #ifndef typedef_SFc5_Zigor_ModelInstanceStruct 67 | #define typedef_SFc5_Zigor_ModelInstanceStruct 68 | 69 | typedef struct { 70 | SimStruct *S; 71 | ChartInfoStruct chartInfo; 72 | uint32_T chartNumber; 73 | uint32_T instanceNumber; 74 | int32_T c5_sfEvent; 75 | boolean_T c5_isStable; 76 | boolean_T c5_doneDoubleBufferReInit; 77 | uint8_T c5_is_active_c5_Zigor_Model; 78 | } SFc5_Zigor_ModelInstanceStruct; 79 | 80 | #endif /*typedef_SFc5_Zigor_ModelInstanceStruct*/ 81 | 82 | /* Named Constants */ 83 | 84 | /* Variable Declarations */ 85 | 86 | /* Variable Definitions */ 87 | 88 | /* Function Declarations */ 89 | extern const mxArray *sf_c5_Zigor_Model_get_eml_resolved_functions_info(void); 90 | 91 | /* Function Definitions */ 92 | extern void sf_c5_Zigor_Model_get_check_sum(mxArray *plhs[]); 93 | extern void c5_Zigor_Model_method_dispatcher(SimStruct *S, int_T method, void 94 | *data); 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/c5_Zigor_Model.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/c5_Zigor_Model.obj -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/mexopts.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem MSSDK71OPTS.BAT 3 | rem 4 | rem Compile and link options used for building MEX-files 5 | rem using the Microsoft Windows Software Development Kit. 6 | rem 7 | rem $Revision: 1.1.6.3.2.1 $ $Date: 2012/07/12 13:53:58 $ 8 | rem Copyright 2010 The MathWorks, Inc. 9 | rem 10 | rem StorageVersion: 1.0 11 | rem C++keyFileName: MSSDK71OPTS.BAT 12 | rem C++keyName: Microsoft SDK 13 | rem C++keyManufacturer: Microsoft 14 | rem C++keyVersion: 7.1 15 | rem C++keyLanguage: C++ 16 | rem C++keyLinkerName: Microsoft SDK 17 | rem C++keyLinkerVersion: 7.1 18 | rem 19 | rem ******************************************************************** 20 | rem General parameters 21 | rem ******************************************************************** 22 | 23 | set MATLAB=%MATLAB% 24 | set VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 10.0 25 | set VCINSTALLDIR=%VSINSTALLDIR%\VC 26 | rem In this case, LINKERDIR is being used to specify the location of the SDK 27 | set LINKERDIR=C:\Program Files\Microsoft SDKs\Windows\v7.1\ 28 | set PATH=%VCINSTALLDIR%\bin\amd64;%VCINSTALLDIR%\bin;%VCINSTALLDIR%\VCPackages;%VSINSTALLDIR%\Common7\IDE;%VSINSTALLDIR%\Common7\Tools;%LINKERDIR%\bin\x64;%LINKERDIR%\bin;%MATLAB_BIN%;%PATH% 29 | set INCLUDE=%VCINSTALLDIR%\INCLUDE;%LINKERDIR%\include;%LINKERDIR%\include\gl;%VCINSTALLDIR%\ATLMFC\INCLUDE;%INCLUDE% 30 | set LIB=%VCINSTALLDIR%\LIB\amd64;%LINKERDIR%\LIB\X64;%VCINSTALLDIR%\ATLMFC\LIB\AMD64;%MATLAB%\extern\lib\win64;%LIB% 31 | set MW_TARGET_ARCH=win64 32 | 33 | rem ******************************************************************** 34 | rem Compiler parameters 35 | rem ******************************************************************** 36 | set COMPILER=cl 37 | set COMPFLAGS=/c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD 38 | set OPTIMFLAGS=/O2 /Oy- /DNDEBUG 39 | set DEBUGFLAGS=/Z7 40 | set NAME_OBJECT=/Fo 41 | 42 | rem ******************************************************************** 43 | rem Linker parameters 44 | rem ******************************************************************** 45 | set LIBLOC=%MATLAB%\extern\lib\win64\microsoft 46 | set LINKER=link 47 | set LINKFLAGS=/dll /export:%ENTRYPOINT% /LIBPATH:"%LIBLOC%" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /manifest /incremental:NO /implib:"%LIB_NAME%.x" /MAP:"%OUTDIR%%MEX_NAME%%MEX_EXT%.map" 48 | set LINKOPTIMFLAGS= 49 | set LINKDEBUGFLAGS=/debug /PDB:"%OUTDIR%%MEX_NAME%%MEX_EXT%.pdb" 50 | set LINK_FILE= 51 | set LINK_LIB= 52 | set NAME_OUTPUT=/out:"%OUTDIR%%MEX_NAME%%MEX_EXT%" 53 | set RSP_FILE_INDICATOR=@ 54 | 55 | rem ******************************************************************** 56 | rem Resource compiler parameters 57 | rem ******************************************************************** 58 | set RC_COMPILER=rc /fo "%OUTDIR%mexversion.res" 59 | set RC_LINKER= 60 | 61 | set POSTLINK_CMDS=del "%LIB_NAME%.x" "%LIB_NAME%.exp" 62 | set POSTLINK_CMDS1=mt -outputresource:"%OUTDIR%%MEX_NAME%%MEX_EXT%;2" -manifest "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest" 63 | set POSTLINK_CMDS2=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest" 64 | set POSTLINK_CMDS3=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.map" 65 | -------------------------------------------------------------------------------- /SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/rtwtypeschksum.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/PV/slprj/_sfprj/Zigor_Model/_self/sfun/src/rtwtypeschksum.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/SolarPanel.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/SolarPanel.m -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/WindTurbine/GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/PowElec_WT.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/WindTurbine/PowElec_WT.m -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/PowElec_WT.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/WindTurbine/PowElec_WT.p -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/PowWind_WT.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/WindTurbine/PowWind_WT.m -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/PowWind_WT.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/WindTurbine/PowWind_WT.p -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/SolveProblemWTZigor.m: -------------------------------------------------------------------------------- 1 | function [Results] = SolveProblemWTZigor( SP ) 2 | %SolveProblem Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | Nslot = SP.OptimParams.horizon/SP.OptimParams.tSample; 6 | Wind=SP.StoredData.WindSpeed; 7 | Price=SP.StoredData.tariff; 8 | ProductionPUvector=[0:0.01:1]; %The productionPU possible values this variable is between 0 and 1 9 | ProductionProposal=zeros(1,Nslot); 10 | ProductionPUproposal=zeros(1,Nslot); 11 | ProductionVector=zeros(1,length(ProductionPUvector)); 12 | 13 | beta=SP.OptimParams.beta; 14 | Incentivemax=SP.OptimParams.Incentivemax; 15 | Incentivemin=SP.OptimParams.Incentivemax; 16 | PriceCutoff=SP.OptimParams.PriceCutoff; 17 | Benefit=zeros(1,Nslot); 18 | for k1=1:Nslot 19 | %k-th Time Slot optimization 20 | for k2=1:length(ProductionPUvector) 21 | [B,ProductionVector(k2)]=Zigor_WT_profit(ProductionPUvector(k2),Price(k1),Wind(k1),SP); 22 | end 23 | %The second alternative 24 | [ProductionProposal(k1),Ref]=min(ProductionVector); % The production has negative value, So to maximime production, we have to minime this value 25 | ProductionPUproposal(k1)=ProductionPUvector(Ref); 26 | f=1/(1+exp(-(Price(k1)-PriceCutoff)/beta)); 27 | IncentiveFactor=Incentivemin+(Incentivemax-Incentivemin)*f; 28 | IncentiveFactor(IncentiveFactor<0)=0; 29 | ProductionPUproposal(k1)=IncentiveFactor*ProductionPUproposal(k1); 30 | [B,ProductionProposal(k1)]=Zigor_WT_profit(ProductionPUproposal(k1),Price(k1),Wind(k1),SP); 31 | Benefit(k1)=B; 32 | end 33 | % SP.OptimProblem.currentSolution.pow=ProductionProposal; 34 | % SP.OptimProblem.currentSolution.objval=sum(Benefit); 35 | % SP.OptimProblem.currentSolution.ProductionPUproposal=ProductionPUproposal; 36 | Results.pow=ProductionProposal; 37 | Results.objval=sum(Benefit); 38 | Results.ProductionPUproposal=ProductionPUproposal; 39 | end 40 | 41 | -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/IntegrationZigorDemisV3.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/IntegrationZigorDemisV3.rar -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/IntegrationZigorDemisV4.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/IntegrationZigorDemisV4.zip -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/MyLittleDEMIS.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear all 3 | close all 4 | %XML 5 | XML='WindTurbine.xml'; 6 | %scheduleXML 7 | scheduleXML=0; %We do not need this variable 8 | % %currentTime 9 | currentTime=0; %We do not need this variable 10 | %OptimParams 11 | OptimParams.beta=[]; 12 | OptimParams.PriceCutoff=[]; 13 | OptimParams.Incentivemin=[]; 14 | OptimParams.Incentivemax=[]; 15 | 16 | OptimParams.horizon=24; %I suppose that this time goes in hours. 17 | OptimParams.tSample = 0.25; %I suppose that this time goes in hours. 18 | OptimParams.updatePeriod=[]; 19 | 20 | %predictions 21 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat') 22 | Wind=windSpeed_forecast(:,1); 23 | TimeWind=[0:OptimParams.tSample:OptimParams.horizon]; 24 | predictions.WindSpeed=interp1([0:OptimParams.horizon],Wind,TimeWind,'linear'); 25 | predictions.tariff=ones(1,96);%Inventado 26 | %measures 27 | measures=[]; %Not used 28 | MiTurbina = WindTurbine(XML, scheduleXML, currentTime, OptimParams, predictions, measures); 29 | MiTurbina = getOptimResult(MiTurbina) 30 | subplot(2,1,1) 31 | %Resultados=MyTurbine.getOptimResult(MyTurbine); 32 | plot(MiTurbina.OptimProblem.currentSolution.pow) 33 | hold on 34 | grid on 35 | xlabel('Time Slot') 36 | ylabel('Production') 37 | subplot(2,1,2) 38 | plot(Wind,'r') 39 | hold on 40 | xlabel('Time Slot') 41 | ylabel('Wind Speed') 42 | grid on -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/PowElec_WT.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/PowElec_WT.m -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/PowElec_WT.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/PowElec_WT.p -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/PowWind_WT.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/PowWind_WT.m -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/PowWind_WT.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/PowWind_WT.p -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/SolveProblemWTZigor.m: -------------------------------------------------------------------------------- 1 | function [Results] = SolveProblemWTZigor( SP ) 2 | %SolveProblem Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | Nslot = SP.OptimParams.horizon/SP.OptimParams.tSample; 6 | Wind=SP.StoredData.WindSpeed; 7 | Price=SP.StoredData.tariff; 8 | ProductionPUvector=[0:0.01:1]; %The productionPU possible values this variable is between 0 and 1 9 | ProductionProposal=zeros(1,Nslot); 10 | ProductionPUproposal=zeros(1,Nslot); 11 | ProductionVector=zeros(1,length(ProductionPUvector)); 12 | 13 | beta=SP.OptimParams.beta; 14 | Incentivemax=SP.OptimParams.Incentivemax; 15 | Incentivemin=SP.OptimParams.Incentivemax; 16 | PriceCutoff=SP.OptimParams.PriceCutoff; 17 | Benefit=zeros(1,Nslot); 18 | for k1=1:Nslot 19 | %k-th Time Slot optimization 20 | for k2=1:length(ProductionPUvector) 21 | [B,ProductionVector(k2)]=Zigor_WT_profit(ProductionPUvector(k2),Price(k1),Wind(k1),SP); 22 | end 23 | %The second alternative 24 | [ProductionProposal(k1),Ref]=min(ProductionVector); % The production has negative value, So to maximime production, we have to minime this value 25 | ProductionPUproposal(k1)=ProductionPUvector(Ref); 26 | f=1/(1+exp(-(Price(k1)-PriceCutoff)/beta)); 27 | IncentiveFactor=Incentivemin+(Incentivemax-Incentivemin)*f; 28 | IncentiveFactor(IncentiveFactor<0)=0; 29 | ProductionPUproposal(k1)=IncentiveFactor*ProductionPUproposal(k1); 30 | [B,ProductionProposal(k1)]=Zigor_WT_profit(ProductionPUproposal(k1),Price(k1),Wind(k1),SP); 31 | Benefit(k1)=B; 32 | end 33 | % SP.OptimProblem.currentSolution.pow=ProductionProposal; 34 | % SP.OptimProblem.currentSolution.objval=sum(Benefit); 35 | % SP.OptimProblem.currentSolution.ProductionPUproposal=ProductionPUproposal; 36 | Results.pow=ProductionProposal; 37 | Results.objval=sum(Benefit); 38 | Results.ProductionPUproposal=ProductionPUproposal; 39 | end 40 | 41 | -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/WindTurbine.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WindTurbine 4 | autonomous 5 | 6 | WindTurbine 7 | 8 | 9 | 10 | 11 | 3 12 | 18 13 | [3 4 6 7.5 9.5 11 14 16 18;0 140 470 780 1450 1860 2200 2280 2300] 14 | 5000 15 | 5000 16 | 0 17 | 7 18 | 97 19 | 96 20 | 42 21 | 35 22 | 23 | 24 | 0.85 25 | 0.9 26 | 0 27 | 1 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/Zigor_WT_profit.m: -------------------------------------------------------------------------------- 1 | function [B,Production]=Zigor_WT_profit(ProductionPU,Price,Wind,SP) 2 | 3 | %% Wind Turbine Parameter loading 4 | 5 | Param_s.Vcuton=SP.Model.Params.Vcuton; 6 | Param_s.Vcutoff=SP.Model.Params.Vcutoff; 7 | Param_m.PowerCurve=SP.Model.Params.PowerCurve; 8 | Param.nPW=SP.Model.Params.nPW; 9 | Param.MaxPW=SP.Model.Params.MaxPW; 10 | Param.Eff.Ploss_off=SP.Model.Params.Ploss_off; 11 | Param.Eff.Ploss_on=SP.Model.Params.Ploss_on; 12 | Param.Eff.Eff_hl=SP.Model.Params.Eff_hl; 13 | Param.Eff.Eff_fl=SP.Model.Params.Eff_fl; 14 | Param.MinWindPW_On=SP.Model.Params.MinWindPW_On; 15 | Param.MinWindPW_av=SP.Model.Params.MinWindPW_av; 16 | 17 | NtimeSlots = SP.OptimParams.horizon/SP.OptimParams.tSample; 18 | 19 | 20 | %Control time series 21 | WT_Shaving_Ctl=ProductionPU;%Algo progresivo de 0 a 1. Variable a manipular, a determinar por nuestro algoritmo 22 | WT_Ctl=ones(NtimeSlots,1); %Disponibilidad 0 o 1 23 | 24 | % Wind Turbine power resource 25 | pwTurbine=PowWind_WT(Param_s,Param_m,Wind); 26 | % Wind Turbine's power stage energy production 27 | pwE=PowElec_WT(Param,pwTurbine,WT_Ctl,WT_Shaving_Ctl); 28 | Production=pwE; 29 | %%Profit calculation 30 | B=-Production*Price; 31 | -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/WindTurbine_EkaitzPruebas/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010, Wouter Falkena 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the distribution 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /SmartGridControl/Models/WindTurbine/Zigor_WT_profit.m: -------------------------------------------------------------------------------- 1 | function [B,Production]=Zigor_WT_profit(ProductionPU,Price,Wind,SP) 2 | 3 | %% Wind Turbine Parameter loading 4 | 5 | Param_s.Vcuton=SP.Model.Params.Vcuton; 6 | Param_s.Vcutoff=SP.Model.Params.Vcutoff; 7 | Param_m.PowerCurve=SP.Model.Params.PowerCurve; 8 | Param.nPW=SP.Model.Params.nPW; 9 | Param.MaxPW=SP.Model.Params.MaxPW; 10 | Param.Eff.Ploss_off=SP.Model.Params.Ploss_off; 11 | Param.Eff.Ploss_on=SP.Model.Params.Ploss_on; 12 | Param.Eff.Eff_hl=SP.Model.Params.Eff_hl; 13 | Param.Eff.Eff_fl=SP.Model.Params.Eff_fl; 14 | Param.MinWindPW_On=SP.Model.Params.MinWindPW_On; 15 | Param.MinWindPW_av=SP.Model.Params.MinWindPW_av; 16 | 17 | NtimeSlots = SP.OptimParams.horizon/SP.OptimParams.tSample; 18 | 19 | 20 | %Control time series 21 | WT_Shaving_Ctl=ProductionPU;%Algo progresivo de 0 a 1. Variable a manipular, a determinar por nuestro algoritmo 22 | WT_Ctl=ones(NtimeSlots,1); %Disponibilidad 0 o 1 23 | 24 | % Wind Turbine power resource 25 | pwTurbine=PowWind_WT(Param_s,Param_m,Wind); 26 | % Wind Turbine's power stage energy production 27 | pwE=PowElec_WT(Param,pwTurbine,WT_Ctl,WT_Shaving_Ctl); 28 | Production=pwE; 29 | %%Profit calculation 30 | B=-Production*Price; 31 | -------------------------------------------------------------------------------- /SmartGridControl/Utils/createConsumer.m: -------------------------------------------------------------------------------- 1 | function [ outConsumer ] = createConsumer( pXML ) 2 | %UNTITLED2 Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | %myXML = strcat('../Work/GridComponents',pXML); 6 | % Schedule is not used 7 | scheduleXML = []; 8 | % %currentTime 9 | currentTime=0; %We do not need this variable 10 | %OptimParams 11 | OptimParams.beta=[]; 12 | OptimParams.PriceCutoff=[]; 13 | 14 | OptimParams.horizon=24; %I suppose that this time goes in hours. 15 | OptimParams.tSample = 0.25; %I suppose that this time goes in hours. 16 | OptimParams.updatePeriod=[]; 17 | 18 | %measures 19 | measures=[]; %Not used 20 | cd ../Models; 21 | outConsumer = Consumer( pXML, scheduleXML, currentTime, OptimParams, measures) 22 | end 23 | 24 | -------------------------------------------------------------------------------- /SmartGridControl/Utils/createDiesel.m: -------------------------------------------------------------------------------- 1 | function [ outDiesel ] = createDiesel( pXML ) 2 | %CREATEDIESEL Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | % Read configuration from XML 6 | %myXML = strcat('../Work/GridComponents',pXML); 7 | 8 | if isstruct(pXML) 9 | def.eNode = pXML; 10 | else 11 | def = xml2struct(pXML); 12 | end 13 | 14 | %scheduleXML 15 | scheduleXML=0; %We do not need this variable 16 | % %currentTime 17 | currentTime=0; %We do not need this variable 18 | %OptimParams 19 | OptimParams.beta=[]; 20 | OptimParams.PriceCutoff=[]; 21 | OptimParams.Incentivemin=[]; 22 | OptimParams.Incentivemax=[]; 23 | 24 | OptimParams.horizon=24; %I suppose that this time goes in hours. 25 | OptimParams.tSample = 0.25; %I suppose that this time goes in hours. 26 | OptimParams.updatePeriod=[]; 27 | %OptimParams.powerCurve2 = str2num(def.eNode.OptimParams.stableNetCurve2.Text); 28 | %measures 29 | measures=[]; %Not used 30 | cd ../Models; 31 | outDiesel = Diesel(pXML, scheduleXML, currentTime, OptimParams, measures) 32 | end 33 | 34 | -------------------------------------------------------------------------------- /SmartGridControl/Utils/createHydro.m: -------------------------------------------------------------------------------- 1 | function [ outHydro ] = createHydro( pXML ) 2 | %CREATEHydro Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | % Read configuration from XML 6 | %myXML = strcat('../Work/GridComponents',pXML); 7 | 8 | if isstruct(pXML) 9 | def.eNode = pXML; 10 | else 11 | def = xml2struct(pXML); 12 | end 13 | 14 | %scheduleXML 15 | scheduleXML=0; %We do not need this variable 16 | % %currentTime 17 | currentTime=0; %We do not need this variable 18 | %OptimParams 19 | OptimParams.beta=[]; 20 | OptimParams.PriceCutoff=[]; 21 | OptimParams.Incentivemin=[]; 22 | OptimParams.Incentivemax=[]; 23 | 24 | OptimParams.horizon=24; %I suppose that this time goes in hours. 25 | OptimParams.tSample = 0.25; %I suppose that this time goes in hours. 26 | OptimParams.updatePeriod=[]; 27 | %OptimParams.powerCurve2 = str2num(def.eNode.OptimParams.stableNetCurve2.Text); 28 | %measures 29 | measures=[]; %Not used 30 | cd ../Models; 31 | outHydro = Hydro(pXML, scheduleXML, currentTime, OptimParams, measures) 32 | end -------------------------------------------------------------------------------- /SmartGridControl/Utils/createPhotoVoltaic.m: -------------------------------------------------------------------------------- 1 | function [ outPanel ] = createPhotoVoltaic( pXML ) 2 | %CREATEPHOTOVOLTAIC Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | %scheduleXML 6 | scheduleXML=0; %We do not need this variable 7 | % %currentTime 8 | currentTime=0; %We do not need this variable 9 | %OptimParams 10 | OptimParams.beta=[]; 11 | OptimParams.PriceCutoff=[]; 12 | OptimParams.Incentivemin=[]; 13 | OptimParams.Incentivemax=[]; 14 | 15 | OptimParams.horizon=24*60*60; %I suppose that this time goes in secs. 16 | OptimParams.tSample = 15*60; %I suppose that this time goes in secs. 17 | 18 | %predictions 19 | cd ../Models/PV; 20 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDif.mat') 21 | timeirrDif=[0:60*60:24*60*60]; %We take only the first day, each hour 22 | 23 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_IrrDir.mat') 24 | timeirrDir=[0:60*60:24*60*60]; %We take only the first day, each hour 25 | 26 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_Text.mat') 27 | timeTAir=[0:1*60*60:24*60*60]; 28 | load('GRC_ANDRAVIDA_166820_iw2_SunPosition.mat') 29 | timeAzi=SunPosition(1,:); 30 | timeEle=timeAzi; 31 | 32 | Time=24*60*60*[0:95]/95; 33 | 34 | predictions.Azimut_Angle=interp1(timeAzi,SunPosition(2,:),Time,'linear','extrap'); 35 | predictions.Elevation_Angle=interp1(timeEle,SunPosition(3,:),Time,'linear','extrap'); 36 | predictions.TAirExt=interp1(timeTAir,temperature_Forecast(:,1),Time,'linear','extrap'); 37 | predictions.irrDir=interp1(timeirrDir,irrDir_Forecast(:,1)',Time,'linear','extrap'); 38 | predictions.irrDif=interp1(timeirrDif,irrDif_Forecast(:,1),Time,'linear','extrap'); 39 | 40 | predictions.tariff=ones(1,96);%Inventado 41 | %measures 42 | measures=[]; %Not used 43 | cd ../; 44 | outPanel = SolarPanel(pXML, scheduleXML, currentTime, OptimParams, predictions, measures) 45 | 46 | end 47 | 48 | -------------------------------------------------------------------------------- /SmartGridControl/Utils/createWindTurbine.m: -------------------------------------------------------------------------------- 1 | function [ outWindTurbine ] = createWindTurbine( pXML ) 2 | %CREATEWINDTURBINE Summary of this function goes here 3 | % Detailed explanation goes here 4 | % XML 5 | %scheduleXML 6 | scheduleXML=0; %We do not need this variable 7 | % %currentTime 8 | currentTime=0; %We do not need this variable 9 | %OptimParams 10 | OptimParams.beta=[]; 11 | OptimParams.PriceCutoff=[]; 12 | OptimParams.Incentivemin=[]; 13 | OptimParams.Incentivemax=[]; 14 | 15 | OptimParams.horizon=24; %I suppose that this time goes in hours. 16 | OptimParams.tSample = 0.25; %I suppose that this time goes in hours. 17 | OptimParams.updatePeriod=[]; 18 | 19 | %predictions 20 | cd ../Models/WindTurbine; 21 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat') 22 | Wind = windSpeed_forecast(:,1); 23 | TimeWind=[0:OptimParams.tSample:OptimParams.horizon]; 24 | predictions.WindSpeed=interp1([0:OptimParams.horizon],Wind,TimeWind,'linear'); 25 | predictions.tariff=ones(1,96);%Inventado 26 | %measures 27 | measures=[]; %Not used 28 | 29 | cd ../; 30 | outWindTurbine = WindTurbine(pXML, scheduleXML, currentTime, OptimParams, predictions, measures) 31 | end 32 | 33 | -------------------------------------------------------------------------------- /SmartGridControl/Utils/funcLocalSearch.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl/Utils/funcLocalSearch.m -------------------------------------------------------------------------------- /SmartGridControl/Utils/generateRandomCurve.m: -------------------------------------------------------------------------------- 1 | function [ result ] = generateRandomCurve( pPower, pSize ) 2 | %GENERATERANDOMCURVE Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | 6 | %tempPowerMatrix = Consumer.Model.powerConsumed(2,:); 7 | %r_range = [min(r) max(r)]; 8 | r = randi( pPower, 1, pSize); 9 | 10 | result = r; 11 | end 12 | 13 | -------------------------------------------------------------------------------- /SmartGridControl/Utils/intersections/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008, Douglas M. Schwarz 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the distribution 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /SmartGridControl/Work/CentraleNode/CentraleNode.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | CentraleNode 4 | autonomous 5 | 6 | CentraleNode 7 | 8 | 9 | 10 | 11 | 12 | ../Work/GridComponents 13 | 14 | 15 | Consumer 16 | C:\Users\Grid\Zigor\TFG 2015-2016\Code\Grid\Consumers 17 | 18 | 19 | Diesel 20 | C:\Users\Grid\Zigor\TFG 2015-2016\Code\Grid\Diesel 21 | 22 | 23 | WindTurbine 24 | C:\Users\Grid\Zigor\TFG 2015-2016\Code\Grid\WindTurbine 25 | 26 | 27 | Battery 28 | 29 | 30 | 31 | 32 | 33 | 100 34 | [47.5 52.5; 100000 100] 35 | [100 100000; 1 10] 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /SmartGridControl/Work/GridComponents/Consumer_001.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Consumer 4 | autonomous 5 | 6 | Consumer_001 7 | 8 | 9 | 10 | 11 | 12 | [[1:1:96]; [1:1:96]] 13 | .9 14 | 100 15 | [ 0.1535 0.1689 0.2620 0.4145 2.8270 4.6390 0.9211 2.6362 3.2084 1.1404 6.0979 0.7895 1.3205 14.0789 22.1199 1.5875 9.7368 0.7456 1.6667 1.3158 1.6667 1.6667 1.8421 2.1199 0.7895 2.6316 0.7895 2.5439 4.4298 7.7151 25.1754 22.5439 25.3509 28.3333 35.0000 16.2281 7.5371 2.7193 1.9737 1.3158 0.7895 0.2632 0.9649 0.0593 0.2967 0.0593 11.4540 26.9436 23.3086 10.7418 0.4154 10.7418 13.0564 8.4273 3.9763 2.7300 2.5519 2.7300 3.4421 4.3323 3.9763 3.2641 4.6884 3.4421 5.0593 4.5104 3.9763 3.7982 4.5104 3.9763 3.7982 3.6202 4.6884 4.1543 5.2226 4.1543 4.3323 7.1810 12.1662 16.2611 25.2077 37.4481 39.4065 38.3383 42.6113 26.9436 23.9169 18.0415 10.9199 7.3591 4.6390 2.8270 0.4145 0.2620 0.1689 0.1535 ] 16 | [ 0.1564 0.3925 0.3945 0.3945 0.3945 0.3317 0.3200 0.3265 0.3243 0.3243 0.3447 0.3562 0.3338 0.3375 0.3309 0.3338 0.3360 0.3360 0.3580 0.3660 0.3740 0.3799 0.3814 0.3799 0.3836 0.3624 0.3558 0.3287 0.3039 0.2871 0.2651 0.2395 0.2162 0.2147 0.2315 0.2257 0.2220 0.2205 0.2205 0.2205 0.2520 0.2754 0.2936 0.2958 0.2951 0.2754 0.2607 0.2520 0.2505 0.2520 0.2490 0.2520 0.3302 0.3740 0.3510 0.3514 0.3514 0.3507 0.2927 0.2556 0.2286 0.2288 0.2201 0.2140 0.2074 0.2059 0.2045 0.2008 0.2096 0.2008 0.1825 0.2001 0.2374 0.2644 0.2973 0.3105 0.3163 0.3178 0.3192 0.3061 0.3031 0.2944 0.2790 0.2702 0.2564 0.2352 0.2337 0.2527 0.2827 0.3675 0.3616 0.3695 0.3682 0.3697 0.3697 0.3697] 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /SmartGridControl/Work/GridComponents/Diesel_002.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Diesel 4 | autonomous 5 | 6 | Diesel_002 7 | 8 | 9 | 10 | 11 | 12 | 100 13 | [0 6.62] 14 | 1.2 15 | 0 16 | [0 5000] 17 | 18 | 19 | 20 | 21 | 0.85 22 | 0.9 23 | 0 24 | 1 25 | 0.25 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /SmartGridControl/Work/GridComponents/Hydro.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hydro 4 | autonomous 5 | 6 | Hydro_001 7 | 8 | 9 | 10 | 11 | 12 | 100000 13 | [0 5.7 9.5 13.6 18] 14 | 0 15 | 0.1 16 | 17 | [0 5000] 18 | 19 | 20 | 21 | 100 22 | 0.9 23 | 24 | 25 | 26 | 0.85 27 | 0.9 28 | 0 29 | 1 30 | 0.25 31 | [47 47.5 48 48.5 49 49.5 50 50.5 51 51.5 52 52.5 53 ; 3100 2700 2600 2300 2280 2200 1860 1450 780 470 140 70 0] 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /SmartGridControl/Work/GridComponents/Not_used_yet/Battery_001.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Battery 4 | autonomous 5 | 6 | Battery_001 7 | 8 | 9 | 10 | 11 | 5000 12 | 0 13 | 7 14 | 97 15 | 96 16 | 300 17 | 35 18 | 0 19 | 37800000 20 | 65 21 | -65 22 | [0 0.200000000000000 0.950000000000000 1] 23 | [0.800000000000000 0.810000000000000 1.400000000000000 1.500000000000000] 24 | [0 0.200000000000000 0.950000000000000 1] 25 | [0.007000000000000 0.007010000000000 0.007020000000000 0.007030000000000] 26 | 30 27 | 12 28 | 65 29 | -65 30 | [0 0.200000000000000 0.950000000000000 1] 31 | [288 2.916000000000000e+02 504 540] 32 | [0 0.200000000000000 0.950000000000000 1] 33 | [2.520000000000000 2.523600000000000 2.527200000000000 2.530800000000000] 34 | [0 0.003002000000000] 35 | [0 150000] 36 | 0.75 37 | [0 65] 38 | [0 0.003000000000000] 39 | 0.001 40 | 0.5 41 | 42 | 43 | 0.85 44 | 0.9 45 | 0 46 | 1 47 | 0.5 48 | 0.2 49 | 0.8 50 | 10 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /SmartGridControl/Work/GridComponents/Not_used_yet/Copy_WindTurbine3_Documentation.xml: -------------------------------------------------------------------------------- 1 | 18 2 | 3 | [48 48.5 49 49.5 50 50.5 51 51.5 52 ; 0 140 470 780 1450 1860 2200 2280 2300] 4 | 5 | 6 | [48 48.5 49 49.5 50 50.5 51 51.5 52; 0.0539 0.0648 0.0757 0.0839 0.0939 0.1039 0.1139 0.1139 0.1239] -------------------------------------------------------------------------------- /SmartGridControl/Work/GridComponents/Not_used_yet/Diesel_001.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Diesel 4 | autonomous 5 | 6 | Diesel_001 7 | 8 | 9 | 10 | 11 | 12 | 100 13 | [0 5.7 9.5 13.6 18] 14 | 0 15 | 250 16 | [47.5 52.5 ; 5000 150] 17 | 18 | 19 | 20 | 21 | 22 | 0.85 23 | 0.9 24 | 0 25 | 1 26 | 0.25 27 | [ 1 2 3 4 5 6 7 8 9 10] 28 | [3 4 6 7.5 9.5 11 14 16 18 21 140 470 780 1450 1860 2200 2280 2300 2400 2500 3 4 6 7.5 9.5 11 14 16 18 21 140 470 780 1450 1860 2200 2280 2300 2400 25003 4 6 7.5 9.5 11 14 16 18 21] 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /SmartGridControl/Work/GridComponents/Not_used_yet/FWClass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | FWZigor 4 | autonomous 5 | 6 | FWZigor 7 | 8 | 9 | 10 | 11 | 0.311*15 12 | 50e3*2*pi/60 13 | 0.75*50e3*2*pi/60 14 | 0.08*1000/ (50000*pi/30) 15 | 0.15*1000/ (50000*pi/30)^2 16 | 0.3*1000/ (50000*pi/30)^3 17 | 0.95 18 | 100 19 | -100 20 | 100e3 21 | -100e3 22 | 100000 23 | 10 24 | 1000 25 | 95 26 | 93 27 | 0.001 28 | 29 | 30 | 0.01 31 | 0.001 32 | 0 33 | 1 34 | 0.1 35 | 0.2 36 | 0.8 37 | 1 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /SmartGridControl/Work/GridComponents/Not_used_yet/PVClass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PhotoVoltaic 4 | autonomous 5 | 6 | PV 7 | 8 | 9 | 10 | 11 | 30 12 | -20 13 | 16500 14 | -0.4 15 | 47 16 | 0.95 17 | 0.25 18 | 15000 19 | 0 20 | 15 21 | 97 22 | 96 23 | 150 24 | 100 25 | 26 | 27 | 15*60 28 | 24*60*60 29 | 0.9 30 | 0.5 31 | -0.1 32 | 1 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SmartGridControl/Work/GridComponents/PVClass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PhotoVoltaic 4 | autonomous 5 | 6 | PV 7 | 8 | 9 | 10 | 11 | 30 12 | -20 13 | 16500 14 | -0.4 15 | 47 16 | 0.95 17 | 0.25 18 | 15000 19 | 0 20 | 15 21 | 97 22 | 96 23 | 150 24 | 100 25 | [47.5 52.5 ; 100 5000] 26 | [47.5 52.5; 0.03 1] 27 | 28 | 29 | 15*60 30 | 24*60*60 31 | 0.9 32 | 0.5 33 | -0.1 34 | 1 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /SmartGridControl/Work/GridComponents/WindTurbine1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WindTurbine 4 | autonomous 5 | 6 | WindTurbine_001 7 | 8 | 9 | 10 | 11 | 3 12 | 18 13 | [47.5 52.5 ; 100 5500] 14 | [47.5 52.5; 0.03 1] 15 | 5000 16 | 5500 17 | 0 18 | 7 19 | 97 20 | 96 21 | 42 22 | 35 23 | 24 | 25 | 0.85 26 | 0.9 27 | 0 28 | 1 29 | 30 | -------------------------------------------------------------------------------- /SmartGridControl/Work/GridComponents/WindTurbine2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WindTurbine 4 | autonomous 5 | 6 | WindTurbine_002 7 | 8 | 9 | 10 | 11 | 3 12 | 18 13 | [47.5 52.5 ; 100 8000] 14 | [47.5 52.5; 0.03 1.2] 15 | 5000 16 | 8000 17 | 0 18 | 7 19 | 97 20 | 96 21 | 42 22 | 35 23 | 24 | 25 | 0.85 26 | 0.9 27 | 0 28 | 1 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /SmartGridControl/Work/GridComponents/WindTurbine3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WindTurbine 4 | autonomous 5 | 6 | WindTurbine_003 7 | 8 | 9 | 10 | 11 | 3 12 | 18 13 | [49 51 ; 100 400] 14 | [49 51; 0.03 0.07] 15 | 5000 16 | 400] 17 | 0 18 | 7 19 | 97 20 | 96 21 | 42 22 | 35 23 | 24 | 25 | 0.85 26 | 0.9 27 | 0 28 | 1 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /SmartGridControl/Work/XMLs_EkaitzPruebas/Battery1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Battery 4 | autonomous 5 | 6 | Battery 7 | 8 | 9 | 10 | 11 | 5000 12 | 0 13 | 7 14 | 97 15 | 96 16 | 300 17 | 35 18 | 0 19 | 37800000 20 | 65 21 | -65 22 | [0 0.200000000000000 0.950000000000000 1] 23 | [0.800000000000000 0.810000000000000 1.400000000000000 1.500000000000000] 24 | [0 0.200000000000000 0.950000000000000 1] 25 | [0.007000000000000 0.007010000000000 0.007020000000000 0.007030000000000] 26 | 30 27 | 12 28 | 65 29 | -65 30 | [0 0.200000000000000 0.950000000000000 1] 31 | [288 2.916000000000000e+02 504 540] 32 | [0 0.200000000000000 0.950000000000000 1] 33 | [2.520000000000000 2.523600000000000 2.527200000000000 2.530800000000000] 34 | [0 0.003002000000000] 35 | [0 150000] 36 | 0.75 37 | [0 65] 38 | [0 0.003000000000000] 39 | 0.001 40 | 0.5 41 | 42 | 43 | 0.85 44 | 0.9 45 | 0 46 | 1 47 | 0.5 48 | 0.2 49 | 0.8 50 | 10 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /SmartGridControl/Work/XMLs_EkaitzPruebas/Central_eNode.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Central_eNode 4 | autonomous 5 | 6 | Central_eNode 7 | 8 | 9 | 10 | 11 | 12 | C:\ 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /SmartGridControl/Work/XMLs_EkaitzPruebas/FWClass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | FWZigor 4 | autonomous 5 | 6 | FWZigor 7 | 8 | 9 | 10 | 11 | 0.311*15 12 | 50e3*2*pi/60 13 | 0.75*50e3*2*pi/60 14 | 0.08*1000/ (50000*pi/30) 15 | 0.15*1000/ (50000*pi/30)^2 16 | 0.3*1000/ (50000*pi/30)^3 17 | 0.95 18 | 100 19 | -100 20 | 100e3 21 | -100e3 22 | 100000 23 | 10 24 | 1000 25 | 95 26 | 93 27 | 0.001 28 | 29 | 30 | 0.01 31 | 0.001 32 | 0 33 | 1 34 | 0.1 35 | 0.2 36 | 0.8 37 | 1 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /SmartGridControl/Work/XMLs_EkaitzPruebas/PVClass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PhotoVoltaic 4 | autonomous 5 | 6 | PV 7 | 8 | 9 | 10 | 11 | 30 12 | -20 13 | 16500 14 | -0.4 15 | 47 16 | 0.95 17 | 0.25 18 | 15000 19 | 0 20 | 15 21 | 97 22 | 96 23 | 150 24 | 100 25 | 26 | 27 | 15*60 28 | 24*60*60 29 | 0.9 30 | 0.5 31 | -0.1 32 | 1 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SmartGridControl/Work/XMLs_EkaitzPruebas/WindTurbine 1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WindTurbine 4 | autonomous 5 | 6 | WindTurbine 7 | 8 | 9 | 10 | 11 | 3 12 | 18 13 | [3 4 6 7.5 9.5 11 14 16 18;0 140 470 780 1450 1860 2200 2280 2300] 14 | 5000 15 | 5000 16 | 0 17 | 7 18 | 97 19 | 96 20 | 42 21 | 35 22 | 23 | 24 | 0.85 25 | 0.9 26 | 0 27 | 1 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /SmartGridControl/Work/XMLs_EkaitzPruebas/WindTurbine2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WindTurbine 4 | autonomous 5 | 6 | WindTurbine 7 | 8 | 9 | 10 | 11 | 3 12 | 18 13 | [3 4 6 7.5 9.5 11 14 16 18;0 140 470 780 1450 1860 2200 2280 2300] 14 | 5000 15 | 5000 16 | 0 17 | 7 18 | 97 19 | 96 20 | 42 21 | 35 22 | 23 | 24 | 0.85 25 | 0.9 26 | 0 27 | 1 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /SmartGridControl/Work/XMLs_EkaitzPruebas/WindTurbine3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WindTurbine 4 | autonomous 5 | 6 | WindTurbine 7 | 8 | 9 | 10 | 11 | 3 12 | 18 13 | [3 4 6 7.5 9.5 11 14 16 18;0 140 470 780 1450 1860 2200 2280 2300] 14 | 5000 15 | 5000 16 | 0 17 | 7 18 | 97 19 | 96 20 | 42 21 | 35 22 | 23 | 24 | 0.85 25 | 0.9 26 | 0 27 | 1 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /SmartGridControl_23122015.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/SmartGridControl_23122015.zip -------------------------------------------------------------------------------- /WT.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/WT.docx -------------------------------------------------------------------------------- /WindTurbine/GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/WindTurbine/GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat -------------------------------------------------------------------------------- /WindTurbine/MyLittleDEMIS.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear all 3 | close all 4 | 5 | %--------------------- Create the WindTurbine ----------------------------- 6 | %XML 7 | XML='WindTurbine.xml'; 8 | % Read configuration from XML 9 | if isstruct(XML) 10 | def.eNode = XML; 11 | else 12 | def = xml2struct(XML); 13 | end 14 | 15 | %scheduleXML 16 | scheduleXML=0; %We do not need this variable 17 | % %currentTime 18 | currentTime=0; %We do not need this variable 19 | %OptimParams 20 | OptimParams.beta=[]; 21 | OptimParams.PriceCutoff=[]; 22 | OptimParams.Incentivemin=[]; 23 | OptimParams.Incentivemax=[]; 24 | 25 | OptimParams.horizon=24; %I suppose that this time goes in hours. 26 | OptimParams.tSample = 0.25; %I suppose that this time goes in hours. 27 | OptimParams.updatePeriod=[]; 28 | 29 | %predictions 30 | load('GRC_ANDRAVIDA_166820_iw2_Forecast_WindSp.mat') 31 | Wind = windSpeed_forecast(:,1); 32 | TimeWind=[0:OptimParams.tSample:OptimParams.horizon]; 33 | predictions.WindSpeed=interp1([0:OptimParams.horizon],Wind,TimeWind,'linear'); 34 | predictions.tariff=ones(1,96);%Inventado 35 | %measures 36 | measures=[]; %Not used 37 | MiTurbina = WindTurbine(XML, scheduleXML, currentTime, OptimParams, predictions, measures); 38 | MiTurbina = getOptimResult(MiTurbina) 39 | %disp(MiTurbina.OptimProblem.currentSolution.pow ); 40 | %-------------------------------------------------------------------------- 41 | 42 | % Infinite loop 43 | while ~finish 44 | 45 | wtPower = MiTurbina.OptimProblem.currentSolution.ProductionPUproposal; 46 | 47 | %fprintf('The power we produce in this time slot is: %f \n', powerNeeded); 48 | 49 | pause(2); 50 | end 51 | %disp(str2numb(powerNeeded)); 52 | -------------------------------------------------------------------------------- /WindTurbine/PowElec_WT.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/WindTurbine/PowElec_WT.m -------------------------------------------------------------------------------- /WindTurbine/PowElec_WT.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/WindTurbine/PowElec_WT.p -------------------------------------------------------------------------------- /WindTurbine/PowWind_WT.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/WindTurbine/PowWind_WT.m -------------------------------------------------------------------------------- /WindTurbine/PowWind_WT.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkerd/Hybrid-grid-simulation/8a6fd1d3311636cfb6ee07e4c88245f14a477b98/WindTurbine/PowWind_WT.p -------------------------------------------------------------------------------- /WindTurbine/SolveProblemWTZigor.m: -------------------------------------------------------------------------------- 1 | function [Results] = SolveProblemWTZigor( SP ) 2 | %SolveProblem Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | Nslot = SP.OptimParams.horizon/SP.OptimParams.tSample; 6 | Wind=SP.StoredData.WindSpeed; 7 | Price=SP.StoredData.tariff; 8 | ProductionPUvector=[0:0.01:1]; %The productionPU possible values this variable is between 0 and 1 9 | ProductionProposal=zeros(1,Nslot); 10 | ProductionPUproposal=zeros(1,Nslot); 11 | ProductionVector=zeros(1,length(ProductionPUvector)); 12 | 13 | beta=SP.OptimParams.beta; 14 | Incentivemax=SP.OptimParams.Incentivemax; 15 | Incentivemin=SP.OptimParams.Incentivemax; 16 | PriceCutoff=SP.OptimParams.PriceCutoff; 17 | Benefit=zeros(1,Nslot); 18 | for k1=1:Nslot 19 | %k-th Time Slot optimization 20 | for k2=1:length(ProductionPUvector) 21 | [B,ProductionVector(k2)]=Zigor_WT_profit(ProductionPUvector(k2),Price(k1),Wind(k1),SP); 22 | end 23 | %The second alternative 24 | [ProductionProposal(k1),Ref]=min(ProductionVector); % The production has negative value, So to maximime production, we have to minime this value 25 | ProductionPUproposal(k1)=ProductionPUvector(Ref); 26 | f=1/(1+exp(-(Price(k1)-PriceCutoff)/beta)); 27 | IncentiveFactor=Incentivemin+(Incentivemax-Incentivemin)*f; 28 | IncentiveFactor(IncentiveFactor<0)=0; 29 | ProductionPUproposal(k1)=IncentiveFactor*ProductionPUproposal(k1); 30 | [B,ProductionProposal(k1)]=Zigor_WT_profit(ProductionPUproposal(k1),Price(k1),Wind(k1),SP); 31 | Benefit(k1)=B; 32 | end 33 | % SP.OptimProblem.currentSolution.pow=ProductionProposal; 34 | % SP.OptimProblem.currentSolution.objval=sum(Benefit); 35 | % SP.OptimProblem.currentSolution.ProductionPUproposal=ProductionPUproposal; 36 | Results.pow=ProductionProposal; 37 | Results.objval=sum(Benefit); 38 | Results.ProductionPUproposal=ProductionPUproposal; 39 | end 40 | 41 | -------------------------------------------------------------------------------- /WindTurbine/WindTurbine.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WindTurbine 4 | autonomous 5 | 6 | WindTurbine 7 | 8 | 9 | 10 | 11 | 3 12 | 18 13 | [3 4 6 7.5 9.5 11 14 16 18;0 140 470 780 1450 1860 2200 2280 2300] 14 | 5000 15 | 5000 16 | 0 17 | 7 18 | 97 19 | 96 20 | 42 21 | 35 22 | 23 | 24 | 0.85 25 | 0.9 26 | 0 27 | 1 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /WindTurbine/Zigor_WT_profit.m: -------------------------------------------------------------------------------- 1 | function [B,Production]=Zigor_WT_profit(ProductionPU,Price,Wind,SP) 2 | 3 | %% Wind Turbine Parameter loading 4 | 5 | Param_s.Vcuton=SP.Model.Params.Vcuton; 6 | Param_s.Vcutoff=SP.Model.Params.Vcutoff; 7 | Param_m.PowerCurve=SP.Model.Params.PowerCurve; 8 | Param.nPW=SP.Model.Params.nPW; 9 | Param.MaxPW=SP.Model.Params.MaxPW; 10 | Param.Eff.Ploss_off=SP.Model.Params.Ploss_off; 11 | Param.Eff.Ploss_on=SP.Model.Params.Ploss_on; 12 | Param.Eff.Eff_hl=SP.Model.Params.Eff_hl; 13 | Param.Eff.Eff_fl=SP.Model.Params.Eff_fl; 14 | Param.MinWindPW_On=SP.Model.Params.MinWindPW_On; 15 | Param.MinWindPW_av=SP.Model.Params.MinWindPW_av; 16 | 17 | NtimeSlots = SP.OptimParams.horizon/SP.OptimParams.tSample; 18 | 19 | 20 | %Control time series 21 | WT_Shaving_Ctl=ProductionPU;%Algo progresivo de 0 a 1. Variable a manipular, a determinar por nuestro algoritmo 22 | WT_Ctl=ones(NtimeSlots,1); %Disponibilidad 0 o 1 23 | 24 | % Wind Turbine power resource 25 | pwTurbine=PowWind_WT(Param_s,Param_m,Wind); 26 | % Wind Turbine's power stage energy production 27 | pwE=PowElec_WT(Param,pwTurbine,WT_Ctl,WT_Shaving_Ctl); 28 | Production=pwE; 29 | %%Profit calculation 30 | B=-Production*Price; 31 | --------------------------------------------------------------------------------