# Inverter power control

**URL:** <https://forum.inductiveautomation.com/t/inverter-power-control/24494>\
**Category:** Ignition\
**Created:** [April 30, 2019, 5:35am UTC](https://forum.inductiveautomation.com/t/inverter-power-control/24494 "2019-04-30T05:35:03Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oleh](https://avatars.discourse-cdn.com/v4/letter/o/b4bc9f/32.png) [@Oleh](https://forum.inductiveautomation.com/u/Oleh)\
**Post date:** [April 30, 2019, 5:35am UTC](https://forum.inductiveautomation.com/t/inverter-power-control/24494/1 "2019-04-30T05:35:03Z")

</div>

I have a problem.  
I im using ignition 7.5.12  
Connecting connecting inverters via modbus tcp.  
There is a solar power plant where 80 inverters are installed. Each inverter has a power regulation function by a tag.  
It is necessary to set the value for example: the power plant should work tomorrow at 11:00 with the total power of 2000 kW, 12:00 2100 kW and so on … How can this be implemented? Requires 2000KV / 80 = 25KW (this value should be automatically recorded to each inverter )

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [April 30, 2019, 6:21am UTC](https://forum.inductiveautomation.com/t/inverter-power-control/24494/2 "2019-04-30T06:21:32Z")

</div>

You must be mistaken on the Ignition version as presently only 8.0.1 (nightly) is available.

Without more details, I’ll give a general answer that’s hopefully useful. Scheduled control like you’re noting would be accomplished by comparing present time to times in schedule and writing values from schedule whenever present time matches a schedule time. Be careful to make sure you don’t miss a scheduled time (check often enough and don’t look for an exact equals match), and ideally only write the values for that schedule once (one shot when time \> scheduledTime).

While this would be easy to do in Ignition, I don’t recommend using an HMI for control logic. Put the schedule and the logic to use it in the PLC and view/edit the schedule in Ignition.

---

<div class="post-metadata">

**Author:** ![Oleh](https://avatars.discourse-cdn.com/v4/letter/o/b4bc9f/32.png) [@Oleh](https://forum.inductiveautomation.com/u/Oleh)\
**Post date:** [April 30, 2019, 6:45am UTC](https://forum.inductiveautomation.com/t/inverter-power-control/24494/3 "2019-04-30T06:45:29Z")

</div>

Sorry.Ignition 7.5.12

---

<div class="post-metadata">

**Author:** ![Oleh](https://avatars.discourse-cdn.com/v4/letter/o/b4bc9f/32.png) [@Oleh](https://forum.inductiveautomation.com/u/Oleh)\
**Post date:** [April 30, 2019, 6:52am UTC](https://forum.inductiveautomation.com/t/inverter-power-control/24494/4 "2019-04-30T06:52:36Z")

</div>

I would like to use Ignition. Where can I find information on how to do this in Ignition? Now there is no way to put an additional PLC.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [April 30, 2019, 7:23am UTC](https://forum.inductiveautomation.com/t/inverter-power-control/24494/5 "2019-04-30T07:23:10Z")

</div>

You can go thru the Inductive University and see [scripting section](https://www.inductiveuniversity.com/courses/scripting/7.9). I think you can use gateway timers for this with a resolution of 5 to 10 seconds, depending upon the accuracy of time trigger. Compare the current time \> the set trigger times to write the appropriate value in the tags corresponding to the Inverted set point.

---

<div class="post-metadata">

**Author:** ![Oleh](https://avatars.discourse-cdn.com/v4/letter/o/b4bc9f/32.png) [@Oleh](https://forum.inductiveautomation.com/u/Oleh)\
**Post date:** [May 8, 2019, 5:29am UTC](https://forum.inductiveautomation.com/t/inverter-power-control/24494/6 "2019-05-08T05:29:31Z")

</div>

Thank you Pramanj! You helped me a lot.  
I wrote a script, it works but gives the error “name Tags is not defined”.  
How can I add a value from the “PR” tag to the row of the script “Values”? The value of the tag “PR” periodically changes.

---

<div class="post-metadata">

**Author:** ![Oleh](https://avatars.discourse-cdn.com/v4/letter/o/b4bc9f/32.png) [@Oleh](https://forum.inductiveautomation.com/u/Oleh)\
**Post date:** [May 8, 2019, 5:29am UTC](https://forum.inductiveautomation.com/t/inverter-power-control/24494/7 "2019-05-08T05:29:47Z")

</div>

![%D0%91%D0%B5%D0%B7%D1%8B%D0%BC%D1%8F%D0%BD%D0%BD%D1%8B%D0%B9](https://us1.discourse-cdn.com/inductiveautomation/original/2X/d/dde1a524ce9a9097e1a4eb8d016f1f2ac1c7a7c1.png) ![%D0%91%D0%B5%D0%B7%D1%8B%D0%BC%D1%8F%D0%BD%D0%BD%D1%8B%D0%B91](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/c4ee0b04a344c4b02f370dc09bf52ed5bc909467.png)

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [May 8, 2019, 5:59am UTC](https://forum.inductiveautomation.com/t/inverter-power-control/24494/8 "2019-05-08T05:59:37Z")

</div>

I guess you need to check the syntax of your code. It should be as per the documentation (for verion 8) [https://docs.inductiveautomation.com/display/DOC80/system.tag.writeBlocking](https://docs.inductiveautomation.com/display/DOC80/system.tag.writeBlocking) which says:

`# Specify the paths`  
`paths ` `=``[`  
` ` `"[default]Folder/Tag_A"` `,`  
` ` `"[default]Folder/Tag_B"`  
` ` `]`

`# Specify the values`  
`values ` `=``[`  
` ` `1` `,`  
` ` `2`  
` ` `]`  
`# Send the writes off`  
`system.tag.writeBlocking(paths, values)`

for version 7.9 see documentation on page [https://docs.inductiveautomation.com/display/DOC79/system.tag.writeAll](https://docs.inductiveautomation.com/display/DOC79/system.tag.writeAll)

So you need to specify the paths for your three variables corresponding to your inverter outputs paths=["[default]P1","[default]P2",[default]P3",[default]PR"] (get paths by right-clicking on the tags in tag browser and select get tag path) and values=[15,11,9,38] and then call system.tag.writeBlocking(paths, values) in the if block when time equals hh:mm:ss (include ss also because your timer runs every 5 seconds or change timer to 60 seconds so that it will trigger once in a minute so you don't need to compare seconds).

In the current code the inverter is getting written outside the if block! So it will overwrite same value again and again!

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [May 8, 2019, 6:37am UTC](https://forum.inductiveautomation.com/t/inverter-power-control/24494/9 "2019-05-08T06:37:38Z")

</div>

> [@Oleh](#):
>
> gives the error “name Tags is not defined”

As @PRAMANJ notes, the error is because the write is happening whether the time condition is met or not. When it is not met, `tags` is `None` because it is only set when the if time condition is true.

Post your code inside triple back ticks (`, or use the \</\> button at the top of the post window) to make it easy for others to read and edit.

> [@Oleh](#):
>
> How can I add a value from the “PR” tag to the row of the script “Values”?

You probably want something like the following (though you may need to stick with your date code as I'm not sure these `system.date` functions exist in your version):

```Python
if system.date.format(system.date.now(), 'hh:mm') == '08:09':
	# Get PR value.
	PR_value = system.tag.read('PR').value
	# List tags to write.
	tags = ['P1', 'P2', 'P3']
	# Below lines are also indented so they only execute when if condition is true (like the tags line above).
	# List values. PR_value will be written to P3 tag.
	values = [15, 11, PR_value]
	# Write tags.
	system.tag.writeAll(tags, values)

```

This will write repeatedly at the timer event interval while the time condition remains true. You could do something like writing another tag storing the last time values were written and check that it is at least a minute ago to avoid redundant writes. Or simpler, as @PRAMANJ suggests, set the event script to run every 60 seconds so the event only occurs once per minute.
