Mitsubishi - Analogue output with variable ramp time and output voltage

Godding666

Member
Join Date
Jun 2024
Location
UK
Posts
13
Hello,

Could anyone assist with some pointers as to how this could best be achieved ?

Problem -
- customer wants an analogue output (0 - 5V) which has a variable output and ramp time set by a recipe system. The curve ball is, the output doesn't always start from 0. For example, one recipe sequence starts with a valve at a pilot flow rate of say 0.5V output from the analogue output card, this then needs to ramp up to the full flow rate set at 4.5V over 6 seconds, but these are variable with which recipe is selected.

My problem is I don't know how to do this and make it dynamic so that when any recipe is selected, it then calculates the difference in output values (from pilot flow to then full flow) over the ramp time selected

I started going down the route of calculating the difference between the 2 flow rates and then dividing that gain by the ramp time it had to span and then trying to do that using timers and counters to increment the output value, but I think I'm over complicating it (and rapidly running out of plc programming knowledge needed to complete this task).

Equipment used - FX5UC plc and FX5-4DA analogue output card (GX works 3 and GT Designer)

Recipe variables - Pilot flow rate / Full flow rate / Ramp time

Any pointers/answers are very much appreciated
 
The best thing to do is get the correct scaling first for example 0-100% or 0-100 ltrs/s (scale the raw into a meaningful values)
Then use the recipe value start & end variables & the time in seconds in the recipe
Let's assume we are using % scale it 0.0 to 100.0%
The recipe contains the following
Start % = 20.5
End % = 100.0
Time = 6 seconds
When you run the recipe force the analogue variable to the recipe start. I.E. 20.5
Calculate the value between the start & end i.e. 79.5
Divide this by the 6.0 seconds that will give you the ramp rate (I suggest you use floating point maths for this)
You could convert the seconds into tenths of seconds.
IEC timers have a value in time i.e. 6 seconds, 0ms there are conversion functions to convert integers to time. which are in multiples of 10ms or 100ms for standard timers.
it will depend on what ramp you want maybe every second i.e. increment the value every second or tenth of a second etc. I will try to come up with something later using GXworks3 on an FX5.
 
Hi parky,

Thank you for your time,

This seems much more straight forward than the way I was trying to go about it, I'll see if I can get it working now.

Would very much appreciate if you could show an example if you've time,

Thanks
 
There are a few questions, for example will it always go to full 5v or is the band anything like for example 2v to 4v or 1v to 4.5v
What sort of increments or is it just shared over the range, not done the analogues on FX5 but done many on FX3 so will have to look into if the FX5 analogues have scaling parameters or if it has to be done in the plc code.
One solution perhaps would be divide the range 20% to 60% into 100ms timebase so the increment is every 10th of a second 40/100 0.4 % per 100ms or even if you want finer increments then a 10ms timebase.
 
the full amount will be variable, so as your example it may start at 1v output to the valve and then go to 4.5v, it's not always minimum to maximum.

the ramp rate is just the difference between the 2 outputs shared over the time. it will be somewhat linear, albeit stepping as it increments at each time point, and as you point out a 10ms time base will give a finer control

the analogue output card can be set either way as I understand it. I have set it at the moment through the scaling parameters for the card which is currently 0 - 5 V / 0 -32000 digitally but the 0 - 32000 can be set to whatever it needs to, I think ?
 
Ahh. I have done it in 0-100% as floats I normally make my analogues in what the real medium is i.e. ltrs, %, kg what ever as floats then use my own scaling block to scale the floating point values back to raw integers, never mind, you really need to convert your integers to reals for the calcs then back to integers to output them to the Analogue.
This one is based on a 100ms increment i.e. 10 times a second but as the increments are small it gives what I consider a smooth response.
By the way I did this on an FX3U so in GXWorks2 but should easy convert to FX5 the functions are very similar If I get time I will try to do it in FX5 & integers note: I have used a decimal place on the time i.e. 0.0 to x.x minutes you could use whole minutes it makes it easier, doing it in minutes & seconds just takes a little more processing.
1720532758503.png
 
Some idea of what the HMI Recipe data types are i.e. decimal places or just integers. or a time like 6m 20S or is it just in whole minutes
Also what is the analogue start & end values on the HMI going to be is it 0.0 -100.0 % or just whole numbers i.e. 100 or 32000 or 0-5 again it depends on what the fields are going to be
 
Amazing :D

So much neater than how I was trying to do it, I'll put this into GX works 3 now and try it. I do have scaling blocks made up to convert to floating point so will use them to convert as you suggest.

To give you the broader picture

I have the HMI recipe system configured as 4 different points which they can alter (and I hope I'm not going to confuse things here)

1 - Flow rate for valve 1 = ##.# (limited as 0.0 - 40.0 and output from HMI (GOT 2507) to plc as a Real(32bit)
2 - Valve 2 as a ratio of valve 1 setpoint above (don't ask me - customers :rolleyes:) = #.# (limited as 0.0 to 0.9) again Real(32bit)
3 - Ramp time = ##.# (limited as 0.0 to 10.0 seconds) Real(32bit)
4 - Dwell time = ##.# (limited as 0.0 to 60.0 seconds) Real(32bit)

The analogues for setting the valve output flow rates aren't needed to be displayed on the HMI, the valves themselves have flow meters built into them and give it back as another analogue in (0-5v) which is then displayed on the screen. All the plc does is set the flow rate of the valve via a 0 -5 v analogue output and then the valve sends back a flow rate (as a 0 - 5 v) through an analogue input which is then displayed on the HMI and can also be checked in the PLC.

Appreciate all your efforts so far
 
Ah.. Just ignore parts of my comments I for some reason must have mis-read I thought it was minutes not seconds. My code calcs were for minutes
So perhaps as you have tenths of seconds then 100ms is a tenth of a second as per my reciprocating timer
 
Just tried it on FX5, not used to that IDE so struggling a bit, got it to work but there is an accumulated error, not much but for example for a range of 10.0 to 40.0 & a time of 4 Seconds it seems to reach 31980 (nearly the 32000) it could be the float accuracy but seems a little out or it could be using a 100ms timer those are known to be a little out anyway.
 
Hi Parky

Thank you for your efforts yesterday, I got mine to work. Had to adjust the multiplier of the time setpoint by 10 and I also got the same error as you I think were it doesn't like it if you're trying to divide something by 0 so just held off any calculations until the recipe items have been uploaded by the HMI or after first boot up.

Same as you, the end result seems to vary slightly, but for this application is going to be more than accurate enough

1720588821870.png
again, thanks for your help (y)
 
Yes you have to watch for divide by 0
I have done one in FBD then found another way in which I did in ladder (wasn't sure you knew FBD) I was going to do it in ST but again not sure you would be up to date in that, I have also added a trap so if the final real value is above the valve hi position it sets it to the valve hi setting, for example, if the hi setpoint is 40.0 & it actually goes to 40.345 I force it to the valve hi limit, I also convert it to an integer & scale it so the 0-40 goes 0-32000 to drive the analogue raw.
I think the error is to do with the precision of the float, as it will accumulate over the itterations.
1720599519103.png
 
Last edited:
I have more experience with ladder as I started with that commissioning systems using old AB slc-500 plc's. FB I only started using when we began using FX5 plc's and GX works 3 and I found it easier to program with. ST, I wouldn't have a clue where to start.

I will implement your maximum check logic as I have noticed the output does go over the 5V output and at this point I'm not sure how the valve will react at anything over the 5V (testing system on a bench at the moment without physical valves) so probably best to limit that.

again, thank you for your time đź‘Ť
 
to be honest probably would not notice it, the amount is less than 2%
At a guess 32000 opposed to 32450 is very small & as far as 5v 32,000 / 5.0 = thats a count of 6,400 per volt a hundreth of a volt is 640 so I don't think it's going to make much difference. There is a RAMP function in FX5 but you need to put that into a timed interrupt for example a 100ms interrupt program the parameters are total value to ramp up to, scans (number of calls to ramp i.e. perhaps your minutes /100ms etc.
 
Just for interest I used the RAMP function in an interrupt & it worked perfectly I converted the required ra,p time into amount of 100ms count, the real Min/Max into raw by multiplying by 800 ( min & max multiplied by 800 then converted gives 0-32000, then in an interrupt (100ms) called the RAMP function it worked like a dream always came out exactly & smaller code, however, I only have the simulator & it worked but when I tried again but in FBD there must be a bug in the simulator it would not process the interrupt seems a bit nippy.
 

Similar Topics

MY plc CONFIGURATION RACK 1 Q02HCPU QX40 X0-XF QX40 X10-X1F QX40 X20-X2F QX40 X30-X3F QX40 X40-X4F Q68ADI X/Y50-X/Y5F Q68ADI X/Y60-X/Y6F...
Replies
0
Views
3,506
Hi, I'm planning to install a new Analogue Input module Q68AD-G. It will inserted on Rack 0 Slot 4. When it's installed, will the code recognise...
Replies
6
Views
2,745
Hi, I've got a Q68AD-G card (8 channel). I want to configure it for 0-10v analogue input. I've enabled the channel by using Un\G0. Then I used the...
Replies
4
Views
2,167
Hi, I've run out of analogue input channels on my Q68AD-G module. If I add a new Q68AD-G module and install it into a spare (blanked-off) slot, it...
Replies
2
Views
1,703
I'm creating a programme offline (as a training exaple, there is no physical PLC to connect to), and I can't figure out how to use any Analogue...
Replies
1
Views
1,756
Back
Top Bottom