Regulate Current with User Subroutine Using Groovy Language

Groovy Language is a dynamic language with features similar to those of Python, Ruby, Perl, and Smalltalk. Groovy is an object-oriented programming language for the Java platform. Most Java code is also syntactically valid Groovy, although semantics may be different.
For the Switched Reluctance Motor, a specific command of current is often used with a chopper in order to decrease the current ripple or hysteresis band. In this example (see Figure 1) discover how to implement such a command using groovy language.

Geometry of the SRM

Figure 1: Geometry of the SRM

Associated circuit of the SRM

Associated circuit of the SRM

 

 

 

 

 

This is a type of stepper motor: the movement of the rotor is a result of alternately exciting a pair of motor poles. In this case the SRM is driven by a voltage supply of 12V and the speed is 500 rpm. In the electric circuit, a specific command will be associated to the switches. The use of an I/O parameter defined by a user function written in groovy will allow the introduction of conditions. Starting from a predefined list of parameters (here current, maximum and minimum value of current, number of switches), the groovy function can define if the switch will be on or off.
The goal is to have a current between a minimum and maximum set as in figure 3. Without the user subroutine, currents can lead to very high saturation levels, which can be seen when we check the flux density.

Figure 3: Current obtained with the regulation

Figure 3: Current obtained with the regulation

Discover how to customize I/O parameters using groovy language in the following article : Regulate Current with User Subroutine Using Groovy Language in Flux®