General Category > Machines Simulator

Mixer - PID

(1/3) > >>

fredz0003:
Hi,

I am trying to learn a bit more about PID's controllers. The mixer machine seems like a good candidate. I wonder if there's a built in component to measure liquid level on the tank, not just two prox switches. And also if is possible to make the top water valve 0-100%, and not just on/off.

I plan to use PID functions in step7. Any ideas are welcome on how to implement this into the mixer machine.

Thank you!  :D

EasyPLC_Master:
The aim of Easy PLC Software Suite is to be an open platform to automation simulation, for this reason provides a lot of tools that allows to develop custom needs.
As you can image, it is impossible to create a software containing all the electronic/mechanical/pneumatic/hydraulic/... components used in the industry, for this, I recommend you to use the User Defined Components in Machines Editor in order to create your own PID.
Once created, you can add it in the Mixer machine, changing the behaviour for your convenience.

fredz0003:
Thanks for the reply. I wasn't trying to create a PID controller as a component, I am doing the PID portion within Step7 Siemens. I was trying to find out if there was a component already in the machines editor, that could read the liquid level in the mixer machine, and also change the water percentage going in with the top valve.

I added this to the world script, to read the water level based on the waterPos.Y, it works quite well:


--- Code: ---IO.SetAnalogInp(0, waterPos.Y);
--- End code ---

I also made a modification to change the water Speed based on an analog output:


--- Code: ---public void Main(GameTime gameTime)
{

speedIn = IO.GetAnalogOut(1);

float fTimeScale = (float)gameTime.ElapsedGameTime.Milliseconds/10;
if(IO.GetOutput(1))
{
if(waterPos.Y < 4.3)
waterPos.Y += speedIn * fTimeScale;
else
OverFlow();

waterPIn.Start();   
water.Position = waterPos;
machine[2].PlaySound("fillwater");
}
else
machine[2].StopSound();
--- End code ---

Lastly I made a small fix, as the water animation was going way below the tank. Probably someone else had already fixed this.


--- Code: ---if(IO.GetOutput(2))
{
// Water should be removed if tank is already empty
// On initial test the water animation goes down even below the tank
// making it look strange. 1.88 fixes this problem. 1 was a bit below the tank.
if(waterPos.Y > 1.88)
{
waterPos.Y -= speedOut * fTimeScale;
waterPOut.Start();   
water.Position = waterPos;
machine[1].PlaySound("fillwater");
}
else
machine[1].StopSound();
--- End code ---

The only question remains, Analog Output 1, and Analog Input 0 are still usable? I don't see them on the I/O report?

fredz0003:
Hi,

I made a few more code changes. I couldn't find documentation on how to use analog signals with step7 driver. On the pdf for the step7 driver all I could see is digital I/O which I already done before. If you can see the machine script, I want to use analog input 0, and analog output 0, 1.

I see information for DB data on the step7 driver pdf tutorial, does this mean I need to write a script on main connecting the analog I/O to a DB address so my step7 program could use that data?

But not sure how to configure the device drivers for step7 driver, and machine simulator driver.
I have attached my easyPLC file, I added a DB1 with one byte, but when testing simaticsPLCSim driver I get a "Unable to cast object of type 'System.Byte[]' to type 'System.IConvertible'

Thanks for the help!  :)

fredz0003:

--- Quote from: fredz0003 on October 12, 2015, 08:23:57 AM ---
But not sure how to configure the device drivers for step7 driver, and machine simulator driver.
I have attached my easyPLC file, I added a DB1 with one byte, but when testing simaticsPLCSim driver I get a "Unable to cast object of type 'System.Byte[]' to type 'System.IConvertible'


--- End quote ---

I meant to say DB1 with one word.

Navigation

[0] Message Index

[#] Next page

Go to full version