Month: July 2024
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
How to fix Error 15243 in Q.B Desktop after update?
I’ve been experiencing Q.B Error 15243 during pay-roll updates. Despite following troubleshooting steps, the issue persists. Has anyone else faced this problem? Any insights or solutions would be greatly appreciated. Thanks!
I’ve been experiencing Q.B Error 15243 during pay-roll updates. Despite following troubleshooting steps, the issue persists. Has anyone else faced this problem? Any insights or solutions would be greatly appreciated. Thanks! Read More
How to fix Error 15222 in Q.B Desktop after update?
I’m facing Q.B Error 15222 while trying to download pay-roll updates. The error message states that the update couldn’t be completed due to a connectivity issue. I’ve tried rebooting my system and checking my internet connection, but nothing seems to work. Any suggestions?
I’m facing Q.B Error 15222 while trying to download pay-roll updates. The error message states that the update couldn’t be completed due to a connectivity issue. I’ve tried rebooting my system and checking my internet connection, but nothing seems to work. Any suggestions? Read More
How to fix Error 12007 in Q.B Desktop after update?
Every time I try to update my Q.B pay-roll, I encounter Q.B Error 12007. It seems to be related to a connection issue.
Every time I try to update my Q.B pay-roll, I encounter Q.B Error 12007. It seems to be related to a connection issue. Read More
The Subscribtion Dioes not Containst any Registered ASNs
https://learn.microsoft.com/en-us/azure/internet-peering/howto-subscription-association-portal
This is my Tracking ID please check this issue and response my email which was not address from last 48 hours untill now
https://learn.microsoft.com/en-us/azure/internet-peering/howto-subscription-association-portalI have follow this documentation and enable Microsoft.Peering. But When I try to add asn it says your subscription Does not contain any registered ASN. Please help me to fix this issue.https://i.is.cc/sEq7Idf.png TrackingID#2407180030009866This is my Tracking ID please check this issue and response my email which was not address from last 48 hours untill now Read More
Will Microsoft release Windows 10 for ARM RTM product for licensed user?
Will Microsoft release Windows 10 for ARM RTM product for licensed user in future?
Will Microsoft release Windows 10 for ARM RTM product for licensed user in future? Read More
Connect Azure SQL Server via User Assigned Managed Identity under Django
TOC
Why we use it
Architecture
How to use it
References
Why we use it
This tutorial will introduce how to integrate Microsoft Entra with Azure SQL Server to avoid using fixed usernames and passwords. By utilizing user-assigned managed identities as a programmatic bridge, it becomes easier for Azure-related PaaS services (such as Function App or App Services) to communicate with the database without storing connection information in plain text.
Architecture
I will introduce each service or component and their configurations in subsequent chapters according to the order of A-D:
A: The company’s account administrator needs to create or designate a user as the database administrator. This role can only be assigned to one person within the database and is responsible for basic configuration and the creation and maintenance of other database users. It is not intended for development or actual system operations.
B: The company’s security department needs to create one or more user-assigned managed identities. In the future, the Web App will issue access requests to the database under different user identities.
C: The company’s data department needs to create or maintain a database and designate Microsoft Entra as the only login method, eliminating other fixed username/password combinations.
D: The company’s development department needs to create a Web App (or other service) as the basic unit of the business system. Programmers within this unit will write business logic (e.g., accessing the database) and deploy it here.
How to use it
A: As this article does not dive into the detailed configuration of Microsoft Entra, it will only outline the process. The company’s account administrator needs to create or designate a user as the database administrator. In this example, we will call this user “cch,” and the account, “cch@thexxxxxxxxxxxx” will be used in subsequent steps.
B: Please create a user-assigned managed identity from Azure Portal. And copy the Client ID and Resource ID once you’ve created the identity for the further use.
C-1: Create a database/SQL server. During this process, you need to specify the user created in Step A as the database administrator. Please note that to select “Microsoft Entra-only authentication.” In this mode, the username/password will no longer be used. Then, click on “Next: Networking.”
Since this article does not cover the detailed network configuration of the database, temporarily allow public access during the tutorial. Use the default values for other settings, click on “Review + Create,” and then click “Create” to finish the setup.
During this process, you need to specify the user-assigned managed identity created in Step B as the entity that will actually operate the database.
And leave it default from the rest of the parts
C-2: After the database has created, you can log in using the identity “cch@thexxxxxxxxxxxx” you’ve get from Step A which is the database administrator. Open a PowerShell terminal and using the “cch” account, enter the following command to log in to SQL Server. You will need to change the <text> to follow your company’s naming conventions.
sqlcmd -S <YOUR_SERVER_NAME>.database.windows.net -d <YOUR_DB_NAME> -U <YOUR_FULL_USER_EMAIL> -G
You will be prompt for a 2 step verification.
Returning to the console, we will now create user accounts in SQL Server for the managed identities setup from Step B. First, we will introduce the method for the user-assigned managed identity. The purpose of the commands is to grant database-related operational permissions to the newly created user. This is just an example. In actual scenarios, you should follow your company’s security policies and make the necessary adjustments accordingly. Please enter the following command.
CREATE USER [<YOUR_IDENTITY_NAME>] FROM EXTERNAL PROVIDER;
USE [<YOUR_DB_NAME>];
EXEC sp_addrolemember ‘db_owner’, ‘<YOUR_IDENTITY_NAME>’;
For testing purposes, we will create a test table, and insert some data.
CREATE TABLE TestTable (
Column1 INT,
Column2 NVARCHAR(100)
);
INSERT INTO TestTable (Column1, Column2) VALUES (1, ‘First Record’);
INSERT INTO TestTable (Column1, Column2) VALUES (2, ‘Second Record’);
D-1: In this example, we can create a Web App with any SKU/region. For the development language (stack), we choose Python as a demonstration, though other languages also support the same functionality. Since this article does not cover the detailed network configuration or other specifics of the Web App, we will use the default values for other settings. Simply click on “Review + Create,” and then click on “Create” to complete the process.
D-2: After Web App has created, please open Azure Cloud Shell in the bash mode and enter a command. You will need to change the <text> to follow your company’s naming conventions.
az webapp identity assign –resource-group <YOUR_RG_NAME> –name <YOUR_APP_NAME> –identities <RESOURCE_ID_IN_STEP_B>
D-3: Programmer can now deploy the code to the Web App. In this tutorial, we use Quickstart: Deploy a Python (Django, Flask, or FastAPI) web app to Azure – Azure App Service | Microsoft Learn to complete the example. Other languages also have their respective SQL Server connectors and follow the same principles.
In requirements.txt, in addition to the existing ones, please add the following packages: mssql-django
In quickstartproject/settings.py, include the following example content, you will need to change the <text> to follow your company’s naming conventions
DATABASES = {
‘default’: {
‘ENGINE’: ‘mssql’,
‘NAME’: ‘<YOUR_DB_NAME>’,
‘HOST’: ‘<YOUR_SERVER_NAME>.database.windows.net’,
‘PORT’: ‘1433’,
“USER”: “<CLIENT_ID_IN_STEP_B>”,
‘OPTIONS’: {
‘driver’: ‘ODBC Driver 18 for SQL Server’,
‘extra_params’: ‘Authentication=ActiveDirectoryMsi’,
}
}
}
In hello_azure/views.py, include the following example content.
def index(request):
raw_text = “”
with connection.cursor() as cursor:
cursor.execute(“SELECT Column2 FROM TestTable”)
rows = cursor.fetchall()
for row in rows:
raw_text = row
return HttpResponse(raw_text, content_type=’text/plain’)
Please note that the code I provided in this tutorial is only suitable for the testing phase. Its purpose is to verify usability and it is not intended for production use. Ultimately, please make the corresponding modifications based on the business functionality and security guidelines of your own environment.
Once the deployment is complete, you can proceed with testing. We can observe that the Web App will call the authentication endpoint in the background to get an access token. It will then use this token to interact with the database and subsequently print out the queried data.
References:
Authenticate with Microsoft Entra ID in sqlcmd – SQL Server | Microsoft Learn
Microsoft Tech Community – Latest Blogs –Read More
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
SQL Query Incremental data load
I have source and staging tables & target table, I want to bring in incremental data into staging from source.
I have 2 date columnCreatedDate and UpdatedDate to work with to bring in the incremental data in stage
Table structure (ID_Pk, CreatedDate, UpdatedDate)
CreatedDate and UpdatedDate are date with time stamp and ID is PK
e.g. Created Date/updated date format ‘2024-05-09 16:13.03.5722250’
I have to write SQL to get only incremental data from source table, by using UpdateDate if not null, in case if updated date is null then use CreateDate to pull the incremental data.
I got the vmaxCreatedDate and vmaxUpdatedDate from targate table put it into varaibles and wrote below query, question is this this sql correct for incremental data load. I am inform to pick incremental data using UpdateDate in case it is NULL then use CreatedDate to bring in only incremental data
Select * from SourceTbl where updateDate > vmaxUpdatedDate and updateDate is not null
UNION
Select * from SourceTbl where createdDate > vmaxCreatedDate
I have source and staging tables & target table, I want to bring in incremental data into staging from source.I have 2 date columnCreatedDate and UpdatedDate to work with to bring in the incremental data in stageTable structure (ID_Pk, CreatedDate, UpdatedDate)CreatedDate and UpdatedDate are date with time stamp and ID is PKe.g. Created Date/updated date format ‘2024-05-09 16:13.03.5722250’I have to write SQL to get only incremental data from source table, by using UpdateDate if not null, in case if updated date is null then use CreateDate to pull the incremental data.I got the vmaxCreatedDate and vmaxUpdatedDate from targate table put it into varaibles and wrote below query, question is this this sql correct for incremental data load. I am inform to pick incremental data using UpdateDate in case it is NULL then use CreatedDate to bring in only incremental dataSelect * from SourceTbl where updateDate > vmaxUpdatedDate and updateDate is not null
UNION
Select * from SourceTbl where createdDate > vmaxCreatedDate Read More
SharePoint list view can’t grouping by and filtering by
Hi,
I’m troubleshooting an issue in SharePoint List, we using Approval Queues to collect all request for approval and create a view list to all user, at view list we grouping by some process and filtering sort A to Z. But, since last Friday we got issue the view list not showing the data.
Has anyone experienced the same issue like us?
Thank you.
Hi, I’m troubleshooting an issue in SharePoint List, we using Approval Queues to collect all request for approval and create a view list to all user, at view list we grouping by some process and filtering sort A to Z. But, since last Friday we got issue the view list not showing the data. Has anyone experienced the same issue like us? Thank you. Read More
Change the cell color base on IF value
Hi Expert
How can I create an excel formula for below condition
Condition
DayUnitSunday10Monday20Tuesday30Wednesday40Thursday50Friday60Saturday70
If condition is below above value, the cell should change to red color
DayCondition is meet or notSunday30Tuesday15 (This cell should change to red color)Monday40Friday40 (This cell should change to red color)Wednesday80Monday5 (This cell should change to red color)Saturday60 (This cell should change to red color)Friday80Wednesday55
Hi Expert How can I create an excel formula for below condition ConditionDayUnitSunday10Monday20Tuesday30Wednesday40Thursday50Friday60Saturday70 If condition is below above value, the cell should change to red color DayCondition is meet or notSunday30Tuesday15 (This cell should change to red color)Monday40Friday40 (This cell should change to red color)Wednesday80Monday5 (This cell should change to red color)Saturday60 (This cell should change to red color)Friday80Wednesday55 Read More
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
windows 11 insider beta program feedback hub too young to send feedback
Hi i just joined the Insider beta program i am unable to provide feedback on the windows app windows free me i wanna be apart of the beta community if anyone can help me please let me know i hope everyone is having a good day or night wherever you may be!(:
Hi i just joined the Insider beta program i am unable to provide feedback on the windows app windows free me i wanna be apart of the beta community if anyone can help me please let me know i hope everyone is having a good day or night wherever you may be!(: Read More
Error with the simulink downsample component
Hello,
I am using the downsample component in simulink, but I am getting the error message:
"Nonzero sample time offsets are not supported"
during C++ generation.
My sample offset is set to 0 in the block parameters window. I also tried to use a workspace variable set to 0 to see if it makes a difference. No change.
I have used this block before without any problem. Any recommendation on how to debug this?
Thanks!Hello,
I am using the downsample component in simulink, but I am getting the error message:
"Nonzero sample time offsets are not supported"
during C++ generation.
My sample offset is set to 0 in the block parameters window. I also tried to use a workspace variable set to 0 to see if it makes a difference. No change.
I have used this block before without any problem. Any recommendation on how to debug this?
Thanks! Hello,
I am using the downsample component in simulink, but I am getting the error message:
"Nonzero sample time offsets are not supported"
during C++ generation.
My sample offset is set to 0 in the block parameters window. I also tried to use a workspace variable set to 0 to see if it makes a difference. No change.
I have used this block before without any problem. Any recommendation on how to debug this?
Thanks! simulink, downsample MATLAB Answers — New Questions
FAQ: When is a Marketplace Private Offer Legally Binding?
Q: At what point in the transaction process does a Private Offer become legally binding? The reason why was it would determine who in the organisation could approve the Private Offer, and then purchase software.
Step 1 – Approval of the Private Offer?
Step 2 – Purchase the Software?
Step 3 – Only when the ISV has configured the software?
A: It is binding at the time of accepting the offer (Step 1). “Accepting the private offer means you agree to the terms and prices listed in the offer, creating a contractual agreement between your organization and the Microsoft partner” – https://learn.microsoft.com/en-us/marketplace/private-offers-accept-offer
Q: At what point in the transaction process does a Private Offer become legally binding? The reason why was it would determine who in the organisation could approve the Private Offer, and then purchase software.
Step 1 – Approval of the Private Offer?
Step 2 – Purchase the Software?
Step 3 – Only when the ISV has configured the software?
A: It is binding at the time of accepting the offer (Step 1). “Accepting the private offer means you agree to the terms and prices listed in the offer, creating a contractual agreement between your organization and the Microsoft partner” – https://learn.microsoft.com/en-us/marketplace/private-offers-accept-offer
FAQ: Is Bicep supported when creating a transactable Azure Managed Application
Q: Is Bicep supported when creating a transactable Azure Managed Application? Right now, I am only aware that ARM templates are supported. Also, have you encountered a way that PowerShell scripts can also be executed within a managed application? Are DevOps pipelines recommended or is there any other best practice?
A: Bicep are not supported directly. You can export the BICEP to ARM and use that inside the package.zip. For the second question, research ARM deployment scripts…. It allows to run scripts in ARM Templates. Link below: https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/deployment-script-template
You can also refer to this blog on using PowerShell in ARM Template:
https://techcommunity.microsoft.com/t5/azure-paas-blog/using-powershell-in-arm-template/ba-p/3277600
Q: Is Bicep supported when creating a transactable Azure Managed Application? Right now, I am only aware that ARM templates are supported. Also, have you encountered a way that PowerShell scripts can also be executed within a managed application? Are DevOps pipelines recommended or is there any other best practice?
A: Bicep are not supported directly. You can export the BICEP to ARM and use that inside the package.zip. For the second question, research ARM deployment scripts…. It allows to run scripts in ARM Templates. Link below: https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/deployment-script-template
You can also refer to this blog on using PowerShell in ARM Template:
https://techcommunity.microsoft.com/t5/azure-paas-blog/using-powershell-in-arm-template/ba-p/3277600
Read More