Month: June 2024
Can’t stabilize system with PID
Hi. I’m trying to stabilize a model for this articol: https://ethz.ch/content/dam/ethz/special-interest/mavt/dynamic-systems-n-control/idsc-dam/Research_DAndrea/Cubli/Cubli_IROS2012.pdf , with a PID controller, and it’s not working. I don’t even know that this is the corect order of the cascade PID. I even try to take each individual part of the cascade PID and simulate it and use the tuner for that. And still it doesn’t working. Does anyone know what to do?
This is the cascade PID:
This is the attempt to try to take individual part of the cascade and simulate:
This is the Control System tuner:Hi. I’m trying to stabilize a model for this articol: https://ethz.ch/content/dam/ethz/special-interest/mavt/dynamic-systems-n-control/idsc-dam/Research_DAndrea/Cubli/Cubli_IROS2012.pdf , with a PID controller, and it’s not working. I don’t even know that this is the corect order of the cascade PID. I even try to take each individual part of the cascade PID and simulate it and use the tuner for that. And still it doesn’t working. Does anyone know what to do?
This is the cascade PID:
This is the attempt to try to take individual part of the cascade and simulate:
This is the Control System tuner: Hi. I’m trying to stabilize a model for this articol: https://ethz.ch/content/dam/ethz/special-interest/mavt/dynamic-systems-n-control/idsc-dam/Research_DAndrea/Cubli/Cubli_IROS2012.pdf , with a PID controller, and it’s not working. I don’t even know that this is the corect order of the cascade PID. I even try to take each individual part of the cascade PID and simulate it and use the tuner for that. And still it doesn’t working. Does anyone know what to do?
This is the cascade PID:
This is the attempt to try to take individual part of the cascade and simulate:
This is the Control System tuner: control, simulink, equation, model MATLAB Answers — New Questions
Filling prepared form in excel with data in another sheet
Hi everyone,
I need to help with filling my form in one sheet with list of data in another sheet.
I have to create new forms of electrical equipment and each of that on new paper. I have list of equipment and I need create around 300 forms with different data.
It is possible to does it in excel?
I need to fill here:
From this:
Hi everyone, I need to help with filling my form in one sheet with list of data in another sheet.I have to create new forms of electrical equipment and each of that on new paper. I have list of equipment and I need create around 300 forms with different data. It is possible to does it in excel? I need to fill here: From this: Read More
Search from specific sharepoint site or folder
Is it possible to use copilot to search info from specific sharepoint site or folder? i tried to give the link to the sharepoint site but it doesn’t seem to be working.
Is it possible to use copilot to search info from specific sharepoint site or folder? i tried to give the link to the sharepoint site but it doesn’t seem to be working. Read More
Problem with some external guests access in Teams using MFA
We have some guest users, from different Home tenants, that have problems logging in to our tenant with MFA when using Edge web browser.
It works fine when they are using InPrivate in Edge, another device or another web browser.
When we check their settings in our Entra everything looks correct. We have not changed any policies or settings and it is not all the guest user from the same Home tenant the have this issue, for most of the guest users from the same Home tenants it works fine accessing our tenant with MFA while a few guest users from the same company/ Home tenant have this issue.
It is almost as if there is a clash between their home tenant AAD user, Microsoft Edge, and the guest user in our AAD.
Does anyone have some recommendations och solutions to this issue?
We have some guest users, from different Home tenants, that have problems logging in to our tenant with MFA when using Edge web browser. It works fine when they are using InPrivate in Edge, another device or another web browser. When we check their settings in our Entra everything looks correct. We have not changed any policies or settings and it is not all the guest user from the same Home tenant the have this issue, for most of the guest users from the same Home tenants it works fine accessing our tenant with MFA while a few guest users from the same company/ Home tenant have this issue. It is almost as if there is a clash between their home tenant AAD user, Microsoft Edge, and the guest user in our AAD. Does anyone have some recommendations och solutions to this issue? Read More
Microsoft Copilot in Azure Series – Copilot Access Management
Hello folks!
Today, we’re diving into Microsoft Copilot in Azure. It’s like having a super-smart assistant in the cloud!
It’s an AI-powered tool that’s all about making your life easier when you’re working with Azure, when you’re navigating the Azure portal, or using the Azure mobile app.
Now, keep in mind, at the time of recording this, Copilot in Azure is still in preview. That means it’s like a sneak peek, and there are some extra terms you have to check out before you jump in.
This Copilot in Azure can be a real lifesaver. It knows a ton about Azure’s services and resources, it also has access to all the information in Azure Resource Graph.
It’s like having a cheat sheet for the cloud. You can ask it questions about your environment, and it’ll give you answers tailored to your own Azure resources, and your level of access.
That means that Microsoft Copilot in Azure will only report on the resources that you have access to. It can only take the actions that you have permission to perform, and it requires confirmation before making changes to your environment.
It complies with all existing access management rules and protections such as:
1- Azure role-based access control (Azure RBAC),
2- Privileged Identity Management,
3- Azure Policy,
4- and resource locks.
You can chat with Copilot right in the Azure portal or on the go with the Azure mobile app. It’s like texting with a friend who can do some of your homework for you. It’ll answer questions, run queries, and even perform tasks for you, all while keeping your organization’s policies in check.
Oh, to use Microsoft Copilot in Azure you might need to have a chat with your network or security admins about a WebSocket connections to https://directline.botframework.com .
It’s required for Copilot in Azure to work.
Now, Let’s dive into controlling the Access to Microsoft Copilot in Azure. By default, everyone in your tenant gets to play with Copilot in Azure. But, as the Global Administrator, you’ve got the power to manage access. Want to give specific users or groups a sneak peek? No problem! the video below shows you how to control access.
Remember, Copilot in Azure only helps you with the stuff you’re already allowed to touch. So, if you’ve already got access to certain data and resources, “Cool, let’s get to work!” But if it’s locked away from you, or you don’t have rights, Copilot respects that – no sneaking in or anything. It’s all about keeping things above board.
And that’s a wrap on this episode of ITOpsTalk “Using Microsoft Copilot in Azure”! Stay tuned to this channel for more episodes and updates
Catch you in the cloud!
Cheers!
Pierre
Microsoft Tech Community – Latest Blogs –Read More
Using Keycloak with Azure AD to integrate AKS Cluster authentication process
Introduction
Integrating Azure Kubernetes Service (AKS) with Keycloak through Azure Active Directory (Azure AD) as an intermediary leverages Azure AD’s support for OpenID Connect (OIDC) to handle authentication and authorization. This integration enhances security, streamlines user management, and simplifies the authentication process for users accessing the AKS cluster.
Use case
The integration of AKS with Keycloak using Azure AD is highly applicable in all these industries and beyond that prioritize security, scalability, and efficient user management, making it a best practice for organizations leveraging cloud-based Kubernetes environments.
Financial Services: Securely manage and authenticate thousands of users accessing sensitive financial data and applications hosted on Kubernetes clusters.
Healthcare: Protect patient data and ensure compliance with healthcare regulations while providing medical staff secure access to applications.
E-commerce: Manage a large user base accessing e-commerce platforms and ensure secure transactions and user data protection.
Technology and Software Development: Provide developers with secure access to development environments and resources hosted on Kubernetes clusters.
Education: Manage access to educational resources and applications for students, faculty, and staff in a secure manner.
Figure 1: Similar use case architecture.
Concept
To make this integration possible and effective you should have a clear understanding of the following components, the concept of using Azure AD as an intermediary, and the pre-requisites.
Understanding the Key Components
What is AKS?
Azure Kubernetes Service (AKS) is a managed Kubernetes service that simplifies deploying, managing, and operating Kubernetes clusters in the cloud.
What is Keycloak
Keycloak is an open-source identity and access management solution that provides features like single sign-on (SSO), identity brokering, and user federation.
What is Azure AD?
Azure Active Directory (Azure AD/Microsoft Entra ID) is Microsoft’s cloud-based identity and access management service, which helps users access external resources like Microsoft 365, the Azure portal, and thousands of other SaaS applications.
Overview of OIDC
OpenID Connect (OIDC) is an identity layer built on top of the OAuth 2.0 protocol, allowing clients to verify the identity of end-users based on the authentication performed by an authorization server.
Why Use Azure AD as an Intermediary?
Using Azure AD as an intermediary offers several benefits:
Enhanced Security: Leverages Azure AD’s robust security features.
Simplified Management: Centralizes authentication and authorization.
Seamless Integration: Provides easy integration with Azure services and applications.
Pre-requisites for Integration
Before starting the integration process, ensure you have:
Azure AD: Set up and configured with necessary permissions.
Keycloak: Configured with a realm ready to be integrated.
AKS Cluster: Either existing or a plan to create a new one with Azure AD integration.
Figure 2: Mian concept
According to the image shown in Figure 2: Main concept, the authentication processes taken place in this concept is Azure Active Directory (Azure AD/Microsoft Entra ID) at the center, and from the right Azure Kubernetes Service requested an authentication and Azure AD will perform OIDC Token Exchange to Keycloak at the left, then Keycloak will perform validation and revert back to Azure AD while, Azure AD respond back to AKS.
Hands-on (Technical Steps)
More technical in these steps and processes, you will find step-by-step guide for seamless Integration.
Register Keycloak as an Application in Azure AD.
Create an App Registration in Azure AD:
Navigate to Azure AD and create a new app registration.
Figure 3: Register Keycloak as an Application in Azure AD -1
Figure 4: Register Keycloak as an Application in Azure AD -2
Save the Client ID and Client Secret from Azure AD. This information will be needed later in Keycloak.
Obtain Client ID and Client Secret
After the registration is complete, go to the app’s overview page and copy the “Application (client) ID”.
Navigate to “Certificates & secrets” and create a new client secret. Copy the value of the client secret as it will not be shown again.
Figure 5: Register Keycloak as an Application in Azure AD -3
Configure API Permissions:
Go to “API permissions” and add the required Microsoft Graph API permissions. Typically, you need `User.Read` and `openid`, `profile`, and `email` permissions.
Figure 6: Register Keycloak as an Application in Azure AD -4
Figure 7: Register Keycloak as an Application in Azure AD -5
On click Add a permission, the above similar pane will be displayed as shown and you will click on Add permission. Then, after Add permission, you will have similar configuration to the below image.
Figure 8: Register Keycloak as an Application in Azure AD -6
Configure Keycloak to Use Azure AD
Set Up Keycloak:
https://www.keycloak.org/downloads
https://quay.io/repository/keycloak/keycloak
Log in to the Keycloak admin console.
Select the realm you want to configure or create a new realm.
Figure 9: Configure Keycloak to use Azure AD
Add Azure AD as an Identity Provider:
In the left menu, go to “Identity Providers”.
Click “Add provider” and select “OpenID Connect v1.0”.
Fill in the details:
Alias: A friendly name for the provider (e.g., AzureAD).
Display Name: A display name for the login button.
Authorization URL: `https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize`
Token URL: `https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token`
Client ID: The Application (client) ID obtained from Azure AD.
Client Secret: The client secret obtained from Azure AD.
Save the configuration.
Import OIDC Metadata:
Go to the Azure AD app registration overview and find the “OpenID Connect metadata document” URL.
Figure 10: Configure Keycloak: In Keycloak, use this URL to import the metadata automatically, which fills out most of the configuration fields.
Integrate AKS with Azure AD
Enable Azure AD Integration When Creating AKS Cluster:
Use the following Azure CLI command to create an AKS cluster with Azure AD integration
az aks create
–resource-group myResourceGroup
–name myAKSCluster
–node-count 1
–enable-aad
–aad-admin-group-object-ids <admin-group-object-id>
–enable-oidc-issuer
–oidc-issuer-url “https://<keycloak-server>/auth/realms/<realm>”
Replace the placeholders with actual values:
`myResourceGroup`: The resource group name.
`myAKSCluster`: The AKS cluster name.
`admin-group-object-id`: The object ID of the Azure AD group that will have admin rights.
`oidc-issuer-url`: The URL of the Keycloak OIDC issuer.
Update Existing AKS Cluster:
If you already have an existing AKS cluster, use the following command to enable Azure AD integration:
az aks update
–resource-group myResourceGroup
–name myAKSCluster
–enable-aad
–aad-server-app-id <server-app-id>
–aad-server-app-secret <server-app-secret>
–aad-client-app-id <client-app-id>
–aad-tenant-id <tenant-id>
Outcome
The benefits of successful integration are not limited to the followings:
Streamlined User Management: Centralized user management through Azure AD.
Enhanced Security: Leverages Azure AD’s security features to protect your AKS cluster.
Simplify Security: Using Azure AD’s security features and Keycloak settings to simplifies the authentication process for users
Conclusion
We saw in this article how integrating AKS with Keycloak using Azure AD as an intermediary provides a robust and secure authentication solution. In addition, to the above steps, you can use `kubectl` to log into the AKS cluster test the integration, redirecting to the Azure AD login page, and after successful authentication, you should be redirected back to Keycloak if configured correctly. Verify that users have the appropriate roles and permissions in both Azure AD and Keycloak to access the AKS cluster. For troubleshooting, ensure the Client ID, Secret, and URLs are correct, and verify all required permissions and alignment of Keycloak and Azure AD settings and use HTTPS for all communications and regularly review and update access controls and permissions for security. Maintaining the system by keeping all components updated and implementing monitoring tools to track the health and performance of the integration and also, advanced configurations include adjusting claims in Keycloak to meet specific requirements and configuring group memberships according to organizational structure which will be in the next article. By following the steps outlined in this article, you can ensure a seamless and efficient integration process to simplify and enhance app security.
Microsoft Tech Community – Latest Blogs –Read More
Fints – extract x years historical prices
Hello,
I have a set of historical prices for MSFT for the last 20 years, from 2001 to 2021. To create the timeseries, I’m using "fints"
How should I retrieve the most recent 5 years of data from a time series, knowing that the reference start date is "31/08/2021"?
I tried using the "fetch" function, but this requires knowing the time series’ end date.
Do you have any ideas/suggestions about what function or approach to take in this situation?
Many thanks,
LHello,
I have a set of historical prices for MSFT for the last 20 years, from 2001 to 2021. To create the timeseries, I’m using "fints"
How should I retrieve the most recent 5 years of data from a time series, knowing that the reference start date is "31/08/2021"?
I tried using the "fetch" function, but this requires knowing the time series’ end date.
Do you have any ideas/suggestions about what function or approach to take in this situation?
Many thanks,
L Hello,
I have a set of historical prices for MSFT for the last 20 years, from 2001 to 2021. To create the timeseries, I’m using "fints"
How should I retrieve the most recent 5 years of data from a time series, knowing that the reference start date is "31/08/2021"?
I tried using the "fetch" function, but this requires knowing the time series’ end date.
Do you have any ideas/suggestions about what function or approach to take in this situation?
Many thanks,
L financial timeseries, timeseries, historicalprices, fints, fetch MATLAB Answers — New Questions
How to switch off all 6 MOSFETs (6SO) with ePWM block from C2000 Motor Control Blockset?
Hi,
I’m currently developing a control algorithm for a PMSM.
I’m using the F28379 Launchpad and the BOOSTXL-DRV8305EVM.
To model the algorithm, I’m using the C2000 Microcontroller Blockset in Simulink.
I generate the three dutycycle commands for the three phases and use the ePWM blocks from the C2000 motor control blockset in the following.
For the algorithm I’m also including a safestate, where all 6 switches of the inverter should be switched off.
How can I do this while maintaining the ePWM blocks as "connection" to the hardware?
What command signals do I have to sent to the ePWM block as input to achieve that behavior?
Just requesting a voltage vector with amplitude = 0 in the alpha-beta-system obviously doesn’t work,
since this will lead all 3 highsides switched on or all lowsides being switched on (space vector 0/7).
I tried playing around with the tripzone tab inside the block but so far wasn’t able to get the desired behavior.
Thanks for the help!Hi,
I’m currently developing a control algorithm for a PMSM.
I’m using the F28379 Launchpad and the BOOSTXL-DRV8305EVM.
To model the algorithm, I’m using the C2000 Microcontroller Blockset in Simulink.
I generate the three dutycycle commands for the three phases and use the ePWM blocks from the C2000 motor control blockset in the following.
For the algorithm I’m also including a safestate, where all 6 switches of the inverter should be switched off.
How can I do this while maintaining the ePWM blocks as "connection" to the hardware?
What command signals do I have to sent to the ePWM block as input to achieve that behavior?
Just requesting a voltage vector with amplitude = 0 in the alpha-beta-system obviously doesn’t work,
since this will lead all 3 highsides switched on or all lowsides being switched on (space vector 0/7).
I tried playing around with the tripzone tab inside the block but so far wasn’t able to get the desired behavior.
Thanks for the help! Hi,
I’m currently developing a control algorithm for a PMSM.
I’m using the F28379 Launchpad and the BOOSTXL-DRV8305EVM.
To model the algorithm, I’m using the C2000 Microcontroller Blockset in Simulink.
I generate the three dutycycle commands for the three phases and use the ePWM blocks from the C2000 motor control blockset in the following.
For the algorithm I’m also including a safestate, where all 6 switches of the inverter should be switched off.
How can I do this while maintaining the ePWM blocks as "connection" to the hardware?
What command signals do I have to sent to the ePWM block as input to achieve that behavior?
Just requesting a voltage vector with amplitude = 0 in the alpha-beta-system obviously doesn’t work,
since this will lead all 3 highsides switched on or all lowsides being switched on (space vector 0/7).
I tried playing around with the tripzone tab inside the block but so far wasn’t able to get the desired behavior.
Thanks for the help! simulink, epwm, electric_motor_control MATLAB Answers — New Questions
about high dimension and low sample using PCA
I am using PCA to detect the abnormality in time-series data. Currently I have high dimension and low sample dataset (15*530 data matrix). I am wondering if I can use PCA to obtain the statistic such as T^2 and SPE. I noticed that some articles stated that it is improper to use PCA to obtain the statistics under such case.I am using PCA to detect the abnormality in time-series data. Currently I have high dimension and low sample dataset (15*530 data matrix). I am wondering if I can use PCA to obtain the statistic such as T^2 and SPE. I noticed that some articles stated that it is improper to use PCA to obtain the statistics under such case. I am using PCA to detect the abnormality in time-series data. Currently I have high dimension and low sample dataset (15*530 data matrix). I am wondering if I can use PCA to obtain the statistic such as T^2 and SPE. I noticed that some articles stated that it is improper to use PCA to obtain the statistics under such case. pca MATLAB Answers — New Questions
Projector for LINQ
Hi,
I would like to share simple projector system, that is I believe a great improvement for LINQ:
using AutoMapper;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace ANeT.SharedData.Projection
{
/// <summary>
/// Base class for any Projector. This design pattern is able to protect input IQueryable for single SQL generation
/// while for IEnumerable allowing to use single query definition by internally representing it as IQueryable.
/// Fill internal method is used to chaining extension modules to final collection (adjusting current collection with new joins, conditions, …).
/// </summary>
/// <typeparam name=”P”>Factory Type</typeparam>
/// <typeparam name=”E”>Entity Type</typeparam>
public abstract class Projector<P, E>
where P : Projector<P, E>, new()
{
bool providersChecked = false;
IQueryProvider? originalProvider = null;
IQueryable<E> collection = null!;
protected IQueryable<E> Collection => collection;
protected Projector()
{ } // Constructor should be hidden so that internal system is safe.
/// <summary>
/// Factory of this Projector. Accepting any input collection,
/// however for IQueryable it is maintaining a single SQL generation.
/// IEnumerable input is internally represented as IQueryable.
/// </summary>
/// <typeparam name=”C”></typeparam>
/// <param name=”collection”></param>
/// <returns>Instance P</returns>
public static P Create<C>(C collection)
where C : IEnumerable<E>
{
P instance = new P();
if (collection is IQueryable<E> queryable)
{
instance.originalProvider = queryable.Provider;
instance.collection = queryable;
}
else
{
instance.collection = collection.AsQueryable();
}
return instance;
}
/// <summary>
/// Chaining method to follow with next Projector,
/// which one must follow the same entity type.
/// </summary>
/// <typeparam name=”C”>Factory Type</typeparam>
/// <returns>Instance C</returns>
public C Chain<C>()
where C : Projector<C, E>, new()
{
C instance = new C();
instance.originalProvider = this.originalProvider;
instance.collection = this.collection;
return instance;
}
/// <summary>
/// This method should be used at begin of any collection extension.
/// It is enforcing Provider rule on any join collection. (Protecting final collection from cross-context mixup.)
/// </summary>
/// <param name=”collections”>Checked collections</param>
/// <exception cref=”InvalidOperationException”></exception>
protected void CheckProviders(params object[] collections)
{
if (originalProvider == null)
{
return;
}
foreach (object collection in collections)
{
if (collection is IQueryable queryable && queryable.Provider != originalProvider)
{
throw new InvalidOperationException(“Chain of querying was broken.”);
}
}
providersChecked = true;
}
/// <summary>
/// Fill current Projector IQueryable with new altered version.
/// For Projector collection that was IQueryable at the input, it enforces Provider compatibility.
/// (Which is requiring programmers to call CheckProviders beforehand.)
/// </summary>
/// <typeparam name=”C”>Collection Type</typeparam>
/// <param name=”collection”>New collection</param>
/// <exception cref=”InvalidOperationException”></exception>
protected void Fill<C>(C collection)
where C : IEnumerable<E>
{
if (originalProvider != null &&
(!providersChecked || collection is not IQueryable<E> queryable || queryable.Provider != originalProvider))
{
throw new InvalidOperationException(“Chain of querying was broken.”);
}
this.collection = (collection as IQueryable<E>) ?? collection.AsQueryable();
this.providersChecked = false;
}
/// <summary>
/// Základní přístup k projekci. Ponechává IQueryable tak, jak bylo vytvořeno.
/// </summary>
/// <returns></returns>
public IQueryable<E> Project()
=> collection;
/// <summary>
/// Projection of current Projector IQueryable to a new collection of re-typed entities.
/// (If unable to re-type, it will copy entities by property name and property type matching.)
/// </summary>
/// <typeparam name=”ME”>Entity Type</typeparam>
/// <returns>Collection ME</returns>
public IQueryable<ME> ProjectTo<ME>()
where ME : new()
{
object result = collection;
if (typeof(ME) != typeof(E))
{
if (CanCast<ME>())
{
result = collection.Cast<ME>();
}
else
{
Expression<Func<E, ME>> selectExpression = GetSelectExpression<ME>();
result = collection.Select(selectExpression);
}
}
return (IQueryable<ME>)result;
}
/// <summary>
/// Projection of current Projector IQueryable to re-typed collection (C) of re-typed entities.
/// (If unable to re-type, it will copy entities by property name and property type matching.)
/// </summary>
/// <typeparam name=”C”>Collection Type</typeparam>
/// <typeparam name=”ME”>Entity Type</typeparam>
/// <returns>Collection C</returns>
public C ProjectTo<C, ME>()
where ME : new()
where C : IEnumerable<ME>
{
object result = collection;
if (typeof(C) == typeof(IEnumerable))
{
if (typeof(ME) == typeof(E))
{
result = collection.AsEnumerable();
}
else
{
if (CanCast<ME>())
{
result = collection.Cast<ME>().AsEnumerable();
}
else
{
Expression<Func<E, ME>> selectExpression = GetSelectExpression<ME>();
result = collection.Select(selectExpression).AsEnumerable();
}
}
}
else if (typeof(ME) != typeof(E))
{
if (CanCast<ME>())
{
result = collection.Cast<ME>();
}
else
{
Expression<Func<E, ME>> selectExpression = GetSelectExpression<ME>();
result = collection.Select(selectExpression);
}
}
return (C)result;
}
/// <summary>
/// Projection of current Projector IQueryable to a new collection of re-typed entities.
/// (If unable to re-type, it will copy entities using AutoMapper.)
/// </summary>
/// <typeparam name=”ME”>Entity Type</typeparam>
/// <returns>Collection ME</returns>
public IQueryable<ME> ProjectTo<ME>(IMapper mapper)
where ME : new()
{
object result = collection;
if (typeof(ME) != typeof(E))
{
if (CanCast<ME>())
{
result = collection.Cast<ME>();
}
else
{
result = collection.Select(e => mapper.Map<ME>(e));
}
}
return (IQueryable<ME>)result;
}
/// <summary>
/// Projection of current Projector IQueryable to re-typed collection (C) of re-typed entities.
/// (If unable to re-type, it will copy entities using AutoMapper.)
/// </summary>
/// <typeparam name=”C”>Collection Type</typeparam>
/// <typeparam name=”ME”>Entity Type</typeparam>
/// <returns>Collection C</returns>
public C ProjectTo<C, ME>(IMapper mapper)
where ME : new()
where C : IEnumerable<ME>
{
object result = collection;
if (typeof(C) == typeof(IEnumerable))
{
if (typeof(ME) == typeof(E))
{
result = collection.AsEnumerable();
}
else
{
if (CanCast<ME>())
{
result = collection.Cast<ME>().AsEnumerable();
}
else
{
result = collection.Select(e => mapper.Map<ME>(e)).AsEnumerable();
}
}
}
else if (typeof(ME) != typeof(E))
{
if (CanCast<ME>())
{
result = collection.Cast<ME>();
}
else
{
result = collection.Select(e => mapper.Map<ME>(e));
}
}
return (C)result;
}
private bool CanCast<ME>()
=> typeof(E).IsAssignableFrom(typeof(ME));
/// <summary>
/// Inner method for Select Linq creation. (Solving property tests and their conversions.)
/// </summary>
/// <typeparam name=”ME”>Entity Type</typeparam>
/// <returns>Lambda Expression Linq Select</returns>
/// <exception cref=”InvalidOperationException”></exception>
private Expression<Func<E, ME>> GetSelectExpression<ME>()
{
Type
sourceType = typeof(E),
targetType = typeof(ME);
PropertyInfo[] sourceProperties = sourceType.GetProperties();
Dictionary<string, PropertyInfo> targetProperties = targetType.GetProperties()
.ToDictionary(key => key.Name, val => val);
ParameterExpression parameter = Expression.Parameter(sourceType, “entity”);
List<MemberBinding> bindings = new List<MemberBinding>();
foreach (PropertyInfo sourceProperty in sourceProperties)
{
if (!targetProperties.ContainsKey(sourceProperty.Name))
{
continue;
}
PropertyInfo? targetProperty = targetProperties[sourceProperty.Name];
Type sourcePropertyType = Nullable.GetUnderlyingType(sourceProperty.PropertyType) ?? sourceProperty.PropertyType;
if (!targetProperty.PropertyType.IsAssignableFrom(sourcePropertyType))
{
throw new InvalidOperationException($”Incompatible property types for property {sourceProperty.Name}”);
}
MemberExpression sourceValue = Expression.Property(parameter, sourceProperty);
Expression convertedSourceValue;
if (sourcePropertyType != sourceProperty.PropertyType) // Is Nullable.
{
convertedSourceValue = Expression.Condition(
Expression.Equal(sourceValue, Expression.Constant(null)), // Test null.
Expression.Default(targetProperty.PropertyType), // Default value.
Expression.Convert(Expression.Property(sourceValue, “Value”), targetProperty.PropertyType));
}
else
{
convertedSourceValue = sourceValue;
}
MemberAssignment binding = Expression.Bind(targetProperty, convertedSourceValue);
bindings.Add(binding);
}
MemberInitExpression initializer = Expression.MemberInit(Expression.New(targetType), bindings);
return Expression.Lambda<Func<E, ME>>(initializer, parameter);
}
}
}
Which has a simple FluentAPI with chaining usage:
public class Small
{
public string IXS_REF { get; set; } = null!;
public DateTime LAST_TIME { get; set; }
}
Small ddd = PersonProjector.Create(new List<IPOREF> { new IPOREF { IXS_REF = “AAA”, LAST_TIME = null } })
.FilterWhatever(joinOne, inList)
.Chain<SecondProjector>()
.ProjectTo<Small>()
.First();
It allows you to define single chain of modular queries and apply it to any collection type. For IQueryable it is protecting input Provider, while for IEnumerable allowing to use all IQueryable methods … Final projection can lead to any ancestor allowing to chain another wave of projections …
Hi,I would like to share simple projector system, that is I believe a great improvement for LINQ:using AutoMapper;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace ANeT.SharedData.Projection
{
/// <summary>
/// Base class for any Projector. This design pattern is able to protect input IQueryable for single SQL generation
/// while for IEnumerable allowing to use single query definition by internally representing it as IQueryable.
/// Fill internal method is used to chaining extension modules to final collection (adjusting current collection with new joins, conditions, …).
/// </summary>
/// <typeparam name=”P”>Factory Type</typeparam>
/// <typeparam name=”E”>Entity Type</typeparam>
public abstract class Projector<P, E>
where P : Projector<P, E>, new()
{
bool providersChecked = false;
IQueryProvider? originalProvider = null;
IQueryable<E> collection = null!;
protected IQueryable<E> Collection => collection;
protected Projector()
{ } // Constructor should be hidden so that internal system is safe.
/// <summary>
/// Factory of this Projector. Accepting any input collection,
/// however for IQueryable it is maintaining a single SQL generation.
/// IEnumerable input is internally represented as IQueryable.
/// </summary>
/// <typeparam name=”C”></typeparam>
/// <param name=”collection”></param>
/// <returns>Instance P</returns>
public static P Create<C>(C collection)
where C : IEnumerable<E>
{
P instance = new P();
if (collection is IQueryable<E> queryable)
{
instance.originalProvider = queryable.Provider;
instance.collection = queryable;
}
else
{
instance.collection = collection.AsQueryable();
}
return instance;
}
/// <summary>
/// Chaining method to follow with next Projector,
/// which one must follow the same entity type.
/// </summary>
/// <typeparam name=”C”>Factory Type</typeparam>
/// <returns>Instance C</returns>
public C Chain<C>()
where C : Projector<C, E>, new()
{
C instance = new C();
instance.originalProvider = this.originalProvider;
instance.collection = this.collection;
return instance;
}
/// <summary>
/// This method should be used at begin of any collection extension.
/// It is enforcing Provider rule on any join collection. (Protecting final collection from cross-context mixup.)
/// </summary>
/// <param name=”collections”>Checked collections</param>
/// <exception cref=”InvalidOperationException”></exception>
protected void CheckProviders(params object[] collections)
{
if (originalProvider == null)
{
return;
}
foreach (object collection in collections)
{
if (collection is IQueryable queryable && queryable.Provider != originalProvider)
{
throw new InvalidOperationException(“Chain of querying was broken.”);
}
}
providersChecked = true;
}
/// <summary>
/// Fill current Projector IQueryable with new altered version.
/// For Projector collection that was IQueryable at the input, it enforces Provider compatibility.
/// (Which is requiring programmers to call CheckProviders beforehand.)
/// </summary>
/// <typeparam name=”C”>Collection Type</typeparam>
/// <param name=”collection”>New collection</param>
/// <exception cref=”InvalidOperationException”></exception>
protected void Fill<C>(C collection)
where C : IEnumerable<E>
{
if (originalProvider != null &&
(!providersChecked || collection is not IQueryable<E> queryable || queryable.Provider != originalProvider))
{
throw new InvalidOperationException(“Chain of querying was broken.”);
}
this.collection = (collection as IQueryable<E>) ?? collection.AsQueryable();
this.providersChecked = false;
}
/// <summary>
/// Základní přístup k projekci. Ponechává IQueryable tak, jak bylo vytvořeno.
/// </summary>
/// <returns></returns>
public IQueryable<E> Project()
=> collection;
/// <summary>
/// Projection of current Projector IQueryable to a new collection of re-typed entities.
/// (If unable to re-type, it will copy entities by property name and property type matching.)
/// </summary>
/// <typeparam name=”ME”>Entity Type</typeparam>
/// <returns>Collection ME</returns>
public IQueryable<ME> ProjectTo<ME>()
where ME : new()
{
object result = collection;
if (typeof(ME) != typeof(E))
{
if (CanCast<ME>())
{
result = collection.Cast<ME>();
}
else
{
Expression<Func<E, ME>> selectExpression = GetSelectExpression<ME>();
result = collection.Select(selectExpression);
}
}
return (IQueryable<ME>)result;
}
/// <summary>
/// Projection of current Projector IQueryable to re-typed collection (C) of re-typed entities.
/// (If unable to re-type, it will copy entities by property name and property type matching.)
/// </summary>
/// <typeparam name=”C”>Collection Type</typeparam>
/// <typeparam name=”ME”>Entity Type</typeparam>
/// <returns>Collection C</returns>
public C ProjectTo<C, ME>()
where ME : new()
where C : IEnumerable<ME>
{
object result = collection;
if (typeof(C) == typeof(IEnumerable))
{
if (typeof(ME) == typeof(E))
{
result = collection.AsEnumerable();
}
else
{
if (CanCast<ME>())
{
result = collection.Cast<ME>().AsEnumerable();
}
else
{
Expression<Func<E, ME>> selectExpression = GetSelectExpression<ME>();
result = collection.Select(selectExpression).AsEnumerable();
}
}
}
else if (typeof(ME) != typeof(E))
{
if (CanCast<ME>())
{
result = collection.Cast<ME>();
}
else
{
Expression<Func<E, ME>> selectExpression = GetSelectExpression<ME>();
result = collection.Select(selectExpression);
}
}
return (C)result;
}
/// <summary>
/// Projection of current Projector IQueryable to a new collection of re-typed entities.
/// (If unable to re-type, it will copy entities using AutoMapper.)
/// </summary>
/// <typeparam name=”ME”>Entity Type</typeparam>
/// <returns>Collection ME</returns>
public IQueryable<ME> ProjectTo<ME>(IMapper mapper)
where ME : new()
{
object result = collection;
if (typeof(ME) != typeof(E))
{
if (CanCast<ME>())
{
result = collection.Cast<ME>();
}
else
{
result = collection.Select(e => mapper.Map<ME>(e));
}
}
return (IQueryable<ME>)result;
}
/// <summary>
/// Projection of current Projector IQueryable to re-typed collection (C) of re-typed entities.
/// (If unable to re-type, it will copy entities using AutoMapper.)
/// </summary>
/// <typeparam name=”C”>Collection Type</typeparam>
/// <typeparam name=”ME”>Entity Type</typeparam>
/// <returns>Collection C</returns>
public C ProjectTo<C, ME>(IMapper mapper)
where ME : new()
where C : IEnumerable<ME>
{
object result = collection;
if (typeof(C) == typeof(IEnumerable))
{
if (typeof(ME) == typeof(E))
{
result = collection.AsEnumerable();
}
else
{
if (CanCast<ME>())
{
result = collection.Cast<ME>().AsEnumerable();
}
else
{
result = collection.Select(e => mapper.Map<ME>(e)).AsEnumerable();
}
}
}
else if (typeof(ME) != typeof(E))
{
if (CanCast<ME>())
{
result = collection.Cast<ME>();
}
else
{
result = collection.Select(e => mapper.Map<ME>(e));
}
}
return (C)result;
}
private bool CanCast<ME>()
=> typeof(E).IsAssignableFrom(typeof(ME));
/// <summary>
/// Inner method for Select Linq creation. (Solving property tests and their conversions.)
/// </summary>
/// <typeparam name=”ME”>Entity Type</typeparam>
/// <returns>Lambda Expression Linq Select</returns>
/// <exception cref=”InvalidOperationException”></exception>
private Expression<Func<E, ME>> GetSelectExpression<ME>()
{
Type
sourceType = typeof(E),
targetType = typeof(ME);
PropertyInfo[] sourceProperties = sourceType.GetProperties();
Dictionary<string, PropertyInfo> targetProperties = targetType.GetProperties()
.ToDictionary(key => key.Name, val => val);
ParameterExpression parameter = Expression.Parameter(sourceType, “entity”);
List<MemberBinding> bindings = new List<MemberBinding>();
foreach (PropertyInfo sourceProperty in sourceProperties)
{
if (!targetProperties.ContainsKey(sourceProperty.Name))
{
continue;
}
PropertyInfo? targetProperty = targetProperties[sourceProperty.Name];
Type sourcePropertyType = Nullable.GetUnderlyingType(sourceProperty.PropertyType) ?? sourceProperty.PropertyType;
if (!targetProperty.PropertyType.IsAssignableFrom(sourcePropertyType))
{
throw new InvalidOperationException($”Incompatible property types for property {sourceProperty.Name}”);
}
MemberExpression sourceValue = Expression.Property(parameter, sourceProperty);
Expression convertedSourceValue;
if (sourcePropertyType != sourceProperty.PropertyType) // Is Nullable.
{
convertedSourceValue = Expression.Condition(
Expression.Equal(sourceValue, Expression.Constant(null)), // Test null.
Expression.Default(targetProperty.PropertyType), // Default value.
Expression.Convert(Expression.Property(sourceValue, “Value”), targetProperty.PropertyType));
}
else
{
convertedSourceValue = sourceValue;
}
MemberAssignment binding = Expression.Bind(targetProperty, convertedSourceValue);
bindings.Add(binding);
}
MemberInitExpression initializer = Expression.MemberInit(Expression.New(targetType), bindings);
return Expression.Lambda<Func<E, ME>>(initializer, parameter);
}
}
} Which has a simple FluentAPI with chaining usage: public class Small
{
public string IXS_REF { get; set; } = null!;
public DateTime LAST_TIME { get; set; }
}
Small ddd = PersonProjector.Create(new List<IPOREF> { new IPOREF { IXS_REF = “AAA”, LAST_TIME = null } })
.FilterWhatever(joinOne, inList)
.Chain<SecondProjector>()
.ProjectTo<Small>()
.First(); It allows you to define single chain of modular queries and apply it to any collection type. For IQueryable it is protecting input Provider, while for IEnumerable allowing to use all IQueryable methods … Final projection can lead to any ancestor allowing to chain another wave of projections … Read More
Python API cannot be built with setup.py in R2021a
I’m trying to get the matlab engine python API to work as I have a long piece of python code which inherits a single call to a MATLAB function.
For sanitary reasons, I want to couple to API to one of my virtual anaconda environments. As I’m using the R2021a release I’ve started by creating a new conda environment with python 3.8 as per the compatibility requirements Versions of Python Compatible with MATLAB Products by Release – MATLAB & Simulink (mathworks.com), and installing no further libraries. Afterwards a python –version reveals this installed Python 3.8.16.
In MATLAB I’ve confirmed the license is activated by running
license(‘inuse’)
which returns "matlab" as I went with a complete blank installation after multiple failed attempts.
When trying to actually built the engine, I’m aware I have to specify the associated python directory with the virtual environment as explained in Install MATLAB Engine API for Python in Nondefault Locations – MATLAB & Simulink – MathWorks Benelux as the default Python environment runs in an incompatible version, so I execute
"python setup.py install –prefix="C:<my_anaconda_path>envsmatlab-api-env"
which returns the following lengthy error message
=============================================================================================================
C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolsdist.py:520: SetuptoolsDeprecationWarning: Invalid version: ‘R2021a’.
!!
********************************************************************************
The version specified is not a valid version according to PEP 440.
This may not work as expected with newer versions of
setuptools, pip, and PyPI.
By 2023-Sep-26, you need to update your project and remove deprecated calls
or your builds will no longer be supported.
See https://peps.python.org/pep-0440/ for details.
********************************************************************************
!!
self._validate_version(self.metadata.version)
C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!
********************************************************************************
Please avoid running “setup.py“ directly.
Instead, use pypa/build, pypa/installer, pypa/build or
other standards-based tools.
See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
********************************************************************************
!!
self.initialize_options()
C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!
********************************************************************************
Please avoid running “setup.py“ and “easy_install“.
Instead, use pypa/build, pypa/installer, pypa/build or
other standards-based tools.
See https://github.com/pypa/setuptools/issues/917 for details.
********************************************************************************
!!
self.initialize_options()
C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolscommandegg_info.py:131: SetuptoolsDeprecationWarning: Invalid version: ‘R2021a’.
!!
********************************************************************************
Version ‘R2021a’ is not valid according to PEP 440.
Please make sure to specify a valid version for your package.
Also note that future releases of setuptools may halt the build process
if an invalid version is given.
By 2023-Sep-26, you need to update your project and remove deprecated calls
or your builds will no longer be supported.
See https://peps.python.org/pep-0440/ for details.
********************************************************************************
!!
return _normalization.best_effort_version(tagged)
Traceback (most recent call last):
File "setup.py", line 80, in <module>
setup(
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscore.py", line 185, in setup
return run_commands(dist)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscore.py", line 201, in run_commands
dist.run_commands()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilsdist.py", line 969, in run_commands
self.run_command(cmd)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolsdist.py", line 1244, in run_command
super().run_command(command)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilsdist.py", line 988, in run_command
cmd_obj.run()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolscommandinstall.py", line 80, in run
self.do_egg_install()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolscommandinstall.py", line 129, in do_egg_install
self.run_command(‘bdist_egg’)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py", line 318, in run_command
self.distribution.run_command(command)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolsdist.py", line 1244, in run_command
super().run_command(command)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilsdist.py", line 987, in run_command
cmd_obj.ensure_finalized()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py", line 111, in ensure_finalized
self.finalize_options()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolscommandbdist_egg.py", line 92, in finalize_options
ei_cmd = self.ei_cmd = self.get_finalized_command("egg_info")
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py", line 305, in get_finalized_command
cmd_obj.ensure_finalized()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py", line 111, in ensure_finalized
self.finalize_options()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolscommandegg_info.py", line 219, in finalize_options
parsed_version = packaging.version.Version(self.egg_version)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_vendorpackagingversion.py", line 197, in __init__
raise InvalidVersion(f"Invalid version: ‘{version}’")
setuptools.extern.packaging.version.InvalidVersion: Invalid version: ‘R2021a’
=============================================================================================================
So it seems that the official way of creating the MATLAB-python API through the setup.py script is depracated in the default setuptools (ver 67.2.2.) that comes with a fresh python 3.8 installation. The suggested alternative based to use pip install instead (based on Why you shouldn’t invoke setup.py directly (ganssle.io)), is only supported for R2022b and upwards according to Install MATLAB Engine API for Python – MATLAB & Simulink – MathWorks Benelux (and trying to do so despite the lack official support still generates a similar error surrounding SetuptoolsDeprecationWarning: Invalid version: ‘R2021a’).
Any help would be appreciated.I’m trying to get the matlab engine python API to work as I have a long piece of python code which inherits a single call to a MATLAB function.
For sanitary reasons, I want to couple to API to one of my virtual anaconda environments. As I’m using the R2021a release I’ve started by creating a new conda environment with python 3.8 as per the compatibility requirements Versions of Python Compatible with MATLAB Products by Release – MATLAB & Simulink (mathworks.com), and installing no further libraries. Afterwards a python –version reveals this installed Python 3.8.16.
In MATLAB I’ve confirmed the license is activated by running
license(‘inuse’)
which returns "matlab" as I went with a complete blank installation after multiple failed attempts.
When trying to actually built the engine, I’m aware I have to specify the associated python directory with the virtual environment as explained in Install MATLAB Engine API for Python in Nondefault Locations – MATLAB & Simulink – MathWorks Benelux as the default Python environment runs in an incompatible version, so I execute
"python setup.py install –prefix="C:<my_anaconda_path>envsmatlab-api-env"
which returns the following lengthy error message
=============================================================================================================
C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolsdist.py:520: SetuptoolsDeprecationWarning: Invalid version: ‘R2021a’.
!!
********************************************************************************
The version specified is not a valid version according to PEP 440.
This may not work as expected with newer versions of
setuptools, pip, and PyPI.
By 2023-Sep-26, you need to update your project and remove deprecated calls
or your builds will no longer be supported.
See https://peps.python.org/pep-0440/ for details.
********************************************************************************
!!
self._validate_version(self.metadata.version)
C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!
********************************************************************************
Please avoid running “setup.py“ directly.
Instead, use pypa/build, pypa/installer, pypa/build or
other standards-based tools.
See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
********************************************************************************
!!
self.initialize_options()
C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!
********************************************************************************
Please avoid running “setup.py“ and “easy_install“.
Instead, use pypa/build, pypa/installer, pypa/build or
other standards-based tools.
See https://github.com/pypa/setuptools/issues/917 for details.
********************************************************************************
!!
self.initialize_options()
C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolscommandegg_info.py:131: SetuptoolsDeprecationWarning: Invalid version: ‘R2021a’.
!!
********************************************************************************
Version ‘R2021a’ is not valid according to PEP 440.
Please make sure to specify a valid version for your package.
Also note that future releases of setuptools may halt the build process
if an invalid version is given.
By 2023-Sep-26, you need to update your project and remove deprecated calls
or your builds will no longer be supported.
See https://peps.python.org/pep-0440/ for details.
********************************************************************************
!!
return _normalization.best_effort_version(tagged)
Traceback (most recent call last):
File "setup.py", line 80, in <module>
setup(
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscore.py", line 185, in setup
return run_commands(dist)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscore.py", line 201, in run_commands
dist.run_commands()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilsdist.py", line 969, in run_commands
self.run_command(cmd)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolsdist.py", line 1244, in run_command
super().run_command(command)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilsdist.py", line 988, in run_command
cmd_obj.run()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolscommandinstall.py", line 80, in run
self.do_egg_install()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolscommandinstall.py", line 129, in do_egg_install
self.run_command(‘bdist_egg’)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py", line 318, in run_command
self.distribution.run_command(command)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolsdist.py", line 1244, in run_command
super().run_command(command)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilsdist.py", line 987, in run_command
cmd_obj.ensure_finalized()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py", line 111, in ensure_finalized
self.finalize_options()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolscommandbdist_egg.py", line 92, in finalize_options
ei_cmd = self.ei_cmd = self.get_finalized_command("egg_info")
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py", line 305, in get_finalized_command
cmd_obj.ensure_finalized()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py", line 111, in ensure_finalized
self.finalize_options()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolscommandegg_info.py", line 219, in finalize_options
parsed_version = packaging.version.Version(self.egg_version)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_vendorpackagingversion.py", line 197, in __init__
raise InvalidVersion(f"Invalid version: ‘{version}’")
setuptools.extern.packaging.version.InvalidVersion: Invalid version: ‘R2021a’
=============================================================================================================
So it seems that the official way of creating the MATLAB-python API through the setup.py script is depracated in the default setuptools (ver 67.2.2.) that comes with a fresh python 3.8 installation. The suggested alternative based to use pip install instead (based on Why you shouldn’t invoke setup.py directly (ganssle.io)), is only supported for R2022b and upwards according to Install MATLAB Engine API for Python – MATLAB & Simulink – MathWorks Benelux (and trying to do so despite the lack official support still generates a similar error surrounding SetuptoolsDeprecationWarning: Invalid version: ‘R2021a’).
Any help would be appreciated. I’m trying to get the matlab engine python API to work as I have a long piece of python code which inherits a single call to a MATLAB function.
For sanitary reasons, I want to couple to API to one of my virtual anaconda environments. As I’m using the R2021a release I’ve started by creating a new conda environment with python 3.8 as per the compatibility requirements Versions of Python Compatible with MATLAB Products by Release – MATLAB & Simulink (mathworks.com), and installing no further libraries. Afterwards a python –version reveals this installed Python 3.8.16.
In MATLAB I’ve confirmed the license is activated by running
license(‘inuse’)
which returns "matlab" as I went with a complete blank installation after multiple failed attempts.
When trying to actually built the engine, I’m aware I have to specify the associated python directory with the virtual environment as explained in Install MATLAB Engine API for Python in Nondefault Locations – MATLAB & Simulink – MathWorks Benelux as the default Python environment runs in an incompatible version, so I execute
"python setup.py install –prefix="C:<my_anaconda_path>envsmatlab-api-env"
which returns the following lengthy error message
=============================================================================================================
C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolsdist.py:520: SetuptoolsDeprecationWarning: Invalid version: ‘R2021a’.
!!
********************************************************************************
The version specified is not a valid version according to PEP 440.
This may not work as expected with newer versions of
setuptools, pip, and PyPI.
By 2023-Sep-26, you need to update your project and remove deprecated calls
or your builds will no longer be supported.
See https://peps.python.org/pep-0440/ for details.
********************************************************************************
!!
self._validate_version(self.metadata.version)
C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!
********************************************************************************
Please avoid running “setup.py“ directly.
Instead, use pypa/build, pypa/installer, pypa/build or
other standards-based tools.
See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
********************************************************************************
!!
self.initialize_options()
C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!
********************************************************************************
Please avoid running “setup.py“ and “easy_install“.
Instead, use pypa/build, pypa/installer, pypa/build or
other standards-based tools.
See https://github.com/pypa/setuptools/issues/917 for details.
********************************************************************************
!!
self.initialize_options()
C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolscommandegg_info.py:131: SetuptoolsDeprecationWarning: Invalid version: ‘R2021a’.
!!
********************************************************************************
Version ‘R2021a’ is not valid according to PEP 440.
Please make sure to specify a valid version for your package.
Also note that future releases of setuptools may halt the build process
if an invalid version is given.
By 2023-Sep-26, you need to update your project and remove deprecated calls
or your builds will no longer be supported.
See https://peps.python.org/pep-0440/ for details.
********************************************************************************
!!
return _normalization.best_effort_version(tagged)
Traceback (most recent call last):
File "setup.py", line 80, in <module>
setup(
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscore.py", line 185, in setup
return run_commands(dist)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscore.py", line 201, in run_commands
dist.run_commands()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilsdist.py", line 969, in run_commands
self.run_command(cmd)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolsdist.py", line 1244, in run_command
super().run_command(command)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilsdist.py", line 988, in run_command
cmd_obj.run()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolscommandinstall.py", line 80, in run
self.do_egg_install()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolscommandinstall.py", line 129, in do_egg_install
self.run_command(‘bdist_egg’)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py", line 318, in run_command
self.distribution.run_command(command)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolsdist.py", line 1244, in run_command
super().run_command(command)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilsdist.py", line 987, in run_command
cmd_obj.ensure_finalized()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py", line 111, in ensure_finalized
self.finalize_options()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolscommandbdist_egg.py", line 92, in finalize_options
ei_cmd = self.ei_cmd = self.get_finalized_command("egg_info")
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py", line 305, in get_finalized_command
cmd_obj.ensure_finalized()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_distutilscmd.py", line 111, in ensure_finalized
self.finalize_options()
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptoolscommandegg_info.py", line 219, in finalize_options
parsed_version = packaging.version.Version(self.egg_version)
File "C:Userss162286AppDataLocalanaconda3envsmatlab-api-envlibsite-packagessetuptools_vendorpackagingversion.py", line 197, in __init__
raise InvalidVersion(f"Invalid version: ‘{version}’")
setuptools.extern.packaging.version.InvalidVersion: Invalid version: ‘R2021a’
=============================================================================================================
So it seems that the official way of creating the MATLAB-python API through the setup.py script is depracated in the default setuptools (ver 67.2.2.) that comes with a fresh python 3.8 installation. The suggested alternative based to use pip install instead (based on Why you shouldn’t invoke setup.py directly (ganssle.io)), is only supported for R2022b and upwards according to Install MATLAB Engine API for Python – MATLAB & Simulink – MathWorks Benelux (and trying to do so despite the lack official support still generates a similar error surrounding SetuptoolsDeprecationWarning: Invalid version: ‘R2021a’).
Any help would be appreciated. python, matlab-engine, setup.py, setuptools MATLAB Answers — New Questions
Hello i need help with this error i am working in LQR control by LMI
A1 = [0 0;0 0];%A1
A2 = [0 10*c/a;-5*c/a 0];%A2
A3 = [0 0;0 -10*c/a];%A3
A4 = [0 10*c/a;-5*c/a -10*c/a];%A4
B = [1/(a*Ra) 1/(a*Ra);L/(a*Ra) -L/(a*Ra)];%Bi
alpha = 3;
beta = 0.1;
% تعريف مصفوفات التكلفة
Q = [6 0; 0 9];
R = 1;
% حل معادلة P B R^-1 B^T P = Q يدويًا
%[P, ~, ~] = care(A, B, Q, R);
%[K,p,e] = lqr(A,B,Q,R)
%disp(‘Matrix P calculated using manual method:’);
%disp(P)
%disp(‘Matrix K calculated using manual method:’);
%disp (K)
%% CONTROLLER: LQR via H2 control
P = sdpvar(2,2);
Y = sdpvar(2,2);
E= 1e-6
W001 = sdpvar(2,2);
W002 = sdpvar(2,2);
W003 = sdpvar(2,2);
W004 = sdpvar(2,2);
gamma = 1;
H11 = A1*P + B*W001 + (A1*P + B*W001)’ + 2*(alpha)*P;
H12 = [-Y (R^0.5)*W001; ((R^0.5)*W001)’ -P];
H13 = trace((Q^0.5)*P*(Q^0.5)’) + trace(Y);
H14 = A1*P + B*W001 + (A1*P + B*W001)’ + 2*(beta)*P;
H21 = A2*P + B*W002 + (A2*P + B*W002)’ + 2*(alpha)*P;
H22 = [-Y (R^0.5)*W002; ((R^0.5)*W002)’ -P];
H23 = A2*P + B*W002 + (A2*P + B*W002)’ + 2*(beta)*P;
H31 = A3*P + B*W003 + (A3*P + B*W003)’ + 2*(alpha)*P;
H32 = [-Y (R^0.5)*W003; ((R^0.5)*W003)’ -P];
H33 = A3*P + B*W003 + (A3*P + B*W003)’ + 2*(beta)*P;
H41 = A4*P + B*W004 + (A4*P + B*W004)’ + 2*(alpha)*P;
H42 = [-Y (R^0.5)*W004; ((R^0.5)*W004)’ -P];
H43 = A4*P + B*W004 + (A4*P + B*W004)’ + 2*(beta)*P;
F = [P>=0]+[-H11<=0]+[H12<=0]+[H13<=gamma]+[H14<=0]+[-H21<=0]+[H22<=0]+[H23<=0]+[-H31<=0]+…
[H32<=0]+[H33<=0]+[-H41<=0]+[H42<=0]+[H43<=0]…
;
ops = sdpsettings(‘solver’,’sedumi’);
% ops = sdpsettings(‘solver’,’gurobi’);
[opt_info] = optimize(F,[],ops);
Pfeasible = value (P);
P_eigs = eig(Pfeasible);
result :
Error using eig
Input matrix contains NaN or Inf.
Error in DYNAMIC2 (line 69)
P_eigs = eig(Pfeasible);A1 = [0 0;0 0];%A1
A2 = [0 10*c/a;-5*c/a 0];%A2
A3 = [0 0;0 -10*c/a];%A3
A4 = [0 10*c/a;-5*c/a -10*c/a];%A4
B = [1/(a*Ra) 1/(a*Ra);L/(a*Ra) -L/(a*Ra)];%Bi
alpha = 3;
beta = 0.1;
% تعريف مصفوفات التكلفة
Q = [6 0; 0 9];
R = 1;
% حل معادلة P B R^-1 B^T P = Q يدويًا
%[P, ~, ~] = care(A, B, Q, R);
%[K,p,e] = lqr(A,B,Q,R)
%disp(‘Matrix P calculated using manual method:’);
%disp(P)
%disp(‘Matrix K calculated using manual method:’);
%disp (K)
%% CONTROLLER: LQR via H2 control
P = sdpvar(2,2);
Y = sdpvar(2,2);
E= 1e-6
W001 = sdpvar(2,2);
W002 = sdpvar(2,2);
W003 = sdpvar(2,2);
W004 = sdpvar(2,2);
gamma = 1;
H11 = A1*P + B*W001 + (A1*P + B*W001)’ + 2*(alpha)*P;
H12 = [-Y (R^0.5)*W001; ((R^0.5)*W001)’ -P];
H13 = trace((Q^0.5)*P*(Q^0.5)’) + trace(Y);
H14 = A1*P + B*W001 + (A1*P + B*W001)’ + 2*(beta)*P;
H21 = A2*P + B*W002 + (A2*P + B*W002)’ + 2*(alpha)*P;
H22 = [-Y (R^0.5)*W002; ((R^0.5)*W002)’ -P];
H23 = A2*P + B*W002 + (A2*P + B*W002)’ + 2*(beta)*P;
H31 = A3*P + B*W003 + (A3*P + B*W003)’ + 2*(alpha)*P;
H32 = [-Y (R^0.5)*W003; ((R^0.5)*W003)’ -P];
H33 = A3*P + B*W003 + (A3*P + B*W003)’ + 2*(beta)*P;
H41 = A4*P + B*W004 + (A4*P + B*W004)’ + 2*(alpha)*P;
H42 = [-Y (R^0.5)*W004; ((R^0.5)*W004)’ -P];
H43 = A4*P + B*W004 + (A4*P + B*W004)’ + 2*(beta)*P;
F = [P>=0]+[-H11<=0]+[H12<=0]+[H13<=gamma]+[H14<=0]+[-H21<=0]+[H22<=0]+[H23<=0]+[-H31<=0]+…
[H32<=0]+[H33<=0]+[-H41<=0]+[H42<=0]+[H43<=0]…
;
ops = sdpsettings(‘solver’,’sedumi’);
% ops = sdpsettings(‘solver’,’gurobi’);
[opt_info] = optimize(F,[],ops);
Pfeasible = value (P);
P_eigs = eig(Pfeasible);
result :
Error using eig
Input matrix contains NaN or Inf.
Error in DYNAMIC2 (line 69)
P_eigs = eig(Pfeasible); A1 = [0 0;0 0];%A1
A2 = [0 10*c/a;-5*c/a 0];%A2
A3 = [0 0;0 -10*c/a];%A3
A4 = [0 10*c/a;-5*c/a -10*c/a];%A4
B = [1/(a*Ra) 1/(a*Ra);L/(a*Ra) -L/(a*Ra)];%Bi
alpha = 3;
beta = 0.1;
% تعريف مصفوفات التكلفة
Q = [6 0; 0 9];
R = 1;
% حل معادلة P B R^-1 B^T P = Q يدويًا
%[P, ~, ~] = care(A, B, Q, R);
%[K,p,e] = lqr(A,B,Q,R)
%disp(‘Matrix P calculated using manual method:’);
%disp(P)
%disp(‘Matrix K calculated using manual method:’);
%disp (K)
%% CONTROLLER: LQR via H2 control
P = sdpvar(2,2);
Y = sdpvar(2,2);
E= 1e-6
W001 = sdpvar(2,2);
W002 = sdpvar(2,2);
W003 = sdpvar(2,2);
W004 = sdpvar(2,2);
gamma = 1;
H11 = A1*P + B*W001 + (A1*P + B*W001)’ + 2*(alpha)*P;
H12 = [-Y (R^0.5)*W001; ((R^0.5)*W001)’ -P];
H13 = trace((Q^0.5)*P*(Q^0.5)’) + trace(Y);
H14 = A1*P + B*W001 + (A1*P + B*W001)’ + 2*(beta)*P;
H21 = A2*P + B*W002 + (A2*P + B*W002)’ + 2*(alpha)*P;
H22 = [-Y (R^0.5)*W002; ((R^0.5)*W002)’ -P];
H23 = A2*P + B*W002 + (A2*P + B*W002)’ + 2*(beta)*P;
H31 = A3*P + B*W003 + (A3*P + B*W003)’ + 2*(alpha)*P;
H32 = [-Y (R^0.5)*W003; ((R^0.5)*W003)’ -P];
H33 = A3*P + B*W003 + (A3*P + B*W003)’ + 2*(beta)*P;
H41 = A4*P + B*W004 + (A4*P + B*W004)’ + 2*(alpha)*P;
H42 = [-Y (R^0.5)*W004; ((R^0.5)*W004)’ -P];
H43 = A4*P + B*W004 + (A4*P + B*W004)’ + 2*(beta)*P;
F = [P>=0]+[-H11<=0]+[H12<=0]+[H13<=gamma]+[H14<=0]+[-H21<=0]+[H22<=0]+[H23<=0]+[-H31<=0]+…
[H32<=0]+[H33<=0]+[-H41<=0]+[H42<=0]+[H43<=0]…
;
ops = sdpsettings(‘solver’,’sedumi’);
% ops = sdpsettings(‘solver’,’gurobi’);
[opt_info] = optimize(F,[],ops);
Pfeasible = value (P);
P_eigs = eig(Pfeasible);
result :
Error using eig
Input matrix contains NaN or Inf.
Error in DYNAMIC2 (line 69)
P_eigs = eig(Pfeasible); lmi lqr MATLAB Answers — New Questions
Save each vector result from a for loop into a matrix
hello i kindly request for assistance. i would like to read 3 files from a file named filenr.lis. this file contains the names of these files that are stored in a directory called wavf. using a for loop, i would like the result of each file read in a matrix, one column per result. These files are not of the same length. See attached files.
Thank youhello i kindly request for assistance. i would like to read 3 files from a file named filenr.lis. this file contains the names of these files that are stored in a directory called wavf. using a for loop, i would like the result of each file read in a matrix, one column per result. These files are not of the same length. See attached files.
Thank you hello i kindly request for assistance. i would like to read 3 files from a file named filenr.lis. this file contains the names of these files that are stored in a directory called wavf. using a for loop, i would like the result of each file read in a matrix, one column per result. These files are not of the same length. See attached files.
Thank you forloop, vector, matrix MATLAB Answers — New Questions
Microsoft clamps down on Windows 11 users who want local accounts
MS has removed online steps for switching from a Microsoft account to a local one and has killed off a past trick for choosing a local account in Windows 11.
MS has removed online steps for switching from a Microsoft account to a local one and has killed off a past trick for choosing a local account in Windows 11. Read More
Integrating Smart Home Technology with Sheer Curtains
Hi everyone,
I’m exploring ways to integrate smart home technology with my sheer curtains and would love to hear your thoughts and experiences.
Discussion Points:
Smart Curtain Solutions: What are the best smart curtain systems available that work well with sheer curtains?Automation Tips: How have you automated your curtains to sync with other smart home devices like lights or thermostats?Installation Challenges: What challenges have you faced when installing smart curtain systems, and how did you overcome them?
For those looking for more information on curtain options, including smart solutions, I found some useful resources at Dubai Curtains and Blinds . They offer a variety of products and helpful guides.
Looking forward to your insights!
Thanks!
Sheikh Muhammad Bin Zahid
Hi everyone,I’m exploring ways to integrate smart home technology with my sheer curtains and would love to hear your thoughts and experiences.Discussion Points:Smart Curtain Solutions: What are the best smart curtain systems available that work well with sheer curtains?Automation Tips: How have you automated your curtains to sync with other smart home devices like lights or thermostats?Installation Challenges: What challenges have you faced when installing smart curtain systems, and how did you overcome them?For those looking for more information on curtain options, including smart solutions, I found some useful resources at Dubai Curtains and Blinds . They offer a variety of products and helpful guides.Looking forward to your insights!Thanks!Sheikh Muhammad Bin Zahid Read More
5 Free AI Sidekicks To Level Up Your Coding Skills
The article “5 Free AI Sidekicks To Level Up Your Coding Skills” from divdev blog discusses various AI-powered coding assistants that can help programmers boost their productivity. It covers five popular tools, each tool offers unique features like code completion, debugging assistance, and even natural language processing to convert plain English descriptions into functional code. These AI copilots are designed to help coders work more efficiently, navigate complex codebases, and overcome common programming challenges.
If you’re a developer looking to enhance your coding skills and streamline your workflow, this article is a must-read. It provides valuable insights into how AI can complement your coding process and potentially save you hours of work. By exploring these tools, you might discover new ways to tackle coding problems, improve your code quality, and stay up-to-date with the latest AI-assisted coding techniques. Whether you’re a beginner or an experienced programmer, these AI sidekicks could be the key to leveling up your coding game. Check out the full article to learn more about each tool’s specific features and how they can benefit your programming projects:
https://divdev.biz.id/post/ai-coding-copilots
The article “5 Free AI Sidekicks To Level Up Your Coding Skills” from divdev blog discusses various AI-powered coding assistants that can help programmers boost their productivity. It covers five popular tools, each tool offers unique features like code completion, debugging assistance, and even natural language processing to convert plain English descriptions into functional code. These AI copilots are designed to help coders work more efficiently, navigate complex codebases, and overcome common programming challenges. If you’re a developer looking to enhance your coding skills and streamline your workflow, this article is a must-read. It provides valuable insights into how AI can complement your coding process and potentially save you hours of work. By exploring these tools, you might discover new ways to tackle coding problems, improve your code quality, and stay up-to-date with the latest AI-assisted coding techniques. Whether you’re a beginner or an experienced programmer, these AI sidekicks could be the key to leveling up your coding game. Check out the full article to learn more about each tool’s specific features and how they can benefit your programming projects:https://divdev.biz.id/post/ai-coding-copilots Read More
Question about generative search and visibility for businesses
How does genAI search work, and how does a business become one of the answers genAI gives? How do you get into the ‘training data’ if that is required.
For a new business, they simply won’t be in the training set when they launch, so it’s going to be very hard to be found. Of course the current issue with the black art of seo is also difficult (I’m experiencing pain for our business as I create a new website because although our seo is ok, our speed is in the toilet so getting punished). So I see an issue for new business, and a lot of it is going ot be small business, trying to get some roots, trying to generate some leads organically. It’s not even really clear where the marketing budget of the future goes when it comes to digital and generative search.
How does genAI search work, and how does a business become one of the answers genAI gives? How do you get into the ‘training data’ if that is required.
For a new business, they simply won’t be in the training set when they launch, so it’s going to be very hard to be found. Of course the current issue with the black art of seo is also difficult (I’m experiencing pain for our business as I create a new website because although our seo is ok, our speed is in the toilet so getting punished). So I see an issue for new business, and a lot of it is going ot be small business, trying to get some roots, trying to generate some leads organically. It’s not even really clear where the marketing budget of the future goes when it comes to digital and generative search. Read More
How to update date depending on cell text
We have a requirement to forecast when a supplier is next due for an audit.
In column A we have the classification, A Critical, B Moderate, C Non-Critical and D Trivial.
In column B we have the date of the last audit.
In column C I would like to have the spreadsheet automatically forecast the date when it is next due.
A Critical – 1 year
B Moderate – 2 year
C Non-Critical – 3 year
D Trivial – N/A
How do I write a formula to do this?
We have a requirement to forecast when a supplier is next due for an audit.In column A we have the classification, A Critical, B Moderate, C Non-Critical and D Trivial.In column B we have the date of the last audit.In column C I would like to have the spreadsheet automatically forecast the date when it is next due.A Critical – 1 yearB Moderate – 2 yearC Non-Critical – 3 yearD Trivial – N/AHow do I write a formula to do this? Read More
Failed to load MCR
I have an old application that gives me an error when I run it. The error message states: "Could not find version 7.13 of the MCR. Attempting to load mclmcrrt713.dll. Please install the correct version of the MCR." I tried to install this version, but it is no longer available. Any help would be highly appreciated. Thanks!I have an old application that gives me an error when I run it. The error message states: "Could not find version 7.13 of the MCR. Attempting to load mclmcrrt713.dll. Please install the correct version of the MCR." I tried to install this version, but it is no longer available. Any help would be highly appreciated. Thanks! I have an old application that gives me an error when I run it. The error message states: "Could not find version 7.13 of the MCR. Attempting to load mclmcrrt713.dll. Please install the correct version of the MCR." I tried to install this version, but it is no longer available. Any help would be highly appreciated. Thanks! answers MATLAB Answers — New Questions
Automatic Synchronization unit (ASU)
Hi guys, im working on a control system of a microgrid and it requires an automatic synchronization unit. According to the reference paper being used for the model the ASU This unit tests the realization of ideal conditions of synchronization. At the correct instant this unit gives control logic signals to circuit breaker and changeover switches S1 and S2 to select the appropriate configuration of active and reactive power.
The ASU checks the grid voltage and the voltage form the microgrid control output and creates a signal which is sent to switches and breakers to control the operation. I am unsure exactly how this system is implemented and the refference does not specify any detail of the design of the simulink block. I would like some assistance if possible.
Attached are the reference papers which I am reffeering to.https://www.researchgate.net/publication/329075194_Improvement_of_Microgrid_System_Using_Synchronverters
https://www.researchgate.net/publication/323151274_Modeling_analysis_and_design_of_Synchronverters_for_Microgrid_ApplicationsHi guys, im working on a control system of a microgrid and it requires an automatic synchronization unit. According to the reference paper being used for the model the ASU This unit tests the realization of ideal conditions of synchronization. At the correct instant this unit gives control logic signals to circuit breaker and changeover switches S1 and S2 to select the appropriate configuration of active and reactive power.
The ASU checks the grid voltage and the voltage form the microgrid control output and creates a signal which is sent to switches and breakers to control the operation. I am unsure exactly how this system is implemented and the refference does not specify any detail of the design of the simulink block. I would like some assistance if possible.
Attached are the reference papers which I am reffeering to.https://www.researchgate.net/publication/329075194_Improvement_of_Microgrid_System_Using_Synchronverters
https://www.researchgate.net/publication/323151274_Modeling_analysis_and_design_of_Synchronverters_for_Microgrid_Applications Hi guys, im working on a control system of a microgrid and it requires an automatic synchronization unit. According to the reference paper being used for the model the ASU This unit tests the realization of ideal conditions of synchronization. At the correct instant this unit gives control logic signals to circuit breaker and changeover switches S1 and S2 to select the appropriate configuration of active and reactive power.
The ASU checks the grid voltage and the voltage form the microgrid control output and creates a signal which is sent to switches and breakers to control the operation. I am unsure exactly how this system is implemented and the refference does not specify any detail of the design of the simulink block. I would like some assistance if possible.
Attached are the reference papers which I am reffeering to.https://www.researchgate.net/publication/329075194_Improvement_of_Microgrid_System_Using_Synchronverters
https://www.researchgate.net/publication/323151274_Modeling_analysis_and_design_of_Synchronverters_for_Microgrid_Applications simulink, microgrid, grid synchronization, controls MATLAB Answers — New Questions