# Redundancy configuration for Siemens 400 PLC

**URL:** <https://forum.inductiveautomation.com/t/redundancy-configuration-for-siemens-400-plc/80119>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [October 6, 2023, 6:11am UTC](https://forum.inductiveautomation.com/t/redundancy-configuration-for-siemens-400-plc/80119 "2023-10-06T06:11:30Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![liangliang\_yi](https://avatars.discourse-cdn.com/v4/letter/l/ad7895/32.png) [@liangliang\_yi](https://forum.inductiveautomation.com/u/liangliang_yi)\
**Post date:** [October 6, 2023, 6:11am UTC](https://forum.inductiveautomation.com/t/redundancy-configuration-for-siemens-400-plc/80119/1 "2023-10-06T06:11:30Z")

</div>

I have a 400 PLC, two CP cards, different IP addresses and slot numbers.

I can use the exchange project to change the ip address if one CP is faulty. but I am not able to change the slot number, which is not working for the 400 PLC redundancy.

> **[Ignition Exchange](https://inductiveautomation.com/exchange/2160%3Aoverview?check_logged_in=1)**
>
> Discover, share, and download community made Ignition resources in collaboration with your organization or the Ignition community.

Then I am thinking about setting up two OPC devices, one for each CP card, then I can dynamically change OPC device in the tag configuration.  
Something like:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/2/725fdb3f006f9e0705fc23b8e77f4301657797b1.png)

But I am cannot find a proper way to write the tag script to point to a common string type memory tag "namePLC", that I can write some script to change the string to point to the working PLC device.

Any suggestion is appreicated.

Here's the function request dated back to 2017.

> **[Add system.device.setDeviceProps function to change properties of a device...](https://inductiveautomation.canny.io/ignition-features-and-ideas/p/add-systemdevicesetdeviceprops-function-to-change-properties-of-a-device-to-comm)**
>
> Up to version 7.9.2 the only function available to change device parameters is: system.device.setDeviceHostname(deviceName, hostname) This way, only ip address

---

<div class="post-metadata">

**Author:** ![Hayden\_Watson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hayden_watson/32/48792_2.png) [@Hayden\_Watson](https://forum.inductiveautomation.com/u/Hayden_Watson)\
**Post date:** [October 6, 2023, 6:32am UTC](https://forum.inductiveautomation.com/t/redundancy-configuration-for-siemens-400-plc/80119/2 "2023-10-06T06:32:59Z")

</div>

When I've had to do similiar for a DNP3 module we were able to write and change the hostname (i.e. the IP address) using scripting, though we you can't change slot numbers, port numbers etc.

Can you not add all of these tags into UDTs, set the device name as a parameter and write a script to change that parameter in case of comms failure?

---

<div class="post-metadata">

**Author:** ![taglias](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@taglias](https://forum.inductiveautomation.com/u/taglias)\
**Post date:** [October 6, 2023, 9:33am UTC](https://forum.inductiveautomation.com/t/redundancy-configuration-for-siemens-400-plc/80119/3 "2023-10-06T09:33:13Z")

</div>

At the time, 2017, I had to use the Kepware OPC server, where you can change dynamically the rack in the PLC connection properties.

Using Ignition maybe you could:

- create two device connections and some tags for both to monitor which PLC is currently master
- create a single UDT containing all the tags, with a parameter PLCName, using in all tags the OPC Tag Path [{PLCName}]DBxxx,REALyyy
- change the parameter of the only tag instance via script writing the device name of the PLC that is master

I never tried it and I would use the Kepware driver, but it's the easiest way I see using Ignition.

---

<div class="post-metadata">

**Author:** ![chaoliang](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@chaoliang](https://forum.inductiveautomation.com/u/chaoliang)\
**Post date:** [October 6, 2023, 11:37am UTC](https://forum.inductiveautomation.com/t/redundancy-configuration-for-siemens-400-plc/80119/4 "2023-10-06T11:37:34Z")

</div>

thank you for the detailed reply. this is exactly what I want to achieve.

But the problem is how to dynamically change the parameter PLCname, I can only assign this with a static value each time I create a UDT instance.

What is the way to dynamically assign value to udt instance parameters?

Thanks

---

<div class="post-metadata">

**Author:** ![chaoliang](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@chaoliang](https://forum.inductiveautomation.com/u/chaoliang)\
**Post date:** [October 6, 2023, 11:39am UTC](https://forum.inductiveautomation.com/t/redundancy-configuration-for-siemens-400-plc/80119/5 "2023-10-06T11:39:40Z")

</div>

Thanks for the reply.

All my tags are from udt instance, as part of the coding library.

It will be a huge change if I am not going to udts.

---

<div class="post-metadata">

**Author:** ![chaoliang](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@chaoliang](https://forum.inductiveautomation.com/u/chaoliang)\
**Post date:** [October 6, 2023, 11:44am UTC](https://forum.inductiveautomation.com/t/redundancy-configuration-for-siemens-400-plc/80119/6 "2023-10-06T11:44:38Z")

</div>

To be in details, I dont want to use script to change the instance parameters, otherwise it will thousands of line of script to change each instance of the udt.

I want the Udt to point to common 'PLCname' memory tag, the value of this tag will be the OPC device name of the UDT tags, So I just need to write one script to change the momory tag value, then all of the udt created tags will be pointing to the new PLC.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 6, 2023, 12:41pm UTC](https://forum.inductiveautomation.com/t/redundancy-configuration-for-siemens-400-plc/80119/7 "2023-10-06T12:41:20Z")

</div>

> [@chaoliang](#):
>
> So I just need to write one script to change the momory tag value, then all of the udt created tags will be pointing to the new PLC.

You cannot. Tag properties cannot be bound to **anything** outside of UDTs, and only to UDT parameters within UDTs. Changes to tag properties or UDT params/props based on other tags must be **written** , typically by a change event **at the source**.

Consider using a UDT parameter that you **don't override** in the instances. Then you can write to the **definition's** value to change all of the instances.

---

<div class="post-metadata">

**Author:** ![chaoliang](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@chaoliang](https://forum.inductiveautomation.com/u/chaoliang)\
**Post date:** [October 6, 2023, 2:40pm UTC](https://forum.inductiveautomation.com/t/redundancy-configuration-for-siemens-400-plc/80119/8 "2023-10-06T14:40:02Z")

</div>

Hi Paul, thank you for the detailed reply every time.

I tried to understand the following sentence, can you elaborate what means by " write to the **definition's** value "?

> Consider using a UDT parameter that you **don't override** in the instances. Then you can write to the **definition's** value to change all of the instances.

for example, I have a UDT created.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/f/8f1f6748ab5453b488cf7d80da310552862daef8.png)

and the tag "outValue" is configured to map to the parameter "name\_PLC".  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/0/4028c513548924575ab11c977002d90b31c32201.png)

Then I created an instance tag "test\_tag" and I assigned the "name\_PLC" parameter to "PLC1".  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/e/1eeb9727242a9bca4614c781e5975df253022af3.png)

How do I change the value "PLC1" to "PLC2"? Is there any ignition function I can use?

---

<div class="post-metadata">

**Author:** ![chaoliang](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@chaoliang](https://forum.inductiveautomation.com/u/chaoliang)\
**Post date:** [October 6, 2023, 2:51pm UTC](https://forum.inductiveautomation.com/t/redundancy-configuration-for-siemens-400-plc/80119/9 "2023-10-06T14:51:48Z")

</div>

While searching way to change tag parameters, I found the following post.

> [@Modify UDT parameter in a Script](https://forum.inductiveautomation.com/t/modify-udt-parameter-in-a-script/62729/5):
>
> @pascal.fragnoud No, it's not overridden in the instance. A colleague suggested it may not update in the tag browser because their isn't a time stamp associated with it.

I am going to have a try and update here.

---

<div class="post-metadata">

**Author:** ![chaoliang](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@chaoliang](https://forum.inductiveautomation.com/u/chaoliang)\
**Post date:** [October 6, 2023, 2:59pm UTC](https://forum.inductiveautomation.com/t/redundancy-configuration-for-siemens-400-plc/80119/10 "2023-10-06T14:59:59Z")

</div>

The following script will change the UDT instance tag parameter from "PLC1" to "PLC2".

```auto
system.tag.writeBlocking("[default]test_tag/Parameters.name_PLC", "PLC1")

```

The following script will change the UDT parameter default value from "PLC1" to "PLC2", hence all instances are changed, as long the instance tag parameter was not overwritten.

```auto
system.tag.writeBlocking("[default]_types_/udt_test/Parameters.name_PLC", "PLC2")

```

---

<div class="post-metadata">

**Author:** ![Khurram\_sarfraz](https://avatars.discourse-cdn.com/v4/letter/k/67e7ee/32.png) [@Khurram\_sarfraz](https://forum.inductiveautomation.com/u/Khurram_sarfraz)\
**Post date:** [February 10, 2024, 12:33pm UTC](https://forum.inductiveautomation.com/t/redundancy-configuration-for-siemens-400-plc/80119/11 "2024-02-10T12:33:46Z")

</div>

I am using the same method as you have described where the UDT parameter name is set by using system.tag.writeBlocking script

I want to changeover from PLC1 to PLC2 when PLC1 is no longer connected.

I have Connected status from PLC1 (S7-400H) as integer and im using it in IF ELSE script to changeover to PLC2 (S7-400H) when PLC1 is no longer connected.

This script doesn't work for me, I have also tested creating Memory integer tag instead of connected status tag and simulated 0 and 1 but that doesn't work too (parameter name doesn't shift over to the other PLC), the ELSE statement works but the IF does not !!

 ![script question-](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/c/aca612fa5885ed015bce3cb757cf992c68da5de4.jpeg)

Can someone Please help!
