Nirtec Studio Forum

General Category => EasyPLC v.5 => Topic started by: bjesnoca on November 13, 2014, 06:59:22 AM

Title: s7 driver maping for Analog signals
Post by: bjesnoca on November 13, 2014, 06:59:22 AM
Halo

Im getting error message every time i try to include analog signals in test mode in EasyPLC.
If i remove analog signals than it is OK and i see exchange of signals but if i include Analog sygnals i get this error:
   "Driver ERROR!: Unable to cast object of type 'System.Byte[]' to type 'System.IConvertible'."

Is there anything else that im missing here?
Title: Re: s7 driver maping for Analog signals
Post by: EasyPLC_Master on November 13, 2014, 08:53:53 AM
Hello!

With the S7-PLCSIM Driver for EasyPLC you can read digital I/O, write digital S7 inputs and read/write DB Blocks.
Then I suppose that when you said analog signals you're referring to DB Blocks, correct?
What kind of data have you mapped the DB blocks in S7?
Take note that Data Blocks are read in words mode.
Title: Re: s7 driver maping for Analog signals
Post by: bjesnoca on November 13, 2014, 06:05:12 PM
Im getting this error during seting and testing my driver in EasyPLC.
I make New project.
I ad driver S7 as "0"  and I ad second driver MAchine simulator as "1".
Than i Ad SCRIPT program and i put your code in so i make this work exchange of signals.
Than i go in and adjust in S7 driver and MAchine simulator same number of inputs and outputs and analog inputs and analog outputs. i make 16,16,8,8 and than i push TEST mode. and than i get this error.
In case that i go in and set up S7 driver like 16 inputs and 16 outputs and leave analog inputs and outputs ( DB-s ) in value 0 i get no error in TEST mode.

in your PDF you where having this set and i see that in your caase it was working.
So did i forget to do something? 
Title: Re: s7 driver maping for Analog signals
Post by: EasyPLC_Master on November 14, 2014, 05:37:00 PM
What is the type you have declared the DB you are trying to read/write?
Test it with INTEGER type.
Title: Re: s7 driver maping for Analog signals
Post by: bjesnoca on February 17, 2015, 06:39:44 PM
Halo again.

I was busy lately and not had time to make this issue working.
What i want is to program Welding Robot simulation.

I have declared in DB1 16 words as an integer value. So DB1.DBW0 , DB1.DBW2 .......and so on. DB1.DBW0 is to control Base of robot and so on........
My testing in EasyPLC is actually working. 
When I am in testing mode inside driver and i test S7 driver I am getting numbers on analog channels changing as im changing them in S7 software but when i start Machine simulator and i try to change values in my S7 project they are not getting transferred to my welding robot.

Is there a  script code i need to add to be able to transfer data between machine simulator and S7 driver.
In Ur example you have declared that you are transferring inputs with outputs but there is no information for DATA or analog signals.
So i have 16 inputs and 16 outputs and 16 analog inputs and 16 analog outputs on both drivers just to make all simple but still not able to control robot with modifying values in S7.

I want to test movement to be able to get data from positions so i can program movement of robot during welding procedure. i have no issue of reading and writing digital signals and this part is working but moving robot is just not working.

Do i need to ad something else to this code to be able to transfer my data from S7 to machine simulator???

for(int f= 0; f<16;f++)
{
   //Write S7 Inputs with USB Card Inputs
   WriteOutput(0, f, ReadInput(1, f));

   //Write USB Card Outputs with S7 Outputs
   WriteOutput(1, f, ReadInput(0, f));

}


I have tried something like that to add to my Code but still not getting it to work

for(int f= 0; f<16;f++)
{
   
   WriteAOutput(0, f, ReadAInput(1, f));
   WriteAOutput(1, f, ReadAInput(0, f));
}

Thank you!
Title: Re: s7 driver maping for Analog signals
Post by: EasyPLC_Master on February 18, 2015, 09:18:50 AM
The script code you have written is OK and must work.
Have you configured the Analog I/O number in EasyPLC -> Machines Simulator driver?

Title: Re: s7 driver maping for Analog signals
Post by: bjesnoca on February 20, 2015, 12:19:58 AM
Ok i have finaly managed it to work partialy.

I had to write code like this.

for(int f=0; f<16; f++)
{
   //Write S7 Inputs with
   WriteOutput(0, f, ReadInput(1, f));

   //Write  Outputs with S7 Outputs
   WriteOutput(1, f, ReadInput(0, f));
}

for(int f=0; f<8; f++)
{
 
   WriteAOutput(0, f, ReadAInput(1, f));

   WriteAOutput(1, f, ReadAInput(0, f));
}

Only in this case it started to work.
With trying to declare 16 analog inputs and outputs is not working.

but now i have other issue.
As im writing to one DB and testing movoement of robot my arm is tilting and not wanting to come to right position imidiatly. i have to write over and ower to the same DB for arm to move slowly.........
I am asuming that as i want it to move to position Machine simulator is  returning position value to the same DB. Like im rewrighting to the same position and i get this issue. So i was on 0 and i want to go to position 50 i put 50 in my DB. As Machine simulator start to move arm it write to same DB position 1 and than it stop......so i put 50 again and again......

I declared 4 positions in DB1 expecting it to be analog inputs  and 4 positions in DB2 expecting it to be analog outputs where i woud be geting actual position from robot back to my S7 procesor.

Where  i have issue here???
im confused now.

Here is my  EasyPLC editor file if it will help.

[attachment deleted by admin]
Title: Re: s7 driver maping for Analog signals
Post by: bjesnoca on February 21, 2015, 04:17:48 AM
I finally resolved all issues and now i can start programming.
Here is my solution.

I uploaded my settings for Easy PLC to correct transfer digital and analog signals between S7-PLCSIM and MAchine simulator.

I had to open Welding project in Machine editor and select robot and re map analog signals.
I upload picture of mapping signals in original form and than after i was finished.

Last photo is to show that all is working now.
As i input value in DB1.dbw.... I see actual movement of that arm in DB2-dbw...
Hope it will be useful to somebody......



[attachment deleted by admin]
Title: Re: s7 driver maping for Analog signals
Post by: EasyPLC_Master on February 22, 2015, 05:06:04 PM
Thank you very much for your input!