Escolar Documentos
Profissional Documentos
Cultura Documentos
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
Warranty and Liability
Note
The Application Examples are not binding and do not claim to be complete
regarding the circuits shown, equipping and any eventuality. The Application
Examples do not represent customer-specific solutions. They are only intended
to provide support for typical applications. You are responsible for ensuring that
the described products are used correctly. These application examples do not
relieve you of the responsibility to use safe practices in application, installation,
operation and maintenance. When using these Application Examples, you
recognize that we cannot be made liable for any damage/claims beyond the
liability clause described. We reserve the right to make changes to these
Application Examples at any time without prior notice.
If there are any deviations between the recommendations provided in these
application examples and other Siemens publications e.g. Catalogs the
contents of the other documents have priority.
We do not accept any liability for the information contained in this document.
Any claims against us based on whatever legal reason resulting from the use of
the examples, information, programs, engineering and performance data etc.,
described in this Application Example shall be excluded. Such an exclusion shall
not apply in the case of mandatory liability, e.g. under the German Product Liability
Act (Produkthaftungsgesetz), in case of intent, gross negligence, or injury of life,
body or health, guarantee for the quality of a product, fraudulent concealment of a
deficiency or breach of a condition which goes to the root of the contract
(wesentliche Vertragspflichten). The damages for a breach of a substantial
contractual obligation are, however, limited to the foreseeable damage, typical for
the type of contract, except in the event of intent or gross negligence or injury to
life, body or health. The above provisions do not imply a change of the burden of
proof to your detriment.
Any form of duplication or distribution of these Application Examples or excerpts
hereof is prohibited without the expressed consent of Siemens Industry Sector.
Caution
The functions and solutions described in this article confine themselves to the
realization of the automation task predominantly. Please take into account
furthermore that corresponding protective measures have to be taken up in the
context of Industrial Security when connecting your equipment to other parts of the
plant, the enterprise network or the Internet. Further information can be found
under the Item-ID 50203404.
http://support.automation.siemens.com/WW/view/en/50203404
Table of Contents
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 3
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
Table of Contents
Warranty and Liability .............................................................................................. 2
Table of Contents ..................................................................................................... 3
1 Automation Problem ...................................................................................... 5
2 Automation Solution ...................................................................................... 6
2.1 Required Basic Knowledge ................................................................ 6
2.2 Components ...................................................................................... 6
2.2.1 SENTRON PAC3200 ......................................................................... 6
2.3 Load control principle ......................................................................... 7
Data acquisition and switching commands ......................................... 7
Measured data of the SENTRON PAC3200 devices .......................... 8
Base quantity for load control ............................................................. 9
Base load and electrical losses .......................................................... 9
Criteria for switching off loads ............................................................ 9
Criteria for switching loads back on .................................................. 11
Priority list ........................................................................................ 12
2.4 Data logging .................................................................................... 13
2.5 Error messages ............................................................................... 14
2.6 Hardware and programming software of the sample project ............. 15
Products. ............................................................................... 15
Programming package ..................................................................... 16
2.7 Wiring of the sample project ............................................................. 17
2.8 Communication principle .................................................................. 17
Client-server relationship ................................................................. 17
The MB_CLIENT instruction ............................................................ 18
Access to the Modbus data register ................................................. 19
Serial communication....................................................................... 19
Network addresses .......................................................................... 20
2.9 Program description......................................................................... 20
2.9.1 Block structure ................................................................................. 21
OB100 Startup............................................................................ 21
OB1 Main ................................................................................... 21
FB501 LoadSwitching, DB501 LoadSwitching_DB ................. 21
FB1084 MB_CLIENT .................................................................. 22
FC502 CALC_P_active_av ......................................................... 22
FC161 Event .............................................................................. 22
FC501 Load_shedding ............................................................... 23
DB503 PAC_data ....................................................................... 23
2.9.2 User parameters .............................................................................. 23
Load-independent parameters in LoadSwitching_DB ....................... 23
Load-dependent parameters in DB PAC_data ............................... 25
2.9.3 Program flow in FB501 LoadSwitching .......................................... 27
Networks. ....................................................................... 27
Sequencer ....................................................................................... 27
2.10 Visualization .................................................................................... 29
Main screen (start screen) ............................................................... 29
Consumer load list screen ............................................................. 30
Error messages screen.................................................................. 30
3 Configuration ................................................................................................ 31
3.1 SIMATIC software installation .......................................................... 31
3.2 Parameterizing the SENTRON PAC3200 devices ............................ 31
3.3 Configuring the HMI ......................................................................... 32
3.4 Settings on the development system (Windows) .............................. 33
3.4.1 Assigning the IP address to the development system ....................... 33
Table of Contents
4
Switching Loads with S7
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
3.4.2 Setting the PG/PC interface ............................................................. 35
3.5 Parameter assignments in the TIA Portal and project download ....... 36
Opening the project ......................................................................... 36
Setting the country-specific local time .............................................. 37
Load settings for the live demo ........................................................ 37
Downloading the control program to the CPU ................................... 38
Setting the CPU clock ...................................................................... 38
Downloading the HMI project part to the KTP600 ............................. 39
Simulating the KTP600 .................................................................... 40
3.6 Expanding the number of SENTRON PAC3200 devices .................. 41
3.6.1 Expansions in data blocks ............................................................... 41
LoadSwitching_DB [DB501] ............................................................. 41
PAC_data [DB503] .......................................................................... 41
3.6.2 Expansions in the Load list HMI screen ......................................... 42
3.6.3 Expansions in the Error messages HMI screen .............................. 44
4 Live demo ..................................................................................................... 45
4.1 Switching behavior .......................................................................... 45
4.2 Error messages ............................................................................... 46
4.3 Data log ........................................................................................... 46
5 Glossary ........................................................................................................ 49
6 Code Elements ............................................................................................. 51
7 References .................................................................................................... 51
8 History .......................................................................................................... 52
1 Automation Problem
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 5
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
1 Automation Problem
Power utilities charge industrial electricity customers not only for the active energy
consumed (in kWh, kWh rate), but they also charge another price dependent on a
power limit (in kW, price per kW). If this power limit specified by the power utility is
exceeded, an additional price per kW has to be charged for the entire accounting
period (e.g., 1 month or 1 year, depending on the terms of the contract).
The power limit is defined as the average of the total electric power imported over a
defined measuring period. Generally, this has a duration of 15 minutes. The power
utility starting with the full hour thus measures the 15-minute energy
consumption and then divides this value by the time to calculate 15-minute average
power demands. If a single one of these power values exceeds the specified power
limit within the accounting period, the price per kW must be paid for the entire
accounting period.
To avoid this, large-scale electricity customers temporarily switch off dispensable
loads. Now the task in this application is as follows:
- Relative to the start of the respective measuring period, the total average
power demand of all loads is to be permanently determined to forecast it for
the end of the measuring period. If it is expected that the power limit will be
exceeded, loads are to be temporarily switched off according to a priority list.
- The respective total average power demands at the end of the measuring
periods are to be logged over at least the accounting period to furnish proof to
the power utility.
Figure 1-1: Task
Load 1
(interruptible)
Load 2
(interruptible)
Load n
(interruptible)
Load 1
(non-interruptible)
Load 2
(non-interruptible)
Load n
(non-interruptible)
Infeed
Measurement of electrical energy
and power by power util ity
Separate power
measurement
2 Automation Solution
2.1 Required Basic Knowledge
6
Switching Loads with S7
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
2 Automation Solution
2.1 Required Basi c Knowledge
A general knowledge of the field of electrical engineering is required to understand
this application example.
Knowledge of the relevant safety regulations and standards is required for
installing and connecting the components.
You should be familiar with PLC handling, especially SIMATIC S7-1200 and with
the TIA portal as a platform for programming and commissioning.
Knowledge concerning load management and optimizing energy delivery is helpful.
2.2 Components
- A SIMATIC S7-1200 CPU (see /2/) is used for load control.
- SENTRON PAC3200 multi-function measuring instruments are used to
measure the power or electrical energy of the loads.
- A KTP600 operator panel is used as the HMI (see /10/).
2.2.1 SENTRON PAC3200
The link to the multi-function measuring instrument you find in
chap. 7 References (/1/).
Abbildung 2-1: SENTRON PAC3200
Find a short summary of the measuring devices features below.
Features
The SENTRON PAC3200 is a Power Monitoring Device for displaying all the
relevant system parameters in low-voltage power distribution. It is capable of
single-phase, two-phase or three-phase measurement and can be used in two-
wire, three-wire and four-wire systems.
2 Automation Solution
2.3 Load control principle
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 7
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
Thanks to its compact design in 96 x 96 mm format, it is an ideal replacement for
all conventional analog indicating instruments.
Thanks to its large measured voltage range, the SENTRON PAC3200 with multi-
range power supply can be connected direct in any low-voltage system up to a
rated system voltage of 690 V.
For the device version with extra-low voltage power supply, direct connection to
systems up to 500 V is permissible.
Higher voltages can be measured using voltage transformers. For measuring
current, either x/1 A or x/5 A current transformer can be used.
The large graphical LC display permits reading even from a distance. The
SENTRON PAC3200 has backlighting that can be adjusted in steps for optimal
readability even under poor lighting conditions.
The combination of four function keys with the multi-language plaintext displays
makes intuitive user prompting possible. The experienced operator can also use
direct navigation for quicker selection of the desired display menu.
The SENTRON PAC3200 has a range of useful monitoring, diagnostics and
service functions, a two-tariff active energy and reactive energy counter, a
universal counter, and a working hours counter for monitoring the running time of
connected loads.
The integral Ethernet interface or an optionally available interface module can be
used for communication. This application uses the inbuilt interface.
In addition, the SENTRON PAC3200 has a multifunctional digital input and digital
output. The parameters can be set either direct on the device or via the
communications interface.
Password protection is integrated via the front of the device to guard against
unauthorized access.
2.3 Load control pri nci ple
Data acquisition and switching commands
The measured data at the power infeed point necessary for load control is acquired
individually for each load by the SENTRON PAC3200 multi-function measuring
instruments and added up in the PLC. No measurement is necessary at the actual
power infeed point. The SENTRON PAC3200 devices transmit the data to the
controller via MODBUS on TCP. The switching-off of loads that is required when
there is an imminent exceeding of the power limit is performed using relays (NC
1
contacts) that are controlled directly by the digital output of the relevant SENTRON
PAC3200 device. The SENTRON PAC3200 devices receive the associated
switching commands from the PLC via MODBUS communication.
Note
Power limit monitoring is alone power customers funeral. The utility doesnt
deliver any digestible data (measurands, warnings) to the customer, which can
be used to switch-off loads in due time. The power customer has to trust in a
good accordance of the utilitys measurements and calculations with the own
ones that are dealt with in this application example .
1
Normally Closed
2 Automation Solution
2.3 Load control principle
8
Switching Loads with S7
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
Figure 2-2: Data acquisition and switching commands
Infeed
Measurement of electrical energy
and power by power utility
PAC
3200
S7-1200
KTP600
PM1207
TIA-Portal
DataLog
PAC
3200
PAC
3200
PAC
3200
PAC
3200
PAC
3200
Load 1
(interruptible)
Load 2
(interruptible)
Load n
(interruptible)
Load 1
(non-interruptible)
Load 2
(non-interruptible)
Load n
(non-interruptible)
Base Load,
Electric Losses
Measured data of the SENTRON PAC3200 devi ces
The multi-function measuring instruments provide a variety of data. For this
application, the following selection of measured values is required by each
SENTRON PAC and transmitted to the controller:
- Active Energy Import Tariff 1 (Wh)
The device is able to differentiate between import and export (e.g., generator
operation) of energy. Furthermore, the active energy can be added up
optionally in tariff 1 or tariff 2
2
. Mostly, these tariffs are referred to as ON PEAK
(e.g., in the daytime) and OFF PEAK (e.g., at night).
- Worki ng Hours Counter (s)
Counts while the measuring instrument is supplied with power. From the count
value and the active energy, the average power demands within the measuring
period are permanently calculated for each load. The software considers the
counter overflow.
- Total Active Power (W)
Total refers to the three phases U, V, W. The instantaneous values of the
active powers are only used for display purposes. They are not used as criteria
for switching off loads.
2
The SENTRON PAC 3200 has a digital input which can be paramererized for tariff
changeover. See Chap. 9.2.6. in /1/. The application uses the default configuration in which the
input has no effect and the electrical energy is added in tariff ON PEAK.
2 Automation Solution
2.3 Load control principle
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 9
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
Base quantity for load control
The calculations for load switching are based on the instantaneous total average
power demand P
av
(t
n
) of all loads that is continually calculated from the start of
each measuring period t
m
. Continually means that P
av
(t
n
) is updated with a
periodicity of t
scan
. The individual average power demand P
av
of a load
permanently results from the active energy provided by the SENTRON PAC
relative to the start of the measuring period-current time time interval. This time
interval is obtained by continually reading out the working hours counter.
In this application, t
m
=15min and t
scan
=15s. Therefore, the average power
demands P
av
(t
n
) and P
av
(t
n
) are updated 60 times during the measuring period.
Base load and el ectri cal losses
When calculating P
av
(t
n
), a not measured optional component P
b
which is e. g.
made up of base load and electrical losses can be added to the individual average
power demands P
av
(t
n
) of the measured loads. If necessary, a respective value (W)
is written to a data block.
Criteria for switching off loads
A load will be switched off when the following four conditions are simultaneously
met at the time t
n
within the measuring period:
- P
av_f c
P
max
P
av-fc
3
is the forecast of P
av
3
for the end of the measuring period. P
av_fc
is
continually calculated thus at the interval t
scan
from the current gradient of
the shape of P
av
. P
max
is the power limit, i.e. the average power demand,
relative to the measuring period, whose exceeding would result in a higher
kilowatthour rate.
Figure 2-3: Forecast of the total average power demand (switching off)
P
max
P
t
P
av
(t)
P
av_fc t
scan
t
m
t
n
t
0
t
m
t
n-1
, ) ) (
) ( ) (
1
1
_ n av n m
n n
n av n av
fc av
t P t t
t t
t P t P
P E +
E E
= E
P
av
(t
n
)
P
av
(t
n-1
)
3
Origin of indices: av=average, fc=forecast
2 Automation Solution
2.3 Load control principle
10
Switching Loads with S7
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
- E
ov
E
off
E
ov
(t
n
)
4
is the consumed energy of all loads from the start of the measuring
period until the current time that exceeds the energy E
max
(t
n
) max. permissible
until that time. E
max
(t
n
) is the product of P
max
and t
n
. E
off
(t
n
) is the energy that is
available for shedding by the next load to be switched off with the power P
off
according to the priority list from the current time until the end of the
measuring period.
Figure 2-4: Energy resource of the next load to be switched off
P
max
P
t
P
av
(t
n
)
t
m
t
n
t
0
t
m
); ( | ) ( |
0 max
t t P t P E
n n av ov
E = E
P
off
E
ov
E
off
); ( |) ) ( | (
max n m n av off off
t t P t P P E E =
E
max
P
off
is the power value of the load that defines its switch-off instant. The smaller
it is compared to the rated power, the sooner the load will be switched off.
The condition E
ov
E
off
of this bullet has two tasks:
The accuracy of the forecast P
av_fc
is limited, particularly at the start of the
measuring period. The calculation of P
av_fc
tends to overreact, which can
result in increased switching off/on of the switchable loads. The energy
consideration in this bullet counteracts this behavior and attenuates the
switching dynamics.
When considering solely the forecast P
av_fc
, a load would always be shed
too soon within the measuring period as the power of the next load to be
switched off is not considered. As the size of the next load to be shed is
known, the software can set the load shedding time so that it is as close to
the demanded power limit as possible.
- Waiting time between switch-off actions was complied with
If successive shedding of several loads is necessary due to quickly increasing
total reference power or low rated powers of the individual loads to be switched
off next, this is performed with the minimum interval t
scan
. If the respective
processes and conditions require a larger minimum interval, this can be
parameterized in multiples of t
scan
.
4
Origin of indices: ov=overload
2 Automation Solution
2.3 Load control principle
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 11
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
- Minimum on time was complied with
For each load, a minimum on time can be parameterized to satisfy the
permitted dynamics of the load. If a load is to be switched off while its on time
is still running, this load will be skipped and the system will continue with the
next load in the priority list.
Criteria for switching loads back on
The above criteria for switching off loads apply accordingly also to switching loads
back on:
A load will be switched on when the following four conditions are simultaneously
met at the time t
n
within the measuring period:
- P
av_f c
< P
max
Figure 2-5: Forecast of the total average power demand (switching on)
P
max
P
t
P
av
(t)
P
av_fc
t
scan
t
m
t
n
t
0
t
m
, ) ) (
) ( ) (
1
1
_ n av n m
n n
n av n av
fc av
t P t t
t t
t P t P
P E +
E E
= E
t
n-1
P
av
(t
n-1
)
P
av
(t
n
)
2 Automation Solution
2.3 Load control principle
12
Switching Loads with S7
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
- E
ov
E
on
Figure 2-6: Energy resource of the next load to be switched on
P
max
P
t
P
av
(t
n
)
t
m
t
n
t
0
t
m
); ( | ) ( |
0 max
t t P t P E
n n av ov
E = E
P
on
E
ov
E
on
); ( |) ) ( | (
max n m n av off off
t t P t P P E E =
In contrast to Figure 2-4, the blue area representing E
ov
is below and the green
area representing E
on
is above the P
max
line in the above figure. P
on
is the
power value of the load that defines its switch-on instant. The greater it is
compared to the rated power, the later the load will be switched on.
- Waiting time between switch-on actions was complied with
If several loads are successively switched on due to quickly decreasing total
reference power or low rated powers of the individual loads to be switched on
next, this is performed with the minimum interval t
scan
. If the respective
processes and conditions require a larger minimum interval, this can be
parameterized in multiples of t
scan
.
- Minimum off time was complied with
For each load, a minimum off time can be parameterized to satisfy the
permitted dynamics of the load. If a load is to be switched on while its off time
is still running, this load will be skipped and the system will continue with the
next load in the priority list.
Priority list
The selection of the load to be switched next (on or off) is based on a priority list to
be edited by the user. It is represented by a field in a DB and organized as follows:
Table 2-1: Priority list
Pri ority l ist
Load that is the first to be switched off and the last to be switched
on
.
.
.
Load that is the first to be switched on and the last to be switched
off
2 Automation Solution
2.4 Data logging
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 13
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
When switching off, the list is processed from top to bottom. When switching on, it
is processed from bottom to top.
NOTICE
Especially highly alternating processes require an exact adjustment wi th
the load control based on the present principl e. You can tune the system
by
- a parameteri zable switching delay (switch_delay, see Table 2-9)
- factors for the consumer loads switch-on and switch-off power
(P_OnOff.OFFfactor, P_OnOff.ONfactor, P_OnOff.threshold, see Table 2-9)
- the costumer loads posi tions in the priori ty li st (prio_list[..], see Table 2-
10)
- the adjustable values
switch-off power (P_switch_off)
switch-on power (P_switch_on)
off-ti me (t_remain_off)
on-time (t_remain_on)
for each costumer load (see Table 2-10)
With the present load control it cannot be ensured, that each technology
respecti vely each process i s controllable in respect of power limit
compliance.
2.4 Data logging
A data log is a data area in the load memory or on the memory card to which
process values can be written. The data logs are saved in CSV format (comma-
separated value). When the controller is connected to a PC via the PROFINET
interface, you can use a Web browser to access the data logs via the Web server
of the SIMATIC S7-1200 and edit and display them, for example, in an Excel
spreadsheet. Access is possible in both RUN and STOP mode of the CPU.
When the controller is restarted, a data log will be created with the
DataLogCreate instruction if it does not exist yet. If it already exists, it will be
opened with DataLogOpen. At the end of the measuring period, the total average
power demand P
av
(t
m
) relative to the measuring period is written to the data log
with DataLogWrite. The number of process values to be written to the data log
can be parameterized by the user. The data log size is limited by the size of the
load memory or memory card. The organization corresponds to a ring buffer.
2 Automation Solution
2.5 Error messages
14
Switching Loads with S7
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
Figure 2-7: Data logging
Load memory
Webserver
DataLogCreate
Dat aLogOpen
DataLogWri te
P
av
(t
m
)
User program
.csv
2.5 Error messages
The following errors that do not require acknowledgement are written to a message
buffer with a time stamp and displayed in a message display on the KTP600. The
error texts can be edited in the TIA Portal:
- Communication fault
The communication is implemented as a sequencer. If one step of the
communication (e.g., wait for connection established, wait for data reception
complete, etc.) exceeds a parameterized time, an error will be reported for the
respective SENTRON PAC.
- No load available to switch-off
If loads are no longer available for switching off in the priority list as all
switchable loads have already been switched off by the system or load
shedding is currently not permitted due to a running minimum on time, an error
message will be generated.
- Scan interval too short
When adding the individual power/energy measured per SENTRON PAC to
the total power/energy over all loads, it is assumed that the individual
power/energy values were determined at exactly the same time. The finite
communication time required for polling a SENTRON PAC3200 device causes
skews that eventually influence the accuracy of the cumulative values. As long
as the scan time t
scan
(=parameterizable time after which polling restarts with
the first SENTRON PAC) is long compared to the sum of the communication
time requirements of all connected SENTRON PAC3200 devices, the issue
can be ignored. If, however, the number of SENTRON PAC3200 devices is so
large that the communication with them lasts longer than t
scan
, t
scan
will no
longer take effect and the summation will no longer be determined. In this
case, an error message will be displayed to inform the user of the problem.
However, please consider that an extension of t
scan
results in a decrease of
the number of measured values within the measuring period and thereby also
adversely affects the accuracy.
2 Automation Solution
2.6 Hardware and programming software of the sample project
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 15
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
- Data l og errors
An error message is configured for each of the DataLogCreate,
DataLogOpen and DataLogWrite data log instructions used. If the respective
instruction sets its error bit, an error message will be generated and the status
word of the instruction will be saved to a DB for evaluation by the user.
2.6 Hardware and programming software of the sampl e
proj ect
In the sample project, two loads are configured that are measured using
SENTRON PAC3200 devices. For information on how to extend the application to
more loads, please refer to chapter 3.6.
Products.
Table 2-2: Products
Components Qty. MLFB/order number
1. SENTRON PAC3200; LCD; 96X96MM POWER
MONITORING DEVICE PANEL MOUNT TYPE FOR
MEASUREMENT OF ELECTR. VALUES VAUX: 110-
340VDC / 95-240VAC VIN: MAX.690/400V; 45-65HZ
AMPIN: X/1A OR X/5A AC COMPRESSION TYPE
TERMINALS
2 7KM2112-0BA00-3AA0
2. SIMATIC S7-1200 POWER MODULE PM1207
STABILIZED POWER SUPPLY INPUT: 120/230 V AC
OUTPUT: 24 V DC/2.5 A
1 6EP1332-1SH71
3. COMPACT SWITCH MODULE CSM 1277 CONNECTION
SIMATIC S7-1200 AND UP TO 3 FURTHER IND.
ETHERNET USERS WITH 10/100 MBIT/S UNMANAGED
SWITCH, 4 RJ 45 PORTS, EXT. 24V DC POWER
SUPPLY, LED DIAGNOSTICS, S7-1200 MODULE INCL.
ELECTRONIC MANUAL ON CD
1 6GK7277-1AA10-0AA0
4. SIMATIC S7-1200, CPU 1215C, KOMPAKT CPU,
DC/DC/DC, 2 PROFINET PORT, ONBOARD I/O: 14 DI
24VDC; 10 DO 24VDC; 0,5A; 2 AI 0-10V DC, 2 AO 0-
20MA DC, STROMVERSORGUNG: DC 20,4 -28,8 V DC,
PROGRAMM/DATENSPEICHER 100 KB
1 6ES7215-1AG31-0XB0
5. SIMATIC HMI KTP600 BASIC COLOR PN, BASIC PANEL,
KEY AND TOUCH OPERATION, 6" TFT DISPLAY, 256
COLORS, PROFINET INTERFACE, CONFIGURATION
FROM WINCC FLEXIBLE 2008 SP2 COMPACT/ WINCC
BASIC V10.5/ STEP7 BASIC V10.5, CONTAINS OPEN
SOURCE SW WHICH IS PROVIDED FREE OF CHARGE
FOR DETAILS SEE CD
1 6AV6647-0AD11-3AX0
6. MINIATURE POWER RELAY SCREW TERMINALS,
2NO+2NC SNAP-ON MOUNTING ON STANDARD
MOUNTING RAIL DC SOLENOID SYSTEM DC 24V
2 3TK2022-0BB4
7. Current transformer
(depending on the loads; both x/1A or also x/5A current
transformers can be used)
2 -
2 Automation Solution
2.6 Hardware and programming software of the sample project
16
Switching Loads with S7
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
Components Qty. MLFB/order number
8. SIMATIC NET INDUSTRIAL ETHERNET TP CORD
RJ 45/RJ 45, CAT 6, TP CABLE 4X2, PREASSEMBLED W.
2 RJ 45 CONNECTORS,
0.5M
1M
2M
6M
10M
4
6XV1870-3Q
E50
H10
H20
H60
N10
Note
- In deviation from Table 2-2 you can use each type of S7-1200 CPU from firmware
V2.1.
- Should the S7-1200 CPU you are going to use not be included in the hardware
catalogue, actualize it with the latest HSP (hardware Support Package). See /5/.
- A KTP600 operator panel is not mandatory. In the TIA Portal, you can work with the
simulation ( icon in the toolbar).
Programming package
Table 2-3: Programming software
Komponente Bestellnummer oder Link
STEP 7 Basic V11 SP2 6ES7822-0AA01-0YA0
Update to zu
STEP 7 Basic V11 SP2
http://support.automation.siemens.com/WW/view/en/58112582
or alternatively
STEP 7 Basic V12 6ES7822-0AA02-0YA5
NOTICE Use always the latest software update (see /6/).
2 Automation Solution
2.7 Wiring of the sample project
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 17
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
2.7 Wiring of the sample project
Figure 2-8: Wiring
L1
N
PE
PS1207
CSM
1277
CPU1215C
+
24V
-
KTP600
SENTRON
PAC3200
1
L1
N
F
Load 1
SENTRON
PAC3200
2
Load wiring as for PAC 1
IP-Adr. 192.168.0.254
IP-Adr. 192.168.0.1
IP-Adr. 192.168.0.200
IP-Adr. 192.168.0.201
The load-side wiring of the SENTRON PAC3200 devices depends on the load
types. The sample wiring shows the connection of a single-phase load. For detailed
information and other examples of how to connect different loads, please refer in
particular to chapter 6.4 Connection examples and chapter 9.2.4 Basic
parameters in /1/.
2.8 Communicati on principle
Client-server rel ationship
As a server, the SENTRON PAC3200 devices provide MODBUS on TCP
communication. Using the MB_CLIENT instruction, the SIMATIC S7-1200 CPU can
communicate as a Modbus TCP client via its PROFINET interface. Additional
communication hardware e.g., a communications processor is not necessary.
2 Automation Solution
2.8 Communication principle
18
Switching Loads with S7
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
The MB_CLIENT instruction
The MB_CLIENT instruction can be found on the Instructions task card in
Communication >Communications processor >MODBUS TCP. When it is
dragged to the program using the mouse, a respective system FB will be created
whose data will be stored in a system DB or as a multi-instance in the instance DB
of the calling FB. In the program, the MB_CLIENT instruction is called only once
per CPU cycle. It satisfies the requirements of its different communication partners
and tasks by the fact that its parameters are variably set for the respective partners
and tasks.
Figure 2-9: MB_CLIENT instruction
For the parameter description of MB_CLIENT, please refer, for example, to the
online help of the TIA Portal.
NOTICE
To communicate with the SENTRON PAC3200, in the static data of the
MB_CLIENT record, the TCON_PARAM.MB_UNIT_ID parameter must have
a val ue between 16#0001 and 16#00F7. As the default value when creating
the data record i s 16#00FF, it must be changed later. In the associated
application example, the change has already been made and the parameter
has been set to 16#0001.
2 Automation Solution
2.8 Communication principle
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 19
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
Access to the Modbus data register
The register is a buffer for the data received from the Modbus server or to be sent
to the Modbus server. It is accessed via the MB_DATA_PTR InOut parameter of
the MB_CLIENT instruction. MB_DATA_PTR is a pointer of the VARIANT type.
This means that only the address information of the actual parameter on
MB_DATA_PTR is transferred, whereas the data type of the actual parameter is
irrelevant. Therefore, it is possible to interpret the Modbus register to be addressed
by means of the symbolic addressing in the correct data view.
Figure 2-10: Different data views of the Modbus data register
(FB LoadSwitching [FB501], static tags))
As can be seen in Figure 2-10, the Modbus data register is eight bytes wide and
assigned to the static tag Rx_LReal. With Rx_Real, Rx_UDInt and Tx_Uint, three
more data views are defined whose data widths can be less than eight bytes. In
this application, the different data views are used to access the following data of
the SENTRON PAC device:
Table 2-4: Reference: Data view measured value/action
Data view Read/Write Measured value/action Reference
Rx_LReal R Active Energy Import Tariff 1
Table 3-6 in /1/ Rx_Real R Total Active Power
Rx_UDInt R Working Hours Counter
Tx_UInt W Switching outputs Table 3-26 in /1/
Seri al communication
To allow operation of more than eight SENTRON PAC3200 devices, the
communication is serial communication:
2 Automation Solution
2.9 Program description
20
Switching Loads with S7
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
Figure 2-11: Serial communication
Connect t o SENTRON PAC n
Receive from / send to SENTRON PAC n
Disconnect from SENTRON PAC n
Wait until end of scan time
n := 1
n := n+1
All SENTRON PACs processed?
Yes
No
Start
The application needs 200-300ms to process a SENTRON PAC3200 device. The
max. possible number of SENTRON PAC3200 devices is determined by the
relation between the total communication time requirement, the scan time and the
length of the measuring period. The issue has already been touched on in chapter
2.5, third bullet.
Network addresses
In the application, the following addresses are assigned:
Table 2-5: Network addresses
Node IP address Subnet mask
Controller 192.168.0.1
255.255.255.0
Operator panel 192.168.0.254
SENTRON PAC 1 192.168.0.200
SENTRON PAC 2 192.168.0.201
The application assumes that all SENTRON PAC3200 devices belong to one
subnet. Therefore, the first three bytes are identical for all measuring instruments
and must be specified only 1 x in the relevant parameter DB. The fourth byte is
crucial for the discrimination of the devices. In this case, the addresses 2-252
5
can
be assigned to the SENTRON PAC3200 devices.
2.9 Program descri pti on
This chapter describes the program structure of the example at the function and
data block level of the automation system.
5
On condition that the IP device address of the development system is 253.
2 Automation Solution
2.9 Program description
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 21
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
2.9.1 Block structure
Figure 2-12 shows the call hierarchy of the program blocks and the access to the
data blocks.
Figure 2-12: Block structure
DB501
PowerMan_DB
FB501
PowerMan
OB1
MAIN
DB503
PAC_data
O
p
e
r
a
t
i
n
g
s
y
s
t
e
m
FC502
CALC_P_active_av
FC161
Event
FC501
Load_shedding
OB100
Startup
FB1084
MB_CLIENT
OB100 Startup
In this block, constants are calculated that are derived from input parameters and
do not change during runtime.
NOTICE
During runtime, do not change input parameters that are accessed in
Startup . These are the following parameters in LoadSwitching_DB:
P_average_limit P_active_sample_max
monitoring_time offset_P_acti ve
offset_E_acti ve offset_h
offset_DQ
(see Table 2-9)
OB1 Main
The block contains only the call of FB501 LoadSwitching.
FB501 LoadSwitching , DB501 LoadSwitching_DB
The FB provides the main functionality of this application. It does not have any
parameters. The tags marked with ! in the comment of the associated instance
DB represent load-independent, general data that must be parameterized by the
user (see Table 2-9).
2 Automation Solution
2.9 Program description
22
Switching Loads with S7
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
FB1084 MB_CLIENT
When the instruction of the same name is inserted into the user program in
System blocks >Program resources, this system FB will be created in the project
tree. The associated static data was created as a multi-instance and is located in
DB501 LoadSwitching_DB under the name MB_CLIENT_Instance.
FC502 CALC_P_active_av
The FC is used as an auxiliary function and, once in the scan interval, calculates
the instantaneous value ) (
act av
t P of the average active power relative to the start
of the measuring period for each SENTRON PAC.
0
0
) ( ) (
) (
t t
t E t E
t P
act
active act active
act av
=
active
E = value of the active energy meter;
act
t = working hours counter value at the moment;
0
t = working hours counter value at the start of the measuring period.
Active energy meter and working hours counter can overflow in the SENTRON
PAC and after an overflow, restart at zero. As the overflow limits are known, the
overflow can be considered. FC502 takes this into account.
Table 2-6: FC502 block parameters
Parameter Data
type
IN/OUT Explanation
E_active LReal IN Value of the active energy meter (Wh)
at the moment
E_active_0 LReal IN Value of the active energy meter (Wh)
at the start of the measuring period
E_active_overflow LReal IN
Overflow value of the active energy meter (Wh) (from /1/)
h UDInt IN Value of the working hours counter (s)
at the moment
h_0 UDInt IN Value of the working hours counter (s)
at the start of the measuring period
h_overflow UDInt IN
Overflow value of the working hours counter (s) (from /1/)
FC161 Event
The FC facilitates entering and removing error bits in alarm words from which the
HMI generates the error messages.
Table 2-7: FC161 block parameters
Parameter Data
type
IN/OUT Explanation
Trigger Bool IN TRUE: Error bit is set
FALSE: Error bit is reset
Event_Bit UInt IN Significance in the error word (015)
Alarm_Word Word INOUT Error word accessed by the HMI
Global_fault Bool OUT =TRUE if at least 1 bit is set in the error word
2 Automation Solution
2.9 Program description
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 23
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
FC501 Load_shedding
In accordance with the explanations in chapter 2.2.1, the block decides if a load is
to be switched off or on. If a load is no longer available for load switching, the block
initiates a relevant error message.
Table 2-8: FC501 block parameters
Parameter Data
type
IN/OUT Explanation
Reset Bool IN At the start of the new measuring period, the block is
executed once with Reset=TRUE. This results in an
initialization for the new measuring process.
switch_load SInt OUT Switching command:
-0 =no action
-1 =switch off load
+1 =switch on load
PAC_index UInt OUT Number of the load to be switched
(corresponds to the array index of the load_spec
array tag in the PAC_data DB.)
SUM_P_active_av_log Real OUT Average of the total active power at the end of the
measuring period that is written to the data log.
DB503 PAC_data
While the data concerning the overall functionality is stored in LoadSwitching_DB,
DB503 includes all necessary load-specific data records. The tags marked with !
in the comment of the DB have to be parameterized by the user (see Table 2-10).
2.9.2 User parameters
The following section provides a description of the tags that have to be
parameterized by the user. In the comment, the respective tags are marked with
!.
Load-independent parameters in LoadSwitching_DB
Table 2-9: Load-independent parameters in LoadSwitching_DB
Name Data type Dim. Explanation
P_average_limit Real W Power limit Pmax
Limit Pmax specified by the power utility for the average
total active power relative to the measuring period. If
exceeded, a higher kilowatthour rate will be charged for
the entire accounting period.
P_base_load Real W Base load Pb
Base load assumed to be constant that is not
measured.
P_active_sample_max USInt - Active power measured value sample no.
The active power can be averaged from several
measured values. The measurements are performed in
direct succession with regard to time.
2 Automation Solution
2.9 Program description
24
Switching Loads with S7
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
Name Data type Dim. Explanation
ext_trigger Bool - Trigger for measuring period
FALSE =CPU clock
TRUE =pos. edge at E0.0
When triggering using the CPU clock, it is
recommended that it be synchronized at regular
intervals, e.g. by means of an NTP server or a GPS
receiver.
ON_ack_required Bool - Acknowledgement for reclosing
FALSE =By load control switched-off loads are
reclosed automatically.
TRUE =Each reclosing demand from the load contol
has to be released manually.
(default value =FALSE)
monitoring_time Time Time Duration of the measuring period tm
Permitted values in minutes:
2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60;
When triggering using the CPU clock, the measuring
periods within an hour always start with the first minute
and the multiples of the minute value that corresponds
to the length of the selected measuring period.
scan_time Time Time Scan time tscan
Interval at which one and the same SENTRON PAC is
periodically polled.
comm_error_time Time Time Detection time for communication faults
The communication flow is organized in a sequencer. If
a step exceeds a specific time, a relevant error
message will be generated and the transition from the
faulty to the next SENTRON PAC will take place.
switch_delay USInt - Switching delay
In terms of software, load switching can be performed
max. at the interval specified by the scan_time. To
avoid avalanches when there are significant load
changes, the switching interval can be extended to
multiples of the scan time.
P_OnOff. Struct
OFFfactor Real - Factor for switch-off power
The measured active power of the load reduced by a
factor (P_OFFfactor <1.0)
6
is used as the switch-off
power (see chapter 2.2.1).
ONfactor Real - Factor for switch-on power
The measured active power of the load increased by a
factor (P_ONfactor >1.0)
6
is used as the switch-on
power (see chapter 2.2.1).
6
Switch-off and switch-on power can also be specified as absolute values (see Table 2-10).
When doing so, the P_OFFfactor, P_ONfactor and threshold parameters are irrelevant.
2 Automation Solution
2.9 Program description
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 25
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
threshold Real W Zero threshold for active power
The switch-off and switch-on powers of the loads are
only permanently derived from the currently measured
active powers when they are above a parameterizable
zero threshold. If this is not the case, a stored value will
be used as a substitute
7
.
DataLog_1. Struct Data log
Data area in the load memory or on the memory card to
which process values are saved.
records UDInt - Total number of data records
The number of data records to be archived. In this
application, a data record consists of only one value,
i.e. the average of the total active power relative to the
measuring period. At the end of each measuring period,
it is written to the load memory or memory card.
filename String File name
Name of the csv file located in the load memory or on
the memory card that can be downloaded from the Web
server to the PC.
header String Column headers
Comma-separated column headers. In this application,
however, there is only one column (aside from the data
record number and time stamp).
offset. Struct Offset addresses of the Modbus registers used
P_active UInt -
Total Active Power (65), see Table 3-6 in /1/
E_active UInt - Active Energy Import Tariff 1 (801), see Table 3-6 in /1/
h UInt - Working Hours Counter (213), see Table 3-6 in /1/
DQ UInt -
Switching outputs (60008), see Table 3-26 in /1/
Load-dependent parameters i n DB PAC_data
Table 2-10: Load-dependent parameters in DB PAC_data
Name Data
type
Dim. Explanation
PAC_max UInt - Number of SENTRON PAC3200 devices
Number of measured loads.
IP. Struct IP address (octets 1-3)
octet1 USInt Octet 1
octet2 USInt Octet 2
octet3 USInt Octet 3
7
This requires that a value above the zero threshold has been measured at least 1 x after the
CPU start. Ensure this if you determine switch-off and switch-on power via the P_OFFfactor and
P_ONfactor parameters.
2 Automation Solution
2.9 Program description
26
Switching Loads with S7
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
Name Data
type
Dim. Explanation
load_spec Array[1..n]
of Struct
Array of load specifications
Maximum number of possible loads
load_spec [ ]. Struct Load specification
index UInt - Index
The value must always be identical to the array element
number. It is necessary to be able to access the
individual loads in the HMI using a text list with names.
IP_octet4 USInt - IP address (octet 4)
Must be in the range from 2 to 253.
P_switch_off Real W Switch-off power
8
Poff
The active power of the load used for the calculation of
the switch-off instant. A value less than or equal to the
rated power is usually used. The smaller the value
compared to the rated power, the sooner the load will
be switched off at a switch-off request within the
measuring period if the software has defined it as the
next load to be switched off.
When you parameterize P_switch_off with 0, the
system uses the measured active power multiplied by
the OFFfactor parameter (see Table 2-9).
P_switch_on Real W Switch-on power
8
Pon
The active power of the load used for the calculation of
the switch-on instant. A value greater than or equal to
the rated power is usually used. The greater the value
compared to the rated power, the later the load will be
switched on at a switch-on request within the
measuring period if the software has defined it as the
next load to be switched on.
When you parameterize P_switch_on with 0, the
system uses the measured active power multiplied by
the ONfactor parameter (see Table 2-9).
t_remain_off Time Time Off time
Time a load must remain switched off after it was
switched off by the system. It will only be available for
switching on after this time has elapsed.
t_remain_on Time Time On time
Time a load must remain switched on after it was
switched on by the system. It will only be available for
switching off after this time has elapsed.
prio_list Array[1..n]
of UInt
Priority list
The first list element has the highest priority, the last
one has the lowest priority with regard to switching off
loads. When loads are switched off, the priority list is
processed from top to bottom (from 1 to n). When loads
are switched back on, it is processed from bottom to top
(from n to 1).
prio_list [ ] UInt - In the priority list, the array element numbers of the
loads have to be entered in load_spec according to the
desired priority. If the load is not available or if it is not
to be switched at all, 0 has to be entered.
8
Different switch-on and switch-off power of a load force hysteresis.
2 Automation Solution
2.9 Program description
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 27
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
Note
This application includes data records for 20 loads. If necessary, modify the
number of data records to save disk space or cover more loads. To do so,
reduce or increase the size of load_spec, prio_list and consumer_load arrays
accordingly. PAC_max must never be greater than the number of elements of
these arrays.
2.9.3 Program flow in FB501 LoadSwitching
Networks.
Table 2-11: Networks of FB501
NW no. Ti tl e Descri ption
1 Monitoring interval - Definition of the trigger times for the measuring period
- Time definition of the end of the measuring period
2 Call MB_CLIENT Call of the MB_CLIENT instruction
3-11 Waiting for Sequencer (see below for the explanation)
12 Recognize communication
faults
A communication fault will be detected if a communication
step exceeds the comm_error_time specified in DB501.
Communication steps are characterized by step number
<1000.
13 Process scan interval timer Process scan interval as a switch-on delay.
The time is started in step 1000 and reset in steps 50 and
1010.
14 Data Log Data logging handling.
15-18 For HMI [..] - Data conditioning for display on the HMI.
NW16-NW18 are used to generate a global error bit.
Sequencer
The state diagram (Figure 2-13) below shows the program flow implemented by the
sequencer. In the diagrams yellow ellipses (states) the program waits for the
events which are displayed by the blue texts. With the arriving event, the current
state is left and the program executes the task which follows the yellow ellipse in
direction of the arrow. Subsequently the program leads where required via a
branching (decision) - to a successor state. The task or branching directly following
a state is always programmed in the same network than the state definition itself.
2 Automation Solution
2.9 Program description
28
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Beitrags-ID: 58856464
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
ll
r
i
g
h
t
s
r
e
s
e
r
v
e
d
Figure 2-13: State diagram
No
Step 1010 (NW11)
Step 50 (NW10)
Step 40 (NW9)
Step 30 (NW8)
Step 24 (NW7)
Step 20 (NW6)
Step 15 (NW5)
Step 10 (NW4)
Step 1000 (NW3)
Restart
Load switched
(DONE)
Start of
measuring period
CONNECTED &
nicht BUSY
P
active
received n times and
mean value generated
(DONE)
E
active
received
(DONE)
Yes
Switching request?
Working hours counter
received (DONE)
Not BUSY
Not CONNECTED
¬ BUSY
Scan time
elapsed?
Initiate communication job
Set MB_CLIENT parameter
Scan time elapsed
I
n
i
t
i
a
t
e
c
o
n
n
e
c
t
i
o
n
e
s
t
a
b
l
i
s
h
m
e
n
t
t
o
P
A
C
1
Save mean value of P
active
Set MB_CLIENT parameter
Save E
active
Log load condition
Set MB_CLIENT parameter
Set MB_CLIENT parameter
Calculate P
av
(relative to measuring period)
Complete communication job
Initiate connection termination
All PACs processed?
No
No
Initiate connection establishment
to the next PAC
Load management (process FB Load_shedding)
Initiate connection establishment to PAC 1
Yes
Yes
2 Automation Solution
2.10 Visualization
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 29
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
2.10 Visualizati on
For monitoring, the KTP600 provides three screens.
Mai n screen (start screen)
Figure 2-14: Main screen
Sum of the current active
powers over all measuring
instruments plus a specified
base load. The value is based
on the measured values read
out of the SENTRON PACs
with register offset address 65
(Total Active Power).
Sum of the current average active
power demands over all
measuring instruments relative to
the start of the measuring period
plus a specified base load. The
value is based on the measured
values read out of the SENTRON
PACs with register offset
addresses 801 (Active Energy
Import Tariff 1) and 213
(Working Hours Counter).
Total active power forecast for the
end of themeasuring period.
Energy reserve currently
provided by the next load to
be switched off or on. When
it has been used up, the
respective load will be
switched off or on.
off :
on:
Loadswitch-off is
pending.
Load switch-on is
pending.
Name of the next load to be
switched off or on
Measuring period
Button to switchto the error list.
If at least one error is pending,
the will button flashred/white.
Button to switch to the
load condition list
Button to release reclosing
next load to be switched on
The bar charts of the power displays are normalized to the specified power limit (in
the example: 8 kW). They display values in the range between 80% and 120% of
the power limit. The number representations allow the display of values less than
10MW.
The bar chart of the energy reserve is also normalized. It displays values in the
range between 0 and 10% of the active energy limit relative to the measuring
period.
The bar chart of the measuring period is normalized to its duration.
The button to release reclosing the next consumer load to be switched on is only
visible, if
- LoadSwitching.ON_ack_required is parameterized to TRUE
9
and
- the load control schedules reclosing a consumer load due to the power regime.
To confirm pressing the ON button, its color becomes light yellow until the
relevant SENTRON PAC3200 device has got the switch-on command for the load.
9
In the project code of the application example bit LoadSwitching.ON_ack_required =FALSE
(default value). Therefore button ON is invisible and consumer loads get reclosed
automatically without any manually release.
2 Automation Solution
2.10 Visualization
30
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Beitrags-ID: 58856464
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
Consumer load list screen
Figure 2-15: Consumer load listscreen
Name of the loads
Switching status
Earliest next switch-on
instant if a minimum off time
has been specified for the
respective load.
Earliest next switch-off instant if
a minimumon time has been
specified for the respective
load.
.
Back to Load
managementscreen
Error messages screen
Figure 2-16: Error messagesscreen
Back to Load
managementscreen
Error messages with
time stampand
alarmstatus
3 Configuration
3.1 SIMATIC software installation
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 31
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
3 Configuration
Once you have properly installed and wired all components and connected them to
the supply voltage as shown in Figure 2-8, the following configurations and
parameter settings have to be made.
3.1 SIMATIC software i nstal lati on
The project was created with TIA Portal Version V11 SP2 Update 5 and Version
V12. The firmware version of the CPU 1215C used was V3.0.2. If necessary,
update your software. see also chap. 2.6 Hardware and programming software of
the sample project
3.2 Parameterizi ng the SENTRON PAC3200 devi ces
Starting from the default configuration of the devices, the following settings have to
be made. They are made in the user interface of the devices. For the general
operation of the SENTRON PAC3200 devices, please refer to chapter 8 Operator
control in /1/. At this point of commissioning, neither measuring voltage nor
measuring current are applied to the measuring instruments.
Table 3-1: Parameterizing the SENTRON PAC3200 devices
No. Instructi on Additional note
1. Language, regional setti ngs group
Navigate to the LANGUAGE/REGIONAL group and set the
desired language.
Parameter Device 1 Device 2
LANGUAGE ENGLISH
See chapter 9.2.3 in /1/
2. Basic parameters group
Basic parameters are all settings for the measuring inputs. Define
the connection type (number of phases, conductors), if you are
measuring with or without voltage transformer and your required
current transformer ratio. Adjust the parameters to your loads.
To test the application in a useful way, the two configured loads
should be in a range where load switching can be properly
monitored in the Load management HMI screen (Figure 2-14).
In the laboratory test, loads were used that were interpreted by
the SENTRON PAC3200 devices as loads with approx. 200W to
1000W. To reach values in that range, you can if loads of that
magnitude are not available to you manipulate the SENTRON
PAC3200 devices with regard to voltage or current conversion by
means of reconfiguring.
See chapter 9.2.4 in /1/
3. Integrated I/O group
Navigate to DIGITAL OUTPUT and define the action.
Parameter Device 1 Device 2
ACTION REMOTE OUTPUT
See chapter 9.2.6 in /1/
3 Configuration
3.3 Configuring the HMI
32
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Beitrags-ID: 58856464
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
No. Instructi on Additional note
4. Communication group
Set the following parameters.
Parameter Device 1 Device 2
IP-ADDR 192.168.0.200 192.168.0.201
SUBNET 255.255.255.0
GATEWAY 0.0.0.0
PROTOCOL MODBUS TCP
See chapter 9.2.7 in /1/
After the above parameterization, the measuring voltage and the measuring current
have to be applied to the SENTRON PAC3200 devices and the displayed
measured values have to be checked.
3.3 Confi guri ng the HMI
If the real KTP600 (not simulated) is used as the operator panel, the project-
specific IP address 192.168.0.254 must be set.
Table 3-2: Assigning the IP address to the KTP600
No. Operator acti on Pi cture / result / additi onal note
1. Select the Control Panel button to open
the control panel of the Loader.
3 Configuration
3.4 Settings on the development system (Windows)
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 33
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
No. Operator acti on Pi cture / result / additi onal note
2. 1. Select the Profinet button to open
the Profinet Settings dialog box.
2. Select Specify an IP address.
3. Make the following entries:
IP address =192.168.0.254
Subnet mask =255.255.255.0
4. Select OK to close the dialog box
and apply the entries.
3.4 Setti ngs on the development system (Wi ndows)
3.4.1 Assigning the IP address to the development system
Your PG/PC must be assigned an IP address in the same subnet as the other
network components involved. The IP addresses of the individual nodes are shown
in Table 2-5.
To assign the IP address for your network card, proceed as follows in the Windows
XP operating system:
Table 3-3: Assigning the IP address to the development system
No. Operator acti on Pi cture / result / additi onal note
1. In the Windows Control Panel, open Network
Connections.
3 Configuration
3.4 Settings on the development system (Windows)
34
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Beitrags-ID: 58856464
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
No. Operator acti on Pi cture / result / additi onal note
2. Select the network card to be used and
right-click to open the properties.
3. Select the Internet Protocol (TCP/IP) item
and open its properties.
4. - Select Use the following IP address.
- In IP address, enter an available address
in the relevant subnet
10
.
- In Subnet mask, enter 255.255.255.0.
- Select OK to confirm the settings.
10
When using IP device address 253 for the development system, the entire address range
from 2-252 will be available to you for the SENTRON PAC3200 devices.
3 Configuration
3.4 Settings on the development system (Windows)
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 35
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
3.4.2 Setting the PG/PC interface
To simulate the KTP600 on the development system, the PG/PC interface must be
set accordingly.
Table 3-4: Setting the PG/PC interface
No. Operator acti on Pi cture / result / additi onal note
1. In the Windows Control Panel, open Set
PG/PC Interface.
2. - In Access Point of the Application, select
S7ONLINE (STEP 7) in conjunction with
the interface parameter assignment of
your network card
( -->TCP/IP(Auto) ->).
- Select OK to confirm the settings.
3 Configuration
3.5 Parameter assignments in the TIA Portal and project download
36
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Beitrags-ID: 58856464
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
3.5 Parameter assi gnments in the TIA Portal and project
download
Opening the project
Table 3-5: Opening the project
No. Operator acti on Pi cture / result / additi onal note
1. Unzip the sample project to any directory on
your hard drive and double-click on the file
with the .ap11 extension.
2. If the TIA Portal has opened in the portal view,
select the project view.
3 Configuration
3.5 Parameter assignments in the TIA Portal and project download
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 37
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
Setting the country-specific local time
Make sure that the date and time of day setting in the CPU is correct. This is
necessary for the following reasons:
- The measuring period for the mean-value generation of the power is
synchronized with the local time.
- The controller synchronizes the KTP600 system time every minute. This
ensures that the time stamps of the alarm messages are correct.
Table 3-6: Setting the country-specific local time
No. Instructi on Pi cture / result / additi onal note
1. Select the CPU.
2. Navigate to the Time of day settings and, if
necessary, adjust the time zone and the
daylight-saving time/standard time settings.
Load settings for the live demo
If, after configuring, you want to perform a live demo as described in chapter 4, it is
recommended at this point to set a power limit and base load so that loads are
switched on and off. Select the load relationships as shown in Figure 3-1.
Figure 3-1: Recommended power relationships for the live demo
Base load
Power limit
Switchable loads
P
t
3 Configuration
3.5 Parameter assignments in the TIA Portal and project download
38
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Beitrags-ID: 58856464
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
Downloading the control program to the CPU
Table 3-7: Downloading the control program to the CPU
No. Instructi on Pi cture / result / additi onal note
1. Connect your development system to the CPU
either directly or using the CSM1277 switch.
2. - Select the PLC_1 [CPU 1214C
DC/DC/DC] PLC folder.
- Select the Download to devicebutton to
download the PLC project part to the
CPU.
3. - Select the PG/PC interface used and the
subnet.
- Check Show all accessible devices.
- Identify your controller from the list of
accessible devices using the MAC
address or via Flash LED.
- Select the selected controller and use the
Load button.
4. - Enable consistent downloading of the
program blocks.
- Select the Load button.
5. After transferring all program blocks to the
controllers, a download result window
appears.
- Check Start all to set the controller to
Run mode.
- Select the Finishbutton to finish the
entire download.
Setting the CPU clock
The CPU clock can be set by directly entering the date and time of day (local time)
or applying the time of day from the development system.
3 Configuration
3.5 Parameter assignments in the TIA Portal and project download
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 39
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
Table 3-8: Setting the CPU clock
No. Instructi on
1. In the project tree, select the PLC_1controller.
2. Select the Go online button.
3. Select the Online and diagnostics option.
4. Open the Set time of day function.
5. Set the date and time of day or apply the local time of the development system.
Note
You can conveniently synchronize the CPU clock in the following two ways:
- Synchronization via NTP server (chapter 5.6.7 in /2/).
- Synchronization via GPS receiver (/7/).
Downloading the HMI project part to the KTP600
If a real KTP600 (not simulated) is used as the operator panel, the HMI project part
must be downloaded to the KTP600. For the transfer, connect your PG/PC to the
HMI either directly or using the CSM1277 switch.
Table 3-9: Downloading the HMI project part to the KTP600
No. Instructi on Pi cture / result / additi onal note
1. - Select the HMI_1 [KTP600 Basic PN]
operator panel folder.
- Select the Download to devicebutton to
download the HMI project part to the CPU.
3 Configuration
3.5 Parameter assignments in the TIA Portal and project download
40
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Beitrags-ID: 58856464
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
No. Instructi on Pi cture / result / additi onal note
2. - If necessary, check the Overwrite all
option.
- Select the Load button.
3. - Depending on the operator panel setting,
you have to trigger the transfer in the
Loader menu of the KTP600 using the
Transfer button.
4. - Once the successful result message is
displayed, select the Finish button to
finish downloading.
- If necessary, reconnect the HMI to the
CSM1277 switch using the patch cable.
Si mulating the KTP600
If you want to run the KTP600 as a simulation on your development system,
proceed as follows:
Table 3-10: Simulating the KTP600
No.
Instructi on
Pi cture / result / additi onal note
1. - Select the HMI_1 [KTP600 PN] operator
panel folder.
- Select the Simulationbutton.
3 Configuration
3.6 Expanding the number of SENTRON PAC3200 devices
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 41
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
3.6 Expanding the number of SENTRON PAC3200 devices
In order to operate the program example with more than two SENTRON PAC3200
devices, you have to provide more Ethernet ports. Use multiple switches or
switches with more ports. Assign each SENTRON PAC3200 device a unique IP
address 192.168.0.2252 (see chapter 9.2.7 in /1/).
3.6.1 Expansions in data blocks
LoadSwitching_DB [DB501]
Table 3-11: Increasing the number of measuring instruments expansions in DB501
Tag Additional note
P_base_load If necessary, reduce the base load that is not measured
if you now (partially) measure it using additional
SENTRON PAC3200 devices.
PAC_data [DB503]
With regard to the memory, 20 SENTRON PAC3200 devices are considered in the
example. If you want to configure more devices, you have to increase the size of
the load_spec, prio_list and consumer_load arrays accordingly.
Table 3-12: Increasing the number of measuring instruments expansions in DB503
Tag Additional note
PAC_max New number of SENTRON PAC3200 devices
load_spec[n].P_switch_off
load_spec[n].P_switch_on
load_spec[n].t_remain_off
load_spec[n].t_remain_on
Define the switch-off/switch-on powers and the off/on
times of the added loads
(for the tag description, see Table 2-10).
prio_list[n] Enter the new loads in the priority list (for the tag
description, see Table 2-10).
3 Configuration
3.6 Expanding the number of SENTRON PAC3200 devices
42
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Beitrags-ID: 58856464
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
3.6.2 Expansions in the Load list HMI screen
Table 3-13: Expansions in the Load list HMI screen
No. Instructi on Pi cture / result / additi onal note
1. In the project tree, go to the Load_list screen
and double-click to open the editor.
2. Put a border around all elements of a row and
copy them as often as necessary for your
number of switchable loads.
3 Configuration
3.6 Expanding the number of SENTRON PAC3200 devices
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 43
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
No. Instructi on Pi cture / result / additi onal note
3. - Open the PAC_data DB.
- Open the properties of the new row
elements.
- Use drag and drop to move the new tags
that have already been created in the
PAC_dataDB to the respective process
tags in the properties fields of the new
HMI screen elements.
D
r
a
g
&
D
r
o
p
The following tags have to be created in the operator panel configuration as shown above:
DB PAC_data Load_list screen
Load namecolumn
load_spec[ ].index Properties
>General
OFFcolumn
consumer_load[ ].OFF >Animations
>View
>Visibility
earliest turn-on instant column (hour)
consumer_load[ ].time_control.turn_on_instant.HOUR >Properties
>General
consumer_load[ ].time_control.turn_on_disabled >Animations
>View
>Visibility
earliest turn-on instantcolumn (minute)
consumer_load[ ].time_control.turn_on_instant.MINUTE >Properties
>General
consumer_load[ ].time_control.turn_on_disabled >Animations
>View
>Visibility
earliest turn-off instant column (hour)
consumer_load[ ].time_control.turn_off_instant.HOUR >Properties
>General
consumer_load[ ].time_control.turn_off_disabled >Animations
>View
>Visibility
earliest turn-off instantcolumn (minute)
consumer_load[ ].time_control.turn_off_instant.MINUTE >Properties
>General
consumer_load[ ].time_control.turn_off_disabled >Animations
>View
>Visibility
3 Configuration
3.6 Expanding the number of SENTRON PAC3200 devices
44
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Beitrags-ID: 58856464
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
No. Instructi on Pi cture / result / additi onal note
4. In the project tree, go to the text list and enter
the names of the new loads in the Load
namelist. The name to be entered
corresponds to the name of the
PAC_data.load_spec[ ].index tag.
Liste mit neuen
Verbrauchern erweitern
3.6.3 Expansions in the Error messages HMI screen
Table 3-14: Expansions in the Error messages HMI screen
No.
Instructi on
Pi cture / result / additi onal note
1. In the project tree, double-click on
HMI alarms.
2. Add the communication fault messages of the
newly added loads to the alarm list. In the
alarm text, specify the relevant load name and
select the trigger tag with the associated array
index.
4 Live demo
4.1 Switching behavior
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 45
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
4 Live demo
4.1 Switchi ng behavior
Initial load relationships as shown in Figure 3-1 are assumed.
Table 4-1: Live demo switching behavior
No. Instructi on Pi cture / result / additi onal note
1. Cause the controller to restart and then go
online.
2. Wait for the start of the measuring period. If it
is triggered using the CPU clock, you can set
the time of day in online mode to start of
measuring period minus n seconds to save
time.
When the measuring period starts after a
restart of the controller, the outputs of all
SENTRON PAC3200 devices will be reset and
all switchable loads will be switched on.
3. Monitor the Load management screen (for
the explanation, see Figure 2-14).
With the third scan after the start of the
measuring period (scan time has elapsed 3 x),
valid data is available that is displayed in the
Load management screen.
The switching behavior will be as follows:
The two loads are successively switched off. In the next measuring period, initially one load is
switched back on (which one depends on the priority list). If the second load is also switched
back on temporarily depends on the relationship between the power values of the loads, base
load and power limit. Over time, the two loads are constantly switched on and off. The core task
of this application is to ensure that the average total power relative to the measuring period
never exceeds the specified power limit at the end of the measuring period. You check this by
evaluating the data log (see chapter 4.2).
4. Go to the Live Demowatch table.
5. In the watch table, modify the following
boundary conditions and monitor the effects of
the modifications.
- Load on/off time
- Load switch-on/switch-off power
- Power limit
- Base load
4 Live demo
4.2 Error messages
46
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Beitrags-ID: 58856464
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
4.2 Error messages
Table 4-2: Live demo error messages
No. Instructi on Pi cture / result / additi onal note
1. No l oad available to switch-off:
In the watch table (see Table 4-1, 5) increase
the base load to such an extent that despite
switching off both loads, the power limit is
exceeded at the end of the measuring period.
At the instant when the system wants to switch
off a (nonexistent) third load, the No load
available to switch-offerror message marked
as incoming is generated and displayed in
the Error messagesHMI screen (see Figure
2-16).
The message disappears as soon as a load is
available for switching off and is switched off.
2. Scan interval too short:
In the watch table (see Table 4-1, 5) enter a
scan interval (LoadSwitching_DB.scan_time)
that is shorter than the communication time for
two loads (e.g., 300ms).
The Scan interval too shorterror message is
generated and displayed in the Error
messagesHMI screen.
The message disappears as soon as the
communication with all loads can be
completed within the scan interval.
3. Communication fault with l oad n:
Remove the RJ 45 connector from one of the
loads.
After the communication monitoring time for
load n has elapsed, the load name
communication faulterror message is
generated and displayed in the Error
messagesHMI screen (see Figure 2-16).
The message disappears as soon as
communication with load n is possible.
4.3 Data log
At the end of each measuring period, the average total power (relative to the
measuring period) is written to a csv file in the load memory as a data log. Wait
until several measuring periods are over before you download the file.
4 Live demo
4.3 Data log
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 47
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
Table 4-3: Live demo data log
No. Instructi on Addi ti onal note / pi cture
1. - Open the browser on your development
system and enter the following IP address
as the Web address: 192.168.0.1. The
Intro page of the controller opens.
- If this has not yet been done, download
and install the security certificate to
ensure that the browser does not inform
you of the missing certificate every time
you open the PLC pages. If the certificate
has already been installed, continue with
5.
2. Install the certificate.
An installation wizard guides you through the
installation. Let Windows automatically select
the certificate store.
3. After finishing the certificate installation, select
ENTER on the Intro page.
4. In Name, enter the user name admin.
It is not necessary to enter a password.
4 Live demo
4.3 Data log
48
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Beitrags-ID: 58856464
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
No. Instructi on Addi ti onal note / pi cture
5. Then navigate to Data Logs and download
the SUM_P_active_av.csv file (the file name is
defined in the DataLog_1 structure in
LoadSwitching_DB).
6. Open the csv file with Microsoft Excel.
Then you can rename, for example, the csv file
to xls, arrange the text in columns and format
the resulting table as required or create a
graphic.
5 Glossary
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 49
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
5 Glossary
Tabelle 5-1: Glossary
Begriff Erluterung
CPU Central Processing Unit in this context the complete controls S7-
1200.
CSV-Format CSV means Comma-Separated Values und describes the format
of a text file used for storing or interchanging simple data structures.
Data Log A data log is a data area in the load memory or on the memory card
to which process values can be written. With den webserver of the
SIMATIC S7-1200 data can be written into an Excel file.
tm Duration of the measuring period, wherein the power utility
calculates the total average power demand to compare it with a
reference value (power limit).
(Tag in STEP 7 program: LoadSwitching_DB.monitoring_time)
tscan Scan cycle in which the SENTRON PAC3200 readings are
transmitted periodically.
(Tag in STEP 7 program: LoadSwitching_DB.scan_time)
Emax(tn) Total energy consumption from the start of the measuring period to
the current instant of time tn in case of permanently keeping the
power limit.
(Tag in STEP 7 program: no direct equvalent)
Eoff(tn) Energy that is available for shedding by the next load to be switched
off according to the priority list from the current time until the end of
the measuring period.
(Tag in STEP 7 program: LoadSwitching_DB.E_switch
11
)
Eon(tn) Energy that is available for switch-on by the next load to be
switched on according to the priority list from the current time until
the end of the measuring period.
(Tag in STEP 7 program: LoadSwitching_DB.E_switch11)
HMI Human Machine Interface
Operator panel as a user interface
IP-Adresse Address if a network participant (CPU, SENTRON PAC3200, HMI,
Engineering system) based on the internet protocol.
MODBUS Serial Communication protocol for use with PLCs, based on a
Master/Slave architecture or a Client/Server relation.
MODBUS on TCP Modbus variant used for communications over TCP/IP networks,
connecting over port 502.
NC-Kontakt Normally closed contact
Relay contact, which is closed if the coil is currentless.
PLC Programmable Logic Controler in this context SIMATIC S7-1200
Pav(tn) Individual average power demand of one load. It permanently
results from the active energy provided by the SENTRON PAC
relative to the interval start of the measuring period current time.
(Tag in STEP 7 program:
PAC_data.consumer_load[#PAC_index].P_active_av)
Pb Not measured base load, which can be entered into the program
and which is added to the loads single power demands.
(Tag in STEP 7 program: LoadSwitching_DB.P_base_load)
11
The program does not differentiate between loads to switch off or on. The distinction is done
by the sign of the overload.
5 Glossary
50
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Beitrags-ID: 58856464
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
Begriff Erluterung
Pmax Power limit specified by the power utility, i.e. the average power
demand, relative to the measuring period, whose exceeding would
result in a higher kilowatthour rate.
(Tag in STEP 7 program: LoadSwitching_DB.P_average_limit)
Poff Active power of the load used for the calculation of the switch-off
instant.
A value less than or equal to the rated power is usually used. The
smaller the value compared to the rated power, the sooner the load
will be switched off at a switch-off request within the measuring
period if the software has defined it as the next load to be switched
off.
(Tag in STEP 7 program: PAC_data.load_spec[n].P_switch_off)
Pon Active power of the load used for the calculation of the switch-on
instant.
A value greater than or equal to the rated power is usually used.
The greater the value compared to the rated power, the later the
load will be switched on at a switch-on request within the measuring
period if the software has defined it as the next load to be switched
on.
(Tag in STEP 7 program: PAC_data.load_spec[n].P_switch_on)
PROFINET Process Fi eld Network is the open Industrial Ethernet standard of
PROFIBUS & PROFINET International (PI) for automation.
PROFINET uses TCP/IP and IT standards
Eov(tn) Consumed energy of all loads from the start of the measuring period
until the current time that exceeds the energy Emax(tn) max.
permissible until that time.
(Tag in STEP 7 program: LoadSwitching_DB.E_overload)
Pav(tn) Instantaneous total average power demand of all loads that is
continually calculated from the start of each power utilitys
measuring period.
(Tag in STEP 7 program: SUM_P_active_av*
[*Temp variable in FC Load_shedding])
Pav_fc Forecast of Pav for the end of the measuring period.
(Tag in STEP 7 program:
LoadSwitching_DB.SUM_P_active_av_fc)
tn Currently regarded moment within the power utilitys measuring
period.
6 Code Elements
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Entry ID: 58856464 51
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
5
8
8
5
6
4
6
4
_
S
e
t
2
4
_
L
o
a
d
S
w
i
t
c
h
i
n
g
_
V
1
d
1
_
e
n
.
d
o
c
6 Code Elements
The software examples are available on the HTML page from which you
downloaded this document.
Table 6-1: Code elements
Fi l e name
12
Contents
58856464_Set24_LoadSwitching_V11_SP2_Vxdx.zip STEP 7 V11 project
58856464_Set24_LoadSwitching_V12_Vxdx.zip STEP 7 V12 project
7 References
Table 7-1: References
No. Document/l ink
/1/ Manual SENTRON Power Monitoring Device PAC3200
http://support.automation.siemens.com/WW/view/en/26504150
/2/ SIMATIC S7-1200 System Manual
http://support.automation.siemens.com/WW/view/en/36932465
/3/ STEP 7 Basic V11.0 SP2 System Manual
http://support.automation.siemens.com/WW/view/en/57199536
STEP 7 Basic V12 System Manual
http://support.automation.siemens.com/WW/view/en/68113678
/4/ S7-1200 Firmware Update to V3.0 via Web Server
http://support.automation.siemens.com/WW/view/en/67190848
/5/ STEP 7 V11 Support Packages for the hardware catalog in the TIA Portal
http://support.automation.siemens.com/WW/view/en/54164095
/6/ Updates for STEP 7 V11 SP2 and WinCC V11 SP2
http://support.automation.siemens.com/WW/view/en/58112582
/7/ GPS synchronization of system time and date of your S7-1200 PLC
http://support.automation.siemens.com/WW/view/en/45057335
/8/ Operating Instructions S7-1200 Compact Switch Module CSM 1277
http://support.automation.siemens.com/WW/view/en/36087313
/9/ Operating Instructions PM1207
http://support.automation.siemens.com/WW/view/en/37316256
/10/ Operating Instructions SIMATIC HMI HMI devices Basic Panels
http://support.automation.siemens.com/WW/view/en/31032678
12
Always use the most current software
(pay attention to _Vxdx in the file name!).
8 History
52
Switching Loads with S7-1200 and SENTRON PAC3200
Version 1.1, Beitrags-ID: 58856464
C
o
p
y
r
i
g
h
t
S
i
e
m
e
n
s
A
G
2
0
1
3
A
l
l
r
i
g
h
t
s
r
e
s
e
r
v
e
d
8 History
Table 8-1: History
Versi on Date Modi fi cati on
V1.0 03/2012 First edition
V1.1 01/2013 - You can select wether reclosing consumer loads is
accomplished manually or automatically
- Editorial revision
V1.1 05/2013 Supplemented by TIA Portal V12 project.
V1.1 07/2013 Minimal text modification in chap.1