Menu

Write to PLCSim Peripheral area on S7-1200 (like S7ProSim WriteInputImage for S7-300)

Help
Mike
2021-08-13
2021-08-14
  • Mike

    Mike - 2021-08-13

    Great project - thanks for developing and maintaining it.
    I need to be able to do the same as changing a value in PLCSim (S7-1200) sim table for the actual I/O.
    We have a working Visual Studio plant simulator which can access an S7-300 PLCSim through S7ProSim but we want to upgrade to an S7-1200 and still use our VS simulator.
    Is it possible to get the S7-1200 PLCSim to change a peripheral input like %I0.0:P (digital) or %IW64:P (analogue)?
    Using S7NetPlus (through NetToPLCSim) writing I0.0 or IB0 does not fail but it also does not change anything in the PLCSim.
    Strangely writing to IB1 does work - probably because there's no actual I/O configured there...

     
  • Thomas Wiens

    Thomas Wiens - 2021-08-13

    The similar interface to S7ProSim comes only with TIA Plcsim Advanced I guess, I haven't used this as we don't have a license for it.

    Without changing the plc program there is no option to use this. An option may be, to change in the plc hardware configuration the settings for the process image at the input cards from cyclic process image to none. I haven't tested it, but maybe you then can write to IB0 for example, and the value is kept as it's not been overwritten by the (virtual) process image.

    Another option is to add a simulation datablock to the program, write the values to the datablock, and at the beginning of OB1 copy the data from the datablock to the input image and overwrite the values from the (virtual) process image.

     
  • Mike

    Mike - 2021-08-14

    ... from cyclic process image to none

    That seems to work - I can now write to the process image (e.g. IB0) and it sticks.
    I now need to devise a flag for the plc so it can detect if it's a real plc (and just copy the peripheral values at the start of OB1) or not (and wait for NetToPLCSim to write to IB0 etc).
    That way I won't have to remember to change OB1 depending on whether it's the real PLC or PLCSim .
    I think I need to check if there's a downside to setting "cyclic process" to "none". (Detection of I/O faults/alarms maybe...)
    If there is I'll try your simulation datablock idea with a PLC/PLCSim flag to control the copy.

    It's a shame Siemens didn't allow for an S7ProSim WriteInputImage equivalent in the protocol or have a PLCSim api.

    Thanks for the pointers.

     
  • Thomas Wiens

    Thomas Wiens - 2021-08-14

    Newer firmware versions of the 1200 support the Get_IM_Data function block. May be ther you get a serial number or a mlfb where you can detect if it's a real plc or Plcsim.

     

Log in to post a comment.