top of page
Search
Writer's pictureIvaylo Fiziev

Cyclic evaluation of scripts


In Process Simulate SCL scripts are executed periodically. The execution rate is defined by the ‘LB Update Rate’ in CEE mode. In PLC mode the rate is fixed to 100ms. You can think of each execution as a ‘cycle’. So on each cycle the script logic relies on the state of the variables.


Variable types:


  1. Inputs – the values of these variables are provided by Process Simulate before each cycle. They can be associated with signals or default values.

  2. Outputs – the values of these variables are provided by the script after each cycle. PS associates them with signals basically.

  3. InOut – These are bi-directional variables that can serve as both inputs and outputs at the same time.

  4. Static – These are variables (internal for the script) that preserve their values between script executions (cycles).

  5. Temp – These are variables (internal for the script) that are allocated/deallocated on each script execution (cycle). They do not preserve their values between script execution. Usually used as local variables.

  6. Constants – These are variables (internal for the script) that can only be read. E.g. read -only.


Side note:

If you use a timer as a Temp variable the timer won’t work because a new timer is created on each script execution. e.g. it will never elapse.

As a static variable however it works because the same timer instance is used on each script execution.


The usage is slightly different compared to most programming languages as you already see. SCL is mainly used for PLC programming and the concept comes from there.

You can think of a SCL script as a virtual PLC associated with the resource.

14 views0 comments

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page