Contrôler l'action #3

Contrôler l'action #3




🛑 TOUTES LES INFORMATIONS CLIQUEZ ICI 👈🏻👈🏻👈🏻

































Contrôler l'action #3
Be the first to get exclusive content straight to your email.
We promise not to spam you. You can unsubscribe at any time.
2022 © Reproduction without explicit permission is prohibited. - PLC SCADA Courses - Engineers Community
Be the first to get exclusive content straight to your email.
We promise not to spam you. You can unsubscribe at any time.
Air to open/close valves and direction of control action
Control valves come in two sorts: air to open; and air to close.
Air to open valves are normally held closed by the spring and require air pressure (a control signal) to open them – they open progressively as the air pressure increases.
Air to close valves are valves which are held open by the valve spring and require air pressure to move them towards the closed position.
The reason for the two types of valves is to allow fail safe operation. In the event of a plant instrument air failure it is important that all control valves fail in a safe position (e.g. an exothermic reactor’s feed valves (or, perhaps, just one of the valves) should fail closed (air to open) and its coolant system valves fail open (air to close)).
The type of valve used obviously impacts on what a controller has to do – changing the type of valve would mean that the controller would need to move the manipulation in the opposite direction.
To simplify things in this course we shall assume that we are always using air to open valves – an increase in control action will cause the valve to open and the flow through it to increase.
The other important thing you need to understand is the direction of control action. Consider the system shown in the diagram.
In this process I have connected a level controller to the bottom valve. For this configuration the controller needs to increase its signal (and hence the flow) when the level in the tank increases.
In this case the controller needs to reduce the flow when the level in the tank increases.
Both configurations are equally capable of controlling the level, but they require the controller to do entirely opposite things. This is what direction of control action involves.
A direct acting controller is one whose output tends to increase as the measurement signal increases.
A reverse acting controller is one whose output tends to decrease as the measurement signal increases.
All control systems are programmable (usually marked DIR/REV) which allows the controller to be switched from direct acting to reverse acting or vice versa.
It is important to get the correct direction of control action. If things are set-up correctly a feedback control system will experience negative feedback, which means that the system will act to reduce errors in its output.
If you get the direction of control action wrong the system will undergo positive feedback and will act to reinforce output errors – this is very likely to cause the system to go unstable. If you are having problems in setting up a stable controller the first thing to check is that you have set the correct direction of control action!
If a fail open control valve is paired with a direct acting controller we get the following process performance: On rising process level the controller output rises which closes the valve.
If the process level is below the set point the controller would be wide open.
This would behave similar to a direct acting regulator only the valve / controller response is slower.
In this case when the process level rises the controller output decreases which tends to open the valve.
If the process level is below the set point the valve is closed.
An example of this application is a compressor recycle valve.
This is the same as the fail open valve / reverse acting controller. An increase in process level means an increase in controller output which means the valve is opened.
If the process level is below the set point the valve is closed. A typical application is backpressure control. (In this case the valve controller acts similar to that of a PSV.)
A rise in process level means a decrease in controller output which means the valve is closed.
If the process level is below the set point the valve is open.
This is typically used for pressure control.





Table of contents



Exit focus mode





















Light



















Dark



















High contrast























Light



















Dark



















High contrast




This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
ASP.NET Core controllers use the Routing middleware to match the URLs of incoming requests and map them to actions . Route templates:
Actions are either conventionally-routed or attribute-routed . Placing a route on the controller or action makes it attribute-routed. See Mixed routing for more information.
The ASP.NET Core MVC template generates conventional routing code similar to the following:
MapControllerRoute is used to create a single route. The single route is named default route. Most apps with controllers and views use a route template similar to the default route. REST APIs should use attribute routing .
The route template "{controller=Home}/{action=Index}/{id?}" :
Matches a URL path like /Products/Details/5
Extracts the route values { controller = Products, action = Details, id = 5 } by tokenizing the path. The extraction of route values results in a match if the app has a controller named ProductsController and a Details action:
MyDisplayRouteInfo is provided by the Rick.Docs.Samples.RouteInfo NuGet package and displays route information.
/Products/Details/5 model binds the value of id = 5 to set the id parameter to 5 . See Model Binding for more details.
{controller=Home} defines Home as the default controller .
{action=Index} defines Index as the default action .
The ? character in {id?} defines id as optional.
Produces the route values { controller = Home, action = Index } .
The values for controller and action make use of the default values. id doesn't produce a value since there's no corresponding segment in the URL path. / only matches if there exists a HomeController and Index action:
Using the preceding controller definition and route template, the HomeController.Index action is run for the following URL paths:
The URL path / uses the route template default Home controllers and Index action. The URL path /Home uses the route template default Index action.
The convenience method MapDefaultControllerRoute :
Routing is configured using the UseRouting and UseEndpoints middleware. To use controllers:
Apps typically don't need to call UseRouting or UseEndpoints . WebApplicationBuilder configures a middleware pipeline that wraps middleware added in Program.cs with UseRouting and UseEndpoints . For more information, see Routing in ASP.NET Core .
Conventional routing is used with controllers and views. The default route:
The preceding is an example of a conventional route . It's called conventional routing because it establishes a convention for URL paths:
Using this default route, the URL path:
Using conventional routing with the default route allows creating the app without having to come up with a new URL pattern for each action. For an app with CRUD style actions, having consistency for the URLs across controllers:
The id in the preceding code is defined as optional by the route template. Actions can execute without the optional ID provided as part of the URL. Generally, when id is omitted from the URL:
Attribute routing provides fine-grained control to make the ID required for some actions and not for others. By convention, the documentation includes optional parameters like id when they're likely to appear in correct usage.
Most apps should choose a basic and descriptive routing scheme so that URLs are readable and meaningful. The default conventional route {controller=Home}/{action=Index}/{id?} :
Enable Logging to see how the built-in routing implementations, such as Route , match requests.
Attribute routing is explained later in this document.
Multiple conventional routes can be configured by adding more calls to MapControllerRoute and MapAreaControllerRoute . Doing so allows defining multiple conventions, or to adding conventional routes that are dedicated to a specific action , such as:
The blog route in the preceding code is a dedicated conventional route . It's called a dedicated conventional route because:
Because controller and action don't appear in the route template "blog/{*article}" as parameters:
/Blog , /Blog/Article , and /Blog/{any-string} are the only URL paths that match the blog route.
See Routing for reference material on routing.
Conventional routing only matches a combination of action and controller that are defined by the app. This is intended to simplify cases where conventional routes overlap.
Adding routes using MapControllerRoute , MapDefaultControllerRoute , and MapAreaControllerRoute automatically assign an order value to their endpoints based on the order they are invoked. Matches from a route that appears earlier have a higher priority. Conventional routing is order-dependent. In general, routes with areas should be placed earlier as they're more specific than routes without an area. Dedicated conventional routes with catch-all route parameters like {*article} can make a route too greedy , meaning that it matches URLs that you intended to be matched by other routes. Put the greedy routes later in the route table to prevent greedy matches.
A catch-all parameter may match routes incorrectly due to a bug in routing. Apps impacted by this bug have the following characteristics:
See GitHub bugs 18677 and 16579 for example cases that hit this bug.
An opt-in fix for this bug is contained in .NET Core 3.1.301 SDK and later . The following code sets an internal switch that fixes this bug:
When two endpoints match through routing, routing must do one of the following:
The preceding controller defines two actions that match:
This is a typical pattern for MVC controllers:
The HttpPostAttribute , [HttpPost] , is provided to routing so that it can choose based on the HTTP method of the request. The HttpPostAttribute makes Edit(int, Product) a better match than Edit(int) .
It's important to understand the role of attributes like HttpPostAttribute . Similar attributes are defined for other HTTP verbs . In conventional routing , it's common for actions to use the same action name when they're part of a show form, submit form workflow. For example, see Examine the two Edit action methods .
If routing can't choose a best candidate, an AmbiguousMatchException is thrown, listing the multiple matched endpoints.
The strings "blog" and "default" in the following examples are conventional route names:
The route names give the route a logical name. The named route can be used for URL generation. Using a named route simplifies URL creation when the ordering of routes could make URL generation complicated. Route names must be unique application wide.
The route name concept is represented in routing as IEndpointNameMetadata . The terms route name and endpoint name :
REST APIs should use attribute routing to model the app's functionality as a set of resources where operations are represented by HTTP verbs .
Attribute routing uses a set of attributes to map actions directly to route templates. The following code is typical for a REST API and is used in the next sample:
In the preceding code, MapControllers is called to map attribute routed controllers.
The HomeController.Index action is run for any of the URL paths / , /Home , /Home/Index , or /Home/Index/3 .
This example highlights a key programming difference between attribute routing and conventional routing . Attribute routing requires more input to specify a route. The conventional default route handles routes more succinctly. However, attribute routing allows and requires precise control of which route templates apply to each action .
With attribute routing, the controller and action names play no part in which action is matched, unless token replacement is used. The following example matches the same URLs as the previous example:
The following code uses token replacement for action and controller :
The following code applies [Route("[controller]/[action]")] to the controller:
In the preceding code, the Index method templates must prepend / or ~/ to the route templates. Route templates applied to an action that begin with / or ~/ don't get combined with route templates applied to the controller.
See Route template precedence for information on route template selection.
The following keywords are reserved route parameter names when using Controllers or Razor Pages:
Using page as a route parameter with attribute routing is a common error. Doing that results in inconsistent and confusing behavior with URL generation.
The special parameter names are used by the URL generation to determine if a URL generation operation refers to a Razor Page or to a Controller.
The following keywords are reserved in the context of a Razor view or a Razor Page:
These keywords shouldn't be used for link generations, model bound parameters, or top level properties.
ASP.NET Core has the following HTTP verb templates:
ASP.NET Core has the following route templates:
Attribute routing can use HttpMethodAttribute attributes such as HttpPostAttribute , HttpPutAttribute , and HttpDeleteAttribute . All of the HTTP verb attributes accept a route template. The following example shows two actions that match the same route template:
When building a REST API, it's rare that you'll need to use [Route(...)] on an action method because the action accepts all HTTP methods. It's better to use the more specific HTTP verb attribute to be precise about what your API supports. Clients of REST APIs are expected to know what paths and HTTP verbs map to specific logical operations.
REST APIs should use attribute routing to model the app's functionality as a set of resources where operations are represented by HTTP verbs. This means that many operations, for example, GET and POST on the same logical resource use the same URL. Attribute routing provides a level of control that's needed to carefully design an API's public endpoint layout.
Since an attribute route applies to a specific action, it's easy to make parameters required as part of the route template definition. In the following example, id is required as part of the URL path:
The Products2ApiController.GetProduct(int) action:
The [Consumes] attribute allows an action to limit the supported request content types. For more information, see Define supported request content types with the Consumes attribute .
See Routing for a full description of route templates and related options.
For more information on [ApiController] , see ApiController attribute .
The following code defines a route name of Products_List :
Route names can be used to generate a URL based on a specific route. Route names:
Route names must be unique application-wide.
Contrast the preceding code with the conventional default route, which defines the id parameter as optional ( {id?} ). The ability to precisely specify APIs has advantages, such as allowing /products and /products/5 to be dispatched to different actions.
To make attribute routing less repetitive, route attributes on the controller are combined with route attributes on the individual actions. Any route templates defined on the controller are prepended to route templates on the actions. Placing a route attribute on the controller makes all actions in the controller use attribute routing.
Both of these actions only match HTTP GET because they're marked with the [HttpGet] attribute.
Route templates applied to an action that begin with / or ~/ don't get combined with route templates applied to the controller. The following example matches a set of URL paths similar to the default route.
The following table explains the [Route] attributes in the preceding code:
Routing builds a tree and matches all endpoints simultaneously:
For example, an attribute route like blog/search/{topic} is more specific than an attribute route like blog/{*article} . The blog/search/{topic} route has higher priority, by default, because it's more specific. Using conventional routing , the developer is responsible for placing routes in the desired order.
Attribute routes can configure an order using the Order property. All of the framework provided route attributes include Order . Routes are processed according to an ascending sort of the Order property. The default order is 0 . Setting a route using Order = -1 runs before routes that don't set an order. Setting a route using Order = 1 runs after default route ordering.
Avoid depending on Order . If an app's URL-space requires explicit order values to route correctly, then it's likely confusing to clients as well. In general, attribute routing selects the correct route with URL matching. If the default order used for URL generation isn't working, using a route name as an override is usually simpler than applying the Order property.
Consider the following two controllers which both define the route matching /home :
Requesting /home with the preceding code throws an exception similar to the following:
Adding Order to one of the route attributes resolves the ambiguity:
With the preceding code, /home runs the HomeController.Index endpoint. To get to the MyDemoController.MyIndex , request /home/MyIndex . Note :
See Razor Pages route and app conventions: Route order for information on route order with Razor Pages.
In some cases, an HTTP 500 error is returned with ambiguous routes. Use logging to see which endpoints caused the AmbiguousMatchException .
For convenience, attribute routes support token replacement by enclosing a token in square-brackets ( [ , ] ). The tokens [action] , [area] , and [controller] are replaced with the values of the action name, area name, and controller name from the action where the route is defined:
Token replacement occurs as the last step of building the attribute routes. The preceding example behaves the same as the following code:
If you are reading this in a language other than English, let us know in this GitHub discussion issue if you'd like to see the code comments in your native language.
Attribute routes can also be combined with inheritance. This is powerful combined with token replac
Fétichiste du pied avec une brune délicieuse
Maginifique duo de pornostars dans un trio excitant
Jeunes et sans entraves personnalités Orgie portées à l\’orgasme beaucoup de ses membres et participants, qui même ne se doutait pas qu\’elle.

Report Page