Beijer HMI (Scripting)

phuz

Member
Join Date
Jun 2008
Location
Mohnton, PA
Posts
1,043
First time working with one of these units. Software isn't too bad, but I'm a bit stuck on the scripting engine. The documentation isn't very helpful. Do the Script Modules constantly run or must they be called? This application has a "timer" script that gets set true with an interval of 1000, but I don't see the code being executed otherwise tag values should be increasing, and they are not. This application was handed to me as the "latest" from the original programmer.
 
It's c# and so event driven.
The script modules are not automatically called, but if you have a timer somewhere this may be calling the sm, or if it doesn't need to be instantiated then maybe just a method in the sm.
In the script module, on the left are events to which methods can be hooked; 'script module created' is a likely candidate for creating a timer event which repeatedly calls other stuff.
Pp
 
It's c# and so event driven.
The script modules are not automatically called, but if you have a timer somewhere this may be calling the sm, or if it doesn't need to be instantiated then maybe just a method in the sm.
In the script module, on the left are events to which methods can be hooked; 'script module created' is a likely candidate for creating a timer event which repeatedly calls other stuff.
Pp

Actually under script module created, there is nothing. The timer is defined, however, within the script module. I just can't figure out what's calling the script.
 
I'd be happy to have a quick look. You can mail it if you'd rather not post it.

No problem with posting this:
(...and thank you:))

Code:
//--------------------------------------------------------------
// Press F1 to get help about using script.
// To access an object that is not located in the current class, start the call with Globals.
// When using events and timers be cautious not to generate memoryleaks,
// please see the help for more information.
//---------------------------------------------------------------

namespace Neo.ApplicationFramework.Generated
{
	using System.Windows.Forms;
	using System;
	using System.Drawing;
	using Neo.ApplicationFramework.Tools;
	using Neo.ApplicationFramework.Common.Graphics.Logic;
	using Neo.ApplicationFramework.Controls;
	using Neo.ApplicationFramework.Interfaces;    
    
	public partial class TimerScript
	{
		private static Timer timer1 = null;
				
		static TimerScript()
		{
			timer1 = new Timer();
			timer1.Tick += new EventHandler(TimeOut1);
			timer1.Interval = 1000;
			timer1.Enabled = true;			
		}

		public void Stop() 
		{
			try {
				timer1.Enabled = false;
			}
			catch(Exception) {}

			if (Globals.Tags.Running_Status.Value==1)
			{Globals.Tags.Paused.Value = 1;
			Globals.Tags.Elapsed_Time_Color.Value=0;
			}		
			else
			{Globals.Tags.Paused.Value = 0;
			}	
		}
		public void Start()
		{
			try {
				Globals.Tags.ElapsedTime.Value = 0;
				Globals.Tags.ElapsedTimeMin.Value = 0;
				timer1.Enabled = true;
				Globals.Tags.Elapsed_Time_Color.Value=1;
				}
			catch(Exception) {}
		}
		
		public void Resume() 
		{
			try {
				timer1.Enabled = true;
				Globals.Tags.Paused.Value = 0;
				Globals.Tags.Elapsed_Time_Color.Value=1;
			}
			catch(Exception) {}
		}
		
		public void Reset()
		{
			try {
				Globals.Tags.ElapsedTime.Value = 0;
				Globals.Tags.ElapsedTimeMin.Value = 0;
				Globals.Tags.Elapsed_Time_Color.Value=0;
			}
			catch(Exception) {}
		}
		
		private static void TimeOut1(Object myObject, EventArgs myEventArgs) 
		{			
			
			if (Globals.Tags.Running_Status.Value==1)
			{Globals.Tags.ElapsedTime.Value = Globals.Tags.ElapsedTime.Value + 1;
				Globals.Tags.ElapsedTimeMin.Value = Globals.Tags.ElapsedTime.Value / 60;
			}
			if (Globals.Tags.Running_Status.Value==1 &&
					Globals.Tags.CookDone.Value ==0)	
				{Globals.Tags.Step_Elapsed_Time.Value = Globals.Tags.ElapsedTimeMin.Value;
				}
			if (Globals.Tags.Running_Status.Value==1 &&
				Globals.Tags.ElapsedTimeMin.Value>=Globals.Tags.Cook_Time_1.Value &&
				Globals.Tags.Rec_Cook_Time_2.Value >0 &&
				Globals.Tags.CookDone.Value ==0)
			
			{Globals.Tags.Cook_Done1.Value = 1;
			Globals.Tags.Step_Elapsed_Time.Value = (Globals.Tags.ElapsedTimeMin.Value-Globals.Tags.Rec_Cook_Time_1.Value);
			}
			
			if (Globals.Tags.Running_Status.Value==1 &&
				Globals.Tags.ElapsedTimeMin.Value>=Globals.Tags.Cook_Time_2.Value &&
				Globals.Tags.Rec_Cook_Time_3.Value >0 &&
				Globals.Tags.CookDone.Value ==0)
			
			{Globals.Tags.Cook_Done2.Value = 1;
			Globals.Tags.Step_Elapsed_Time.Value = (Globals.Tags.ElapsedTimeMin.Value-Globals.Tags.Rec_Cook_Time_1.Value-Globals.Tags.Rec_Cook_Time_2.Value);
			}
			
			if (Globals.Tags.Running_Status.Value==1 &&
				Globals.Tags.ElapsedTimeMin.Value>=Globals.Tags.Cook_Time_3.Value &&
				Globals.Tags.Rec_Cook_Time_4.Value >0 &&
				Globals.Tags.CookDone.Value ==0)
			
			{Globals.Tags.Cook_Done3.Value = 1;
			Globals.Tags.Step_Elapsed_Time.Value = (Globals.Tags.ElapsedTimeMin.Value-Globals.Tags.Rec_Cook_Time_1.Value-Globals.Tags.Rec_Cook_Time_2.Value-Globals.Tags.Rec_Cook_Time_3.Value);
			}
			
			if (Globals.Tags.Running_Status.Value==1 &&
				Globals.Tags.ElapsedTimeMin.Value>=Globals.Tags.Cook_Time_4.Value &&
				Globals.Tags.Rec_Cook_Time_5.Value >0 &&
				Globals.Tags.CookDone.Value ==0)
			
			{Globals.Tags.Cook_Done4.Value = 1;
			Globals.Tags.Step_Elapsed_Time.Value = (Globals.Tags.ElapsedTimeMin.Value-Globals.Tags.Rec_Cook_Time_1.Value-Globals.Tags.Rec_Cook_Time_2.Value-Globals.Tags.Rec_Cook_Time_3.Value-Globals.Tags.Rec_Cook_Time_4.Value);
			}
			if (Globals.Tags.Running_Status.Value==1 &&
				Globals.Tags.ElapsedTimeMin.Value>=Globals.Tags.Cook_Time_5.Value)
			
			{Globals.Tags.CookDone.Value = 1;
			}
			}			
		void TimerScript_Created(System.Object sender, System.EventArgs e)
		{
			
		}	
	}	
}
 
The method called TimerScript() has the same name as the class, so it's a constructor. This'll be called automatically. The timer is created here and its Tick (done) is hooked to the Timeout1 method.
Note, some of the methods (Start, Stop, Resume etc) are defined Public, so I guess they're called from script behind screens. Look for 'Globals.TimerScript.Start();' syntax.
Tbh, looks like work that should've been done in the plc but that's my $0.02.
Pp

Edit...something's nagging me about constructors in a partial class. I'll have a quick look in the morning.
 
The method called TimerScript() has the same name as the class, so it's a constructor. This'll be called automatically. The timer is created here and its Tick (done) is hooked to the Timeout1 method.
Note, some of the methods (Start, Stop, Resume etc) are defined Public, so I guess they're called from script behind screens. Look for 'Globals.TimerScript.Start();' syntax.
Tbh, looks like work that should've been done in the plc but that's my $0.02.
Pp

Edit...something's nagging me about constructors in a partial class. I'll have a quick look in the morning.

So the fact that it's enabled, it doesn't automatically start "ticking" ?
To me, this is different than a normal visual studio app.
I'll poke around for a start, but I cross referenced TimerScript before and nothing else came up. If it just needs the Start, I can easily do that in the main script.
 
I looked in every screen's script and there is no reference to the TimerScript.Start. But, since you said this gets called automatically, I would assume it get's enabled immediately upon loading, right? The declaration for timer1 includes a timer1.enabled so I would expect to see that going all the time.

None of the graphic screens have any custom scripting behind them, anyway.
 
Last edited:
Didn't realize you could do actions directly out of the tag database, but I found it. There is a bit being set in the main script which didn't cross reference to anything else, but I found this box at the very end, and voila!

Capture.PNG
 
Now I am confused about how the datalogging actually starts. I have it set to collect at periods of 5 seconds, and I have my trend set to use the logged values, but it doesn't start showing the graphs until I go to the trend page, and once I do that, it continues to collect.
 
Hello
That trigger was well hidden! Well found!
Trending...are the tags set to 'Always Active' in the tag list?
TBH, I thought tags reference in the datalogger had this applied regardless, but I could be wrong.
 
I confirmed the data logger is collecting data right away, but the graph is only showing data from the time I enter the trend.
 

Similar Topics

hello every body. I want to upload program from E100 HMI Beijer. I have " E - Designer " software and CAB5 programing cable. I tried with USB to...
Replies
18
Views
3,182
Hello, Maybe it is just a simple problem, but I cannot solve it. I have a Wago 750-881 connected to a Beier HMI through IP TCP, the connection is...
Replies
0
Views
872
Well, I'm working with this ABB plc project, and It's been a learning experience coming from Allen Bradley. The project can't be changed to an AB...
Replies
1
Views
1,137
Hello, Can somebody tell me how to Upload and Download program from Beijer 1071 Panel Operator/HMI to a CF Card directly without E-Designer, since...
Replies
2
Views
1,431
Hi. I need to get an upload from a Cimrex 30 HMI. According to a label on the back, it's made by Beijer. See attached photos. It's successfully...
Replies
5
Views
2,529
Back
Top Bottom