Crimson 3: Tag Initial State

Join Date
Jun 2016
Location
San Francisco
Posts
7
Is there an easy way to set the initial state of a tag in Crimson 3.0? I have a numeric read/write tag that is linked to one of my plc's analog outputs. I'd like to have it set to a default value when the program initialized and then allow the user to change it manually later.

Changing it manually later is easy but I can't seem to find an initial state setting. Seems like this should be easy. What am I missing?

Thanks.

Scot
 
Is there an easy way to set the initial state of a tag in Crimson 3.0? I have a numeric read/write tag that is linked to one of my plc's analog outputs. I'd like to have it set to a default value when the program initialized and then allow the user to change it manually later.

Changing it manually later is easy but I can't seem to find an initial state setting. Seems like this should be easy. What am I missing?

Thanks.

Scot

Update:
Figured it out. "Pages" section has global setting which allows you to call a function on start up or on power up. Great place for initial condition function. It there's a better way I'd love to hear it but this worked for me.
 
You can also make the tag(s) retentive, and just run the defaults function once to set everything the way you want it.
 
I almost always have a Startup Program that I call by adding that program to the startup field on the global page settings.

In the program file, you can do assignments to tags conditionally.

I often have string tags to label things in some widgets I use often. In the water industrty, the operations folks have a wide variety of naming conventions for things like tanks, pumps and especially water towers.

So I will name the tags, tag folders, and pages generically like "Vessel_A", B, C, etc. Then in my startup program I may have something like:

Code:
if (Rawwater.Chem.Pump_1.Title =="") Rawwater.Chem.Pump_1.Title := "PUMP A";
if (Rawwater.Chem.Pump_2.Title =="") Rawwater.Chem.Pump_2.Title := "PUMP B";

if (Rawwater.Chem.Tank_1.Title =="") Rawwater.Chem.Tank_1.Title := "East TANK Caustic";
if (Rawwater.Chem.Tank_2.Title =="") Rawwater.Chem.Tank_2.Title := "Middle TANK JPH100";
if (Rawwater.Chem.Tank_3.Title =="") Rawwater.Chem.Tank_3.Title := "West TANK JPH100";

In that example, the operator with proper security credentials at runtime can edit the titles of the tanks if, for example, they switch chemical names in a vessel. But I want to make sure that if for whatever reason, the retentive value of the string is wiped out, that I stuff a value in there upon start up.

I have only seen retentive data lost one time in ten years working with these things and it was due to a programming bug I caused...

Paul
 
I usually made a "firstScan" tag and put everything inside of it:
Code:
if (firstScan) {
  // initialize things
  firstScan = false;
}

One thing to keep in mind with retentive variables is how often they are written. I believe that they are written about one minute after power-up and every five or so minutes thereafter. This is in order to reduce the write cycles to the memory. If you make a change and lose power before the next write cycle that change won't be saved.
 
I usually made a "firstScan" tag and put everything inside of it:
Code:
if (firstScan) {
  // initialize things
  firstScan = false;
}

One thing to keep in mind with retentive variables is how often they are written. I believe that they are written about one minute after power-up and every five or so minutes thereafter. This is in order to reduce the write cycles to the memory. If you make a change and lose power before the next write cycle that change won't be saved.

Don't tags initialize set to false/0? In your example if(firstScan) would never be true, right?
 
You're right, it would as I've shown it. Keep in mind that you can also initialize tags with a value. For example:
Code:
int firstScan = true;

I also tended to write my HMI programs a little differently than many do. I didn't like having the different screens run the programs as it can make it difficult to figure out later where a program is being called from. Usually I made a "Main()" (my arbitrary name) program that was called on powerup. This program would look something like this:

Code:
int firstScan = true;
// declare other tags

if (firstScan) {
  // initialize things

  firstScan = false;
}

//run this next section forever
while(1) {
  // do all sorts of things and call the other programs as needed
}

This program would continuously run (it would never complete) and it would call other sub-programs as needed. These sub-programs would need to be run as background tasks (making sure they didn't overlap if they were not single pass programs) in order for them to actually be run.
 
Is there an easy way to set the initial state of a tag in Crimson 3.0? I have a numeric read/write tag that is linked to one of my plc's analog outputs. I'd like to have it set to a default value when the program initialized and then allow the user to change it manually later.

Changing it manually later is easy but I can't seem to find an initial state setting. Seems like this should be easy. What am I missing?

Thanks.

Scot

Why are we doing this in Crimson rather than the PLC? As much as I like the Crimson 3.0 based products, I prefer to leave my control in my controller.

If you need to periodically reset the output value, you can use whatever move statement your plc uses and base that on whatever condition you like - even a pushbutton from the display.

Just wondering...
 
Why are we doing this in Crimson rather than the PLC? As much as I like the Crimson 3.0 based products, I prefer to leave my control in my controller.

If you need to periodically reset the output value, you can use whatever move statement your plc uses and base that on whatever condition you like - even a pushbutton from the display.

Just wondering...


That's a good question. I also prefer to have all data control in the controller.
Different styles for each person.
 
In my cases where I am doing this, the tags are "memory" tags kept only in the HMI.

I use lots of "Memory Tags" also, but when it comes to physical outputs, I let the Control Device (PLC, PAC, etc.) do what it was designed to do.

I know that everyone has their way of doing things, but since the OP was asking "how" to do something, I thought it good to ask the "why" question too.
 
I agree. I once worked in a factory where an operator just about got fired because the width of a product changed slightly making a bunch of scrap.

The root causes:
1) loose power wire on the PV550. When the operator bumped the panel, once in a while it would reboot the HMI. The operator worked most of the time where she could not see the HMI so never noticed the reboot sequence.

2) PV550 set to write to controller on power up.

So I agree to let the PLC handle the states of values that it controls.
 
The Graphite HMIs have enough horsepower that in many cases (because our control schemes are so simple and programs so small) we will use the Graphite as the controller.

But yes, I also agree that if there is a separate controller present, it should be the keeper of all the tags basically, with only copies or intermediate values for displayed calculations on the HMI.
 
Why are we doing this in Crimson rather than the PLC? As much as I like the Crimson 3.0 based products, I prefer to leave my control in my controller.

If you need to periodically reset the output value, you can use whatever move statement your plc uses and base that on whatever condition you like - even a pushbutton from the display.

Just wondering...

At the time, I was having a tough time figuring out how to set the initial state in my DoMore PLC and figured it might be easier to set the initial state in the HMI. I've since then figured out how to do that as well so maybe I'll rewrite that section later so values don't get reset if the HMI crashes. Thanks for the help everyone.
 

Similar Topics

Hi, I'm having an issue in crimson 3.0 when I create a programme using a case statement referencing a fault word that each bit needs to change the...
Replies
5
Views
262
Hi, I have a complex database in Crimson 3.0 and in one of the display pages I am trying to get a tag to show the sum of several other tags. The...
Replies
3
Views
173
Action On Release command Set(ConveyorPopup,ConveyorPop_1) rejected w/ string tags. SetStringTag(index, data) wants an index. How does one pass...
Replies
8
Views
966
Hi I'm trying to embed a Tag into the text field of a 'Multistate' Tag in Crimson 3.1. Is this at all possible and if so what is the syntax to...
Replies
3
Views
856
I am having a problem understanding how to assign tags for a simple stop - start push buttons. The Logix 5000 routine to stop and start the pump...
Replies
17
Views
4,944
Back
Top Bottom