
adccommunitymod (AutomationDirect) asked a question.
Created Date: July 18,2017
Created By: ThereIsNoSky
**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****
Hello, I'm currently writing my first Productivity 2000 program, and I have been watching videos on the Interconnecting Automation website. I am going to be doing quite a few analog compares, etc. and I think I can do that without a problem. In order to fully test my program, I was hoping to write a simulation task as well that I could enable or disable with a single bit. I was hoping that I could use that bit to select whether a live value or a simulated value should be fed into the final Tag. For instance: I have a SIM_Enabled bit TST_Level - Float RAW_Level - Float Level_Tank - Float Level_Tank is what I will use for my HMI and all of my logic. So, I am curious if I can have a rung that does this: if SIM_Enabled = true then Level_Tank = TST_Level else if SIM_Enabled = false then Level_Tank = RAW_Level Does that make sense? Is that possible? What rung commands would I use to implement? I played around with forcing values in the Data Window, but I would like to be able to let the simulation run unimpeded overnight / for several days. I looked at the Math Command, but that didn't seem to be working. Thanks for your help.
Created Date: July 18,2017
Created by: ThereIsNoSky
Hello,
I'm currently writing my first Productivity 2000 program, and I have been watching videos on the Interconnecting Automation website. I am going to be doing quite a few analog compares, etc. and I think I can do that without a problem.
In order to fully test my program, I was hoping to write a simulation task as well that I could enable or disable with a single bit.
I was hoping that I could use that bit to select whether a live value or a simulated value should be fed into the final Tag.
For instance:
I have a SIM_Enabled bit
TST_Level - Float
RAW_Level - Float
Level_Tank - Float
Level_Tank is what I will use for my HMI and all of my logic.
So, I am curious if I can have a rung that does this:
if SIM_Enabled = true then Level_Tank = TST_Level
else if SIM_Enabled = false then Level_Tank = RAW_Level
Does that make sense? Is that possible? What rung commands would I use to implement?
I played around with forcing values in the Data Window, but I would like to be able to let the simulation run unimpeded overnight / for several days.
I looked at the Math Command, but that didn't seem to be working.
Thanks for your help.
Created Date: July 18,2017
Created by: kewakl
CPD Copy Data
CPD will copy the left term into the right term whenever the run is true.
Would this rung pair do it?
. SIM_Enabled |
.--------]/
. +-----------------------
.
. SIM_Enabled |
.--------]
. +-----------------------
.
This rung will be equivalent, but looks more brutish because it AWAYS makes the first copy, then overwrites Level_Tank with TST_Level is SIM_Enabled is true
. |
.-----+------------------------------+ CPD
. | | RAW_Level Level_Tank
. | +-----------------------
. |
. | SIM_Enabled |
. +--------]
. +-----------------------
.
You can have multiple terms copied in one CPD, if you wish.
. Store_EN |
.--------]^
. | RAW_Level Tank_Level_History(1),(1)
. | Timestamp Tank_Level_History(2),(1)
. +-----------------------
Created Date: July 19,2017
Created by: OkiePC
The way I would do this is to put your tag mapping in a subroutine. Have another subroutine for simulation. When your SIM bit is true, don't call the I/O mapping subroutine(s) and DO call the simulation routine.
Created Date: July 19,2017
Created by: kewakl
The way I would do this is to put your tag mapping in a subroutine. Have another subroutine for simulation. When your SIM bit is true, don't call the I/O mapping subroutine(s) and DO call the simulation routine.
Excellent methodology! Not sure OP is this far along, though.
To carry this further, if process permits, I copy all my iterable (physical ANALOG) data to arrays so I can do the SAME process functions on all similar data within a loop. This way, all of my data is indexable, the results are indexable and the process function's logic is minimized.
Created Date: July 26,2017
Created by: ThereIsNoSky
This was exactly the response suggestion that I needed. I have since gotten my entire program running except for the Modbus Read commands for some of my inputs, but that's for another thread (if I can't get it figured out). Thank you both for your suggestions, they were just the bump in the right direction that I needed.