Category: Matlab
Category Archives: Matlab
“Error using xlsread, Worksheet ‘Sheet1’ not found. ” I have this eror and I don’t know why. I have the sheet and it’s in the folder which I have my script and functions.
<</matlabcentral/answers/uploaded_files/104026/Untitled.png>>
I attached the eror in Png
Error using xlsread (line 247)
Worksheet ‘Sheet1’ not found.
Error in load_the_prediction_data (line 15)
[~,Times]=xlsread([‘dee1_’ char(Current_time_stamp) ‘.xlsx’],’Sheet1′,’A:A’);<</matlabcentral/answers/uploaded_files/104026/Untitled.png>>
I attached the eror in Png
Error using xlsread (line 247)
Worksheet ‘Sheet1’ not found.
Error in load_the_prediction_data (line 15)
[~,Times]=xlsread([‘dee1_’ char(Current_time_stamp) ‘.xlsx’],’Sheet1′,’A:A’); <</matlabcentral/answers/uploaded_files/104026/Untitled.png>>
I attached the eror in Png
Error using xlsread (line 247)
Worksheet ‘Sheet1’ not found.
Error in load_the_prediction_data (line 15)
[~,Times]=xlsread([‘dee1_’ char(Current_time_stamp) ‘.xlsx’],’Sheet1′,’A:A’); eror, xlsread MATLAB Answers — New Questions
Jacobian matrix in ode15s
Hi everyone,
I am using ode15s to solve a set of stiff odes and the final model is developed in the form of
where M(t,y) is the mass matrix, and y is the generalised coordinate vector. According to the syntax of ode15s, it is crucial to provide its Jacobian matrix to raise the accuracy.
I do not know too much numerical calculation of stiff odes, and here I want to know, is the Jacobian matrix JJ calculated in this manner:
If not, how to arrive at a correct one?
Many thanks!Hi everyone,
I am using ode15s to solve a set of stiff odes and the final model is developed in the form of
where M(t,y) is the mass matrix, and y is the generalised coordinate vector. According to the syntax of ode15s, it is crucial to provide its Jacobian matrix to raise the accuracy.
I do not know too much numerical calculation of stiff odes, and here I want to know, is the Jacobian matrix JJ calculated in this manner:
If not, how to arrive at a correct one?
Many thanks! Hi everyone,
I am using ode15s to solve a set of stiff odes and the final model is developed in the form of
where M(t,y) is the mass matrix, and y is the generalised coordinate vector. According to the syntax of ode15s, it is crucial to provide its Jacobian matrix to raise the accuracy.
I do not know too much numerical calculation of stiff odes, and here I want to know, is the Jacobian matrix JJ calculated in this manner:
If not, how to arrive at a correct one?
Many thanks! ode15s, jacobian matrix MATLAB Answers — New Questions
Class properties Value not available in a different function.
I have a class called BatteryPlotCalculation and one of its properties is BatteryVoltageSection.
properties
BatteryVoltageSection
end
Then there is a method that sets the values for BatteryVoltageSection.
function plotCalculations(obj)
obj. BatteryVoltageSection %This is the last line of the function and I removed semicolon to see what
% value is coming here and it works
end
Then there is a function to return this value
function Battery_Voltage_Section = getSectionValues(obj)
obj. BatteryVoltageSection % I tried the same here, i.e remove semicolon to see what values are here,
% but here it is empty.
Battery_Voltage_Section = obj.BatteryVoltageSection;
end
So why is it, why is the value available on the top, but not in the second function. They are both the same value. Also in the main program, they are called in the correct order as well.
BatteryPlotValues = BatteryPlotCalculation(app.MeasurementData,app.DataType, app.ReferenceVoltage, app.ReferenceEnergy, MaxMinArray);
BatteryPlotValues.plotCalculations;
BatteryVoltageSection = BatteryPlotValues.getSectionValues;
So this is how they are called in the main program. So you can be sure that second function is only called after the first function has been called, which means the values obtained in the first function for obj.BatteryVoltageSection should be available in the second function as well. But it is not there. Why is that? Thank you.I have a class called BatteryPlotCalculation and one of its properties is BatteryVoltageSection.
properties
BatteryVoltageSection
end
Then there is a method that sets the values for BatteryVoltageSection.
function plotCalculations(obj)
obj. BatteryVoltageSection %This is the last line of the function and I removed semicolon to see what
% value is coming here and it works
end
Then there is a function to return this value
function Battery_Voltage_Section = getSectionValues(obj)
obj. BatteryVoltageSection % I tried the same here, i.e remove semicolon to see what values are here,
% but here it is empty.
Battery_Voltage_Section = obj.BatteryVoltageSection;
end
So why is it, why is the value available on the top, but not in the second function. They are both the same value. Also in the main program, they are called in the correct order as well.
BatteryPlotValues = BatteryPlotCalculation(app.MeasurementData,app.DataType, app.ReferenceVoltage, app.ReferenceEnergy, MaxMinArray);
BatteryPlotValues.plotCalculations;
BatteryVoltageSection = BatteryPlotValues.getSectionValues;
So this is how they are called in the main program. So you can be sure that second function is only called after the first function has been called, which means the values obtained in the first function for obj.BatteryVoltageSection should be available in the second function as well. But it is not there. Why is that? Thank you. I have a class called BatteryPlotCalculation and one of its properties is BatteryVoltageSection.
properties
BatteryVoltageSection
end
Then there is a method that sets the values for BatteryVoltageSection.
function plotCalculations(obj)
obj. BatteryVoltageSection %This is the last line of the function and I removed semicolon to see what
% value is coming here and it works
end
Then there is a function to return this value
function Battery_Voltage_Section = getSectionValues(obj)
obj. BatteryVoltageSection % I tried the same here, i.e remove semicolon to see what values are here,
% but here it is empty.
Battery_Voltage_Section = obj.BatteryVoltageSection;
end
So why is it, why is the value available on the top, but not in the second function. They are both the same value. Also in the main program, they are called in the correct order as well.
BatteryPlotValues = BatteryPlotCalculation(app.MeasurementData,app.DataType, app.ReferenceVoltage, app.ReferenceEnergy, MaxMinArray);
BatteryPlotValues.plotCalculations;
BatteryVoltageSection = BatteryPlotValues.getSectionValues;
So this is how they are called in the main program. So you can be sure that second function is only called after the first function has been called, which means the values obtained in the first function for obj.BatteryVoltageSection should be available in the second function as well. But it is not there. Why is that? Thank you. matlab, oop, function MATLAB Answers — New Questions
Designing a Microstrip Array Antenna Using Genetic Algorithm
Hi, I’ve recently got a project to design a microstrip array antenna using Genetic Algorithm on Matlab. The odd part is how our university failed to give us any tutorials on Matlab beforehand.
Can anyone help me out as to how i’m supposed to get the design parameters using MATLAB, or if you have any similar coding that would be appreciated..thanks a lot!Hi, I’ve recently got a project to design a microstrip array antenna using Genetic Algorithm on Matlab. The odd part is how our university failed to give us any tutorials on Matlab beforehand.
Can anyone help me out as to how i’m supposed to get the design parameters using MATLAB, or if you have any similar coding that would be appreciated..thanks a lot! Hi, I’ve recently got a project to design a microstrip array antenna using Genetic Algorithm on Matlab. The odd part is how our university failed to give us any tutorials on Matlab beforehand.
Can anyone help me out as to how i’m supposed to get the design parameters using MATLAB, or if you have any similar coding that would be appreciated..thanks a lot! genetic algorithm microstrip array antenna optimization design MATLAB Answers — New Questions
How to zoom a figure and show the details?
Good day,
How can I zoom a figure to show the details and include the zoomed area of the figure within the original figure?Good day,
How can I zoom a figure to show the details and include the zoomed area of the figure within the original figure? Good day,
How can I zoom a figure to show the details and include the zoomed area of the figure within the original figure? figure toolbar MATLAB Answers — New Questions
How can I change multistage nlmpc Solver?
I am trying to change nlmpcMultistage object solver from ‘fmincon’ to ‘gmres’ following this guide: https://www.mathworks.com/help/mpc/ug/control-robot-manipulator-using-cgmres-solver.html
However, I receive the following error:
"Error using nlmpcMultistage/set.Optimization
Invalid field name "Solver" found in the "Optimization" structure."
I also tried a suggestion such as to initialize the object with the Solver argument specified as: nlmpcMultistage(p,nx,’MV’,1,’MD’,2,’Solver’,’cgmres’);
However I get the following error: Error using nlmpcMultistage
Input channel must be one of the following types: ‘MV’ (manipulated variable), ‘MD’ (measured
disturbance), or ‘UD’ (unmeasured disturbance).
Like the Solver option is not available.
Is there a way to change the solver to cgmres?
Thanks in advanceI am trying to change nlmpcMultistage object solver from ‘fmincon’ to ‘gmres’ following this guide: https://www.mathworks.com/help/mpc/ug/control-robot-manipulator-using-cgmres-solver.html
However, I receive the following error:
"Error using nlmpcMultistage/set.Optimization
Invalid field name "Solver" found in the "Optimization" structure."
I also tried a suggestion such as to initialize the object with the Solver argument specified as: nlmpcMultistage(p,nx,’MV’,1,’MD’,2,’Solver’,’cgmres’);
However I get the following error: Error using nlmpcMultistage
Input channel must be one of the following types: ‘MV’ (manipulated variable), ‘MD’ (measured
disturbance), or ‘UD’ (unmeasured disturbance).
Like the Solver option is not available.
Is there a way to change the solver to cgmres?
Thanks in advance I am trying to change nlmpcMultistage object solver from ‘fmincon’ to ‘gmres’ following this guide: https://www.mathworks.com/help/mpc/ug/control-robot-manipulator-using-cgmres-solver.html
However, I receive the following error:
"Error using nlmpcMultistage/set.Optimization
Invalid field name "Solver" found in the "Optimization" structure."
I also tried a suggestion such as to initialize the object with the Solver argument specified as: nlmpcMultistage(p,nx,’MV’,1,’MD’,2,’Solver’,’cgmres’);
However I get the following error: Error using nlmpcMultistage
Input channel must be one of the following types: ‘MV’ (manipulated variable), ‘MD’ (measured
disturbance), or ‘UD’ (unmeasured disturbance).
Like the Solver option is not available.
Is there a way to change the solver to cgmres?
Thanks in advance nlmpcmultistage, cgmres, nlmpc, solver MATLAB Answers — New Questions
Retrieving RMS of a signal with variable sample rate
Hello community,
I’m using PLECS, with a variable solver, and would like to postprocess its data within matlab. Trying to extract the RMS value of signals has been a struggle, as the sampling rate increases a lot when there are transient phenomena. Therefore, using rms(values) gives me an extremely higher rms value than the expected, as I am working with pulsed values. Also changing to a discrete solver to have equal sampling rate, is not wanted because it’s much slower.
I’ve been looking at a method to attach the timestamps in my signals somehow, to work around this problem. Yet, I’m not having any luck. Does anyone know of an available function or code snipper to figure this out, please?
Thank you for any help.Hello community,
I’m using PLECS, with a variable solver, and would like to postprocess its data within matlab. Trying to extract the RMS value of signals has been a struggle, as the sampling rate increases a lot when there are transient phenomena. Therefore, using rms(values) gives me an extremely higher rms value than the expected, as I am working with pulsed values. Also changing to a discrete solver to have equal sampling rate, is not wanted because it’s much slower.
I’ve been looking at a method to attach the timestamps in my signals somehow, to work around this problem. Yet, I’m not having any luck. Does anyone know of an available function or code snipper to figure this out, please?
Thank you for any help. Hello community,
I’m using PLECS, with a variable solver, and would like to postprocess its data within matlab. Trying to extract the RMS value of signals has been a struggle, as the sampling rate increases a lot when there are transient phenomena. Therefore, using rms(values) gives me an extremely higher rms value than the expected, as I am working with pulsed values. Also changing to a discrete solver to have equal sampling rate, is not wanted because it’s much slower.
I’ve been looking at a method to attach the timestamps in my signals somehow, to work around this problem. Yet, I’m not having any luck. Does anyone know of an available function or code snipper to figure this out, please?
Thank you for any help. rms, variable sampling, plecs MATLAB Answers — New Questions
Confusion about Train Humanoid Walker
I’m using MATLAB’s example "Train Humanoid Walker" without changing any parameters or weights. I expected to train the robot to walk smoothly, but even after training for over 10,000 episodes, the best result I achieved was just one step of movement. What adjustments can I make to ensure the humanoid robot walks properly? Thanks a lot for your help.I’m using MATLAB’s example "Train Humanoid Walker" without changing any parameters or weights. I expected to train the robot to walk smoothly, but even after training for over 10,000 episodes, the best result I achieved was just one step of movement. What adjustments can I make to ensure the humanoid robot walks properly? Thanks a lot for your help. I’m using MATLAB’s example "Train Humanoid Walker" without changing any parameters or weights. I expected to train the robot to walk smoothly, but even after training for over 10,000 episodes, the best result I achieved was just one step of movement. What adjustments can I make to ensure the humanoid robot walks properly? Thanks a lot for your help. reinforcement learning, humanoid walker MATLAB Answers — New Questions
Unable to obtain Sheets object in ActiveX control.
Use the ActiveX control to write values to an Excel file.
objExcel = actxserver(‘excel.application’);
objExcel.Visible = 1;
objExcelFile = objExcel.Workbooks.Open( t_filePath );
objSheet = objExcelFile.Sheets.Item(1);
objSheet.Range(t_range).value = t_outputData;
Error message
Method, property or field ‘Sheets’ of class ‘Interface.000208DA_0000_0000_C000_000000000046’ is not recognized. Error: ActiveXExcel (line 4) objSheet = objExcelFile.Sheets.Item(1);
A script that previously worked fine in R2021a now gives an error every time in R2024a.
How can I do ?
Thanks in advance. Use the ActiveX control to write values to an Excel file.
objExcel = actxserver(‘excel.application’);
objExcel.Visible = 1;
objExcelFile = objExcel.Workbooks.Open( t_filePath );
objSheet = objExcelFile.Sheets.Item(1);
objSheet.Range(t_range).value = t_outputData;
Error message
Method, property or field ‘Sheets’ of class ‘Interface.000208DA_0000_0000_C000_000000000046’ is not recognized. Error: ActiveXExcel (line 4) objSheet = objExcelFile.Sheets.Item(1);
A script that previously worked fine in R2021a now gives an error every time in R2024a.
How can I do ?
Thanks in advance. Use the ActiveX control to write values to an Excel file.
objExcel = actxserver(‘excel.application’);
objExcel.Visible = 1;
objExcelFile = objExcel.Workbooks.Open( t_filePath );
objSheet = objExcelFile.Sheets.Item(1);
objSheet.Range(t_range).value = t_outputData;
Error message
Method, property or field ‘Sheets’ of class ‘Interface.000208DA_0000_0000_C000_000000000046’ is not recognized. Error: ActiveXExcel (line 4) objSheet = objExcelFile.Sheets.Item(1);
A script that previously worked fine in R2021a now gives an error every time in R2024a.
How can I do ?
Thanks in advance. activex, sheets MATLAB Answers — New Questions
How should i solve the STM32CubeMX tool Firmware installation issue?
Embedded Coder Support Package for STMicroelectronics STM32 Processors : Installation Errors
[ERROR] AnalyticsContext:980 – The ST intranet updater server is unknown: mcucrossselector.codex.cro.st.com
[ERROR] ServerAccessManage:1058 – Problem during Server Connexion : IO error PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] ServerAccessManage:1032 – Warning during Server Connexion : Unknown host www.ebuc23.com
[ERROR] ConfigurationRetriever:139 – IOException on connection: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] ConfigurationRetriever:139 – IOException on connection: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] ConfigurationRetriever:139 – IOException on connection: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] ServerAccessManage:1058 – Problem during Server Connexion : IO error PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] ServerAccessManage:537 – Problem during Server Connexion : : updaters.zip.
[ERROR] ServerAccessManage:1032 – Warning during Server Connexion : Unknown host www.ebuc23.com
[ERROR] ServerAccessManage:537 – Unknown host server name. : updaters.zip.
[ERROR] Engine:463 – C:Userskarthikeyan j.stm32cubemxthirdpartiespdscEmbeddedOffice.I-CUBE-FS-RTOS.1.0.1.pdsc: PDSC version is not supported
[ERROR] Engine:463 – C:Userskarthikeyan j.stm32cubemxthirdpartiespdscRealThread.X-CUBE-RT-Thread_Nano.4.1.1.pdsc: PDSC version is not supported
[ERROR] Engine:463 – C:Userskarthikeyan j.stm32cubemxthirdpartiespdscSTMicroelectronics.X-CUBE-DPower.1.2.0.pdsc: PDSC version is not supported
[ERROR] Engine:463 – C:Userskarthikeyan j.stm32cubemxthirdpartiespdscSTMicroelectronics.FP-SNS-STBOX1.2.0.0.pdsc: PDSC version is not supported
swmgr refresh
2024-07-22 11:50:58,605 [ERROR] ConfigurationRetriever:139 – IOException on connection: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2024-07-22 11:50:58,678 [ERROR] ConfigurationRetriever:139 – IOException on connection: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2024-07-22 11:50:58,797 [ERROR] ServerAccessManage:1058 – Problem during Server Connexion : IO error PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2024-07-22 11:50:58,798 [ERROR] ServerAccessManage:537 – Problem during Server Connexion : : updaters.zip.
2024-07-22 11:50:58,802 [ERROR] ServerAccessManage:1032 – Warning during Server Connexion : Unknown host www.ebuc23.com
2024-07-22 11:50:58,802 [ERROR] ServerAccessManage:537 – Unknown host server name. : updaters.zip.
2024-07-22 11:50:59,031 [INFO] CheckServerUpdateThread:115 – End of CheckServer Thread
2024-07-22 11:50:59,045 [INFO] LoadServerUpdatesThread:339 – End of LoadServerUpdate Thread
KO
The Previous Step installation screenshot are attached for reference.Embedded Coder Support Package for STMicroelectronics STM32 Processors : Installation Errors
[ERROR] AnalyticsContext:980 – The ST intranet updater server is unknown: mcucrossselector.codex.cro.st.com
[ERROR] ServerAccessManage:1058 – Problem during Server Connexion : IO error PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] ServerAccessManage:1032 – Warning during Server Connexion : Unknown host www.ebuc23.com
[ERROR] ConfigurationRetriever:139 – IOException on connection: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] ConfigurationRetriever:139 – IOException on connection: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] ConfigurationRetriever:139 – IOException on connection: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] ServerAccessManage:1058 – Problem during Server Connexion : IO error PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] ServerAccessManage:537 – Problem during Server Connexion : : updaters.zip.
[ERROR] ServerAccessManage:1032 – Warning during Server Connexion : Unknown host www.ebuc23.com
[ERROR] ServerAccessManage:537 – Unknown host server name. : updaters.zip.
[ERROR] Engine:463 – C:Userskarthikeyan j.stm32cubemxthirdpartiespdscEmbeddedOffice.I-CUBE-FS-RTOS.1.0.1.pdsc: PDSC version is not supported
[ERROR] Engine:463 – C:Userskarthikeyan j.stm32cubemxthirdpartiespdscRealThread.X-CUBE-RT-Thread_Nano.4.1.1.pdsc: PDSC version is not supported
[ERROR] Engine:463 – C:Userskarthikeyan j.stm32cubemxthirdpartiespdscSTMicroelectronics.X-CUBE-DPower.1.2.0.pdsc: PDSC version is not supported
[ERROR] Engine:463 – C:Userskarthikeyan j.stm32cubemxthirdpartiespdscSTMicroelectronics.FP-SNS-STBOX1.2.0.0.pdsc: PDSC version is not supported
swmgr refresh
2024-07-22 11:50:58,605 [ERROR] ConfigurationRetriever:139 – IOException on connection: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2024-07-22 11:50:58,678 [ERROR] ConfigurationRetriever:139 – IOException on connection: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2024-07-22 11:50:58,797 [ERROR] ServerAccessManage:1058 – Problem during Server Connexion : IO error PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2024-07-22 11:50:58,798 [ERROR] ServerAccessManage:537 – Problem during Server Connexion : : updaters.zip.
2024-07-22 11:50:58,802 [ERROR] ServerAccessManage:1032 – Warning during Server Connexion : Unknown host www.ebuc23.com
2024-07-22 11:50:58,802 [ERROR] ServerAccessManage:537 – Unknown host server name. : updaters.zip.
2024-07-22 11:50:59,031 [INFO] CheckServerUpdateThread:115 – End of CheckServer Thread
2024-07-22 11:50:59,045 [INFO] LoadServerUpdatesThread:339 – End of LoadServerUpdate Thread
KO
The Previous Step installation screenshot are attached for reference. Embedded Coder Support Package for STMicroelectronics STM32 Processors : Installation Errors
[ERROR] AnalyticsContext:980 – The ST intranet updater server is unknown: mcucrossselector.codex.cro.st.com
[ERROR] ServerAccessManage:1058 – Problem during Server Connexion : IO error PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] ServerAccessManage:1032 – Warning during Server Connexion : Unknown host www.ebuc23.com
[ERROR] ConfigurationRetriever:139 – IOException on connection: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] ConfigurationRetriever:139 – IOException on connection: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] ConfigurationRetriever:139 – IOException on connection: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] ServerAccessManage:1058 – Problem during Server Connexion : IO error PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] ServerAccessManage:537 – Problem during Server Connexion : : updaters.zip.
[ERROR] ServerAccessManage:1032 – Warning during Server Connexion : Unknown host www.ebuc23.com
[ERROR] ServerAccessManage:537 – Unknown host server name. : updaters.zip.
[ERROR] Engine:463 – C:Userskarthikeyan j.stm32cubemxthirdpartiespdscEmbeddedOffice.I-CUBE-FS-RTOS.1.0.1.pdsc: PDSC version is not supported
[ERROR] Engine:463 – C:Userskarthikeyan j.stm32cubemxthirdpartiespdscRealThread.X-CUBE-RT-Thread_Nano.4.1.1.pdsc: PDSC version is not supported
[ERROR] Engine:463 – C:Userskarthikeyan j.stm32cubemxthirdpartiespdscSTMicroelectronics.X-CUBE-DPower.1.2.0.pdsc: PDSC version is not supported
[ERROR] Engine:463 – C:Userskarthikeyan j.stm32cubemxthirdpartiespdscSTMicroelectronics.FP-SNS-STBOX1.2.0.0.pdsc: PDSC version is not supported
swmgr refresh
2024-07-22 11:50:58,605 [ERROR] ConfigurationRetriever:139 – IOException on connection: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2024-07-22 11:50:58,678 [ERROR] ConfigurationRetriever:139 – IOException on connection: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2024-07-22 11:50:58,797 [ERROR] ServerAccessManage:1058 – Problem during Server Connexion : IO error PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2024-07-22 11:50:58,798 [ERROR] ServerAccessManage:537 – Problem during Server Connexion : : updaters.zip.
2024-07-22 11:50:58,802 [ERROR] ServerAccessManage:1032 – Warning during Server Connexion : Unknown host www.ebuc23.com
2024-07-22 11:50:58,802 [ERROR] ServerAccessManage:537 – Unknown host server name. : updaters.zip.
2024-07-22 11:50:59,031 [INFO] CheckServerUpdateThread:115 – End of CheckServer Thread
2024-07-22 11:50:59,045 [INFO] LoadServerUpdatesThread:339 – End of LoadServerUpdate Thread
KO
The Previous Step installation screenshot are attached for reference. embedded coder support package for stmicroelectron, installation error MATLAB Answers — New Questions
calculate image distortion level
I have nine similar images, each exhibiting different qualities of visual patterns. Each image is composed of a single unit that is repeated multiple times, either randomly or in a uniform pattern, to form a complete image. My objective is to assess the extent of disruption each image causes to the human visual system. Unfortunately, I do not have a reference image for comparison.
I have attempted various methods to analyze these images, including mean geometric disruption, blur disruption, color disruption, and ranking the images based on quality. However, none of these approaches have provided a satisfactory analysis. I need an idea to find a metric to calculate the distortion level of each image to the human visual system.I have nine similar images, each exhibiting different qualities of visual patterns. Each image is composed of a single unit that is repeated multiple times, either randomly or in a uniform pattern, to form a complete image. My objective is to assess the extent of disruption each image causes to the human visual system. Unfortunately, I do not have a reference image for comparison.
I have attempted various methods to analyze these images, including mean geometric disruption, blur disruption, color disruption, and ranking the images based on quality. However, none of these approaches have provided a satisfactory analysis. I need an idea to find a metric to calculate the distortion level of each image to the human visual system. I have nine similar images, each exhibiting different qualities of visual patterns. Each image is composed of a single unit that is repeated multiple times, either randomly or in a uniform pattern, to form a complete image. My objective is to assess the extent of disruption each image causes to the human visual system. Unfortunately, I do not have a reference image for comparison.
I have attempted various methods to analyze these images, including mean geometric disruption, blur disruption, color disruption, and ranking the images based on quality. However, none of these approaches have provided a satisfactory analysis. I need an idea to find a metric to calculate the distortion level of each image to the human visual system. image processing MATLAB Answers — New Questions
How can I analyze the sum and product together in a code?
Hello,
I have just started to learn matlab and tried to solve the following equations:
where,
and the values of alpha(j) will be retrieved from an excel file containing 10 values of it.
Can someone let me know the procedure?
Thank youHello,
I have just started to learn matlab and tried to solve the following equations:
where,
and the values of alpha(j) will be retrieved from an excel file containing 10 values of it.
Can someone let me know the procedure?
Thank you Hello,
I have just started to learn matlab and tried to solve the following equations:
where,
and the values of alpha(j) will be retrieved from an excel file containing 10 values of it.
Can someone let me know the procedure?
Thank you programming, matlab, equation, sum MATLAB Answers — New Questions
Mean Value Analysis for Single Class Customers
Hello everyone,
I have a closed queue formulation where I require to do mean value analysis for single class of customers for single node, multiple nodes, infinite nodes and load dependent node. I am attaching the formula. Can you kindly help me in getting the answer.
inputs: N, K, m_i, p_ij, mu_i, mu_i(j)
Thank you for your help.
With regards,Hello everyone,
I have a closed queue formulation where I require to do mean value analysis for single class of customers for single node, multiple nodes, infinite nodes and load dependent node. I am attaching the formula. Can you kindly help me in getting the answer.
inputs: N, K, m_i, p_ij, mu_i, mu_i(j)
Thank you for your help.
With regards, Hello everyone,
I have a closed queue formulation where I require to do mean value analysis for single class of customers for single node, multiple nodes, infinite nodes and load dependent node. I am attaching the formula. Can you kindly help me in getting the answer.
inputs: N, K, m_i, p_ij, mu_i, mu_i(j)
Thank you for your help.
With regards, mean value analysis, queueing theory MATLAB Answers — New Questions
I want to change the parameters of the Synchronous Machine Model 1.0 according to the rpm.
I am using the Synchronous Machine Model 1.0 in Simulink Simscape.
I want to model a generator and need to change the parameters of the Synchronous Machine Model 1.0 according to the rpm. Currently, I have declared the parameters in the workspace and am importing them into the model.
I have the relationship between rpm and the parameters, I want to change the parameters at every step. How can I do this?I am using the Synchronous Machine Model 1.0 in Simulink Simscape.
I want to model a generator and need to change the parameters of the Synchronous Machine Model 1.0 according to the rpm. Currently, I have declared the parameters in the workspace and am importing them into the model.
I have the relationship between rpm and the parameters, I want to change the parameters at every step. How can I do this? I am using the Synchronous Machine Model 1.0 in Simulink Simscape.
I want to model a generator and need to change the parameters of the Synchronous Machine Model 1.0 according to the rpm. Currently, I have declared the parameters in the workspace and am importing them into the model.
I have the relationship between rpm and the parameters, I want to change the parameters at every step. How can I do this? simulink, simscape, workspace MATLAB Answers — New Questions
MemMap.h file does not contain content for Calprm and Var memory segments that were present in .c source code file
Hello,
I am using Matlab R2023b. I have created a Simulink model and generated AUTOSAR compliant C code. In my Simulink model, I created SwAddrMethods named CAL, CODE and VAR. The CAL method is for Calprm memory section, CODE is for Code memory section and VAR is for Var memory section.
In my generated .c source code and .h header files, I see the #defines for each SwAddrMethod. Some excerpts from my .c code below:
.
.
/* Please see snapshots for source code and MemMap header file for reference. */
.
.
Same case is true for the .h header file. I can see instances of #defines for all 3 SwAddrMethods.
But, in the generated MemMap.h header file, I can only see reference to #ifdef PwrSteerOutPrcs_START_SEC_CODE
#undef PwrSteerOutPrcs_START_SEC_CODE and #ifdef PwrSteerOutPrcs_STOP_SEC_CODE
#undef PwrSteerOutPrcs_STOP_SEC_CODE.
I do not notice the START_SEC_CAL, STOP_SEC_CAL and START_SEC_VAR, STOP_SEC_VAR are being generated.
.
.
/* Please see snapshots for source code and MemMap header file for reference. */
.
.
Q1. What can cause the #defines for CAL and VAR to not be defined in MemMap.h? Is this soem setting I can correct in Autosar Component Viewer app / Simulink Model Settings? Or is it a bug in Matlab R2023b release?
Attached are snapshot #1 of the 1 instrumented signal. Am I using the correct settings? I have noticed in some models that instead of ‘From signal object: Global’ , there is an ‘Auto’ option in the dropdown for ‘Mapped to’ (attached in snapshot #2). I do not get that option for ‘Auto’.
Q2. Is there a setting I should change on my Model Settings / Autosar App to get the Auto dropdown option? Will that help resolve Q1? Or is this a bug in matlab R2023b. Please advise.
Any help is much appreciated! Thank you!Hello,
I am using Matlab R2023b. I have created a Simulink model and generated AUTOSAR compliant C code. In my Simulink model, I created SwAddrMethods named CAL, CODE and VAR. The CAL method is for Calprm memory section, CODE is for Code memory section and VAR is for Var memory section.
In my generated .c source code and .h header files, I see the #defines for each SwAddrMethod. Some excerpts from my .c code below:
.
.
/* Please see snapshots for source code and MemMap header file for reference. */
.
.
Same case is true for the .h header file. I can see instances of #defines for all 3 SwAddrMethods.
But, in the generated MemMap.h header file, I can only see reference to #ifdef PwrSteerOutPrcs_START_SEC_CODE
#undef PwrSteerOutPrcs_START_SEC_CODE and #ifdef PwrSteerOutPrcs_STOP_SEC_CODE
#undef PwrSteerOutPrcs_STOP_SEC_CODE.
I do not notice the START_SEC_CAL, STOP_SEC_CAL and START_SEC_VAR, STOP_SEC_VAR are being generated.
.
.
/* Please see snapshots for source code and MemMap header file for reference. */
.
.
Q1. What can cause the #defines for CAL and VAR to not be defined in MemMap.h? Is this soem setting I can correct in Autosar Component Viewer app / Simulink Model Settings? Or is it a bug in Matlab R2023b release?
Attached are snapshot #1 of the 1 instrumented signal. Am I using the correct settings? I have noticed in some models that instead of ‘From signal object: Global’ , there is an ‘Auto’ option in the dropdown for ‘Mapped to’ (attached in snapshot #2). I do not get that option for ‘Auto’.
Q2. Is there a setting I should change on my Model Settings / Autosar App to get the Auto dropdown option? Will that help resolve Q1? Or is this a bug in matlab R2023b. Please advise.
Any help is much appreciated! Thank you! Hello,
I am using Matlab R2023b. I have created a Simulink model and generated AUTOSAR compliant C code. In my Simulink model, I created SwAddrMethods named CAL, CODE and VAR. The CAL method is for Calprm memory section, CODE is for Code memory section and VAR is for Var memory section.
In my generated .c source code and .h header files, I see the #defines for each SwAddrMethod. Some excerpts from my .c code below:
.
.
/* Please see snapshots for source code and MemMap header file for reference. */
.
.
Same case is true for the .h header file. I can see instances of #defines for all 3 SwAddrMethods.
But, in the generated MemMap.h header file, I can only see reference to #ifdef PwrSteerOutPrcs_START_SEC_CODE
#undef PwrSteerOutPrcs_START_SEC_CODE and #ifdef PwrSteerOutPrcs_STOP_SEC_CODE
#undef PwrSteerOutPrcs_STOP_SEC_CODE.
I do not notice the START_SEC_CAL, STOP_SEC_CAL and START_SEC_VAR, STOP_SEC_VAR are being generated.
.
.
/* Please see snapshots for source code and MemMap header file for reference. */
.
.
Q1. What can cause the #defines for CAL and VAR to not be defined in MemMap.h? Is this soem setting I can correct in Autosar Component Viewer app / Simulink Model Settings? Or is it a bug in Matlab R2023b release?
Attached are snapshot #1 of the 1 instrumented signal. Am I using the correct settings? I have noticed in some models that instead of ‘From signal object: Global’ , there is an ‘Auto’ option in the dropdown for ‘Mapped to’ (attached in snapshot #2). I do not get that option for ‘Auto’.
Q2. Is there a setting I should change on my Model Settings / Autosar App to get the Auto dropdown option? Will that help resolve Q1? Or is this a bug in matlab R2023b. Please advise.
Any help is much appreciated! Thank you! memorymap, memmap.h, swaddrmethods, autosar dictionary, autosar code generation MATLAB Answers — New Questions
Create a table with 2 header lines followed by numeric data
header line 1 = string
header line 2 = string
line 3:end = numeric data
How do I create a table with two header lines followed by the numeric data?
I have been using table(numeric data, ‘VariableNames’, header line 1) but cannot find a way to have two header lines before the numeric data begins.
Any help would be much appreciated.header line 1 = string
header line 2 = string
line 3:end = numeric data
How do I create a table with two header lines followed by the numeric data?
I have been using table(numeric data, ‘VariableNames’, header line 1) but cannot find a way to have two header lines before the numeric data begins.
Any help would be much appreciated. header line 1 = string
header line 2 = string
line 3:end = numeric data
How do I create a table with two header lines followed by the numeric data?
I have been using table(numeric data, ‘VariableNames’, header line 1) but cannot find a way to have two header lines before the numeric data begins.
Any help would be much appreciated. table MATLAB Answers — New Questions
Matlab GUI Standalone Applications for Arduino Hardware
I worked on a simple GUI that does nothing but read an analog pin and send some commands on digital pins (I have some buttons in the GUI that do this) on my arduino board. Everything works as it should when I run GUI through MatLab. I tried to deploy this GUI also for my colleagues who do not use Matlab following the indications from here: Create Standalone Applications for Arduino Hardware – MATLAB & Simulink (mathworks.com).
I downloaded the Arduino CLI, unzipped it, then with the commands "arduino-cli core install arduino:avr@xxx" I installed all the boards. The problem is that when I try to connect to my arduino board, I select the correct COM port, board type, and the path to the Arduino CLI, regardless of which path I choose, it doesn’t work.I worked on a simple GUI that does nothing but read an analog pin and send some commands on digital pins (I have some buttons in the GUI that do this) on my arduino board. Everything works as it should when I run GUI through MatLab. I tried to deploy this GUI also for my colleagues who do not use Matlab following the indications from here: Create Standalone Applications for Arduino Hardware – MATLAB & Simulink (mathworks.com).
I downloaded the Arduino CLI, unzipped it, then with the commands "arduino-cli core install arduino:avr@xxx" I installed all the boards. The problem is that when I try to connect to my arduino board, I select the correct COM port, board type, and the path to the Arduino CLI, regardless of which path I choose, it doesn’t work. I worked on a simple GUI that does nothing but read an analog pin and send some commands on digital pins (I have some buttons in the GUI that do this) on my arduino board. Everything works as it should when I run GUI through MatLab. I tried to deploy this GUI also for my colleagues who do not use Matlab following the indications from here: Create Standalone Applications for Arduino Hardware – MATLAB & Simulink (mathworks.com).
I downloaded the Arduino CLI, unzipped it, then with the commands "arduino-cli core install arduino:avr@xxx" I installed all the boards. The problem is that when I try to connect to my arduino board, I select the correct COM port, board type, and the path to the Arduino CLI, regardless of which path I choose, it doesn’t work. matlab, gui, matlab gui, arduino, deploytool MATLAB Answers — New Questions
Why can’t this example of “Signal Source Separation Using W-Net Architecture” be opened in MATLAB?
When i try to run the example of "Signal Source Separation Using W-Net Architecture" on MATLAB, it showed "Error: "Error saving to local data stream." when communicating with websave (line 107) 5URL ‘https://ssd.mathworks.com/supportfiles/SPT/data/fetal-ecg-source-separation-testData,zip’.
error matlab,internal.examples.downloadsupportFile(line 48)localfile =websave(localfile,webFilePath);".
The code block :"Download the train and test data sets using the downloadSupportFile function. The data will be unzipped to the tempdir directory. If you want the data at a different location, change trainingDatasetFolder and testDatasetFolder to the desired locations " can’t run, and the detailed code is if trainNetworkFlag
% Download training data set
trainingDatasetZipFile = matlab.internal.examples.downloadSupportFile(‘SPT’,’data/fetal-ecg-source-separation-trainingData.zip’);
trainingDatasetFolder = fullfile(tempdir,’fetal-ecg-source-separation-trainingData’);
if ~exist(trainingDatasetFolder,’dir’)
unzip(trainingDatasetZipFile,trainingDatasetFolder);
end
end
% Download test data set
testDatasetZipFile = matlab.internal.examples.downloadSupportFile(‘SPT’,’data/fetal-ecg-source-separation-testData.zip’);
testDatasetFolder = fullfile(tempdir,’fetal-ecg-source-separation-testData’);
if ~exist(testDatasetFolder,’dir’)
unzip(testDatasetZipFile,testDatasetFolder);
end
Thank you very much for your answers!have a nice day!When i try to run the example of "Signal Source Separation Using W-Net Architecture" on MATLAB, it showed "Error: "Error saving to local data stream." when communicating with websave (line 107) 5URL ‘https://ssd.mathworks.com/supportfiles/SPT/data/fetal-ecg-source-separation-testData,zip’.
error matlab,internal.examples.downloadsupportFile(line 48)localfile =websave(localfile,webFilePath);".
The code block :"Download the train and test data sets using the downloadSupportFile function. The data will be unzipped to the tempdir directory. If you want the data at a different location, change trainingDatasetFolder and testDatasetFolder to the desired locations " can’t run, and the detailed code is if trainNetworkFlag
% Download training data set
trainingDatasetZipFile = matlab.internal.examples.downloadSupportFile(‘SPT’,’data/fetal-ecg-source-separation-trainingData.zip’);
trainingDatasetFolder = fullfile(tempdir,’fetal-ecg-source-separation-trainingData’);
if ~exist(trainingDatasetFolder,’dir’)
unzip(trainingDatasetZipFile,trainingDatasetFolder);
end
end
% Download test data set
testDatasetZipFile = matlab.internal.examples.downloadSupportFile(‘SPT’,’data/fetal-ecg-source-separation-testData.zip’);
testDatasetFolder = fullfile(tempdir,’fetal-ecg-source-separation-testData’);
if ~exist(testDatasetFolder,’dir’)
unzip(testDatasetZipFile,testDatasetFolder);
end
Thank you very much for your answers!have a nice day! When i try to run the example of "Signal Source Separation Using W-Net Architecture" on MATLAB, it showed "Error: "Error saving to local data stream." when communicating with websave (line 107) 5URL ‘https://ssd.mathworks.com/supportfiles/SPT/data/fetal-ecg-source-separation-testData,zip’.
error matlab,internal.examples.downloadsupportFile(line 48)localfile =websave(localfile,webFilePath);".
The code block :"Download the train and test data sets using the downloadSupportFile function. The data will be unzipped to the tempdir directory. If you want the data at a different location, change trainingDatasetFolder and testDatasetFolder to the desired locations " can’t run, and the detailed code is if trainNetworkFlag
% Download training data set
trainingDatasetZipFile = matlab.internal.examples.downloadSupportFile(‘SPT’,’data/fetal-ecg-source-separation-trainingData.zip’);
trainingDatasetFolder = fullfile(tempdir,’fetal-ecg-source-separation-trainingData’);
if ~exist(trainingDatasetFolder,’dir’)
unzip(trainingDatasetZipFile,trainingDatasetFolder);
end
end
% Download test data set
testDatasetZipFile = matlab.internal.examples.downloadSupportFile(‘SPT’,’data/fetal-ecg-source-separation-testData.zip’);
testDatasetFolder = fullfile(tempdir,’fetal-ecg-source-separation-testData’);
if ~exist(testDatasetFolder,’dir’)
unzip(testDatasetZipFile,testDatasetFolder);
end
Thank you very much for your answers!have a nice day! wnet, ecg signal, neural network, signal separate, matlab code MATLAB Answers — New Questions
Why does my GTX Titan Black GPU underperform in double precision calculations in MATLAB R2015a?
I experience unexpectedly slow performance of the GPU in double precision benchmarks.
I have a fast PC (Intel i7-4790 3.6GHz, 16GB of 1600MHz memory, Windows 7 64bit, and a nVidia GeForce GTX Titan Black GPU card, in PCIe 3.0×16 slot, with 850W power supply. I have downloaded the video drivers and CUDA toolkit and installed matlab Parallel Computing Toolbox:
>> gpuDeviceans =CUDADevice withproperties:Name: ‘GeForce GTX TITAN Black’Index: 1ComputeCapability: ‘3.5’SupportsDouble: 1DriverVersion: 7ToolkitVersion: 6.5000MaxThreadsPerBlock: 1024MaxShmemPerBlock: 49152MaxThreadBlockSize: [1024 1024 64]MaxGridSize: [2.1475e+09 65535 65535]SIMDWidth: 32TotalMemory: 6.4425e+09AvailableMemory: 6.2105e+09MultiprocessorCount: 15ClockRateKHz: 980000ComputeMode: ‘Default’GPUOverlapsTransfers: 1KernelExecutionTimeout: 1CanMapHostMemory: 1DeviceSupported: 1DeviceSelected: 1
I then downloaded the GPU benchmarking tool by by the MathWorks Parallel Computing Toolbox Team (version of Updated 05 Jan 2015), from http://www.mathworks.com/matlabcentral/fileexchange/34080-gpubenchand executed the “gpuBench”.
The results show that my GPU performs similarly to Quadro K6000 in single precision benchmarks (with deviations up to 40%, as expected: both the cards have the same no of CUDA cores but the memory bandwidth is higher for my Titan Black and the amount of memory is higher K6000)
However, the GeForce GTX Titan Black performs 4 times (!) slower than Quadro K6000 in the double precision benchmarks! This is unexpected for several reasons.A) both cards are fairly similar:Specification type K6000 / Titan BlackCUDA cores: 2880 / 2880Clock: 902MHz /889MHzMemory clock: 6 Gbps/ 7GbpsMemory bandwidth: 288GB/s / 336GB/s
B) There are benchmarking tests done by the MathWorksParallel Computing Toolbox Team shown in the file “Older benchmarks for GPUs” attached. From those results, a GPU very similar to mine, GeForce GTX Titan (anolder GPU with 2688 CUDA cores, 837MHz clock, 6Gbps memory clock and 288GB/s memory bandwidth) shows benchmarks very much similar to Quadro K6000:
Card DOUBLE SINGLE Benchmark MTimes,Backlash, FFT, MTimes,Backlash,FFTK6000 1092 421 160 3017 831 334GTX Titan 1106 352 150 2933 582 298My GPU 252 163 110 4221 994 409
These results indicate that my GPU card (GeForce GTX Titan Black) should be faster than or similar to the Quadro K6000. However, the performance in the double precision is terrible (4x slower).I experience unexpectedly slow performance of the GPU in double precision benchmarks.
I have a fast PC (Intel i7-4790 3.6GHz, 16GB of 1600MHz memory, Windows 7 64bit, and a nVidia GeForce GTX Titan Black GPU card, in PCIe 3.0×16 slot, with 850W power supply. I have downloaded the video drivers and CUDA toolkit and installed matlab Parallel Computing Toolbox:
>> gpuDeviceans =CUDADevice withproperties:Name: ‘GeForce GTX TITAN Black’Index: 1ComputeCapability: ‘3.5’SupportsDouble: 1DriverVersion: 7ToolkitVersion: 6.5000MaxThreadsPerBlock: 1024MaxShmemPerBlock: 49152MaxThreadBlockSize: [1024 1024 64]MaxGridSize: [2.1475e+09 65535 65535]SIMDWidth: 32TotalMemory: 6.4425e+09AvailableMemory: 6.2105e+09MultiprocessorCount: 15ClockRateKHz: 980000ComputeMode: ‘Default’GPUOverlapsTransfers: 1KernelExecutionTimeout: 1CanMapHostMemory: 1DeviceSupported: 1DeviceSelected: 1
I then downloaded the GPU benchmarking tool by by the MathWorks Parallel Computing Toolbox Team (version of Updated 05 Jan 2015), from http://www.mathworks.com/matlabcentral/fileexchange/34080-gpubenchand executed the “gpuBench”.
The results show that my GPU performs similarly to Quadro K6000 in single precision benchmarks (with deviations up to 40%, as expected: both the cards have the same no of CUDA cores but the memory bandwidth is higher for my Titan Black and the amount of memory is higher K6000)
However, the GeForce GTX Titan Black performs 4 times (!) slower than Quadro K6000 in the double precision benchmarks! This is unexpected for several reasons.A) both cards are fairly similar:Specification type K6000 / Titan BlackCUDA cores: 2880 / 2880Clock: 902MHz /889MHzMemory clock: 6 Gbps/ 7GbpsMemory bandwidth: 288GB/s / 336GB/s
B) There are benchmarking tests done by the MathWorksParallel Computing Toolbox Team shown in the file “Older benchmarks for GPUs” attached. From those results, a GPU very similar to mine, GeForce GTX Titan (anolder GPU with 2688 CUDA cores, 837MHz clock, 6Gbps memory clock and 288GB/s memory bandwidth) shows benchmarks very much similar to Quadro K6000:
Card DOUBLE SINGLE Benchmark MTimes,Backlash, FFT, MTimes,Backlash,FFTK6000 1092 421 160 3017 831 334GTX Titan 1106 352 150 2933 582 298My GPU 252 163 110 4221 994 409
These results indicate that my GPU card (GeForce GTX Titan Black) should be faster than or similar to the Quadro K6000. However, the performance in the double precision is terrible (4x slower). I experience unexpectedly slow performance of the GPU in double precision benchmarks.
I have a fast PC (Intel i7-4790 3.6GHz, 16GB of 1600MHz memory, Windows 7 64bit, and a nVidia GeForce GTX Titan Black GPU card, in PCIe 3.0×16 slot, with 850W power supply. I have downloaded the video drivers and CUDA toolkit and installed matlab Parallel Computing Toolbox:
>> gpuDeviceans =CUDADevice withproperties:Name: ‘GeForce GTX TITAN Black’Index: 1ComputeCapability: ‘3.5’SupportsDouble: 1DriverVersion: 7ToolkitVersion: 6.5000MaxThreadsPerBlock: 1024MaxShmemPerBlock: 49152MaxThreadBlockSize: [1024 1024 64]MaxGridSize: [2.1475e+09 65535 65535]SIMDWidth: 32TotalMemory: 6.4425e+09AvailableMemory: 6.2105e+09MultiprocessorCount: 15ClockRateKHz: 980000ComputeMode: ‘Default’GPUOverlapsTransfers: 1KernelExecutionTimeout: 1CanMapHostMemory: 1DeviceSupported: 1DeviceSelected: 1
I then downloaded the GPU benchmarking tool by by the MathWorks Parallel Computing Toolbox Team (version of Updated 05 Jan 2015), from http://www.mathworks.com/matlabcentral/fileexchange/34080-gpubenchand executed the “gpuBench”.
The results show that my GPU performs similarly to Quadro K6000 in single precision benchmarks (with deviations up to 40%, as expected: both the cards have the same no of CUDA cores but the memory bandwidth is higher for my Titan Black and the amount of memory is higher K6000)
However, the GeForce GTX Titan Black performs 4 times (!) slower than Quadro K6000 in the double precision benchmarks! This is unexpected for several reasons.A) both cards are fairly similar:Specification type K6000 / Titan BlackCUDA cores: 2880 / 2880Clock: 902MHz /889MHzMemory clock: 6 Gbps/ 7GbpsMemory bandwidth: 288GB/s / 336GB/s
B) There are benchmarking tests done by the MathWorksParallel Computing Toolbox Team shown in the file “Older benchmarks for GPUs” attached. From those results, a GPU very similar to mine, GeForce GTX Titan (anolder GPU with 2688 CUDA cores, 837MHz clock, 6Gbps memory clock and 288GB/s memory bandwidth) shows benchmarks very much similar to Quadro K6000:
Card DOUBLE SINGLE Benchmark MTimes,Backlash, FFT, MTimes,Backlash,FFTK6000 1092 421 160 3017 831 334GTX Titan 1106 352 150 2933 582 298My GPU 252 163 110 4221 994 409
These results indicate that my GPU card (GeForce GTX Titan Black) should be faster than or similar to the Quadro K6000. However, the performance in the double precision is terrible (4x slower). gpu, slow, slower MATLAB Answers — New Questions
optimising hybrid energy design using genetic algorithm
i’m working on optimising a design of a hybrid PV/Wind energy system (with battery) using Genetic Algorithms ,and based on a research paper i have been able to code the following :
% Solar PV Generator script
function solargen = solar(Areapv)
% Input:
% Areapv = total area of all PV modules, one of the variables to be optimized
% x = solar irradiance (data read from an Excel file)
x = xlsread(‘éclairement_tlemcen.xlsx’,’A1:A8784′);
effpv = 0.227; % efficiency of the PV module specified by manufacturer
% Output:
% solargen = power produced by the PV generator (kW)
% solargen = Areapv * effpv * Irrad * 0.001;
w = effpv * Areapv * 0.001;
solargen = w .* x;
end
wind turbine script
% Wind Generator script
function windgen = windpower(Areawt)
% Inputs:
% Areawt = total rotor swept area of all wind turbines used (m2)
% Areawt is one of the variables to be optimized
coeff_wt = 45/100; % coefficient of power of wind turbine
rho = 1.1839; % density of air (kg/m3) at 1 atm pres and 25 degC temp
vci = 2.01168; % wind turbine cut-in/min wind speed (m/s)
vrat = 13.8582; % wind turbine rated wind speed (m/s)
vco = 17.8816; % wind turbine cut-out/max wind speed (m/s)
% vact = actual wind speed (data read from an Excel file)
vact = xlsread(‘wind_speed_tlemcen.xlsx’,’A1:A8784′);
y = length(vact); % number of wind speed data points
% windgen = power produced by the wind generator (kW)
b = zeros(1, y); % preallocation of memory outside loop
windgen = b.’;
for a = 1:y
if ((vact(a) < vci)||(vact(a) > vco)) % wind speed less than cut-in or greater than cut-out
z = 0;
elseif ((vact(a) >= vci)&&(vact(a) < vrat)) % wind speed between cut-in and rated
z = 0.5 * coeff_wt * rho * Areawt * (vrat.^3) * ((vact(a).^3 – vci.^3)/(vrat.^3 – vci.^3)) * 0.001;
else % wind speed between rated and cut-out
z = 0.5 * coeff_wt * rho * Areawt * (vrat.^3) * 0.001;
end
windgen(a) = z;
end
end
battery script
% Battery System script
function [battpower,Pload] = battery(Areapv,Areawt,Capbatt)
% Inputs:
% Areapv = total area of all PV modules used (m2)
% Areawt = total rotor swept area of all wind turbines used (m2)
% Capbatt = total energy capacity of all batteries used (kWh)
% The three inputs are the variables to be optimized
% Pload = load demand (data read from an Excel file)
Pl = xlsread(‘charge_tlemcen.xlsx’,’A1:A8784′);
Pload = 0.001 * Pl; % load power in kW
eff_inv = 88/100; % efficiency of inverter
eff_batt_cha = 92/100; % efficiency of battery charging
eff_batt_disch = 100/100; % efficiency of battery discharging
Ppv = solar(Areapv); % generation from solar
Pwind = windpower(Areawt); % generation from wind
soc_max = 98/100; % maximum state of charge of battery
dod_max = 80/100; % maximum depth of discharge
y = length(Pload);
% preallocation of memory outside loop for some variables
c = zeros(1, y);
Pgen = c.’;
d = zeros(1, y);
soc = d.’;
e = zeros(1, y);
dod = e.’;
f = zeros(1, y);
Pdump = f.’;
g = zeros(1, y);
battpower = g.’;
h = zeros(1, y);
Pdef = h.’;
soc(1) = soc_max; % initial state of charge of battery
dod(1) = 1 – soc(1); % initial state of discharge of battery
for b = 1:y
Pgen(b) = Ppv(b) + Pwind(b);
soc(b) = soc(b) + (battpower(b)/(1000*Capbatt));
if Pgen(b) > (Pload(b)/eff_inv) % generation > load
if soc(b) < soc_max % battery not charged fully
battpower(b) = (Pgen(b) – (Pload(b)/eff_inv)) *eff_batt_cha; % battery charges, battpower is +ve
else
soc(b) >= soc_max; % battery charged to maximum
battpower(b) = 0; % no more charging
Pdump(b) = Pgen(b) – (Pload(b)/eff_inv);
% surplus power is dumped after battery charges to maximum
end
elseif Pgen(b) < (Pload(b)/eff_inv) % generation < load
if (dod(b)) < dod_max % battery not dicharged to maximum
battpower(b) = -((Pload(b)/eff_inv) – Pgen(b)) * eff_batt_disch; % battery discharges, battpower is -ve
else
dod(b) >= dod_max; % battery discharged to maximum
battpower(b) = 0; % no more discharging
Pdef(b) = Pload(b) – (Pgen(b) + ((1000 * Capbatt)* ((soc(b)-(1-dod_max))))* eff_inv);
% deficit power persists after battery discharged fully
end
else % Pgen(b) = (Pload(b)/eff_inv) i.e. generation = load
battpower(b) = 0; % No charging or discharging
end
end
end
LPSP script which is the non linear constraint script
function [LPSP_value,LPSP_eq] = LPSP(Areapv,Areawt,Capbatt)
eff_inv = 88/100; % efficiency of inverter
s = solar(Areapv); % call solar function
w = windpower(Areawt); % call wind function
Pg = s + w; % generation = solar + wind
[b,Pl] = battery(Areapv,Areawt,Capbatt); % call battery function
Pgen = sum(Pg); % total generation
Pload = sum(Pl); % total load
battp = sum(b); % total battery power
LPS = sum(Pdef);
LPSP_value = (LPS / Pload) – 0.05; % LPSP <= 0.05
LPSP_eq = [];
end
the cost script which is the objective function
% Total System Cost script
% The total system cost is the sum of the following costs:
% Capital/investment costs
% Operation and maintenance costs
% Replacement costs
% Salvage revenue (negative cost)
% The present value of the above cost components are found for each of the
% three main system components: solar pv generator, wind generator and
% battery system; all costs are then added to get the total system cost
% The total system cost is the objective function to be optimized by a
% genetic algorithm. The constraints of this function are the loss of power
% supply probability (defined in a separate function) and the input
% variables.
function system_cost = cost(Areapv,Areawt,Capbatt)
%————————————————————————-%
% Constraints
Areapv_max = 20 * 1.63; % 20 PV modules maximum (32.6 m2 max area)
Areapv(Areapv>Areapv_max) = Areapv_max;
Areapv_min = 10 * 1.63; % 10 PV modules minimum (16.3 m2 min area)
Areapv(Areapv<Areapv_min) = Areapv_min;
Areawt_max = 10 * pi * (0.85344.^2); % 10 wind turbines maximum
% (22.8821 m2 max area)
Areawt(Areawt>Areawt_max) = Areawt_max;
Areawt_min = 3 * pi * (0.85344.^2); % 3 wind turbines minimum
% (6.8646 m2 min area)
Areawt(Areawt<Areawt_min) = Areawt_min;
Capbatt_max = 20 * 1.68; % 20 battery units maximum (33.6 kWh max)
Capbatt(Capbatt>Capbatt_max) = Capbatt_max;
Capbatt_min = 10 * 1.68; % 10 battery units minimum (16.8 kWh min)
Capbatt(Capbatt<Capbatt_min) = Capbatt_min;
%————————————————————————-%
% Project lifetime
%proj_life = 25; % years
%————————————————————————-%
% Rates applicable
%int = 5/100; % interest rate that affects all costs
%infl = 3/100; % inflation rate that affects salvage costs
%inc = 4/100; % non-inflation rate at which non-salvage costs increase
%————————————————————————-%
% Solar specifications
cap_pv = 300/1.63; % capital cost of PV module (184.0491 UK pounds/m2)
oandm_pv = 7.5/1.63; % o & m cost of PV module (4.6012 UK pounds/m2/yr)
sal_pv = 60/1.63; % salvage revenue of PV module (36.8098 UK pounds/m2)
%life_pv = 25; % lifetime of PV module (years)
%rep_pv = (proj_life / life_pv) – 1; % number of replacements in project (0)
%————————————————————————-%
% Wind specifications
cap_wt = 1125/(pi*(0.85344.^2)); % capital cost of turbine
% (491.6507 UK pounds/m2)
oandm_wt = 168.75/(pi*(0.85344.^2)); % o & m cost of turbine
% (73.7476 UK pounds/m2/yr)
sal_wt = 225/(pi*(0.85344.^2)); % salvage revenue of turbine
% (98.3301 UK pounds/m2)
%life_wt = 12.5; % lifetime of turbine (years)
%rep_wt = (proj_life / life_wt) – 1; % number of replacements in project (1)
%————————————————————————-%
% Battery specifications
cap_batt = 364/1.68; % capital cost of battery (216.6667 UK pounds/kWh)
oandm_batt = 3.64/1.68; % o & m cost of battery (2.1667 UK pounds/kWh/yr)
sal_batt = 36.4/1.68; % salvage revenue of battery (21.6667 UK pounds/kWh)
%life_batt = 2.5; % lifetime of battery (years)
%rep_batt = (proj_life / life_batt) – 1; % number of replacements in project;
% (9)
%————————————————————————-%
% Useful factors for net present value
%fac1 = (1+inc)/(1+int); % 0.9905
%fac2 = (1+infl)/(1+int); % 0.9810
%factor1a = symsum(fac1.^((k-1)*life_wt),k,1,rep_wt);
factor1a = 1; % summation of fac1^(k-1)*life_wt) for turbine replacements
%factor1b = symsum(fac1.^((k-1)*life_batt),k,1,rep_batt);
factor1b = 8.1943; % summation of fac1.^((k-1)*life_batt) for battery
% replacements
%factor2 = symsum(fac1.^k,k,1,proj_life);
factor2 = 22.1282; % summation of fac1^k for project life
% factor2 = fac1 + (fac1.^2) + (fac1.^3) + … + (fac1.^25)
%factor3a = ((1+infl).^proj_life)/((1+int).^proj_life);
factor3a = 0.6183;
%factor3b = symsum(fac2.^(x*life_wt),x,1,rep_wt);
factor3b = 0.7863; % summation of fac2^(x*life_wt) for turbine life
%factor3c = symsum(fac2.^(x*life_batt),x,1,rep_batt);
factor3c = 7.1315; % summation of fac2^(x*life_batt) for battery life
%————————————————————————-%
% Capital costs and replacement costs
% Solar
pv_caprep = cap_pv * Areapv;
pv_caprep_npv = pv_caprep;
const_pv1 = pv_caprep_npv / Areapv;
% Wind
windg_caprep = cap_wt * Areawt;
windg_caprep_npv = windg_caprep * factor1a;
const_wt1 = windg_caprep_npv / Areawt;
% Battery
batt_caprep = cap_batt * Capbatt;
batt_caprep_npv = batt_caprep * factor1b;
const_batt1 = batt_caprep_npv / Capbatt;
%————————————————————————-%
% Operation and maintenance costs
% Solar
pv_oandm = oandm_pv * Areapv;
pv_oandm_npv = pv_oandm * factor2;
const_pv2 = pv_oandm_npv / Areapv;
% Wind
windg_oandm = oandm_wt * Areawt;
windg_oandm_npv = windg_oandm * factor2;
const_wt2 = windg_oandm_npv / Areawt;
% Battery
batt_oandm = oandm_batt * Capbatt;
batt_oandm_npv = batt_oandm * factor2;
const_batt2 = batt_oandm_npv / Capbatt;
%————————————————————————-%
% Salvage revenues
% Solar
pv_sal = sal_pv * Areapv;
pv_sal_npv = pv_sal * factor3a;
const_pv3 = pv_sal_npv / Areapv;
% Wind
windg_sal = sal_wt * Areawt;
windg_sal_npv = windg_sal * factor3b;
const_wt3 = windg_sal_npv / Areawt;
% Battery
batt_sal = sal_batt * Capbatt;
batt_sal_npv = batt_sal * factor3c;
const_batt3 = batt_sal_npv / Capbatt;
%————————————————————————-%
% Total system cost
% In general: system cost = capital cost + o&m cost – salvage revenue
system_cost = ((const_pv1 + const_pv2 – const_pv3) * Areapv) + …
((const_wt1 + const_wt2 – const_wt3) * Areawt) +((const_batt1 + const_batt2 – const_batt3) * Capbatt);
end
the ga script
nvars = 3; % number of input variables
fun = @cost; % objective function to be optimized (system cost)
lb = [16.3 6.865 16.8]; % lower bounds of input variables
ub = [32.6 22.882 33.6]; % lower bounds of input variables
nonlcon = @LPSP; % nonlinear constraint function (loss of power supply
% probability
% Optimization command
[X,fval] = ga(fun,nvars,[],[],[],[],lb,ub,nonlcon);
i can provide the exel data files you need to run the function
these are the errors i could not fix :
Error using .*
Matrix dimensions must agree.
Error in solar (line 12)
solargen = w .* x;
Error in LPSP (line 9)
s = solar(Areapv); % call solar function
Error in createAnonymousFcn>@(x)fcn(x,FcnArgs{:}) (line 11)
fcn_handle = @(x) fcn(x,FcnArgs{:});
Error in constrValidate (line 23)
[cineq,ceq] = nonlcon(Iterate.x’);
Error in gacommon (line 132)
[LinearConstr, Iterate,nineqcstr,neqcstr,ncstr] = constrValidate(NonconFcn, …
Error in ga (line 336)
NonconFcn,options,Iterate,type] = gacommon(nvars,fun,Aineq,bineq,Aeq,beq,lb,ub, …
Error in gen (line 28)
[X,fval] = ga(fun,nvars,[],[],[],[],lb,ub,nonlcon);
Caused by:
Failure in initial user-supplied nonlinear constraint function evaluation.i’m working on optimising a design of a hybrid PV/Wind energy system (with battery) using Genetic Algorithms ,and based on a research paper i have been able to code the following :
% Solar PV Generator script
function solargen = solar(Areapv)
% Input:
% Areapv = total area of all PV modules, one of the variables to be optimized
% x = solar irradiance (data read from an Excel file)
x = xlsread(‘éclairement_tlemcen.xlsx’,’A1:A8784′);
effpv = 0.227; % efficiency of the PV module specified by manufacturer
% Output:
% solargen = power produced by the PV generator (kW)
% solargen = Areapv * effpv * Irrad * 0.001;
w = effpv * Areapv * 0.001;
solargen = w .* x;
end
wind turbine script
% Wind Generator script
function windgen = windpower(Areawt)
% Inputs:
% Areawt = total rotor swept area of all wind turbines used (m2)
% Areawt is one of the variables to be optimized
coeff_wt = 45/100; % coefficient of power of wind turbine
rho = 1.1839; % density of air (kg/m3) at 1 atm pres and 25 degC temp
vci = 2.01168; % wind turbine cut-in/min wind speed (m/s)
vrat = 13.8582; % wind turbine rated wind speed (m/s)
vco = 17.8816; % wind turbine cut-out/max wind speed (m/s)
% vact = actual wind speed (data read from an Excel file)
vact = xlsread(‘wind_speed_tlemcen.xlsx’,’A1:A8784′);
y = length(vact); % number of wind speed data points
% windgen = power produced by the wind generator (kW)
b = zeros(1, y); % preallocation of memory outside loop
windgen = b.’;
for a = 1:y
if ((vact(a) < vci)||(vact(a) > vco)) % wind speed less than cut-in or greater than cut-out
z = 0;
elseif ((vact(a) >= vci)&&(vact(a) < vrat)) % wind speed between cut-in and rated
z = 0.5 * coeff_wt * rho * Areawt * (vrat.^3) * ((vact(a).^3 – vci.^3)/(vrat.^3 – vci.^3)) * 0.001;
else % wind speed between rated and cut-out
z = 0.5 * coeff_wt * rho * Areawt * (vrat.^3) * 0.001;
end
windgen(a) = z;
end
end
battery script
% Battery System script
function [battpower,Pload] = battery(Areapv,Areawt,Capbatt)
% Inputs:
% Areapv = total area of all PV modules used (m2)
% Areawt = total rotor swept area of all wind turbines used (m2)
% Capbatt = total energy capacity of all batteries used (kWh)
% The three inputs are the variables to be optimized
% Pload = load demand (data read from an Excel file)
Pl = xlsread(‘charge_tlemcen.xlsx’,’A1:A8784′);
Pload = 0.001 * Pl; % load power in kW
eff_inv = 88/100; % efficiency of inverter
eff_batt_cha = 92/100; % efficiency of battery charging
eff_batt_disch = 100/100; % efficiency of battery discharging
Ppv = solar(Areapv); % generation from solar
Pwind = windpower(Areawt); % generation from wind
soc_max = 98/100; % maximum state of charge of battery
dod_max = 80/100; % maximum depth of discharge
y = length(Pload);
% preallocation of memory outside loop for some variables
c = zeros(1, y);
Pgen = c.’;
d = zeros(1, y);
soc = d.’;
e = zeros(1, y);
dod = e.’;
f = zeros(1, y);
Pdump = f.’;
g = zeros(1, y);
battpower = g.’;
h = zeros(1, y);
Pdef = h.’;
soc(1) = soc_max; % initial state of charge of battery
dod(1) = 1 – soc(1); % initial state of discharge of battery
for b = 1:y
Pgen(b) = Ppv(b) + Pwind(b);
soc(b) = soc(b) + (battpower(b)/(1000*Capbatt));
if Pgen(b) > (Pload(b)/eff_inv) % generation > load
if soc(b) < soc_max % battery not charged fully
battpower(b) = (Pgen(b) – (Pload(b)/eff_inv)) *eff_batt_cha; % battery charges, battpower is +ve
else
soc(b) >= soc_max; % battery charged to maximum
battpower(b) = 0; % no more charging
Pdump(b) = Pgen(b) – (Pload(b)/eff_inv);
% surplus power is dumped after battery charges to maximum
end
elseif Pgen(b) < (Pload(b)/eff_inv) % generation < load
if (dod(b)) < dod_max % battery not dicharged to maximum
battpower(b) = -((Pload(b)/eff_inv) – Pgen(b)) * eff_batt_disch; % battery discharges, battpower is -ve
else
dod(b) >= dod_max; % battery discharged to maximum
battpower(b) = 0; % no more discharging
Pdef(b) = Pload(b) – (Pgen(b) + ((1000 * Capbatt)* ((soc(b)-(1-dod_max))))* eff_inv);
% deficit power persists after battery discharged fully
end
else % Pgen(b) = (Pload(b)/eff_inv) i.e. generation = load
battpower(b) = 0; % No charging or discharging
end
end
end
LPSP script which is the non linear constraint script
function [LPSP_value,LPSP_eq] = LPSP(Areapv,Areawt,Capbatt)
eff_inv = 88/100; % efficiency of inverter
s = solar(Areapv); % call solar function
w = windpower(Areawt); % call wind function
Pg = s + w; % generation = solar + wind
[b,Pl] = battery(Areapv,Areawt,Capbatt); % call battery function
Pgen = sum(Pg); % total generation
Pload = sum(Pl); % total load
battp = sum(b); % total battery power
LPS = sum(Pdef);
LPSP_value = (LPS / Pload) – 0.05; % LPSP <= 0.05
LPSP_eq = [];
end
the cost script which is the objective function
% Total System Cost script
% The total system cost is the sum of the following costs:
% Capital/investment costs
% Operation and maintenance costs
% Replacement costs
% Salvage revenue (negative cost)
% The present value of the above cost components are found for each of the
% three main system components: solar pv generator, wind generator and
% battery system; all costs are then added to get the total system cost
% The total system cost is the objective function to be optimized by a
% genetic algorithm. The constraints of this function are the loss of power
% supply probability (defined in a separate function) and the input
% variables.
function system_cost = cost(Areapv,Areawt,Capbatt)
%————————————————————————-%
% Constraints
Areapv_max = 20 * 1.63; % 20 PV modules maximum (32.6 m2 max area)
Areapv(Areapv>Areapv_max) = Areapv_max;
Areapv_min = 10 * 1.63; % 10 PV modules minimum (16.3 m2 min area)
Areapv(Areapv<Areapv_min) = Areapv_min;
Areawt_max = 10 * pi * (0.85344.^2); % 10 wind turbines maximum
% (22.8821 m2 max area)
Areawt(Areawt>Areawt_max) = Areawt_max;
Areawt_min = 3 * pi * (0.85344.^2); % 3 wind turbines minimum
% (6.8646 m2 min area)
Areawt(Areawt<Areawt_min) = Areawt_min;
Capbatt_max = 20 * 1.68; % 20 battery units maximum (33.6 kWh max)
Capbatt(Capbatt>Capbatt_max) = Capbatt_max;
Capbatt_min = 10 * 1.68; % 10 battery units minimum (16.8 kWh min)
Capbatt(Capbatt<Capbatt_min) = Capbatt_min;
%————————————————————————-%
% Project lifetime
%proj_life = 25; % years
%————————————————————————-%
% Rates applicable
%int = 5/100; % interest rate that affects all costs
%infl = 3/100; % inflation rate that affects salvage costs
%inc = 4/100; % non-inflation rate at which non-salvage costs increase
%————————————————————————-%
% Solar specifications
cap_pv = 300/1.63; % capital cost of PV module (184.0491 UK pounds/m2)
oandm_pv = 7.5/1.63; % o & m cost of PV module (4.6012 UK pounds/m2/yr)
sal_pv = 60/1.63; % salvage revenue of PV module (36.8098 UK pounds/m2)
%life_pv = 25; % lifetime of PV module (years)
%rep_pv = (proj_life / life_pv) – 1; % number of replacements in project (0)
%————————————————————————-%
% Wind specifications
cap_wt = 1125/(pi*(0.85344.^2)); % capital cost of turbine
% (491.6507 UK pounds/m2)
oandm_wt = 168.75/(pi*(0.85344.^2)); % o & m cost of turbine
% (73.7476 UK pounds/m2/yr)
sal_wt = 225/(pi*(0.85344.^2)); % salvage revenue of turbine
% (98.3301 UK pounds/m2)
%life_wt = 12.5; % lifetime of turbine (years)
%rep_wt = (proj_life / life_wt) – 1; % number of replacements in project (1)
%————————————————————————-%
% Battery specifications
cap_batt = 364/1.68; % capital cost of battery (216.6667 UK pounds/kWh)
oandm_batt = 3.64/1.68; % o & m cost of battery (2.1667 UK pounds/kWh/yr)
sal_batt = 36.4/1.68; % salvage revenue of battery (21.6667 UK pounds/kWh)
%life_batt = 2.5; % lifetime of battery (years)
%rep_batt = (proj_life / life_batt) – 1; % number of replacements in project;
% (9)
%————————————————————————-%
% Useful factors for net present value
%fac1 = (1+inc)/(1+int); % 0.9905
%fac2 = (1+infl)/(1+int); % 0.9810
%factor1a = symsum(fac1.^((k-1)*life_wt),k,1,rep_wt);
factor1a = 1; % summation of fac1^(k-1)*life_wt) for turbine replacements
%factor1b = symsum(fac1.^((k-1)*life_batt),k,1,rep_batt);
factor1b = 8.1943; % summation of fac1.^((k-1)*life_batt) for battery
% replacements
%factor2 = symsum(fac1.^k,k,1,proj_life);
factor2 = 22.1282; % summation of fac1^k for project life
% factor2 = fac1 + (fac1.^2) + (fac1.^3) + … + (fac1.^25)
%factor3a = ((1+infl).^proj_life)/((1+int).^proj_life);
factor3a = 0.6183;
%factor3b = symsum(fac2.^(x*life_wt),x,1,rep_wt);
factor3b = 0.7863; % summation of fac2^(x*life_wt) for turbine life
%factor3c = symsum(fac2.^(x*life_batt),x,1,rep_batt);
factor3c = 7.1315; % summation of fac2^(x*life_batt) for battery life
%————————————————————————-%
% Capital costs and replacement costs
% Solar
pv_caprep = cap_pv * Areapv;
pv_caprep_npv = pv_caprep;
const_pv1 = pv_caprep_npv / Areapv;
% Wind
windg_caprep = cap_wt * Areawt;
windg_caprep_npv = windg_caprep * factor1a;
const_wt1 = windg_caprep_npv / Areawt;
% Battery
batt_caprep = cap_batt * Capbatt;
batt_caprep_npv = batt_caprep * factor1b;
const_batt1 = batt_caprep_npv / Capbatt;
%————————————————————————-%
% Operation and maintenance costs
% Solar
pv_oandm = oandm_pv * Areapv;
pv_oandm_npv = pv_oandm * factor2;
const_pv2 = pv_oandm_npv / Areapv;
% Wind
windg_oandm = oandm_wt * Areawt;
windg_oandm_npv = windg_oandm * factor2;
const_wt2 = windg_oandm_npv / Areawt;
% Battery
batt_oandm = oandm_batt * Capbatt;
batt_oandm_npv = batt_oandm * factor2;
const_batt2 = batt_oandm_npv / Capbatt;
%————————————————————————-%
% Salvage revenues
% Solar
pv_sal = sal_pv * Areapv;
pv_sal_npv = pv_sal * factor3a;
const_pv3 = pv_sal_npv / Areapv;
% Wind
windg_sal = sal_wt * Areawt;
windg_sal_npv = windg_sal * factor3b;
const_wt3 = windg_sal_npv / Areawt;
% Battery
batt_sal = sal_batt * Capbatt;
batt_sal_npv = batt_sal * factor3c;
const_batt3 = batt_sal_npv / Capbatt;
%————————————————————————-%
% Total system cost
% In general: system cost = capital cost + o&m cost – salvage revenue
system_cost = ((const_pv1 + const_pv2 – const_pv3) * Areapv) + …
((const_wt1 + const_wt2 – const_wt3) * Areawt) +((const_batt1 + const_batt2 – const_batt3) * Capbatt);
end
the ga script
nvars = 3; % number of input variables
fun = @cost; % objective function to be optimized (system cost)
lb = [16.3 6.865 16.8]; % lower bounds of input variables
ub = [32.6 22.882 33.6]; % lower bounds of input variables
nonlcon = @LPSP; % nonlinear constraint function (loss of power supply
% probability
% Optimization command
[X,fval] = ga(fun,nvars,[],[],[],[],lb,ub,nonlcon);
i can provide the exel data files you need to run the function
these are the errors i could not fix :
Error using .*
Matrix dimensions must agree.
Error in solar (line 12)
solargen = w .* x;
Error in LPSP (line 9)
s = solar(Areapv); % call solar function
Error in createAnonymousFcn>@(x)fcn(x,FcnArgs{:}) (line 11)
fcn_handle = @(x) fcn(x,FcnArgs{:});
Error in constrValidate (line 23)
[cineq,ceq] = nonlcon(Iterate.x’);
Error in gacommon (line 132)
[LinearConstr, Iterate,nineqcstr,neqcstr,ncstr] = constrValidate(NonconFcn, …
Error in ga (line 336)
NonconFcn,options,Iterate,type] = gacommon(nvars,fun,Aineq,bineq,Aeq,beq,lb,ub, …
Error in gen (line 28)
[X,fval] = ga(fun,nvars,[],[],[],[],lb,ub,nonlcon);
Caused by:
Failure in initial user-supplied nonlinear constraint function evaluation. i’m working on optimising a design of a hybrid PV/Wind energy system (with battery) using Genetic Algorithms ,and based on a research paper i have been able to code the following :
% Solar PV Generator script
function solargen = solar(Areapv)
% Input:
% Areapv = total area of all PV modules, one of the variables to be optimized
% x = solar irradiance (data read from an Excel file)
x = xlsread(‘éclairement_tlemcen.xlsx’,’A1:A8784′);
effpv = 0.227; % efficiency of the PV module specified by manufacturer
% Output:
% solargen = power produced by the PV generator (kW)
% solargen = Areapv * effpv * Irrad * 0.001;
w = effpv * Areapv * 0.001;
solargen = w .* x;
end
wind turbine script
% Wind Generator script
function windgen = windpower(Areawt)
% Inputs:
% Areawt = total rotor swept area of all wind turbines used (m2)
% Areawt is one of the variables to be optimized
coeff_wt = 45/100; % coefficient of power of wind turbine
rho = 1.1839; % density of air (kg/m3) at 1 atm pres and 25 degC temp
vci = 2.01168; % wind turbine cut-in/min wind speed (m/s)
vrat = 13.8582; % wind turbine rated wind speed (m/s)
vco = 17.8816; % wind turbine cut-out/max wind speed (m/s)
% vact = actual wind speed (data read from an Excel file)
vact = xlsread(‘wind_speed_tlemcen.xlsx’,’A1:A8784′);
y = length(vact); % number of wind speed data points
% windgen = power produced by the wind generator (kW)
b = zeros(1, y); % preallocation of memory outside loop
windgen = b.’;
for a = 1:y
if ((vact(a) < vci)||(vact(a) > vco)) % wind speed less than cut-in or greater than cut-out
z = 0;
elseif ((vact(a) >= vci)&&(vact(a) < vrat)) % wind speed between cut-in and rated
z = 0.5 * coeff_wt * rho * Areawt * (vrat.^3) * ((vact(a).^3 – vci.^3)/(vrat.^3 – vci.^3)) * 0.001;
else % wind speed between rated and cut-out
z = 0.5 * coeff_wt * rho * Areawt * (vrat.^3) * 0.001;
end
windgen(a) = z;
end
end
battery script
% Battery System script
function [battpower,Pload] = battery(Areapv,Areawt,Capbatt)
% Inputs:
% Areapv = total area of all PV modules used (m2)
% Areawt = total rotor swept area of all wind turbines used (m2)
% Capbatt = total energy capacity of all batteries used (kWh)
% The three inputs are the variables to be optimized
% Pload = load demand (data read from an Excel file)
Pl = xlsread(‘charge_tlemcen.xlsx’,’A1:A8784′);
Pload = 0.001 * Pl; % load power in kW
eff_inv = 88/100; % efficiency of inverter
eff_batt_cha = 92/100; % efficiency of battery charging
eff_batt_disch = 100/100; % efficiency of battery discharging
Ppv = solar(Areapv); % generation from solar
Pwind = windpower(Areawt); % generation from wind
soc_max = 98/100; % maximum state of charge of battery
dod_max = 80/100; % maximum depth of discharge
y = length(Pload);
% preallocation of memory outside loop for some variables
c = zeros(1, y);
Pgen = c.’;
d = zeros(1, y);
soc = d.’;
e = zeros(1, y);
dod = e.’;
f = zeros(1, y);
Pdump = f.’;
g = zeros(1, y);
battpower = g.’;
h = zeros(1, y);
Pdef = h.’;
soc(1) = soc_max; % initial state of charge of battery
dod(1) = 1 – soc(1); % initial state of discharge of battery
for b = 1:y
Pgen(b) = Ppv(b) + Pwind(b);
soc(b) = soc(b) + (battpower(b)/(1000*Capbatt));
if Pgen(b) > (Pload(b)/eff_inv) % generation > load
if soc(b) < soc_max % battery not charged fully
battpower(b) = (Pgen(b) – (Pload(b)/eff_inv)) *eff_batt_cha; % battery charges, battpower is +ve
else
soc(b) >= soc_max; % battery charged to maximum
battpower(b) = 0; % no more charging
Pdump(b) = Pgen(b) – (Pload(b)/eff_inv);
% surplus power is dumped after battery charges to maximum
end
elseif Pgen(b) < (Pload(b)/eff_inv) % generation < load
if (dod(b)) < dod_max % battery not dicharged to maximum
battpower(b) = -((Pload(b)/eff_inv) – Pgen(b)) * eff_batt_disch; % battery discharges, battpower is -ve
else
dod(b) >= dod_max; % battery discharged to maximum
battpower(b) = 0; % no more discharging
Pdef(b) = Pload(b) – (Pgen(b) + ((1000 * Capbatt)* ((soc(b)-(1-dod_max))))* eff_inv);
% deficit power persists after battery discharged fully
end
else % Pgen(b) = (Pload(b)/eff_inv) i.e. generation = load
battpower(b) = 0; % No charging or discharging
end
end
end
LPSP script which is the non linear constraint script
function [LPSP_value,LPSP_eq] = LPSP(Areapv,Areawt,Capbatt)
eff_inv = 88/100; % efficiency of inverter
s = solar(Areapv); % call solar function
w = windpower(Areawt); % call wind function
Pg = s + w; % generation = solar + wind
[b,Pl] = battery(Areapv,Areawt,Capbatt); % call battery function
Pgen = sum(Pg); % total generation
Pload = sum(Pl); % total load
battp = sum(b); % total battery power
LPS = sum(Pdef);
LPSP_value = (LPS / Pload) – 0.05; % LPSP <= 0.05
LPSP_eq = [];
end
the cost script which is the objective function
% Total System Cost script
% The total system cost is the sum of the following costs:
% Capital/investment costs
% Operation and maintenance costs
% Replacement costs
% Salvage revenue (negative cost)
% The present value of the above cost components are found for each of the
% three main system components: solar pv generator, wind generator and
% battery system; all costs are then added to get the total system cost
% The total system cost is the objective function to be optimized by a
% genetic algorithm. The constraints of this function are the loss of power
% supply probability (defined in a separate function) and the input
% variables.
function system_cost = cost(Areapv,Areawt,Capbatt)
%————————————————————————-%
% Constraints
Areapv_max = 20 * 1.63; % 20 PV modules maximum (32.6 m2 max area)
Areapv(Areapv>Areapv_max) = Areapv_max;
Areapv_min = 10 * 1.63; % 10 PV modules minimum (16.3 m2 min area)
Areapv(Areapv<Areapv_min) = Areapv_min;
Areawt_max = 10 * pi * (0.85344.^2); % 10 wind turbines maximum
% (22.8821 m2 max area)
Areawt(Areawt>Areawt_max) = Areawt_max;
Areawt_min = 3 * pi * (0.85344.^2); % 3 wind turbines minimum
% (6.8646 m2 min area)
Areawt(Areawt<Areawt_min) = Areawt_min;
Capbatt_max = 20 * 1.68; % 20 battery units maximum (33.6 kWh max)
Capbatt(Capbatt>Capbatt_max) = Capbatt_max;
Capbatt_min = 10 * 1.68; % 10 battery units minimum (16.8 kWh min)
Capbatt(Capbatt<Capbatt_min) = Capbatt_min;
%————————————————————————-%
% Project lifetime
%proj_life = 25; % years
%————————————————————————-%
% Rates applicable
%int = 5/100; % interest rate that affects all costs
%infl = 3/100; % inflation rate that affects salvage costs
%inc = 4/100; % non-inflation rate at which non-salvage costs increase
%————————————————————————-%
% Solar specifications
cap_pv = 300/1.63; % capital cost of PV module (184.0491 UK pounds/m2)
oandm_pv = 7.5/1.63; % o & m cost of PV module (4.6012 UK pounds/m2/yr)
sal_pv = 60/1.63; % salvage revenue of PV module (36.8098 UK pounds/m2)
%life_pv = 25; % lifetime of PV module (years)
%rep_pv = (proj_life / life_pv) – 1; % number of replacements in project (0)
%————————————————————————-%
% Wind specifications
cap_wt = 1125/(pi*(0.85344.^2)); % capital cost of turbine
% (491.6507 UK pounds/m2)
oandm_wt = 168.75/(pi*(0.85344.^2)); % o & m cost of turbine
% (73.7476 UK pounds/m2/yr)
sal_wt = 225/(pi*(0.85344.^2)); % salvage revenue of turbine
% (98.3301 UK pounds/m2)
%life_wt = 12.5; % lifetime of turbine (years)
%rep_wt = (proj_life / life_wt) – 1; % number of replacements in project (1)
%————————————————————————-%
% Battery specifications
cap_batt = 364/1.68; % capital cost of battery (216.6667 UK pounds/kWh)
oandm_batt = 3.64/1.68; % o & m cost of battery (2.1667 UK pounds/kWh/yr)
sal_batt = 36.4/1.68; % salvage revenue of battery (21.6667 UK pounds/kWh)
%life_batt = 2.5; % lifetime of battery (years)
%rep_batt = (proj_life / life_batt) – 1; % number of replacements in project;
% (9)
%————————————————————————-%
% Useful factors for net present value
%fac1 = (1+inc)/(1+int); % 0.9905
%fac2 = (1+infl)/(1+int); % 0.9810
%factor1a = symsum(fac1.^((k-1)*life_wt),k,1,rep_wt);
factor1a = 1; % summation of fac1^(k-1)*life_wt) for turbine replacements
%factor1b = symsum(fac1.^((k-1)*life_batt),k,1,rep_batt);
factor1b = 8.1943; % summation of fac1.^((k-1)*life_batt) for battery
% replacements
%factor2 = symsum(fac1.^k,k,1,proj_life);
factor2 = 22.1282; % summation of fac1^k for project life
% factor2 = fac1 + (fac1.^2) + (fac1.^3) + … + (fac1.^25)
%factor3a = ((1+infl).^proj_life)/((1+int).^proj_life);
factor3a = 0.6183;
%factor3b = symsum(fac2.^(x*life_wt),x,1,rep_wt);
factor3b = 0.7863; % summation of fac2^(x*life_wt) for turbine life
%factor3c = symsum(fac2.^(x*life_batt),x,1,rep_batt);
factor3c = 7.1315; % summation of fac2^(x*life_batt) for battery life
%————————————————————————-%
% Capital costs and replacement costs
% Solar
pv_caprep = cap_pv * Areapv;
pv_caprep_npv = pv_caprep;
const_pv1 = pv_caprep_npv / Areapv;
% Wind
windg_caprep = cap_wt * Areawt;
windg_caprep_npv = windg_caprep * factor1a;
const_wt1 = windg_caprep_npv / Areawt;
% Battery
batt_caprep = cap_batt * Capbatt;
batt_caprep_npv = batt_caprep * factor1b;
const_batt1 = batt_caprep_npv / Capbatt;
%————————————————————————-%
% Operation and maintenance costs
% Solar
pv_oandm = oandm_pv * Areapv;
pv_oandm_npv = pv_oandm * factor2;
const_pv2 = pv_oandm_npv / Areapv;
% Wind
windg_oandm = oandm_wt * Areawt;
windg_oandm_npv = windg_oandm * factor2;
const_wt2 = windg_oandm_npv / Areawt;
% Battery
batt_oandm = oandm_batt * Capbatt;
batt_oandm_npv = batt_oandm * factor2;
const_batt2 = batt_oandm_npv / Capbatt;
%————————————————————————-%
% Salvage revenues
% Solar
pv_sal = sal_pv * Areapv;
pv_sal_npv = pv_sal * factor3a;
const_pv3 = pv_sal_npv / Areapv;
% Wind
windg_sal = sal_wt * Areawt;
windg_sal_npv = windg_sal * factor3b;
const_wt3 = windg_sal_npv / Areawt;
% Battery
batt_sal = sal_batt * Capbatt;
batt_sal_npv = batt_sal * factor3c;
const_batt3 = batt_sal_npv / Capbatt;
%————————————————————————-%
% Total system cost
% In general: system cost = capital cost + o&m cost – salvage revenue
system_cost = ((const_pv1 + const_pv2 – const_pv3) * Areapv) + …
((const_wt1 + const_wt2 – const_wt3) * Areawt) +((const_batt1 + const_batt2 – const_batt3) * Capbatt);
end
the ga script
nvars = 3; % number of input variables
fun = @cost; % objective function to be optimized (system cost)
lb = [16.3 6.865 16.8]; % lower bounds of input variables
ub = [32.6 22.882 33.6]; % lower bounds of input variables
nonlcon = @LPSP; % nonlinear constraint function (loss of power supply
% probability
% Optimization command
[X,fval] = ga(fun,nvars,[],[],[],[],lb,ub,nonlcon);
i can provide the exel data files you need to run the function
these are the errors i could not fix :
Error using .*
Matrix dimensions must agree.
Error in solar (line 12)
solargen = w .* x;
Error in LPSP (line 9)
s = solar(Areapv); % call solar function
Error in createAnonymousFcn>@(x)fcn(x,FcnArgs{:}) (line 11)
fcn_handle = @(x) fcn(x,FcnArgs{:});
Error in constrValidate (line 23)
[cineq,ceq] = nonlcon(Iterate.x’);
Error in gacommon (line 132)
[LinearConstr, Iterate,nineqcstr,neqcstr,ncstr] = constrValidate(NonconFcn, …
Error in ga (line 336)
NonconFcn,options,Iterate,type] = gacommon(nvars,fun,Aineq,bineq,Aeq,beq,lb,ub, …
Error in gen (line 28)
[X,fval] = ga(fun,nvars,[],[],[],[],lb,ub,nonlcon);
Caused by:
Failure in initial user-supplied nonlinear constraint function evaluation. genetic algorithm MATLAB Answers — New Questions