×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 1853767, Entry date: 12/15/2008
(9)
Rate

With STEP 7, how can you control servovalves, frequency converters or current converters via a ramp-function generator?

  • Entry
  • Associated product(s)
Introduction: Here is an example of how to realize a ramp generator. The ramp generator is implemented in the function FC10. There is also a WinCC project that you can use to test and follow the function. ...

Introduction:
Here is an example of how to realize a ramp generator. The ramp generator is implemented in the function FC10. There is also a WinCC project that you can use to test and follow the function.

Contents:

  1. Description of the function
  2. Description of the parameters  
  3. Description of FC10 networks  
  4. Download - documents
  5. Download - sample projects

1. Description of the function
With this program, the ACTUAL value is made to approach a preset maximum or minimum value at a preset speed. The function here is independent of the OB1 cycle. The ramp function can also be used for damping when approaching a setpoint value.

A function run could look liked this:

 


Bild 01

In this case, the output value of the function is taken by travelling first from the null value to the minimum value and then to the maximum value.

Note:
If the ramp changes suddenly, then the increment (Plus or Minus) or the "Time per step" is configured incorrectly.

Remedy:
Change the values to realistic values according to your application.
 

Parameter

Values in the example

Increment (Plus / Minus) 1,000
Time per step (ms) 500

2. Description of the parameters
 

Name

Type

Declaration

Comments

Activate

BOOL

in

1 - the ramp function is executed
0 - the ACTUAL value set to the null point (zero value)

R_max

BOOL

in

1 - the ACTUAL value goes to the specified maximum value

R_min

BOOL

in

1 - the ACTUAL value goes to the specified minimum value

R_max / R_min

 

 

Both 0 - the ACTUAL value goes to the specified null point
Both 1 - the ACTUAL value goes to the specified null point

R_OK

BOOL

in_out

The bit is set when the ACTUAL value reaches the setpoint value.

Max_Value

REAL

in_out

Specified input to run up the ramp, maximum value

Null_Point

REAL

in_out

Ramp reset value, zero value

Min_Value

REAL

in_out

Specified input to run down the ramp, minimum value

Actual_Value

REAL

in_out

Output value: current ramp value, ACTUAL value

R_plus

REAL

in_out

Increment for running up the ramp

R_minus

REAL

in_out

Increment for running down the ramp (ramp return)

R_Time

DWORD

in_out

Time in milliseconds for one step
e.g. increment: 1000
time: 1000 ms
Here the actual value is incremented by 1000 in 1 second, but only until the setpoint value is reached (e.g. R_max/R_min). This defines the degree of increase.

MEG_Time

DWORD

in_out

This is the cycle time of the CPU, which is read out of OB1
L #OB1_PREV_CYCLE
T "OB1Cycle"
With "OB1Cycle" (MD123), the FC10 is switched to MEG_Time.
The time function is not available if an incorrect cycle specification is given.

Notes:

  • If R_max and R_min are identical, the function brings the ramp value Actual_Value to the initial value Null_Point.
  • If you enter the value 0 for the parameters R_plus, R_minus or R_Time, the function corrects the value to 1.
  • If you enter a negative value for the parameters R_plus, R_minus or R_Time, the function turns it into a positive value.
  • Max Value, Min Value and Null Point are interchangeable. The ramp is always run to the value preset with the parameters R_max and R_min. If, for example, you have set R_max = 1 and R_min = 0, then the actual value approaches the maximum value set. Null_Point can also be set to less than Min_Value or greater than Max_Value.

Special points:

  • If the ACTUAL value is greater than the setpoint value, the function takes the parameter R_minus as increment.
  • If the ACTUAL value is less than the setpoint value, the function takes the parameter R_plus as increment. This is done regardless of the settings of parameters R_max and R_minus.
  • In order to keep the cycle independent of the OB1 cycle, you must match the parameter MEG_Time with the local tag OB1_PREV_CYCLE. The function evaluates the parameter MEG_Time and changes the parameters R_Time, R_Plus and R_minus accordingly.
  • The function can change the parameters automatically. If you wish to continue using the parameters R_Time, R_Plus and R_minus in your program, you must buffer the parameters.

3. Description of FC10 networks
 

No.

Title

Comments

1

Reset R_OK bit

Values are always set for the program to ensure easy programming and execution.

2

Checking the Activate bit

If the Activate bit is not set, the ACTUAL value is set to the null point and the function is terminated.

3

Check input values

The parameters R_Time, R_plus and R_minus are checked. These basic values are corrected if necessary so that the ramp function can be executed without any errors.

4

Set ramp increment

The ramp can be approached in two different increments. The function compares ACTUAL and setpoint values and loads the appropriate increment accordingly.

5

Calculate time factor in increment

To ensure that the ramp does not depend on the cycle time, the time value is calculated in the increment.

6

Execute ramp function

The ACTUAL value is changed with the calculated increment in the direction of the current setpoint valued. Then a check is made to see whether the setpoint value has been overrun and this is corrected if necessary.

4. Document download:
In the following PDF document you will find the STL source of function FC10 that implements the ramp function.

FC10_1.pdf ( 7 KB )

The following PDF document contains a sample ramp function call. Note that you must buffer the local parameter OB1_PREV_CYCLE before the call.

ob1_1.pdf ( 3 KB )

The following PDF document contains the description of the symbols.

Symboltable_1.pdf ( 6 KB )

5. Download - sample projects
The following ZIP archive contains the STEP 7 sample project.

Attachment 1: Rampe_1.zip ( 310 KB )

The following ZIP archive contains as sample WinCC project. Copy the file to your hard disk. Double-click the archive to extract it into a directory. Figure 01 above is configured in the "Sample.pdl" file. The Tag Management contains a PROFIBUS connection with the following parameters:

  • Station address 2
  • Slot number 2

You might have to adapt these parameters to your hardware configuration.

Attachment 2a: WinCCSample_1_V6_2_2.zip ( 10488 KB )

The following download contains the analog WinCC flexible project:

Attachment 3: WinCC_flexible_Sample_1.zip ( 1490 KB )

Runnability and test environment:
The following table lists the components that have been used to create this entry and verify the functions described.

Components Product and version designation
PC operating system Microsoft Windows XP SP2
Standard tools -
Engineering tool STEP 7 V5.4 SP3 HF1
HMI software WinCC V6.2 SP2 & WinCC V7.0
WinCC flexible 2007 HF4
HMI system WinCC PC Runtime
WinCC flexible PC Runtime

Keywords:
Ramp, Power-up ramp, Startup ramp

 

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
https://www.siemens.com/cybersecurity#Ouraspiration.