```python
try:
    num = int(value)
    if num >= 0:
        return num
    else:
        return 0
except (TypeError, ValueError) as e:
    return 0
```