Denzil

Alpha2 Help?

6 posts in this topic

Hi

Although I have used programming languages like basic and C for many years, I have recently tried to get to grips with programming (with the software (not direct)) the Alpha2

I have to admit that I am struggling! I have made a little progress since I worked out that you have to build almost everything at a very low level. But I still can not work out how you make variables that can be used in the program?

For example : If condition A is true X = 10; But if condition A is false then X = 2. I have tried using the bit inputs on the math FBs to enable/disable values of X, but although this will initially alter the value , sending a 0 bit merely freezes the calculation and the value does not change.

It seems like it should be such a simple thing to do? Is there a fundamental concept I am missing?

Any help would be greatly appreciated

Share this post


Link to post
Share on other sites

Hello,

In the Alpha2 you cannot create internal variables. In other words, all you can do is to use logic instructions directly attached to eachother... In essence the Alpha2 is like connecting physical electrical connections - hence there is no dynamic creation of variables/objects. Take a screenshot of the code you're struggling with, maybe we can help...

As a small side note: The Alpha2 is not the "easiest" to program as it has a lot of limitation compared to a FX CPU, where you can create ladder blocks with different internal variables. Since you are an experienced Basic/C user you would probably love Structured Text programming... :-)

But again, post an image of the code, and an explanation of where you're struggling.

Share this post


Link to post
Share on other sites

Thanks Kaare_t

I am at home now and my Alpha2 stuff is at work. It may be that I can explain though:

I am trying to control some swimming pool heaters depending on the generation from SolarPV panels on and the amount of energy consumption on site. It is more economic to use the PV generation in the pool heaters than to 'export' it onto the utility grid. I have two analogue transducers measuring PV generation and site consumption. I have three heaters attached to three digital outputs. 

So, the easy bit is I can calculate whether the site is exporting energy by subtracting the consumption from the generation. Positive results indicate that we are exporting. Then if we are exporting more than the power of the first heater (24kW)-Turn it on. If we are still exporting more than 24kW turn on the second heater; and so on. I have managed to implement this and the PLC is now running out in the field and performing well (after some modifications; an averaging function on the two inputs and some delays on the heaters turning on/off to reduce chatter on the contactors.

The reason for my initial question was that during the development, I wanted to 'tune' the switching behaviour in the software simulator by adding the increase in consumption as the loads were switched on. Simulated feedback if you like? So when heater1 is turned on 24kW would be added to the consumption input. 

So my approach would be that if Heater1 is on, a new calculation is added to the consumption input Cons=Cons-24 I tried to do this by taking the bit output of heater1 to enable this additional calculation. This does work....... until heater1 is turned off, at which point the calculation 'freezes' the value. You cant 'unsubtract' the 24kW when heater1 turns off

Is there a workaround to let me change the values in the calculation?

I am glad you say the Alpha2 is not the easiest to program, I thought I was really missing something when I could not work out how to do this? I have a simular task in the near future. Again involving controlling loads to limit energy export to the Grid. It sounds like I may be better off trying a different PLC. I started already with the Alpha2 though. The new job requires that the permissible export varies (0kw; 30kW and unlimited )depending on time year and the time of day too. I found that the Alpha2 Time FB made it very easy to set when the different permissible values apply. Do the FX have an inbuilt calender/clock function? I was planning on using the PID block and some PWM to fire some SSRs for faster more accurate control of the export (The export limits are contractual in this case)Do you think I am going to struggle with the Alpha to apply the export values to the actual limiting part of the setup?

Thanks again, your help is much appreciated

 

Share this post


Link to post
Share on other sites

Could you post a screenshot of the code that's not working? At the moment I don't have Alpha SW installed, so I cannot see... Or you can wait until I get it installed...

Share this post


Link to post
Share on other sites

OK I will try to post a screenshot tommorrow

Share this post


Link to post
Share on other sites

Hi

I have uploaded a screenshot now. It should make sense if you read the description in my previous post. The mess in the middle with lots of counters are two averaging functions I built to stabilise the analogue inputs a little before the main calculation.

Although it is now running in the field. I had to tune the switching on site. If I could have built in some virtual feedback, I could have done this tuning in the comfort of my office.

I thought it would have been easy to add an additional 24kW to the average consumption calculation every time one of the outputs (o01-o03) turned on and subtaract when they turn off again. But I just cannot find how to do it!

Any ideas would b greatly appreciated

 

AlthoiDivertOS4.thumb.png.9dce6c09024a59d60b14

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now