Activity for tvm

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Vijeo doesn't support TIME variables, so the easiest thing to do is convert to a STRING in your program, and use that variable. You could use TimeAsString:= TIME_TO_STRING(TimeVar) to get a string that looks like this: T#5h10m45s200ms

  • tvm tvm posted a comment on a wiki page

    Check any of your JSONVARs. The Names variable contains an array of the variable name divided by level. For example, if the variable path is Application.Test_SingleVar_PRG.colour, then the array will contain [3] 'Application' [2] 'Test_SingleVar_PRG' [1] 'colour' The ApplicationLevel property should be the array index which contains 'Application', in this case 3. This is all figured out in the JSONVAR.FB_Init method. The other place to check is JSONVAR.VarName, which is the full instance path of...

  • tvm tvm posted a comment on a wiki page

    Correct. In an actual use case I think the compose and parse would happen on different machines.

  • tvm tvm posted a comment on a wiki page

    If you can post an example I can test it here.

  • tvm tvm posted a comment on a wiki page

    The EXIT is in the correct place in the original, this is not a bug. The loop returns FALSE and exits on the first occurrence of a mismatch. If there are any mismatches, there is no point in evaluating the rest of the array. All levels must match for this method to return TRUE.

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    I'm getting this error on one of my projects. Searching for it I came across this https://www.codesys.com/fileadmin/data/Images/System/Releaseinformation/Patch-Note-CODESYS-Visualization-4300.html which says it was a bug VIS-1394, fixed in Visualization 4.3.0.0. I'm using a previous visu version, what is the cause of this error, and what can be done to work around it?

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    It will be a reference, because it's a VAR_IN_OUT. it's a little weird debugging the array online. It just shows as a POINTER TO INT, and you can't actually see the array from the function side. But you can still work with it as a normal array, not a pointer.

  • tvm tvm modified a comment on discussion Engineering πŸ‡¬πŸ‡§

    maybe this would be a better approach, then you don't have to pass the constant at all. FUNCTION fun : INT VAR_IN_OUT arr: ARRAY[*] OF INT; END_VAR VAR lower: DINT; upper: DINT; END_VAR lower:= LOWER_BOUND(arr, 1); upper:= UPPER_BOUND(arr, 1); see here as well https://help.codesys.com/api-content/2/codesys/3.5.12.0/en/_cds_datatype_array/

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    maybe this would be a better approach, then you don't have to pass the constant at all. FUNCTION fun : INT VAR_IN_OUT arr: ARRAY[*] OF INT; END_VAR VAR lower: DINT; upper: DINT; END_VAR lower:= LOWER_BOUND(arr, 1); upper:= UPPER_BOUND(arr, 1); see here as well https://help.codesys.com/api-content/2/codesys/3.5.13.0/en/_cds_vartypes_var_in_out/#constant-input-and-output-variable

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    This works for me in Schneider Machine Expert 2.2, which is based on Codesys 3.5.19. It did not work in Machine Expert 2.1, which was based on Codesys 3.5.16. METHOD PUBLIC Method1 : INT VAR_INPUT TestVar: INT:= 5; END_VAR Method1:= TestVar; PROGRAM SR_Main VAR TestFB: TEST_FB; Var1: INT; END_VAR Var1:= TestFB.Method1();

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    you might have some slight inaccuracies with using a REAL. See here for an explanation: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019ZSMSA2&l=en-US It might not matter, depends on how accurate you need it. I usually stick with integer types for something like this

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    It's probably because you have an INT in the input to the MUL function, which will then try to output an INT as well. INT variables can only handle values of -32768 to 32767. Your value of 523000 won't fit in an INT, so it turns into an invalid number. Use a DINT. This is usually better for working with time values anyway, because time values are all 32 bit. Or if you can't, use INT_TO_DINT(gvlp.detectie_nalooptijd_s) in the input to the MUL function.

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Anyone else using the SEND_RECV_MSG function block for RS-485 communication on Schneider Machine Expert? I have had ongoing issues with it for several years, which Schneider tech support is aware of, but hasn't been able to fix. The latest version of Machine Expert (v2.2) appears to have broken some of the functionality altogether. I'd be interested in hearing from anyone else using this platform for serial communication.

  • tvm tvm modified a wiki page

    Home

  • tvm tvm modified a wiki page

    Home

  • tvm tvm modified a wiki page

    Home

  • tvm tvm modified a wiki page

    Home

  • tvm tvm posted a comment on a wiki page

    I've released v 1.0.0.15 (link above). I tested your project as well as several of mine, with various different orders of the variables and it's working for me. The code on line 100 was correct, as far as how the FOR loop/EXIT worked, but I refactored some of that to make it easier to understand.

  • tvm tvm modified a wiki page

    Home

  • tvm tvm posted a comment on a wiki page

    I think I have reproduced something like this, but it would be helpful if you can provide a test program, or at least a JSON string that demonstrates it.

  • tvm tvm modified a comment on a wiki page

    @bnewman as far as I'm concerned, it's released under the terms of "it's on the internet so people can do whatever the heck they want with it". I think I had to pick a license when I put it on here, but I don't actually know anything about GPL, nor do I care. Use it, modify it, copy it, put it in your own projects, contribute to it, credit me. Or not. Whatever you like. I just changed the licensing to both MIT and Unlicense. I honestly don't know the difference, but I hope that makes it easier for...

  • tvm tvm posted a comment on a wiki page

    I haven't had a lot of time to do anything with this for several months, but thanks for the input. It does look like a bug, I'll try to take a closer look at it next week.

  • tvm tvm posted a comment on a wiki page

    @bnewman as far as I'm concerned, it's released under the terms of "it's on the internet so people can do whatever the heck they want with it". I think I had to pick a license when I put it on here, but I don't actually know anything about GPL, nor do I care. Use it, modify it, copy it, put it in your own projects, contribute to it, credit me. Or not. Whatever you like.

  • tvm tvm posted a comment on discussion Codesys V2.3 πŸ‡¬πŸ‡§

    Those libraries come with Schneider Machine Expert, which is their branded version of Codesys. I don't think you can program Schneider PLCs with plain Codesys.

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    ok, that's different than our issue then. We're using Schneider Electric M262 PLCs, and we've had it where certain web browsers cause the web server to only allow https connections, but it's not recoverable with a refresh. It usually requires a power cycle or even a full firmware flash. Your issue might have more to do with the timing. I don't know if it helps you, but we normally run our visu task at 200mS, with an update rate of 200mS. Seems to work. I went through this: https://faq.codesys.com/pages/viewpage.action?pageId=112525371...

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    We have seen this kind of thing before. I have two questions: 1. What kind of HMI are you using? 2. When this happens, are you able to connect using https, on port 8089?

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Have you looked at this? https://forge.codesys.com/prj/codesys-example/element-collect/home/Home/ It's not exactly what you're looking for, but I've been able to make some things work more efficiently using this library.

  • tvm tvm posted a comment on discussion Forge πŸ‡¬πŸ‡§

    Probably. When I developed this library, that was probably the biggest recurring issue--trying to consistently parse or compose with such a wide variety of possible strings and variable structures, arrays, named objects vs, unnamed, etc. The MaxLevel input was sort of a compromise--it works but I've never really liked it.

  • tvm tvm posted a comment on discussion Forge πŸ‡¬πŸ‡§

    Which example program? There were a few different ones.

  • tvm tvm posted a comment on discussion Forge πŸ‡¬πŸ‡§

    Yes, if you're using STRUCT_TO_JSON within a function block, you'll have to adjust the MaxLevel input to suit your application. There's a long comment in the function block that explains how to use it. For JSON_TO_STRUCT, can you post an example or something? Are you certain that there is data in your JSON string before Execute is called? It will only run once on the string when it sees the rising edge of Execute.

  • tvm tvm modified a comment on discussion Forge πŸ‡¬πŸ‡§

    Here's the deal. It's free, open source software. If it doesn't work in your situation, feel free to figure out why, modify it, and submit it, and I'll give you credit. Others have done so. OR, send me detailed instructions on how to reproduce the error, a test project, or the string you were working on, or something, anything, and I might be able to help you. "this code gives exception" doesn't give me much to work with does it?

  • tvm tvm posted a comment on discussion Forge πŸ‡¬πŸ‡§

    Here's the deal. It's free, open source software. If it doesn't work in your situation, feel free to figure out why, modify it, and submit it, and I'll give you credit. Others have done so. OR, send me detailed instructions on how to reproduce the error, a test project, or the string you were working on, or something, anything. "this code gives exception" doesn't give me much to work with does it?

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    There's not actually any code in the JSONVAR function block itself, all the work is done in properties and methods. If you post an example I can test it.

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    The easiest way I've found is to drag the column left or right in the element itself. But you can also manually change any of the column properties to whatever variable you want, using INDEX as the array index

  • tvm tvm posted a comment on discussion Forge πŸ‡¬πŸ‡§

    IF FUNCTION2() THEN FLAG:= TRUE; END_IF The () brackets call the function. Without them you're evaluating the function itself as it if was a data type, without actually running the code in it.

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    see this question: https://forge.codesys.com/forge/talk/Visualization/thread/c9261c7f7d/ I've had this occur when I convert the plc in a project to a different type.

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Take a look at this, maybe it's what you want: https://help.codesys.com/api-content/2/codesys/3.5.12.0/en/_cds_pragma_conditional/

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    On one of my projects, someone connected to the web visu and caused the PLC to crash. I can see a message in the logs: "Get-Property will crash because it did not evaluate to a valid getter. Is there an inbetween null value in nested properties?." But I haven't been able to reproduce it, so I don't know which visu or element is causing it. I've seen this error before, when trying to use the visu text editor element while "Activate property handling in all elements properties" is checked in the Project...

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    There's also this method of declaring a function block instance for each I/O channel, seems like it would accomplish what you're trying to do quite nicely: https://help.codesys.com/api-content/2/codesys/3.5.13.0/en/_cds_configuring_devices_mapping_ios/#mapping-a-device-input-to-a-function-block-instance

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Thanks for the update. Your original post said that the fault happens "when viewing trends". Has it ever happened when the visu is not open, or is it always while viewing a chart? I created my own library for trending, but it still uses the XY Chart. I have no idea if the built in trends use the same elements as the generic XY Chart, but it seems reasonable. My trends reference an ARRAY[1..1440] OF REAL, which seems to work just fine under normal conditions. But I wonder if the crashes I've seen...

  • tvm tvm modified a comment on discussion Engineering πŸ‡¬πŸ‡§

    I just tried your code here and it works for me. ParseJSON is looking for the rising edge of Execute, are you sure your sPayload variable has data in it before the parse is executed?

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    I just tried your here and it works for me. ParseJSON is looking for the rising edge of Execute, are you sure your sPayload variable has data in it before the parse is executed?

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    I'm using Schneider Machine Expert, which is their brand labelled version of Codesys. I've seen something similar when I open the Library Manager or the Visualization Manager. It just freezes, sometimes as much as 10 minutes. The load on my computer doesn't go up, and I'm not sure what's going on in the background, but there's nothing to do but wait.

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    OK, a couple ideas: I had an issue a couple years ago with the HMISTW panels using HMI FW version 1.0, where all the web visus could stop working (both touch screen and computer). Upgrading to 1.1 fixed it, but I always thought it was more likely a server issue. Which is the only reason I bring it up here, it might not have anything to do with anything. I'm using the M262 L10 and L20, and I've seen it on both. I have one job with an M35, and I've never seen it there. But we don't specialize in any...

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    I have a similar situation. I'm not using the built in trends, I created my own library for that, but I am using M262 PLCs with web visu. I haven't been able to narrow down the problem, but I have seen the same thing with Processor Load watchdog at seemingly random times. My best guess at the moment is something to do with the interaction between file access and the visu, but that's still just a guess. I've also seen it happen a few times where the PLC stays running , but the http server stops working...

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    I managed to get a yahoo address working with an app password setup. I've also had mixed results with different corporate mail servers, some of them work and some don't. Depends a lot on the IT department.

  • tvm tvm modified a comment on discussion Engineering πŸ‡¬πŸ‡§

    Good luck. I spent hours trying to get gmail working with an M262. Looks like you have the same problem I had, it would work once, then fail. Schneider tech support claims to have made it work. This is from an email they sent me: "I attached the project L3 used to test with Gmail (very simple project without visu...). In this project, L3 put the CertVerifyMode to AllCertificates because Gmail certificates are in the Quarantined Certificates by default (see screenshot below). In case you want to use...

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Good luck. I spent hours trying to get gmail working with an M262. Looks like you have the same problem I had, it would work once, then fail. Schneider tech support claims to have made it work. This is from an email they sent me: I attached the project L3 used to test with Gmail (very simple project without visu...). In this project, L3 put the CertVerifyMode to AllCertificates because Gmail certificates are in the Quarantined Certificates by default (see screenshot below). In case you want to use...

  • tvm tvm modified a comment on discussion Visualization πŸ‡¬πŸ‡§

    You can access external variables by using VAR_IN_OUT in the function. Depending on how fancy you need to get, you could even declare a function block in the visu itself and call methods of it in the same way.

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    You can access external variables by using VAR_IN_OUT. Depending on how fancy you need to get, you could even declare a function block in the visu itself and call methods of it in the same way.

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    I've done this by creating a function with return type BOOL, then calling the function from an element in its State variables/Invisible property.

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    right click on your application, got to properties, "Build" tab. Under Compiler defines, add the string VISU_USEPROPERTYINFO Normally this gets added automatically for me, if I check "Activate property handling in all element properties" in the Project Settings/Visualization. But I've noticed that the compiler define gets lost if I convert from one PLC to another.

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    I'm not exactly sure why, but your variable is of type Integer, but the value looks more like a Real. This is one of the places where JSON doesn't correspond to IEC61131 types. In JSON, a Number can be either floating point or integer. Of course, we have to strictly declare the types, so the library uses types like this: TYPE JSONVALUETYPE : ( json_string, //local var is type STRING json_number, //local var is REAL json_integer, //local var is DINT json_boolean, //local var is BOOL json_null, //local...

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    It's on my list of things to do, but I'm in the middle of a big project right now so I probably won't get to it until the new year.

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    Yeah I understand that, but some visu elements don't have the OnMouseClick input. Checkboxes and Combo Boxes, for example. So in the example, I want to more than just check the box on a Checkbox element, I also want to set a variable.

  • tvm tvm modified a comment on discussion Forge πŸ‡¬πŸ‡§

    ok yeah, that's not actually a great example. I'll make some better ones. The resulting JSON string from ComposeJSON looks like this: {"LocalJSONObj":{"var1":true,"var2":34.8756,"var3":"teststring","obj":{"var4":22,"var5":false,"var6":"qwer","var7":[123.234,55.46001,985]},"arrayobj":[1,2,3]}} It's created an object starting at the first level "LocalJSONObj" variable. Therefore, it doesn't match the "NewJSONObj" variable in the parse There's two ways to fix this: 1.Use a different string on the parse...

  • tvm tvm modified a comment on discussion Forge πŸ‡¬πŸ‡§

    ok yeah, that's not actually a great example. I'll make some better ones. The resulting JSON string from ComposeJSON looks like this: {"LocalJSONObj":{"var1":true,"var2":34.8756,"var3":"teststring","obj":{"var4":22,"var5":false,"var6":"qwer","var7":[123.234,55.46001,985]},"arrayobj":[1,2,3]}} It's created an object starting at the first level "LocalJSONObj" variable. Therefore, it doesn't match the "NewJSONObj" variable in the parse There's two ways to fix this: 1.Use a different string on the parse...

  • tvm tvm modified a comment on discussion Forge πŸ‡¬πŸ‡§

    ok yeah, that's not actually a great example. I'll make some better ones. The resulting JSON string from ComposeJSON looks like this: {"LocalJSONObj":{"var1":true,"var2":34.8756,"var3":"teststring","obj":{"var4":22,"var5":false,"var6":"qwer","var7":[123.234,55.46001,985]},"arrayobj":[1,2,3]}} It's created an object starting at the first level "LocalJSONObj" variable. Therefore, it doesn't match the "NewJSONObj" variable in the parse There's two ways to fix this: 1. Use a different string on the parse...

  • tvm tvm modified a comment on discussion Forge πŸ‡¬πŸ‡§

    ok yeah, that's not actually a great example. I'll make some better ones. The resulting JSON string from ComposeJSON looks like this: {"LocalJSONObj":{"var1":true,"var2":34.8756,"var3":"teststring","obj":{"var4":22,"var5":false,"var6":"qwer","var7":[123.234,55.46001,985]},"arrayobj":[1,2,3]}} It's created an object starting at the first level "LocalJSONObj" variable. Therefore, it doesn't match the "NewJSONObj" variable in the parse There's two ways to fix this: 1. Use a different string on the parse...

  • tvm tvm posted a comment on discussion Forge πŸ‡¬πŸ‡§

    ok yeah, that's not actually a great example. I'll make some better ones. The resulting JSON string from ComposeJSON looks like this: {"LocalJSONObj":{"var1":true,"var2":34.8756,"var3":"teststring","obj":{"var4":22,"var5":false,"var6":"qwer","var7":[123.234,55.46001,985]},"arrayobj":[1,2,3]}} It's created an object starting at the first level "LocalJSONObj" variable. Therefore, it doesn't match the "NewJSONObj" variable in the parse There's two ways to fix this: 1. Use a different string on the parse...

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    I've create a visu with a single checkbox, associated with an interface variable TestClickFrame_VISU VAR_IN_OUT TestVar: BOOL; //referenced by the "Variable" property of the checkbox in the visu END_VAR I then create another visu, "TestClick_VISU", which contains a single frame, referenced to TestClickFrame_VISU On that frame, I assign the "OnMouseClick" Input, which is configured to execute the following code: Test_PRG.TestVar2:= Test_PRG.TestVar2 + 1; The OnMouseClick event of the frame works,...

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    This thread that I was involved in a couple years ago doesn't directly answer your questions, but perhaps it has some useful information. I often use VAR_INPUT with an interface and it works quite well. https://forge.codesys.com/forge/talk/Visualization/thread/bcbc83fe88/

  • tvm tvm posted a comment on discussion Forge πŸ‡¬πŸ‡§

    If you post an example of the JSON string I can take a look at it.

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    You can maybe get around this by using a REFERENCE TO in your property. So your property could look like this: PROPERTY PUBLIC CurrentCartridge : REFERENCE TO CARTRIDGE CurrentCartridge REF= AllCartridges[currentcartridgeindex]; (*or whatever your backing variable is called*) The same works with arrays. Of course, this only works if you have a backing variable to refer to, if you're creating it on the fly, you'll have to use helper variables.

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Sometimes when trying to set a breakpoint, I get the following error message: "The code in the execution point contains unsupported elements." What does this mean? Seems to happen mostly in functions, but it's inconsistent--sometimes it will work, and sometimes not.

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    I wrote this library a few years ago for JSON parsing. It might help you. https://forge.codesys.com/lib/pro-json/home/Home/

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Well that helped me track down a bug that's been around for a while. Try the new version 1.0.0.14 https://forge.codesys.com/lib/pro-json/home/Home/ Basically each JSONVAR has properties so the composer knows what kind of variable it is. The end of an array should also be, by definition, the end of an object, but that flag was not set, so it missed the last '}' I've tested this a bit, but I wouldn't say extensively. I actually use the parser more than the composer myself. There's so many possible...

  • tvm tvm modified a wiki page

    Home

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Try this: IF (timer.ET >= T#4S) AND (timer.ET <= T#7S) THEN X:= TRUE; END_IF

  • tvm tvm posted a comment on discussion Forge πŸ‡¬πŸ‡§

    Same question posted here: https://forge.codesys.com/forge/talk/Engineering/thread/d24dbf522d/ Just for future reference

  • tvm tvm modified a comment on discussion Engineering πŸ‡¬πŸ‡§

    That would be a good feature, I'll have to think about the best way to implement that. As a workaround for now, you could try manually setting the NumberOfVars input of STRUCT_TO_JSON. In all the example projects, I've always used SIZEOF(LocalJSONObj) / SIZEOF(JSONVAR), which will always result in the total number of JSONVARs in the local object. In your example, I think it would result in 22 variables. If you set it manually, or with some code, to 15, the composer should ignore your last 7 null...

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    That would be a good feature, I'll have to think about the best way to implement that. As a workaround for now, you could try manually setting the NumberOfVars input of STRUCT_TO_JSON. In all the example projects, I've always used SIZEOF(LocalJSONObj) / SIZEOF(JSONVAR), which will always result in the total number of objects in the local objects. In your example, I think it would result in 22 variables. If you set it manually, or with some code, to 15, the composer should ignore your last 7 null...

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Try this: https://help.codesys.com/webapp/_cds_struct_using_scripts;product=codesys;version=3.5.17.0 This script will find any variable that starts with an underscore and create a property for it def CreateAllProperties(fbname): # get current project project = projects.primary # find the function block fb = project.find(fbname, True)[0] # get the declaration text declaration = fb.textual_declaration # iterate all lines in the declaration for i in range(declaration.linecount): line = declaration.get_line(i)...

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    activeapp = proj.active_application folder = activeapp.find('Folder Name', recursive = True)[0] folder.import_xml(reporter, filename) -OR- folder.create_pou("POU Name")

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    I've created the following python script to add certain libraries to a project. It seems to work fine, except for with certain libraries, placeholders don't get resolved. I've attached a screenshot of the library manager after the script runs. Is this an issue with my script, or something to do with the libraries themselves? The strange thing is that I have a project with two applications, and on each one different libraries resolve correctly. from __future__ import print_function Project = projects.primary...

  • tvm tvm modified a comment on discussion Visualization πŸ‡¬πŸ‡§

    create a function: FUNCTION INITFB: FB_Menu; VAR_INPUT Var1: BOOL; //whatever initialization parameters you want END_VAR INITFB.Var1:= Var1; Then, in your visu VAR fb: FB_Menu:= INITFB(Var1:= TRUE); END_VAR you might be able to do the same thing with properties of FB_Menu FUNCTION_BLOCK FB_Menu PROPERTY Var1 : BOOL then in visu VAR fb: FB_Menu:= (Var1:= TRUE); END_VAR

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    create a function: FUNCTION INITFB: FB_Menu; VAR_INPUT Var1: BOOL; //whatever initialization parameters you want END_VAR FB_Menu.Var1:= Var1; Then, in your visu VAR fb: FB_Menu:= INITFB(Var1:= TRUE); END_VAR you might be able to do the same thing with properties of FB_Menu FUNCTION_BLOCK FB_Menu PROPERTY Var1 : BOOL then in visu VAR fb: FB_Menu:= (Var1:= TRUE); END_VAR

  • tvm tvm posted a comment on discussion Forge πŸ‡¬πŸ‡§

    There was an issue with the .Done output not working correctly in v1.0.0.12. v1.0.0.13 corrects that, and some minor changes. Talk Topic about project #pro-json

  • tvm tvm modified a wiki page

    Home

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    It's because the fbOpenMessageDialog function block is looking for a rising edge on the xExecute input. This section: IF xOpenMessageDialog THEN xOpenMessageDialog := FALSE; fbOpenMessageDialog.xExecute := FALSE; END_IF doesn't actually run the function block, it just sets the xExecute input to false. But fbOpenMessageDialog doesn't actually run again until you change GVL_Visual.autoSeqNumber on line 1. But when it does run, it doesn't see a rising edge, because xExecute is TRUE, the same as it was...

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    Is there any way to use the constants VISU_MIN_NUMBER_OF_CLIENTS and VISU_MAX_NUMBER_OF_CLIENTS into a library? Right now I create a parameter list with these values, and then manually set them to match the Maximum number of visualization clients value in the Visualization Manager. But that easily leads to errors.

  • tvm tvm modified a comment on discussion Visualization πŸ‡¬πŸ‡§

    I'm using the following code to get information on the current logged in user: VAR CurrentUser: VisuUserManagement.VUM_User; END_VAR CurrentUser:= VisuUserManagement.g_VisuUserMgmtIntern.GetCurrentUser(); If I call this with no user logged in, I get the screenshot below, as expected. When I log in, I can see the username, etc, as expected. However, when I log out, the username, password, user groups, etc stay as if I'm still logged in. I would expect to see empty strings in the username, and 0's...

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    I'm using the following code to get information on the current logged in user: VAR CurrentUser: VisuUserManagement.VUM_User; END_VAR CurrentUser:= VisuUserManagement.g_VisuUserMgmtIntern.GetCurrentUser(); If I call this with no user logged in, I get the screenshot below, as expected. When I log in, I can see the username, etc, as expected. However, when I log out, the username, password, user groups, etc stay as if I'm still logged in. I would expect to see empty strings in the username, and 0's...

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    There is still one thing I don't understand, however. If I use the responsive design, with a Client Manager Listener implementing VisuElems.IClientManagerListener3, why does the GlobalClientID variable always return -1?

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    For anyone else trying to figure this out, here's what finally worked: VAR_INPUT itfClient: VU.IVisualizationClient; END_VAR VAR pClientWrapper: POINTER TO VU.FbClientWrapper; pClientData: POINTER TO VisuElems.VisuStructClientData; END_VAR __QUERYPOINTER(itfClient, pClientWrapper); pClientData:= pClientWrapper^.ClientDataPointer; then pClientData points to the correct place, for example pClientData^.rClientRect.ptBottomRight.iX This was all by trial and error, so I really don't know if this is the...

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    The part I really don't understand is this: If I set a breakpoint in the HandleClient method of the VU.IVisualizationClientIteration interface, I get the attached screenshot, which seems to show that pClient is part of itfClient (VU.IVisualizationClient). However, I can't access that pClient data in the program. I tried to use QUERYPOINTER(itfClient, pClientData), but it returns an invalid pointer

  • tvm tvm modified a comment on discussion Visualization πŸ‡¬πŸ‡§

    I'm trying to get the size of each visualization client and store it in an array. There appears to be two approaches to getting information from the visu clients: Use the Visu Utils client iteration. Something like this thread: https://forge-codesys-com.translate.goog/forge/talk/Deutsch/thread/f14041c158/?xtrsl=auto&xtrtl=en&xtrhl=en-US&xtrpto=wapp#8477 The problem, this works with an interface itfClinet of type VU.IVisualizationClient. This interface appears to include the information I need. When...

  • tvm tvm modified a comment on discussion Visualization πŸ‡¬πŸ‡§

    I'm trying to get the size of each visualization client and store it in an array. There appears to be two approaches to getting information from the visu clients: Use the Visu Utils client iteration. Something like this thread: https://forge-codesys-com.translate.goog/forge/talk/Deutsch/thread/f14041c158/?xtrsl=auto&xtrtl=en&xtrhl=en-US&xtrpto=wapp#8477 The problem, this works with an interface itfClinet of type VU.IVisualizationClient. This interface appears to include the information I need. When...

  • tvm tvm modified a comment on discussion Visualization πŸ‡¬πŸ‡§

    I'm trying to get the size of each visualization client and store it in an array. There appears to be two approaches to getting information from the visu clients: Use the Visu Utils client iteration. Something like this thread: https://forge-codesys-com.translate.goog/forge/talk/Deutsch/thread/f14041c158/?xtrsl=auto&xtrtl=en&xtrhl=en-US&xtrpto=wapp#8477 The problem, this works with an interface itfClinet of type VU.IVisualizationClient. This interface appears to include the information I need. When...

  • tvm tvm posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    I'm trying to get the size of each visualization client and store it in an array. There appears to be two approaches to getting information from the visu clients: Use the Visu Utils client iteration. Something like this thread: https://forge-codesys-com.translate.goog/forge/talk/Deutsch/thread/f14041c158/?xtrsl=auto&xtrtl=en&xtrhl=en-US&xtrpto=wapp#8477 The problem, this works with an interface itfClinet of type VU.IVisualizationClient. This interface appears to include the information I need. When...

  • tvm tvm modified a comment on discussion Engineering πŸ‡¬πŸ‡§

    Those variables are part of a parameter list. You can change them in the library manager of your project: This guy has a good explanation of how parameter lists works: https://stefanhenneken.net/2017/09/10/iec-61131-3-parameter-transfer-via-parameter-list/

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Those variables are part of a parameter list. You can change them in the library manager of your project:

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Maybe I misunderstand what you're saying, but I regularly index 2 dimensional arrays with variables, for example: myArray: ARRAY[1..10,1..10] OF INT; FOR i:= 1 TO 10 DO FOR j:= 1 TO 10 DO myArray[i,j]:= i; END_FOR END_FOR

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    What's actually the difference between ARRAY [1..6,1..38] OF WORD, and ARRAY [1..6] OF ARRAY[1..38] OF WORD? It seems to me that they're the same thing. In either case arrRawData[1] should be an ARRAY [1..38] OF WORD. Other programming languages treat arrays in this way, is this just one of those Codesys quirks?

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Probably Object Type MW, and address 1296. But Modbus is a bit of a free for all when it comes to addressing and implementation, so you might have to try some different things. It could be Object Type IW, or the address could be 1295 if it's zero based. Or it could be 41295 or 31295 if they implemented it that way. Assign a variable to the inputs so you can experiment with the addressing when you're online until you get the result you're expecting.

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    https://product-help.schneider-electric.com/Machine%20Expert/V1.1/en/m2xxcom/m2xxcom/Communication_Functions_on_Controllers/Communication_Functions_on_Controllers-3.htm#XREF_D_RU_0004860_1 When the communication error code is FE hex, the OperationErrorCodes enumerated type contains the protocol-specific error detection code. (Refer to your specific protocol’s error detection codes.) So, the OperError code 3 is a Modbus exception code 3, "Illegal Data Value". Which is strange, because you're reading...

  • tvm tvm modified a comment on discussion Codesys V2.3 πŸ‡¬πŸ‡§

    some notes on your code FOR vCount := 0 TO 1999 DO NOTE: vCount gets reset to 0 on every scan of the PLC vVsample[vCount] := INT_TO_REAL(WORD_TO_INT(vVin)); Delay(IN:=TRUE, PT:=T#1S); It's usually best to put timers outside of loops IF NOT(Delay.Q) THEN this condition will only be true once per second. On every other scan cycle of the PLC, Delay.Q will be false. RETURN; RETURN exits the whole function block, not the loop itself. To exit a loop, use EXIT this RETURN will happen on every scan except...

  • tvm tvm modified a comment on discussion Codesys V2.3 πŸ‡¬πŸ‡§

    some notes on your code FOR vCount := 0 TO 1999 DO //NOTE: vCount gets reset to 0 on every scan of the PLC vVsample[vCount] := INT_TO_REAL(WORD_TO_INT(vVin)); Delay(IN:=TRUE, PT:=T#1S); It's usually best to put timers outside of loops IF NOT(Delay.Q) THEN this condition will only be true once per second. On every other scan cycle of the PLC, Delay.Q will be false. RETURN; RETURN exits the whole function block, not the loop itself. To exit a loop, use EXIT this RETURN will happen on every scan except...

  • tvm tvm posted a comment on discussion Codesys V2.3 πŸ‡¬πŸ‡§

    some notes on your code FOR vCount := 0 TO 1999 DO //NOTE: vCount gets reset to 0 on every scan of the PLC vVsample[vCount] := INT_TO_REAL(WORD_TO_INT(vVin)); Delay(IN:=TRUE, PT:=T#1S); //It's usually best to put timers outside of loops IF NOT(Delay.Q) THEN //<--this condition will only be true once per second. On every other scan cycle of the PLC, Delay.Q will be false. RETURN; //RETURN exits the whole function block, not the loop itself. //To exit a loop, use EXIT //this RETURN will happen on every...

  • tvm tvm posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    No real difference when there's only one elsif statement, but consider what your code would look like if there was more than one this: IF [conditional_expresion] THEN <instructions>; ELSIF [conditional_expresion] THEN <instructions>; ELSIF [conditional_expresion] THEN <instructions>; ELSIF [conditional_expresion] THEN <instructions>; ELSE <instructions>; END IF; is easier to understand and troubleshoot than this: IF [conditional_expresion] THEN <instructions>; ELSE IF [conditional_expresion] THEN...

1 >