Tutorial 1: Create a component

In this first tutorial, we will show you some key ideas of

Concepts

Throughout the tutorial, you need an understanding of the following concepts:

Now let's start with VIGO6

What you need to build - control logic

1. You need to build the light green component in the picture to the left. You specify a setpoint. When the temperature is below the setpoint, the component should turn on an output connected to a heating element. But, when the temperature is above the setpoint, the output should turn off.

2. You "measure" the temperature with a 4-20 mA temperature transmitter.

3. The regulation is a simple on/off controller with a temperature hysteresis. You control the regulating interval with a timer.

What you need to build - view

 

You need to be able to

Step 1 - Create a temperature regulator component

1. Open the component.

    a. Click on the "open type"-icon (or press "CTRL-O").

    b. Then select "COMPONENTS>>".

    c. You can now type any part of the name or

Step 2 - Create variables and constants in your component

 

1. Add an     a. Right-click on the section "    b. Click on "Add constant".

    c. Choose PD_2003 Float32.

    d. Change the name to Regulating_interval.

    e. Right-click on the variable and press "It defines how often the regulator runs.

2. Add a     a. Right-click on the section "    b. Click on "Add variable".

    c. Choose PD_2003 Float32.

    d. Change the name to Actual_temperature_value.

    e. Right-click on the variable and press "It holds the actual temperature.

3. Add a

Step 3 - Add subcomponents - registers and timer

We want to make the

Add registers

1.

Add a timer, so you can repeat your regulation at defined intervals:
    a. Add PD_4404 Timer_

Step 4 - Add connectors

 
 

Your temperature regulator component will need to interface with already made components. First, for reading a temperature (the orange component on the drawing to the left), second for setting a digital output (the blue component on the drawing). Hence you need to add

Create a connection to the output component

Assignment of a value to a variable

On the left of ’:=’ you write the name of the variable, you want to assign a value to. On the right side is the value. For example, a constant, variable, or

Step 5 - Add a method and write your control code

Now you need to write the actual piece of code that will enable your component to make the wanted regulation.

Create a new method:

1. Right-click on the Name it Regulate.

Write code for your temperature control:
You can right-click and use "select identifier" and "code templates" instead of writing all the code yourself.
 

1. Read the temperature from the input component into the Actual_temperature" in the control component.

2. If the temperature is lower than the setpoint, then open the output.

3. In all other cases close the output.

Here is what your code should look like:

Step 6 - Repeat the regulation

You need to make sure that your regulation keeps running at specific intervals, and for this, you use the

Step 7 - Handle the startup in Init

You need to be sure that your system is in a known state before you start your regulation.

1. ‘Init your Temperature_regulator_simple component.

2. Call the Timermethod after ‘What your code should look like:

NB: The editor inserts ‘Call_asynchronously’ when you call a

Visualization

Step 8- Create a view of the temperature regulator component.

Your component should be able to

Congratulations. Finally, you have created your control component with control logic and a

 

And to recap, here is what you have built:

Now let us move to the next tutorial where you learn how to create